Lines Matching full:vm
386 static std::vector<Local<SymbolRef>> GetSymbolRef(EcmaVM *vm) in GetSymbolRef() argument
389 …static std::vector<Local<SymbolRef>> value = { SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symb… in GetSymbolRef()
390 … SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symbolKey2")), in GetSymbolRef()
391 … SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symbolKey3")) }; in GetSymbolRef()
479 void ObjectRefSet(Local<ObjectRef> object, EcmaVM *vm, Local<SymbolRef> symbol) in ObjectRefSet() argument
483 bool b = object->Set(vm, cnt, StringRef::NewFromUtf8(vm, "TestValue1")); in ObjectRefSet()
485 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test2"), StringRef::NewFromUtf8(vm, "TestValue2")); in ObjectRefSet()
487 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "TestValue3")); in ObjectRefSet()
489 b = object->Set(vm, symbol, StringRef::NewFromUtf8(vm, "symbolValue")); in ObjectRefSet()
492 Local<FunctionRef> getter1 = FunctionRef::New(vm, Getter1); in ObjectRefSet()
493 Local<FunctionRef> setter1 = FunctionRef::New(vm, Setter1); in ObjectRefSet()
495 Local<FunctionRef> getter2 = FunctionRef::New(vm, Getter2); in ObjectRefSet()
496 Local<FunctionRef> setter2 = FunctionRef::New(vm, Setter2); in ObjectRefSet()
498 Local<FunctionRef> getter3 = FunctionRef::New(vm, Getter3); in ObjectRefSet()
499 Local<FunctionRef> setter3 = FunctionRef::New(vm, Setter3); in ObjectRefSet()
501 PropertyAttribute attribute1(StringRef::NewFromUtf8(vm, "AttributeValue1"), true, true, false); in ObjectRefSet()
502 PropertyAttribute attribute2(StringRef::NewFromUtf8(vm, "AttributeValue2"), false, true, true); in ObjectRefSet()
503 PropertyAttribute attribute3(StringRef::NewFromUtf8(vm, "AttributeValue3"), true, false, true); in ObjectRefSet()
506 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), attribute1); in ObjectRefSet()
508 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "Test2"), attribute2); in ObjectRefSet()
510 b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "Accessor1"), getter1, setter1); in ObjectRefSet()
512 b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "Test3"), getter2, setter2); in ObjectRefSet()
514 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), attribute3); in ObjectRefSet()
516 …b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), getter3, setter3,… in ObjectRefSet()
520 void GetProperty(Local<ObjectRef> object, EcmaVM *vm) in GetProperty() argument
523 Local<ArrayRef> names = object->GetOwnPropertyNames(vm); in GetProperty()
524 int cnt = names->Length(vm); in GetProperty()
527 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in GetProperty()
528 if (value->IsSymbol(vm)) { in GetProperty()
530 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in GetProperty()
532 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in GetProperty()
537 void Get(Local<ObjectRef> object, EcmaVM *vm) in Get() argument
541 Local<JSValueRef> value = object->Get(vm, cnt); in Get()
542 if (value->IsString(vm)) { in Get()
543 GTEST_LOG_(INFO) << "Key:1 Value:" << value->ToString(vm)->ToString(vm); in Get()
545 value = object->Get(vm, StringRef::NewFromUtf8(vm, "Test2")); in Get()
546 if (value->IsString(vm)) { in Get()
547 GTEST_LOG_(INFO) << "Key:Test2 Value:" << value->ToString(vm)->ToString(vm); in Get()
549 value = object->Get(vm, StringRef::NewFromUtf8(vm, "AttributeKey1")); in Get()
550 if (value->IsString(vm)) { in Get()
551 GTEST_LOG_(INFO) << "Key:AttributeKey1 Value:" << value->ToString(vm)->ToString(vm); in Get()
554 object->Set(vm, StringRef::NewFromUtf8(vm, "Accessor1"), NumberRef::New(vm, num)); in Get()
555 object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "Test3Value")); in Get()
556 object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), in Get()
557 SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "AttributeKey3Value"))); in Get()
558 Local<StringRef> str = object->Get(vm, StringRef::NewFromUtf8(vm, "AttributeKey3")); in Get()
559 if (str->IsString(vm)) { in Get()
560 GTEST_LOG_(INFO) << "Key:AttributeKey3 Value:" << str->ToString(vm); in Get()
562 str = object->Get(vm, StringRef::NewFromUtf8(vm, "Accessor1")); in Get()
563 if (str->IsString(vm)) { in Get()
564 GTEST_LOG_(INFO) << "Key:Accessor1 Value:" << str->ToString(vm); in Get()
566 str = object->Get(vm, StringRef::NewFromUtf8(vm, "Test3")); in Get()
567 if (str->IsString(vm)) { in Get()
568 GTEST_LOG_(INFO) << "Key:Test3 Value:" << str->ToString(vm); in Get()
572 void SetValueAgain(Local<ObjectRef> object, EcmaVM *vm) in SetValueAgain() argument
577 bool b = object->Set(vm, cnt, StringRef::NewFromUtf8(vm, "TestValueAgain1")); in SetValueAgain()
579 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "TestValueAgai… in SetValueAgain()
581 b = object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), in SetValueAgain()
582 StringRef::NewFromUtf8(vm, "AttributeValueAgain1")); in SetValueAgain()
584 b = object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), in SetValueAgain()
585 StringRef::NewFromUtf8(vm, "AttributeValueAgain3")); in SetValueAgain()
587 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Accessor1"), StringRef::NewFromUtf8(vm, "Attribute… in SetValueAgain()
590 Get(object, vm); in SetValueAgain()
591 GetProperty(object, vm); in SetValueAgain()
594 void GetOwnEnumerablePropertyNames(Local<ObjectRef> object, EcmaVM *vm) in GetOwnEnumerablePropertyNames() argument
597 Local<ArrayRef> names = object->GetOwnEnumerablePropertyNames(vm); in GetOwnEnumerablePropertyNames()
598 int cnt = names->Length(vm); in GetOwnEnumerablePropertyNames()
601 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in GetOwnEnumerablePropertyNames()
602 if (value->IsSymbol(vm)) { in GetOwnEnumerablePropertyNames()
604 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in GetOwnEnumerablePropertyNames()
606 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in GetOwnEnumerablePropertyNames()
611 void PrintAllProperty(Local<ObjectRef> object, EcmaVM *vm, int flag) in PrintAllProperty() argument
613 Local<ArrayRef> names = object->GetAllPropertyNames(vm, flag); in PrintAllProperty()
614 int cnt = names->Length(vm); in PrintAllProperty()
632 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in PrintAllProperty()
633 if (value->IsSymbol(vm)) { in PrintAllProperty()
635 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in PrintAllProperty()
637 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in PrintAllProperty()
642 void GetAllPropertyNames(Local<ObjectRef> object, EcmaVM *vm) in GetAllPropertyNames() argument
646 PrintAllProperty(object, vm, i); in GetAllPropertyNames()
650 void HasAndDelete(Local<ObjectRef> object, EcmaVM *vm) in HasAndDelete() argument
653 bool b = object->Has(vm, 1); // 1 = key in HasAndDelete()
655 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
657 b = object->Delete(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
659 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
663 void FreezeAndSeal(Local<ObjectRef> object, EcmaVM *vm) in FreezeAndSeal() argument
666 object->Seal(vm); in FreezeAndSeal()
669 bool b = object->Set(vm, num1, StringRef::NewFromUtf8(vm, "Seal1")); in FreezeAndSeal()
671 b = object->Delete(vm, num1); in FreezeAndSeal()
673 b = object->Set(vm, num2, StringRef::NewFromUtf8(vm, "2")); in FreezeAndSeal()
675 object->Freeze(vm); in FreezeAndSeal()
676 PropertyAttribute attribute(StringRef::NewFromUtf8(vm, "FreezeValue"), true, true, false); in FreezeAndSeal()
677 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "Freeze"), attribute); in FreezeAndSeal()
679 b = object->Has(vm, num2); in FreezeAndSeal()
681 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Freeze")); in FreezeAndSeal()
683 b = object->Delete(vm, num2); in FreezeAndSeal()
685 b = object->Delete(vm, StringRef::NewFromUtf8(vm, "Freeze")); in FreezeAndSeal()
689 void GetOwnProperty(Local<ObjectRef> object, EcmaVM *vm) in GetOwnProperty() argument
693 bool b = object->GetOwnProperty(vm, NumberRef::New(vm, 1), value1); in GetOwnProperty()
696 b = object->GetOwnProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), value2); in GetOwnProperty()
704 Local<JSValueRef> value = value2.GetValue(vm); in GetOwnProperty()
705 ASSERT_EQ("AttributeValue1", value->ToString(vm)->ToString(vm)); in GetOwnProperty()
716 void NativePointer(Local<ObjectRef> object, EcmaVM *vm) in NativePointer() argument
720 object->SetNativePointerFieldCount(vm, cnt); in NativePointer()
721 ASSERT_EQ(cnt, object->GetNativePointerFieldCount(vm)); in NativePointer()
725 object->SetNativePointerField(vm, cnt2, static_cast<void *>(a), nullptr, nullptr); in NativePointer()
726 object->SetNativePointerField(vm, cnt3, static_cast<void *>(a), nullptr, nullptr); in NativePointer()
727 A *value1 = static_cast<A *>(object->GetNativePointerField(vm, cnt2)); in NativePointer()
728 A *value2 = static_cast<A *>(object->GetNativePointerField(vm, cnt3)); in NativePointer()
737 Local<NativePointerRef> native = NativePointerRef::New(vm, static_cast<void *>(a)); in NativePointer()
738 bool b = object->ConvertToNativeBindingObject(vm, native); in NativePointer()
742 void SetPrototype(Local<ObjectRef> object, EcmaVM *vm) in SetPrototype() argument
746 Local<NumberRef> obj = NumberRef::New(vm, cnt); in SetPrototype()
747 object->SetPrototype(vm, obj); in SetPrototype()
748 Local<JSValueRef> type = object->GetPrototype(vm); in SetPrototype()
752 GTEST_LOG_(INFO) << "Prototype: " << type->Typeof(vm)->ToString(vm); in SetPrototype()
787 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
788 LocalScope scope(vm); in HWTEST_F_L0()
790 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
808 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
809 LocalScope scope(vm); in HWTEST_F_L0()
815 GTEST_LOG_(INFO) << "func test arg " << i << " " << arg->Int32Value(vm); in HWTEST_F_L0()
820 int arg0 = jsArg0->Int32Value(vm); in HWTEST_F_L0()
821 int arg1 = jsArg1->Int32Value(vm); in HWTEST_F_L0()
825 return NumberRef::New(vm, sum); in HWTEST_F_L0()
840 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunc() local
841 LocalScope scope(vm); in AddFunc()
847 GTEST_LOG_(INFO) << "func test arg " << i << " " << arg->Int32Value(vm); in AddFunc()
852 int arg0 = jsArg0->Int32Value(vm); in AddFunc()
853 int arg1 = jsArg1->Int32Value(vm); in AddFunc()
856 return NumberRef::New(vm, sum); in AddFunc()
861 EcmaVM *vm = runtimeInfo->GetVM(); in AddProxyFunc() local
862 LocalScope scope(vm); in AddProxyFunc()
868 return NumberRef::New(vm, 0); in AddProxyFunc()
881 Local<JSValueRef> jsSum = addFunc->Call(vm, JSValueRef::Undefined(vm), argv, addFuncArgCount); in AddProxyFunc()
882 int sum = jsSum->Int32Value(vm); in AddProxyFunc()
886 return NumberRef::New(vm, sum); in AddProxyFunc()
1014 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1017 static void AddStaticVariable(EcmaVM *vm, Local<FunctionRef> &claFunc);
1019 static void AddStaticFunction(EcmaVM *vm, Local<FunctionRef> &claFunc);
1022 static void AddVariable(EcmaVM *vm, Local<ObjectRef> &proto);
1024 static void AddFunction(EcmaVM *vm, Local<ObjectRef> &proto);
1028 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1029 static Local<Greeter> New(EcmaVM *vm, Local<StringRef> greet);
1032 … static void SetPrivateGreeting(EcmaVM *vm, Local<Greeter> thisRef, Local<StringRef> priGreeting);
1033 static Local<StringRef> Greet(EcmaVM *vm, Local<Greeter> thisRef);
1036 static Local<StringRef> StandardGreeting(EcmaVM *vm);
1037 static Local<StringRef> StandardPosition(EcmaVM *vm);
1052 Local<FunctionRef> Greeter::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1055 …Greeter::standardGreetingStrKey = SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "standardGreetingS… in NewClassFunction()
1056 Greeter::privateGreetingKey = SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "privateGreeting")); in NewClassFunction()
1060 vm, in NewClassFunction()
1063 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1064 LocalScope scope(vm); in NewClassFunction()
1067 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1071 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "greeting"), greet); in NewClassFunction()
1082 AddStaticVariable(vm, claFunc); in NewClassFunction()
1084 AddStaticFunction(vm, claFunc); in NewClassFunction()
1085 Local<JSValueRef> jsProto = claFunc->GetFunctionPrototype(vm); in NewClassFunction()
1086 Local<ObjectRef> proto = jsProto->ToObject(vm); in NewClassFunction()
1089 AddVariable(vm, proto); in NewClassFunction()
1091 AddFunction(vm, proto); in NewClassFunction()
1093 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, Greeter::CLASS_NAME.c_str())); in NewClassFunction()
1097 Local<FunctionRef> Greeter::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1099 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1100 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, Greeter::CLASS_NAME.c_… in GetClassFunction()
1101 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1104 Local<FunctionRef> claFunc = Greeter::NewClassFunction(vm); in GetClassFunction()
1106 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1111 void Greeter::AddStaticVariable(EcmaVM *vm, Local<FunctionRef> &claFunc) in AddStaticVariable() argument
1115 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "position"), StringRef::NewFromUtf8(vm, "door")); in AddStaticVariable()
1118 claFunc->Set(vm, Greeter::standardGreetingStrKey, StringRef::NewFromUtf8(vm, "Hello, there")); in AddStaticVariable()
1122 void Greeter::AddStaticFunction(EcmaVM *vm, Local<FunctionRef> &claFunc) in AddStaticFunction() argument
1125 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "StandardGreeting"), in AddStaticFunction()
1126 FunctionRef::New(vm, in AddStaticFunction()
1129 EcmaVM *vm = runtimeInfo->GetVM(); in AddStaticFunction() local
1130 LocalScope scope(vm); in AddStaticFunction()
1131 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddStaticFunction()
1132 … Local<JSValueRef> jsStandardGreetingStr = claFunc->Get(vm, Greeter::standardGreetingStrKey); in AddStaticFunction()
1136 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "StandardPosition"), in AddStaticFunction()
1137 FunctionRef::New(vm, in AddStaticFunction()
1140 EcmaVM *vm = runtimeInfo->GetVM(); in AddStaticFunction() local
1141 LocalScope scope(vm); in AddStaticFunction()
1142 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddStaticFunction()
1143 Local<JSValueRef> jsPosition = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "position")); in AddStaticFunction()
1149 void Greeter::AddVariable(EcmaVM *vm, Local<ObjectRef> &proto) in AddVariable() argument
1152 proto->Set(vm, Greeter::privateGreetingKey, JSValueRef::Undefined(vm)); in AddVariable()
1154 proto->Set(vm, StringRef::NewFromUtf8(vm, "greeting"), JSValueRef::Undefined(vm)); in AddVariable()
1158 void Greeter::AddFunction(EcmaVM *vm, Local<ObjectRef> &proto) in AddFunction() argument
1161 proto->Set(vm, StringRef::NewFromUtf8(vm, "SetPrivateGreeting"), in AddFunction()
1162 FunctionRef::New(vm, in AddFunction()
1165 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunction() local
1166 LocalScope scope(vm); in AddFunction()
1169 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in AddFunction()
1172 thisRef->Set(vm, Greeter::privateGreetingKey, priGreeting); in AddFunction()
1173 return JSValueRef::Undefined(vm); in AddFunction()
1176 proto->Set(vm, StringRef::NewFromUtf8(vm, "Greet"), in AddFunction()
1177 FunctionRef::New(vm, in AddFunction()
1180 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunction() local
1181 LocalScope scope(vm); in AddFunction()
1183 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddFunction()
1186 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in AddFunction()
1187 Local<JSValueRef> jsPrivateGreeting = thisRef->Get(vm, Greeter::privateGreetingKey); in AddFunction()
1188 Local<JSValueRef> jsGreeting = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "greeting")); in AddFunction()
1189 … Local<JSValueRef> jsStandardGreetingStr = claFunc->Get(vm, Greeter::standardGreetingStrKey); in AddFunction()
1191 if (jsPrivateGreeting->IsString(vm)) { in AddFunction()
1192 ret.append("Hello, ").append(jsPrivateGreeting->ToString(vm)->ToString(vm)); in AddFunction()
1193 } else if (jsGreeting->IsString(vm)) { in AddFunction()
1194 ret.append("Hello, ").append(jsGreeting->ToString(vm)->ToString(vm)); in AddFunction()
1196 ret.append(jsStandardGreetingStr->ToString(vm)->ToString(vm)); in AddFunction()
1198 return StringRef::NewFromUtf8(vm, ret.c_str(), ret.size()); in AddFunction()
1202 Local<Greeter> Greeter::New(EcmaVM *vm, Local<StringRef> greet) in New() argument
1205 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in New()
1209 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1210 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1217 void Greeter::SetPrivateGreeting(EcmaVM *vm, Local<Greeter> thisRef, Local<StringRef> priGreeting) in SetPrivateGreeting() argument
1220 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "SetPrivateGreeting")); in SetPrivateGreeting()
1222 func->Call(vm, objRef, argv, 1); in SetPrivateGreeting()
1228 Local<StringRef> Greeter::Greet(EcmaVM *vm, Local<Greeter> thisRef) in Greet() argument
1231 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "Greet")); in Greet()
1232 return func->Call(vm, objRef, nullptr, 0); in Greet()
1238 Local<StringRef> Greeter::StandardGreeting(EcmaVM *vm) in StandardGreeting() argument
1241 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in StandardGreeting()
1243 Local<FunctionRef> func = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "StandardGreeting")); in StandardGreeting()
1245 return func->Call(vm, JSValueRef::Undefined(vm), nullptr, 0); in StandardGreeting()
1251 Local<StringRef> Greeter::StandardPosition(EcmaVM *vm) in StandardPosition() argument
1254 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in StandardPosition()
1256 Local<FunctionRef> func = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "StandardPosition")); in StandardPosition()
1258 return func->Call(vm, JSValueRef::Undefined(vm), nullptr, 0); in StandardPosition()
1372 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1376 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1377 static Local<Derive> New(EcmaVM *vm, Local<NumberRef> num);
1379 static Local<NumberRef> Compute(EcmaVM *vm, Local<Derive> thisRef);
1387 Local<FunctionRef> Derive::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1390 vm, in NewClassFunction()
1393 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1394 LocalScope scope(vm); in NewClassFunction()
1397 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1401 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1405 Local<JSValueRef> jsProto = claFunc->GetFunctionPrototype(vm); in NewClassFunction()
1406 Local<ObjectRef> proto = jsProto->ToObject(vm); in NewClassFunction()
1408 proto->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), NumberRef::New(vm, 1)); in NewClassFunction()
1410 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1411 FunctionRef::New(vm, in NewClassFunction()
1414 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1415 LocalScope scope(vm); in NewClassFunction()
1419 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1421 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1422 int num = jsNum->Int32Value(vm); in NewClassFunction()
1423 return NumberRef::New(vm, num); in NewClassFunction()
1426 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, Derive::CLASS_NAME.c_str())); in NewClassFunction()
1430 Local<FunctionRef> Derive::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1432 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1433 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, Derive::CLASS_NAME.c_s… in GetClassFunction()
1434 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1437 Local<FunctionRef> claFunc = Derive::NewClassFunction(vm); in GetClassFunction()
1439 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1443 Local<Derive> Derive::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1446 Local<FunctionRef> claFunc = Derive::GetClassFunction(vm); in New()
1450 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1451 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1455 Local<NumberRef> Derive::Compute(EcmaVM *vm, Local<Derive> thisRef) in Compute() argument
1458 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "Compute")); in Compute()
1459 return func->Call(vm, objRef, nullptr, 0); in Compute()
1476 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1480 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1481 static Local<DeriveDouble> New(EcmaVM *vm, Local<NumberRef> num);
1491 Local<FunctionRef> DeriveDouble::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1494 vm, in NewClassFunction()
1497 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1498 LocalScope scope(vm); in NewClassFunction()
1503 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1505 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1510 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, DeriveDouble::CLASS_NAME.c_str())); in NewClassFunction()
1513 Local<ObjectRef> proto = claFunc->GetFunctionPrototype(vm)->ToObject(vm); in NewClassFunction()
1514 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1515 FunctionRef::New(vm, in NewClassFunction()
1518 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1519 LocalScope scope(vm); in NewClassFunction()
1522 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1523 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1524 int num = jsNum->Int32Value(vm); in NewClassFunction()
1527 return NumberRef::New(vm, num); in NewClassFunction()
1530 Local<FunctionRef> claFuncBase = Derive::GetClassFunction(vm); in NewClassFunction()
1532 claFunc->Inherit(vm, claFuncBase); in NewClassFunction()
1536 Local<FunctionRef> DeriveDouble::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1538 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1539 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, DeriveDouble::CLASS_NA… in GetClassFunction()
1540 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1543 Local<FunctionRef> claFunc = DeriveDouble::NewClassFunction(vm); in GetClassFunction()
1544 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1548 Local<DeriveDouble> DeriveDouble::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1551 Local<FunctionRef> claFunc = DeriveDouble::GetClassFunction(vm); in New()
1555 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1556 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1574 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1578 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1579 static Local<DerivedTriple> New(EcmaVM *vm, Local<NumberRef> num);
1589 Local<FunctionRef> DerivedTriple::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1592 vm, in NewClassFunction()
1595 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1596 LocalScope scope(vm); in NewClassFunction()
1601 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1603 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1608 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, DerivedTriple::CLASS_NAME.c_str())); in NewClassFunction()
1611 Local<ObjectRef> proto = claFunc->GetFunctionPrototype(vm)->ToObject(vm); in NewClassFunction()
1612 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1613 FunctionRef::New(vm, in NewClassFunction()
1616 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1617 LocalScope scope(vm); in NewClassFunction()
1620 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1621 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1622 int num = jsNum->Int32Value(vm); in NewClassFunction()
1625 return NumberRef::New(vm, num); in NewClassFunction()
1628 Local<FunctionRef> claFuncBase = Derive::GetClassFunction(vm); in NewClassFunction()
1630 claFunc->Inherit(vm, claFuncBase); in NewClassFunction()
1634 Local<FunctionRef> DerivedTriple::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1636 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1637 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, DerivedTriple::CLASS_N… in GetClassFunction()
1638 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1641 Local<FunctionRef> claFunc = DerivedTriple::NewClassFunction(vm); in GetClassFunction()
1642 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1646 Local<DerivedTriple> DerivedTriple::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1649 Local<FunctionRef> claFunc = DerivedTriple::GetClassFunction(vm); in New()
1653 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1654 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
2209 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2210 LocalScope scope(vm); in HWTEST_F_L0()
2212 int num = jsNum->Int32Value(vm); in HWTEST_F_L0()
2215 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2220 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2221 LocalScope scope(vm); in HWTEST_F_L0()
2223 std::string err = jsStr->ToString(vm)->ToString(vm); in HWTEST_F_L0()
2226 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2231 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2232 LocalScope scope(vm); in HWTEST_F_L0()
2235 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2250 std::string jsValue2String(EcmaVM *vm, Local<JSValueRef> &jsVal) in jsValue2String() argument
2252 if (jsVal->IsString(vm)) { in jsValue2String()
2253 return "type string, val : " + jsVal->ToString(vm)->ToString(vm); in jsValue2String()
2255 return "type number, val : " + std::to_string(jsVal->Int32Value(vm)); in jsValue2String()
2257 return "type bool, val : " + std::to_string(jsVal->BooleaValue(vm)); in jsValue2String()
2258 } else if (jsVal->IsSymbol(vm)) { in jsValue2String()
2260 return "type symbol, val : " + symbol->GetDescription(vm)->ToString(vm); in jsValue2String()
2262 return "type other : " + jsVal->ToString(vm)->ToString(vm); in jsValue2String()
2266 void MapSetValue(EcmaVM *vm, Local<MapRef> &map, Local<JSValueRef> symbolKey) in MapSetValue() argument
2268 map->Set(vm, StringRef::NewFromUtf8(vm, "key1"), StringRef::NewFromUtf8(vm, "val1")); in MapSetValue()
2270 map->Set(vm, StringRef::NewFromUtf8(vm, "key2"), NumberRef::New(vm, num2)); in MapSetValue()
2271 map->Set(vm, StringRef::NewFromUtf8(vm, "key3"), BooleanRef::New(vm, true)); in MapSetValue()
2272 …map->Set(vm, StringRef::NewFromUtf8(vm, "key4"), SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "va… in MapSetValue()
2274 map->Set(vm, IntegerRef::New(vm, num5), StringRef::NewFromUtf8(vm, "val5")); in MapSetValue()
2277 map->Set(vm, IntegerRef::New(vm, num61), IntegerRef::New(vm, num62)); in MapSetValue()
2278 map->Set(vm, BooleanRef::New(vm, true), StringRef::NewFromUtf8(vm, "val7")); in MapSetValue()
2279 map->Set(vm, symbolKey, StringRef::NewFromUtf8(vm, "val8")); in MapSetValue()
2282 void MapGetValue(EcmaVM *vm, Local<MapRef> &map, Local<JSValueRef> symbolKey) in MapGetValue() argument
2284 Local<JSValueRef> val1 = map->Get(vm, StringRef::NewFromUtf8(vm, "key1")); in MapGetValue()
2285 bool val1IsString = val1->IsString(vm); in MapGetValue()
2286 …LOG_(INFO) << "key1 : IsString:" << val1IsString << " val:" << val1->ToString(vm)->ToString(vm); in MapGetValue()
2288 Local<JSValueRef> val2 = map->Get(vm, StringRef::NewFromUtf8(vm, "key2")); in MapGetValue()
2290 GTEST_LOG_(INFO) << "key2 : IsNumber:" << val2IsNumber << " val:" << val2->Int32Value(vm); in MapGetValue()
2292 Local<JSValueRef> val3 = map->Get(vm, StringRef::NewFromUtf8(vm, "key3")); in MapGetValue()
2294 GTEST_LOG_(INFO) << "key3 : IsBoolean:" << val3IsBoolean << " val:" << val3->BooleaValue(vm); in MapGetValue()
2296 Local<JSValueRef> val4 = map->Get(vm, StringRef::NewFromUtf8(vm, "key4")); in MapGetValue()
2297 bool val4IsSymbol = val4->IsSymbol(vm); in MapGetValue()
2300 << val4Symbol->GetDescription(vm)->ToString(vm); in MapGetValue()
2303 Local<JSValueRef> val5 = map->Get(vm, IntegerRef::New(vm, num5)); in MapGetValue()
2304 GTEST_LOG_(INFO) << "55 : " << val5->ToString(vm)->ToString(vm); in MapGetValue()
2307 Local<JSValueRef> val6 = map->Get(vm, IntegerRef::New(vm, num6)); in MapGetValue()
2308 GTEST_LOG_(INFO) << "66 : " << val6->Int32Value(vm); in MapGetValue()
2309 Local<JSValueRef> val7 = map->Get(vm, BooleanRef::New(vm, true)); in MapGetValue()
2310 GTEST_LOG_(INFO) << "true : " << val7->ToString(vm)->ToString(vm); in MapGetValue()
2312 Local<JSValueRef> val8 = map->Get(vm, symbolKey); in MapGetValue()
2313 GTEST_LOG_(INFO) << "SymbolRef(key8) : " << val8->ToString(vm)->ToString(vm); in MapGetValue()
2315 Local<JSValueRef> val82 = map->Get(vm, SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "key8"))); in MapGetValue()
2318 int32_t size = map->GetSize(vm); in MapGetValue()
2320 int32_t totalElement = map->GetTotalElements(vm); in MapGetValue()
2324 Local<JSValueRef> jsKey = map->GetKey(vm, i); in MapGetValue()
2325 Local<JSValueRef> jsVal = map->GetValue(vm, i); in MapGetValue()
2326 …GTEST_LOG_(INFO) << "for map index : " << i << " key : " << jsValue2String(vm, jsKey) << " v… in MapGetValue()
2327 jsValue2String(vm, jsVal); in MapGetValue()
2331 void MapIteratorGetValue(EcmaVM *vm, Local<MapRef> &map) in MapIteratorGetValue() argument
2333 Local<MapIteratorRef> mapIter = MapIteratorRef::New(vm, map); in MapIteratorGetValue()
2334 ecmascript::EcmaRuntimeCallInfo *mapIterInfo = mapIter->GetEcmaRuntimeCallInfo(vm); in MapIteratorGetValue()
2336 Local<StringRef> kind = mapIter->GetKind(vm); in MapIteratorGetValue()
2337 GTEST_LOG_(INFO) << "Map Iterator kind : " << kind->ToString(vm); in MapIteratorGetValue()
2339 for (Local<ArrayRef> array = MapIteratorRef::Next(vm, mapIterInfo); array->IsArray(vm); in MapIteratorGetValue()
2340 array = MapIteratorRef::Next(vm, mapIterInfo)) { in MapIteratorGetValue()
2342 Local<JSValueRef> jsKey = ArrayRef::GetValueAt(vm, array, 0); in MapIteratorGetValue()
2343 Local<JSValueRef> jsVal = ArrayRef::GetValueAt(vm, array, 1); in MapIteratorGetValue()
2344 …_LOG_(INFO) << "for map iterator index : " << index << " key : " << jsValue2String(vm, jsKey) << in MapIteratorGetValue()
2345 " val : " << jsValue2String(vm, jsVal); in MapIteratorGetValue()
2473 void JsonObjGetValue(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetValue() argument
2475 Local<JSValueRef> jsVal1 = obj->Get(vm, StringRef::NewFromUtf8(vm, "str1")); in JsonObjGetValue()
2476 bool jsVal1IsString = jsVal1->IsString(vm); in JsonObjGetValue()
2477 Local<StringRef> val1 = jsVal1->ToString(vm); in JsonObjGetValue()
2478 … GTEST_LOG_(INFO) << "str1 : is string : " << jsVal1IsString << " value : " << val1->ToString(vm); in JsonObjGetValue()
2479 Local<JSValueRef> jsVal2 = obj->Get(vm, StringRef::NewFromUtf8(vm, "str2")); in JsonObjGetValue()
2481 int val2 = jsVal2->Int32Value(vm); in JsonObjGetValue()
2483 Local<JSValueRef> jsVal3 = obj->Get(vm, StringRef::NewFromUtf8(vm, "333")); in JsonObjGetValue()
2484 int val3 = jsVal3->Int32Value(vm); in JsonObjGetValue()
2486 Local<JSValueRef> jsVal4 = obj->Get(vm, StringRef::NewFromUtf8(vm, "444")); in JsonObjGetValue()
2487 Local<StringRef> val4 = jsVal4->ToString(vm); in JsonObjGetValue()
2488 GTEST_LOG_(INFO) << "str4 : " << val4->ToString(vm); in JsonObjGetValue()
2490 Local<JSValueRef> jsVal8 = obj->Get(vm, StringRef::NewFromUtf8(vm, "b8")); in JsonObjGetValue()
2498 void JsonObjGetArray(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetArray() argument
2500 Local<JSValueRef> jsVal5 = obj->Get(vm, StringRef::NewFromUtf8(vm, "arr5")); in JsonObjGetArray()
2502 int length = val5Obj->Get(vm, StringRef::NewFromUtf8(vm, "length"))->Int32Value(vm); in JsonObjGetArray()
2505 Local<JSValueRef> val5Item = val5Obj->Get(vm, NumberRef::New(vm, i)); in JsonObjGetArray()
2506 GTEST_LOG_(INFO) << "arr5 : " << i << " " << val5Item->Int32Value(vm); in JsonObjGetArray()
2509 uint32_t length2 = val5Arr->Length(vm); in JsonObjGetArray()
2512 Local<JSValueRef> val5Item = ArrayRef::GetValueAt(vm, val5Arr, i); in JsonObjGetArray()
2513 GTEST_LOG_(INFO) << "arr5 : " << i << " " << val5Item->Int32Value(vm); in JsonObjGetArray()
2515 Local<JSValueRef> jsVal6 = obj->Get(vm, StringRef::NewFromUtf8(vm, "arr6")); in JsonObjGetArray()
2517 int length3 = val6Obj->Get(vm, StringRef::NewFromUtf8(vm, "length"))->Int32Value(vm); in JsonObjGetArray()
2520 Local<JSValueRef> val6Item = val6Obj->Get(vm, NumberRef::New(vm, i)); in JsonObjGetArray()
2521 GTEST_LOG_(INFO) << "arr6 : " << i << " " << val6Item->ToString(vm)->ToString(vm); in JsonObjGetArray()
2526 void JsonObjGetObject(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetObject() argument
2528 Local<JSValueRef> jsVal7 = obj->Get(vm, StringRef::NewFromUtf8(vm, "data7")); in JsonObjGetObject()
2529 Local<ObjectRef> val7Obj = jsVal7->ToObject(vm); in JsonObjGetObject()
2530 Local<ArrayRef> val7ObjKeys = val7Obj->GetOwnPropertyNames(vm); in JsonObjGetObject()
2531 for (uint32_t i = 0; i < val7ObjKeys->Length(vm); ++i) { in JsonObjGetObject()
2532 Local<JSValueRef> itemKey = ArrayRef::GetValueAt(vm, val7ObjKeys, i); in JsonObjGetObject()
2533 Local<JSValueRef> itemVal = val7Obj->Get(vm, itemKey); in JsonObjGetObject()
2534 …_LOG_(INFO) << "data7 : item index:" << i << " Key:" << itemKey->ToString(vm)->ToString(vm) << in JsonObjGetObject()
2535 " val:" << itemVal->ToString(vm)->ToString(vm); in JsonObjGetObject()
2889 Local<JSValueRef> ThrowErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowErrorFuncTest() argument
2891 int i = par->Int32Value(vm); in ThrowErrorFuncTest()
2894 Local<JSValueRef> error = Exception::Error(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowErrorFuncTest()
2895 JSNApi::ThrowException(vm, error); in ThrowErrorFuncTest()
2896 return JSValueRef::Undefined(vm); in ThrowErrorFuncTest()
2899 return NumberRef::New(vm, i * num); in ThrowErrorFuncTest()
2902 Local<JSValueRef> ThrowRangeErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowRangeErrorFuncTest() argument
2904 int i = par->Int32Value(vm); in ThrowRangeErrorFuncTest()
2907 … Local<JSValueRef> error = Exception::RangeError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowRangeErrorFuncTest()
2908 JSNApi::ThrowException(vm, error); in ThrowRangeErrorFuncTest()
2909 return JSValueRef::Undefined(vm); in ThrowRangeErrorFuncTest()
2912 return NumberRef::New(vm, i * num); in ThrowRangeErrorFuncTest()
2915 Local<JSValueRef> ThrowReferenceErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowReferenceErrorFuncTest() argument
2917 int i = par->Int32Value(vm); in ThrowReferenceErrorFuncTest()
2920 …Local<JSValueRef> error = Exception::ReferenceError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())… in ThrowReferenceErrorFuncTest()
2921 JSNApi::ThrowException(vm, error); in ThrowReferenceErrorFuncTest()
2922 return JSValueRef::Undefined(vm); in ThrowReferenceErrorFuncTest()
2925 return NumberRef::New(vm, i * num); in ThrowReferenceErrorFuncTest()
2928 Local<JSValueRef> ThrowSyntaxErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowSyntaxErrorFuncTest() argument
2930 int i = par->Int32Value(vm); in ThrowSyntaxErrorFuncTest()
2933 … Local<JSValueRef> error = Exception::SyntaxError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowSyntaxErrorFuncTest()
2934 JSNApi::ThrowException(vm, error); in ThrowSyntaxErrorFuncTest()
2935 return JSValueRef::Undefined(vm); in ThrowSyntaxErrorFuncTest()
2938 return NumberRef::New(vm, i * num); in ThrowSyntaxErrorFuncTest()
2941 Local<JSValueRef> ThrowTypeErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowTypeErrorFuncTest() argument
2943 int i = par->Int32Value(vm); in ThrowTypeErrorFuncTest()
2946 … Local<JSValueRef> error = Exception::TypeError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowTypeErrorFuncTest()
2947 JSNApi::ThrowException(vm, error); in ThrowTypeErrorFuncTest()
2948 return JSValueRef::Undefined(vm); in ThrowTypeErrorFuncTest()
2951 return NumberRef::New(vm, i * num); in ThrowTypeErrorFuncTest()
2954 Local<JSValueRef> ThrowAggregateErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowAggregateErrorFuncTest() argument
2956 int i = par->Int32Value(vm); in ThrowAggregateErrorFuncTest()
2959 …Local<JSValueRef> error = Exception::AggregateError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())… in ThrowAggregateErrorFuncTest()
2960 JSNApi::ThrowException(vm, error); in ThrowAggregateErrorFuncTest()
2961 return JSValueRef::Undefined(vm); in ThrowAggregateErrorFuncTest()
2964 return NumberRef::New(vm, i * num); in ThrowAggregateErrorFuncTest()
2967 Local<JSValueRef> ThrowEvalErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowEvalErrorFuncTest() argument
2969 int i = par->Int32Value(vm); in ThrowEvalErrorFuncTest()
2972 … Local<JSValueRef> error = Exception::EvalError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowEvalErrorFuncTest()
2973 JSNApi::ThrowException(vm, error); in ThrowEvalErrorFuncTest()
2974 return JSValueRef::Undefined(vm); in ThrowEvalErrorFuncTest()
2977 return NumberRef::New(vm, i * num); in ThrowEvalErrorFuncTest()
2980 Local<JSValueRef> ThrowOOMErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowOOMErrorFuncTest() argument
2982 int i = par->Int32Value(vm); in ThrowOOMErrorFuncTest()
2985 … Local<JSValueRef> error = Exception::OOMError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowOOMErrorFuncTest()
2986 JSNApi::ThrowException(vm, error); in ThrowOOMErrorFuncTest()
2987 return JSValueRef::Undefined(vm); in ThrowOOMErrorFuncTest()
2990 return NumberRef::New(vm, i * num); in ThrowOOMErrorFuncTest()
2993 Local<JSValueRef> ThrowTerminationErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowTerminationErrorFuncTest() argument
2995 int i = par->Int32Value(vm); in ThrowTerminationErrorFuncTest()
2998 …Local<JSValueRef> error = Exception::TerminationError(vm, StringRef::NewFromUtf8(vm, errStr.c_str(… in ThrowTerminationErrorFuncTest()
2999 JSNApi::ThrowException(vm, error); in ThrowTerminationErrorFuncTest()
3000 return JSValueRef::Undefined(vm); in ThrowTerminationErrorFuncTest()
3003 return NumberRef::New(vm, i * num); in ThrowTerminationErrorFuncTest()
3007 void ClearAndPrintException4JSNApi(const EcmaVM *vm, const std::string log) in ClearAndPrintException4JSNApi() argument
3009 if (!JSNApi::HasPendingException(vm)) { in ClearAndPrintException4JSNApi()
3014 JSNApi::PrintExceptionInfo(vm); in ClearAndPrintException4JSNApi()
3015 Local<ObjectRef> exception = JSNApi::GetAndClearUncaughtException(vm); in ClearAndPrintException4JSNApi()
3016 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4JSNApi()
3017 std::string exceptionMessage = exception->Get(vm, StringRef::NewFromUtf8(vm, in ClearAndPrintException4JSNApi()
3018 "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4JSNApi()
3019 std::string exceptionStack = exception->Get(vm, in ClearAndPrintException4JSNApi()
3020 StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)->ToString(vm); in ClearAndPrintException4JSNApi()
3028 void ClearAndPrintException4TryCatch1(const EcmaVM *vm, const std::string log) in ClearAndPrintException4TryCatch1() argument
3030 TryCatch tryCatch(vm); in ClearAndPrintException4TryCatch1()
3036 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4TryCatch1()
3037 std::string exceptionMessage = exception->Get(vm, in ClearAndPrintException4TryCatch1()
3038 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4TryCatch1()
3039 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in ClearAndPrintException4TryCatch1()
3047 void ClearAndPrintException4TryCatch2(const EcmaVM *vm, const std::string log) in ClearAndPrintException4TryCatch2() argument
3049 TryCatch tryCatch(vm); in ClearAndPrintException4TryCatch2()
3057 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4TryCatch2()
3058 std::string exceptionMessage = exception->Get(vm, in ClearAndPrintException4TryCatch2()
3059 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4TryCatch2()
3060 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in ClearAndPrintException4TryCatch2()
3069 void PrintAndRethrowException4TryCatch3(const EcmaVM *vm, const std::string log) in PrintAndRethrowException4TryCatch3() argument
3071 TryCatch tryCatch(vm); in PrintAndRethrowException4TryCatch3()
3078 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in PrintAndRethrowException4TryCatch3()
3079 std::string exceptionMessage = exception->Get(vm, in PrintAndRethrowException4TryCatch3()
3080 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in PrintAndRethrowException4TryCatch3()
3081 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in PrintAndRethrowException4TryCatch3()