• Home
  • Raw
  • Download

Lines Matching full:vm

434 static std::vector<Local<SymbolRef>> GetSymbolRef(EcmaVM *vm)  in GetSymbolRef()  argument
437 …static std::vector<Local<SymbolRef>> value = { SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symb… in GetSymbolRef()
438 … SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symbolKey2")), in GetSymbolRef()
439 … SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "symbolKey3")) }; in GetSymbolRef()
527 void ObjectRefSet(Local<ObjectRef> object, EcmaVM *vm, Local<SymbolRef> symbol) in ObjectRefSet() argument
531 bool b = object->Set(vm, cnt, StringRef::NewFromUtf8(vm, "TestValue1")); in ObjectRefSet()
533 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test2"), StringRef::NewFromUtf8(vm, "TestValue2")); in ObjectRefSet()
535 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "TestValue3")); in ObjectRefSet()
537 b = object->Set(vm, symbol, StringRef::NewFromUtf8(vm, "symbolValue")); in ObjectRefSet()
540 Local<FunctionRef> getter1 = FunctionRef::New(vm, Getter1); in ObjectRefSet()
541 Local<FunctionRef> setter1 = FunctionRef::New(vm, Setter1); in ObjectRefSet()
543 Local<FunctionRef> getter2 = FunctionRef::New(vm, Getter2); in ObjectRefSet()
544 Local<FunctionRef> setter2 = FunctionRef::New(vm, Setter2); in ObjectRefSet()
546 Local<FunctionRef> getter3 = FunctionRef::New(vm, Getter3); in ObjectRefSet()
547 Local<FunctionRef> setter3 = FunctionRef::New(vm, Setter3); in ObjectRefSet()
549 PropertyAttribute attribute1(StringRef::NewFromUtf8(vm, "AttributeValue1"), true, true, false); in ObjectRefSet()
550 PropertyAttribute attribute2(StringRef::NewFromUtf8(vm, "AttributeValue2"), false, true, true); in ObjectRefSet()
551 PropertyAttribute attribute3(StringRef::NewFromUtf8(vm, "AttributeValue3"), true, false, true); in ObjectRefSet()
554 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), attribute1); in ObjectRefSet()
556 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "Test2"), attribute2); in ObjectRefSet()
558 b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "Accessor1"), getter1, setter1); in ObjectRefSet()
560 b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "Test3"), getter2, setter2); in ObjectRefSet()
562 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), attribute3); in ObjectRefSet()
564 …b = object->SetAccessorProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), getter3, setter3,… in ObjectRefSet()
568 void GetProperty(Local<ObjectRef> object, EcmaVM *vm) in GetProperty() argument
571 Local<ArrayRef> names = object->GetOwnPropertyNames(vm); in GetProperty()
572 int cnt = names->Length(vm); in GetProperty()
575 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in GetProperty()
576 if (value->IsSymbol(vm)) { in GetProperty()
578 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in GetProperty()
580 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in GetProperty()
585 void Get(Local<ObjectRef> object, EcmaVM *vm) in Get() argument
589 Local<JSValueRef> value = object->Get(vm, cnt); in Get()
590 if (value->IsString(vm)) { in Get()
591 GTEST_LOG_(INFO) << "Key:1 Value:" << value->ToString(vm)->ToString(vm); in Get()
593 value = object->Get(vm, StringRef::NewFromUtf8(vm, "Test2")); in Get()
594 if (value->IsString(vm)) { in Get()
595 GTEST_LOG_(INFO) << "Key:Test2 Value:" << value->ToString(vm)->ToString(vm); in Get()
597 value = object->Get(vm, StringRef::NewFromUtf8(vm, "AttributeKey1")); in Get()
598 if (value->IsString(vm)) { in Get()
599 GTEST_LOG_(INFO) << "Key:AttributeKey1 Value:" << value->ToString(vm)->ToString(vm); in Get()
602 object->Set(vm, StringRef::NewFromUtf8(vm, "Accessor1"), NumberRef::New(vm, num)); in Get()
603 object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "Test3Value")); in Get()
604 object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), in Get()
605 SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "AttributeKey3Value"))); in Get()
606 Local<StringRef> str = object->Get(vm, StringRef::NewFromUtf8(vm, "AttributeKey3")); in Get()
607 if (str->IsString(vm)) { in Get()
608 GTEST_LOG_(INFO) << "Key:AttributeKey3 Value:" << str->ToString(vm); in Get()
610 str = object->Get(vm, StringRef::NewFromUtf8(vm, "Accessor1")); in Get()
611 if (str->IsString(vm)) { in Get()
612 GTEST_LOG_(INFO) << "Key:Accessor1 Value:" << str->ToString(vm); in Get()
614 str = object->Get(vm, StringRef::NewFromUtf8(vm, "Test3")); in Get()
615 if (str->IsString(vm)) { in Get()
616 GTEST_LOG_(INFO) << "Key:Test3 Value:" << str->ToString(vm); in Get()
620 void SetValueAgain(Local<ObjectRef> object, EcmaVM *vm) in SetValueAgain() argument
625 bool b = object->Set(vm, cnt, StringRef::NewFromUtf8(vm, "TestValueAgain1")); in SetValueAgain()
627 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Test3"), StringRef::NewFromUtf8(vm, "TestValueAgai… in SetValueAgain()
629 b = object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), in SetValueAgain()
630 StringRef::NewFromUtf8(vm, "AttributeValueAgain1")); in SetValueAgain()
632 b = object->Set(vm, StringRef::NewFromUtf8(vm, "AttributeKey3"), in SetValueAgain()
633 StringRef::NewFromUtf8(vm, "AttributeValueAgain3")); in SetValueAgain()
635 …b = object->Set(vm, StringRef::NewFromUtf8(vm, "Accessor1"), StringRef::NewFromUtf8(vm, "Attribute… in SetValueAgain()
638 Get(object, vm); in SetValueAgain()
639 GetProperty(object, vm); in SetValueAgain()
642 void GetOwnEnumerablePropertyNames(Local<ObjectRef> object, EcmaVM *vm) in GetOwnEnumerablePropertyNames() argument
645 Local<ArrayRef> names = object->GetOwnEnumerablePropertyNames(vm); in GetOwnEnumerablePropertyNames()
646 int cnt = names->Length(vm); in GetOwnEnumerablePropertyNames()
649 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in GetOwnEnumerablePropertyNames()
650 if (value->IsSymbol(vm)) { in GetOwnEnumerablePropertyNames()
652 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in GetOwnEnumerablePropertyNames()
654 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in GetOwnEnumerablePropertyNames()
659 void PrintAllProperty(Local<ObjectRef> object, EcmaVM *vm, int flag) in PrintAllProperty() argument
661 Local<ArrayRef> names = object->GetAllPropertyNames(vm, flag); in PrintAllProperty()
662 int cnt = names->Length(vm); in PrintAllProperty()
680 Local<JSValueRef> value = ArrayRef::GetValueAt(vm, names, i); in PrintAllProperty()
681 if (value->IsSymbol(vm)) { in PrintAllProperty()
683 GTEST_LOG_(INFO) << "PropertyNames: " << symbol->GetDescription(vm)->ToString(vm); in PrintAllProperty()
685 GTEST_LOG_(INFO) << "PropertyNames: " << value->ToString(vm)->ToString(vm); in PrintAllProperty()
690 void GetAllPropertyNames(Local<ObjectRef> object, EcmaVM *vm) in GetAllPropertyNames() argument
694 PrintAllProperty(object, vm, i); in GetAllPropertyNames()
698 void HasAndDelete(Local<ObjectRef> object, EcmaVM *vm) in HasAndDelete() argument
701 bool b = object->Has(vm, 1); // 1 = key in HasAndDelete()
703 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
705 b = object->Delete(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
707 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Test2")); in HasAndDelete()
711 void FreezeAndSeal(Local<ObjectRef> object, EcmaVM *vm) in FreezeAndSeal() argument
714 object->Seal(vm); in FreezeAndSeal()
717 bool b = object->Set(vm, num1, StringRef::NewFromUtf8(vm, "Seal1")); in FreezeAndSeal()
719 b = object->Delete(vm, num1); in FreezeAndSeal()
721 b = object->Set(vm, num2, StringRef::NewFromUtf8(vm, "2")); in FreezeAndSeal()
723 object->Freeze(vm); in FreezeAndSeal()
724 PropertyAttribute attribute(StringRef::NewFromUtf8(vm, "FreezeValue"), true, true, false); in FreezeAndSeal()
725 b = object->DefineProperty(vm, StringRef::NewFromUtf8(vm, "Freeze"), attribute); in FreezeAndSeal()
727 b = object->Has(vm, num2); in FreezeAndSeal()
729 b = object->Has(vm, StringRef::NewFromUtf8(vm, "Freeze")); in FreezeAndSeal()
731 b = object->Delete(vm, num2); in FreezeAndSeal()
733 b = object->Delete(vm, StringRef::NewFromUtf8(vm, "Freeze")); in FreezeAndSeal()
737 void GetOwnProperty(Local<ObjectRef> object, EcmaVM *vm) in GetOwnProperty() argument
741 bool b = object->GetOwnProperty(vm, NumberRef::New(vm, 1), value1); in GetOwnProperty()
744 b = object->GetOwnProperty(vm, StringRef::NewFromUtf8(vm, "AttributeKey1"), value2); in GetOwnProperty()
752 Local<JSValueRef> value = value2.GetValue(vm); in GetOwnProperty()
753 ASSERT_EQ("AttributeValue1", value->ToString(vm)->ToString(vm)); in GetOwnProperty()
764 void NativePointer(Local<ObjectRef> object, EcmaVM *vm) in NativePointer() argument
768 object->SetNativePointerFieldCount(vm, cnt); in NativePointer()
769 ASSERT_EQ(cnt, object->GetNativePointerFieldCount(vm)); in NativePointer()
773 object->SetNativePointerField(vm, cnt2, static_cast<void *>(a), nullptr, nullptr); in NativePointer()
774 object->SetNativePointerField(vm, cnt3, static_cast<void *>(a), nullptr, nullptr); in NativePointer()
775 A *value1 = static_cast<A *>(object->GetNativePointerField(vm, cnt2)); in NativePointer()
776 A *value2 = static_cast<A *>(object->GetNativePointerField(vm, cnt3)); in NativePointer()
785 Local<NativePointerRef> native = NativePointerRef::New(vm, static_cast<void *>(a)); in NativePointer()
786 bool b = object->ConvertToNativeBindingObject(vm, native); in NativePointer()
790 void SetPrototype(Local<ObjectRef> object, EcmaVM *vm) in SetPrototype() argument
794 Local<NumberRef> obj = NumberRef::New(vm, cnt); in SetPrototype()
795 object->SetPrototype(vm, obj); in SetPrototype()
796 Local<JSValueRef> type = object->GetPrototype(vm); in SetPrototype()
800 GTEST_LOG_(INFO) << "Prototype: " << type->Typeof(vm)->ToString(vm); in SetPrototype()
835 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
836 LocalScope scope(vm); in HWTEST_F_L0()
838 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
856 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
857 LocalScope scope(vm); in HWTEST_F_L0()
863 GTEST_LOG_(INFO) << "func test arg " << i << " " << arg->Int32Value(vm); in HWTEST_F_L0()
868 int arg0 = jsArg0->Int32Value(vm); in HWTEST_F_L0()
869 int arg1 = jsArg1->Int32Value(vm); in HWTEST_F_L0()
873 return NumberRef::New(vm, sum); in HWTEST_F_L0()
888 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunc() local
889 LocalScope scope(vm); in AddFunc()
895 GTEST_LOG_(INFO) << "func test arg " << i << " " << arg->Int32Value(vm); in AddFunc()
900 int arg0 = jsArg0->Int32Value(vm); in AddFunc()
901 int arg1 = jsArg1->Int32Value(vm); in AddFunc()
904 return NumberRef::New(vm, sum); in AddFunc()
909 EcmaVM *vm = runtimeInfo->GetVM(); in AddProxyFunc() local
910 LocalScope scope(vm); in AddProxyFunc()
916 return NumberRef::New(vm, 0); in AddProxyFunc()
929 Local<JSValueRef> jsSum = addFunc->Call(vm, JSValueRef::Undefined(vm), argv, addFuncArgCount); in AddProxyFunc()
930 int sum = jsSum->Int32Value(vm); in AddProxyFunc()
934 return NumberRef::New(vm, sum); in AddProxyFunc()
1062 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1065 static void AddStaticVariable(EcmaVM *vm, Local<FunctionRef> &claFunc);
1067 static void AddStaticFunction(EcmaVM *vm, Local<FunctionRef> &claFunc);
1070 static void AddVariable(EcmaVM *vm, Local<ObjectRef> &proto);
1072 static void AddFunction(EcmaVM *vm, Local<ObjectRef> &proto);
1076 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1077 static Local<Greeter> New(EcmaVM *vm, Local<StringRef> greet);
1080 … static void SetPrivateGreeting(EcmaVM *vm, Local<Greeter> thisRef, Local<StringRef> priGreeting);
1081 static Local<StringRef> Greet(EcmaVM *vm, Local<Greeter> thisRef);
1084 static Local<StringRef> StandardGreeting(EcmaVM *vm);
1085 static Local<StringRef> StandardPosition(EcmaVM *vm);
1100 Local<FunctionRef> Greeter::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1103 …Greeter::standardGreetingStrKey = SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "standardGreetingS… in NewClassFunction()
1104 Greeter::privateGreetingKey = SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "privateGreeting")); in NewClassFunction()
1108 vm, in NewClassFunction()
1111 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1112 LocalScope scope(vm); in NewClassFunction()
1115 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1119 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "greeting"), greet); in NewClassFunction()
1130 AddStaticVariable(vm, claFunc); in NewClassFunction()
1132 AddStaticFunction(vm, claFunc); in NewClassFunction()
1133 Local<JSValueRef> jsProto = claFunc->GetFunctionPrototype(vm); in NewClassFunction()
1134 Local<ObjectRef> proto = jsProto->ToObject(vm); in NewClassFunction()
1137 AddVariable(vm, proto); in NewClassFunction()
1139 AddFunction(vm, proto); in NewClassFunction()
1141 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, Greeter::CLASS_NAME.c_str())); in NewClassFunction()
1145 Local<FunctionRef> Greeter::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1147 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1148 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, Greeter::CLASS_NAME.c_… in GetClassFunction()
1149 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1152 Local<FunctionRef> claFunc = Greeter::NewClassFunction(vm); in GetClassFunction()
1154 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1159 void Greeter::AddStaticVariable(EcmaVM *vm, Local<FunctionRef> &claFunc) in AddStaticVariable() argument
1163 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "position"), StringRef::NewFromUtf8(vm, "door")); in AddStaticVariable()
1166 claFunc->Set(vm, Greeter::standardGreetingStrKey, StringRef::NewFromUtf8(vm, "Hello, there")); in AddStaticVariable()
1170 void Greeter::AddStaticFunction(EcmaVM *vm, Local<FunctionRef> &claFunc) in AddStaticFunction() argument
1173 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "StandardGreeting"), in AddStaticFunction()
1174 FunctionRef::New(vm, in AddStaticFunction()
1177 EcmaVM *vm = runtimeInfo->GetVM(); in AddStaticFunction() local
1178 LocalScope scope(vm); in AddStaticFunction()
1179 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddStaticFunction()
1180 … Local<JSValueRef> jsStandardGreetingStr = claFunc->Get(vm, Greeter::standardGreetingStrKey); in AddStaticFunction()
1184 claFunc->Set(vm, StringRef::NewFromUtf8(vm, "StandardPosition"), in AddStaticFunction()
1185 FunctionRef::New(vm, in AddStaticFunction()
1188 EcmaVM *vm = runtimeInfo->GetVM(); in AddStaticFunction() local
1189 LocalScope scope(vm); in AddStaticFunction()
1190 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddStaticFunction()
1191 Local<JSValueRef> jsPosition = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "position")); in AddStaticFunction()
1197 void Greeter::AddVariable(EcmaVM *vm, Local<ObjectRef> &proto) in AddVariable() argument
1200 proto->Set(vm, Greeter::privateGreetingKey, JSValueRef::Undefined(vm)); in AddVariable()
1202 proto->Set(vm, StringRef::NewFromUtf8(vm, "greeting"), JSValueRef::Undefined(vm)); in AddVariable()
1206 void Greeter::AddFunction(EcmaVM *vm, Local<ObjectRef> &proto) in AddFunction() argument
1209 proto->Set(vm, StringRef::NewFromUtf8(vm, "SetPrivateGreeting"), in AddFunction()
1210 FunctionRef::New(vm, in AddFunction()
1213 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunction() local
1214 LocalScope scope(vm); in AddFunction()
1217 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in AddFunction()
1220 thisRef->Set(vm, Greeter::privateGreetingKey, priGreeting); in AddFunction()
1221 return JSValueRef::Undefined(vm); in AddFunction()
1224 proto->Set(vm, StringRef::NewFromUtf8(vm, "Greet"), in AddFunction()
1225 FunctionRef::New(vm, in AddFunction()
1228 EcmaVM *vm = runtimeInfo->GetVM(); in AddFunction() local
1229 LocalScope scope(vm); in AddFunction()
1231 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in AddFunction()
1234 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in AddFunction()
1235 Local<JSValueRef> jsPrivateGreeting = thisRef->Get(vm, Greeter::privateGreetingKey); in AddFunction()
1236 Local<JSValueRef> jsGreeting = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "greeting")); in AddFunction()
1237 … Local<JSValueRef> jsStandardGreetingStr = claFunc->Get(vm, Greeter::standardGreetingStrKey); in AddFunction()
1239 if (jsPrivateGreeting->IsString(vm)) { in AddFunction()
1240 ret.append("Hello, ").append(jsPrivateGreeting->ToString(vm)->ToString(vm)); in AddFunction()
1241 } else if (jsGreeting->IsString(vm)) { in AddFunction()
1242 ret.append("Hello, ").append(jsGreeting->ToString(vm)->ToString(vm)); in AddFunction()
1244 ret.append(jsStandardGreetingStr->ToString(vm)->ToString(vm)); in AddFunction()
1246 return StringRef::NewFromUtf8(vm, ret.c_str(), ret.size()); in AddFunction()
1250 Local<Greeter> Greeter::New(EcmaVM *vm, Local<StringRef> greet) in New() argument
1253 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in New()
1257 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1258 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1265 void Greeter::SetPrivateGreeting(EcmaVM *vm, Local<Greeter> thisRef, Local<StringRef> priGreeting) in SetPrivateGreeting() argument
1268 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "SetPrivateGreeting")); in SetPrivateGreeting()
1270 func->Call(vm, objRef, argv, 1); in SetPrivateGreeting()
1276 Local<StringRef> Greeter::Greet(EcmaVM *vm, Local<Greeter> thisRef) in Greet() argument
1279 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "Greet")); in Greet()
1280 return func->Call(vm, objRef, nullptr, 0); in Greet()
1286 Local<StringRef> Greeter::StandardGreeting(EcmaVM *vm) in StandardGreeting() argument
1289 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in StandardGreeting()
1291 Local<FunctionRef> func = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "StandardGreeting")); in StandardGreeting()
1293 return func->Call(vm, JSValueRef::Undefined(vm), nullptr, 0); in StandardGreeting()
1299 Local<StringRef> Greeter::StandardPosition(EcmaVM *vm) in StandardPosition() argument
1302 Local<FunctionRef> claFunc = Greeter::GetClassFunction(vm); in StandardPosition()
1304 Local<FunctionRef> func = claFunc->Get(vm, StringRef::NewFromUtf8(vm, "StandardPosition")); in StandardPosition()
1306 return func->Call(vm, JSValueRef::Undefined(vm), nullptr, 0); in StandardPosition()
1420 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1424 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1425 static Local<Derive> New(EcmaVM *vm, Local<NumberRef> num);
1427 static Local<NumberRef> Compute(EcmaVM *vm, Local<Derive> thisRef);
1435 Local<FunctionRef> Derive::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1438 vm, in NewClassFunction()
1441 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1442 LocalScope scope(vm); in NewClassFunction()
1445 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1449 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1453 Local<JSValueRef> jsProto = claFunc->GetFunctionPrototype(vm); in NewClassFunction()
1454 Local<ObjectRef> proto = jsProto->ToObject(vm); in NewClassFunction()
1456 proto->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), NumberRef::New(vm, 1)); in NewClassFunction()
1458 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1459 FunctionRef::New(vm, in NewClassFunction()
1462 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1463 LocalScope scope(vm); in NewClassFunction()
1467 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1469 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1470 int num = jsNum->Int32Value(vm); in NewClassFunction()
1471 return NumberRef::New(vm, num); in NewClassFunction()
1474 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, Derive::CLASS_NAME.c_str())); in NewClassFunction()
1478 Local<FunctionRef> Derive::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1480 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1481 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, Derive::CLASS_NAME.c_s… in GetClassFunction()
1482 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1485 Local<FunctionRef> claFunc = Derive::NewClassFunction(vm); in GetClassFunction()
1487 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1491 Local<Derive> Derive::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1494 Local<FunctionRef> claFunc = Derive::GetClassFunction(vm); in New()
1498 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1499 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1503 Local<NumberRef> Derive::Compute(EcmaVM *vm, Local<Derive> thisRef) in Compute() argument
1506 Local<FunctionRef> func = objRef->Get(vm, StringRef::NewFromUtf8(vm, "Compute")); in Compute()
1507 return func->Call(vm, objRef, nullptr, 0); in Compute()
1524 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1528 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1529 static Local<DeriveDouble> New(EcmaVM *vm, Local<NumberRef> num);
1539 Local<FunctionRef> DeriveDouble::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1542 vm, in NewClassFunction()
1545 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1546 LocalScope scope(vm); in NewClassFunction()
1551 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1553 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1558 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, DeriveDouble::CLASS_NAME.c_str())); in NewClassFunction()
1561 Local<ObjectRef> proto = claFunc->GetFunctionPrototype(vm)->ToObject(vm); in NewClassFunction()
1562 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1563 FunctionRef::New(vm, in NewClassFunction()
1566 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1567 LocalScope scope(vm); in NewClassFunction()
1570 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1571 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1572 int num = jsNum->Int32Value(vm); in NewClassFunction()
1575 return NumberRef::New(vm, num); in NewClassFunction()
1578 Local<FunctionRef> claFuncBase = Derive::GetClassFunction(vm); in NewClassFunction()
1580 claFunc->Inherit(vm, claFuncBase); in NewClassFunction()
1584 Local<FunctionRef> DeriveDouble::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1586 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1587 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, DeriveDouble::CLASS_NA… in GetClassFunction()
1588 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1591 Local<FunctionRef> claFunc = DeriveDouble::NewClassFunction(vm); in GetClassFunction()
1592 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1596 Local<DeriveDouble> DeriveDouble::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1599 Local<FunctionRef> claFunc = DeriveDouble::GetClassFunction(vm); in New()
1603 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1604 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
1622 static Local<FunctionRef> NewClassFunction(EcmaVM *vm);
1626 static Local<FunctionRef> GetClassFunction(EcmaVM *vm);
1627 static Local<DerivedTriple> New(EcmaVM *vm, Local<NumberRef> num);
1637 Local<FunctionRef> DerivedTriple::NewClassFunction(EcmaVM *vm) in NewClassFunction() argument
1640 vm, in NewClassFunction()
1643 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1644 LocalScope scope(vm); in NewClassFunction()
1649 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1651 thisRef->Set(vm, StringRef::NewFromUtf8(vm, "baseNum"), num); in NewClassFunction()
1656 claFunc->SetName(vm, StringRef::NewFromUtf8(vm, DerivedTriple::CLASS_NAME.c_str())); in NewClassFunction()
1659 Local<ObjectRef> proto = claFunc->GetFunctionPrototype(vm)->ToObject(vm); in NewClassFunction()
1660 proto->Set(vm, StringRef::NewFromUtf8(vm, "Compute"), in NewClassFunction()
1661 FunctionRef::New(vm, in NewClassFunction()
1664 EcmaVM *vm = runtimeInfo->GetVM(); in NewClassFunction() local
1665 LocalScope scope(vm); in NewClassFunction()
1668 Local<ObjectRef> thisRef = jsThisRef->ToObject(vm); in NewClassFunction()
1669 Local<JSValueRef> jsNum = thisRef->Get(vm, StringRef::NewFromUtf8(vm, "baseNum")); in NewClassFunction()
1670 int num = jsNum->Int32Value(vm); in NewClassFunction()
1673 return NumberRef::New(vm, num); in NewClassFunction()
1676 Local<FunctionRef> claFuncBase = Derive::GetClassFunction(vm); in NewClassFunction()
1678 claFunc->Inherit(vm, claFuncBase); in NewClassFunction()
1682 Local<FunctionRef> DerivedTriple::GetClassFunction(EcmaVM *vm) in GetClassFunction() argument
1684 Local<ObjectRef> globalObj = JSNApi::GetGlobalObject(vm); in GetClassFunction()
1685 …Local<JSValueRef> jsClaFunc = globalObj->Get(vm, StringRef::NewFromUtf8(vm, DerivedTriple::CLASS_N… in GetClassFunction()
1686 if (jsClaFunc->IsFunction(vm)) { in GetClassFunction()
1689 Local<FunctionRef> claFunc = DerivedTriple::NewClassFunction(vm); in GetClassFunction()
1690 globalObj->Set(vm, claFunc->GetName(vm), claFunc); in GetClassFunction()
1694 Local<DerivedTriple> DerivedTriple::New(EcmaVM *vm, Local<NumberRef> num) in New() argument
1697 Local<FunctionRef> claFunc = DerivedTriple::GetClassFunction(vm); in New()
1701 Local<JSValueRef> jsObj = claFunc->Constructor(vm, argv, 1); in New()
1702 Local<ObjectRef> obj = jsObj->ToObject(vm); in New()
2257 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2258 LocalScope scope(vm); in HWTEST_F_L0()
2260 int num = jsNum->Int32Value(vm); in HWTEST_F_L0()
2263 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2268 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2269 LocalScope scope(vm); in HWTEST_F_L0()
2271 std::string err = jsStr->ToString(vm)->ToString(vm); in HWTEST_F_L0()
2274 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2279 EcmaVM *vm = runtimeInfo->GetVM(); in HWTEST_F_L0() local
2280 LocalScope scope(vm); in HWTEST_F_L0()
2283 return JSValueRef::Undefined(vm); in HWTEST_F_L0()
2298 std::string jsValue2String(EcmaVM *vm, Local<JSValueRef> &jsVal) in jsValue2String() argument
2300 if (jsVal->IsString(vm)) { in jsValue2String()
2301 return "type string, val : " + jsVal->ToString(vm)->ToString(vm); in jsValue2String()
2303 return "type number, val : " + std::to_string(jsVal->Int32Value(vm)); in jsValue2String()
2305 return "type bool, val : " + std::to_string(jsVal->BooleaValue(vm)); in jsValue2String()
2306 } else if (jsVal->IsSymbol(vm)) { in jsValue2String()
2308 return "type symbol, val : " + symbol->GetDescription(vm)->ToString(vm); in jsValue2String()
2310 return "type other : " + jsVal->ToString(vm)->ToString(vm); in jsValue2String()
2314 void MapSetValue(EcmaVM *vm, Local<MapRef> &map, Local<JSValueRef> symbolKey) in MapSetValue() argument
2316 map->Set(vm, StringRef::NewFromUtf8(vm, "key1"), StringRef::NewFromUtf8(vm, "val1")); in MapSetValue()
2318 map->Set(vm, StringRef::NewFromUtf8(vm, "key2"), NumberRef::New(vm, num2)); in MapSetValue()
2319 map->Set(vm, StringRef::NewFromUtf8(vm, "key3"), BooleanRef::New(vm, true)); in MapSetValue()
2320 …map->Set(vm, StringRef::NewFromUtf8(vm, "key4"), SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "va… in MapSetValue()
2322 map->Set(vm, IntegerRef::New(vm, num5), StringRef::NewFromUtf8(vm, "val5")); in MapSetValue()
2325 map->Set(vm, IntegerRef::New(vm, num61), IntegerRef::New(vm, num62)); in MapSetValue()
2326 map->Set(vm, BooleanRef::New(vm, true), StringRef::NewFromUtf8(vm, "val7")); in MapSetValue()
2327 map->Set(vm, symbolKey, StringRef::NewFromUtf8(vm, "val8")); in MapSetValue()
2330 void MapGetValue(EcmaVM *vm, Local<MapRef> &map, Local<JSValueRef> symbolKey) in MapGetValue() argument
2332 Local<JSValueRef> val1 = map->Get(vm, StringRef::NewFromUtf8(vm, "key1")); in MapGetValue()
2333 bool val1IsString = val1->IsString(vm); in MapGetValue()
2334 …LOG_(INFO) << "key1 : IsString:" << val1IsString << " val:" << val1->ToString(vm)->ToString(vm); in MapGetValue()
2336 Local<JSValueRef> val2 = map->Get(vm, StringRef::NewFromUtf8(vm, "key2")); in MapGetValue()
2338 GTEST_LOG_(INFO) << "key2 : IsNumber:" << val2IsNumber << " val:" << val2->Int32Value(vm); in MapGetValue()
2340 Local<JSValueRef> val3 = map->Get(vm, StringRef::NewFromUtf8(vm, "key3")); in MapGetValue()
2342 GTEST_LOG_(INFO) << "key3 : IsBoolean:" << val3IsBoolean << " val:" << val3->BooleaValue(vm); in MapGetValue()
2344 Local<JSValueRef> val4 = map->Get(vm, StringRef::NewFromUtf8(vm, "key4")); in MapGetValue()
2345 bool val4IsSymbol = val4->IsSymbol(vm); in MapGetValue()
2348 << val4Symbol->GetDescription(vm)->ToString(vm); in MapGetValue()
2351 Local<JSValueRef> val5 = map->Get(vm, IntegerRef::New(vm, num5)); in MapGetValue()
2352 GTEST_LOG_(INFO) << "55 : " << val5->ToString(vm)->ToString(vm); in MapGetValue()
2355 Local<JSValueRef> val6 = map->Get(vm, IntegerRef::New(vm, num6)); in MapGetValue()
2356 GTEST_LOG_(INFO) << "66 : " << val6->Int32Value(vm); in MapGetValue()
2357 Local<JSValueRef> val7 = map->Get(vm, BooleanRef::New(vm, true)); in MapGetValue()
2358 GTEST_LOG_(INFO) << "true : " << val7->ToString(vm)->ToString(vm); in MapGetValue()
2360 Local<JSValueRef> val8 = map->Get(vm, symbolKey); in MapGetValue()
2361 GTEST_LOG_(INFO) << "SymbolRef(key8) : " << val8->ToString(vm)->ToString(vm); in MapGetValue()
2363 Local<JSValueRef> val82 = map->Get(vm, SymbolRef::New(vm, StringRef::NewFromUtf8(vm, "key8"))); in MapGetValue()
2366 int32_t size = map->GetSize(vm); in MapGetValue()
2368 int32_t totalElement = map->GetTotalElements(vm); in MapGetValue()
2372 Local<JSValueRef> jsKey = map->GetKey(vm, i); in MapGetValue()
2373 Local<JSValueRef> jsVal = map->GetValue(vm, i); in MapGetValue()
2374 …GTEST_LOG_(INFO) << "for map index : " << i << " key : " << jsValue2String(vm, jsKey) << " v… in MapGetValue()
2375 jsValue2String(vm, jsVal); in MapGetValue()
2379 void MapIteratorGetValue(EcmaVM *vm, Local<MapRef> &map) in MapIteratorGetValue() argument
2381 Local<MapIteratorRef> mapIter = MapIteratorRef::New(vm, map); in MapIteratorGetValue()
2382 ecmascript::EcmaRuntimeCallInfo *mapIterInfo = mapIter->GetEcmaRuntimeCallInfo(vm); in MapIteratorGetValue()
2384 Local<StringRef> kind = mapIter->GetKind(vm); in MapIteratorGetValue()
2385 GTEST_LOG_(INFO) << "Map Iterator kind : " << kind->ToString(vm); in MapIteratorGetValue()
2387 for (Local<ArrayRef> array = MapIteratorRef::Next(vm, mapIterInfo); array->IsArray(vm); in MapIteratorGetValue()
2388 array = MapIteratorRef::Next(vm, mapIterInfo)) { in MapIteratorGetValue()
2390 Local<JSValueRef> jsKey = ArrayRef::GetValueAt(vm, array, 0); in MapIteratorGetValue()
2391 Local<JSValueRef> jsVal = ArrayRef::GetValueAt(vm, array, 1); in MapIteratorGetValue()
2392 …_LOG_(INFO) << "for map iterator index : " << index << " key : " << jsValue2String(vm, jsKey) << in MapIteratorGetValue()
2393 " val : " << jsValue2String(vm, jsVal); in MapIteratorGetValue()
2521 void JsonObjGetValue(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetValue() argument
2523 Local<JSValueRef> jsVal1 = obj->Get(vm, StringRef::NewFromUtf8(vm, "str1")); in JsonObjGetValue()
2524 bool jsVal1IsString = jsVal1->IsString(vm); in JsonObjGetValue()
2525 Local<StringRef> val1 = jsVal1->ToString(vm); in JsonObjGetValue()
2526 … GTEST_LOG_(INFO) << "str1 : is string : " << jsVal1IsString << " value : " << val1->ToString(vm); in JsonObjGetValue()
2527 Local<JSValueRef> jsVal2 = obj->Get(vm, StringRef::NewFromUtf8(vm, "str2")); in JsonObjGetValue()
2529 int val2 = jsVal2->Int32Value(vm); in JsonObjGetValue()
2531 Local<JSValueRef> jsVal3 = obj->Get(vm, StringRef::NewFromUtf8(vm, "333")); in JsonObjGetValue()
2532 int val3 = jsVal3->Int32Value(vm); in JsonObjGetValue()
2534 Local<JSValueRef> jsVal4 = obj->Get(vm, StringRef::NewFromUtf8(vm, "444")); in JsonObjGetValue()
2535 Local<StringRef> val4 = jsVal4->ToString(vm); in JsonObjGetValue()
2536 GTEST_LOG_(INFO) << "str4 : " << val4->ToString(vm); in JsonObjGetValue()
2538 Local<JSValueRef> jsVal8 = obj->Get(vm, StringRef::NewFromUtf8(vm, "b8")); in JsonObjGetValue()
2546 void JsonObjGetArray(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetArray() argument
2548 Local<JSValueRef> jsVal5 = obj->Get(vm, StringRef::NewFromUtf8(vm, "arr5")); in JsonObjGetArray()
2550 int length = val5Obj->Get(vm, StringRef::NewFromUtf8(vm, "length"))->Int32Value(vm); in JsonObjGetArray()
2553 Local<JSValueRef> val5Item = val5Obj->Get(vm, NumberRef::New(vm, i)); in JsonObjGetArray()
2554 GTEST_LOG_(INFO) << "arr5 : " << i << " " << val5Item->Int32Value(vm); in JsonObjGetArray()
2557 uint32_t length2 = val5Arr->Length(vm); in JsonObjGetArray()
2560 Local<JSValueRef> val5Item = ArrayRef::GetValueAt(vm, val5Arr, i); in JsonObjGetArray()
2561 GTEST_LOG_(INFO) << "arr5 : " << i << " " << val5Item->Int32Value(vm); in JsonObjGetArray()
2563 Local<JSValueRef> jsVal6 = obj->Get(vm, StringRef::NewFromUtf8(vm, "arr6")); in JsonObjGetArray()
2565 int length3 = val6Obj->Get(vm, StringRef::NewFromUtf8(vm, "length"))->Int32Value(vm); in JsonObjGetArray()
2568 Local<JSValueRef> val6Item = val6Obj->Get(vm, NumberRef::New(vm, i)); in JsonObjGetArray()
2569 GTEST_LOG_(INFO) << "arr6 : " << i << " " << val6Item->ToString(vm)->ToString(vm); in JsonObjGetArray()
2574 void JsonObjGetObject(EcmaVM *vm, Local<ObjectRef> obj) in JsonObjGetObject() argument
2576 Local<JSValueRef> jsVal7 = obj->Get(vm, StringRef::NewFromUtf8(vm, "data7")); in JsonObjGetObject()
2577 Local<ObjectRef> val7Obj = jsVal7->ToObject(vm); in JsonObjGetObject()
2578 Local<ArrayRef> val7ObjKeys = val7Obj->GetOwnPropertyNames(vm); in JsonObjGetObject()
2579 for (uint32_t i = 0; i < val7ObjKeys->Length(vm); ++i) { in JsonObjGetObject()
2580 Local<JSValueRef> itemKey = ArrayRef::GetValueAt(vm, val7ObjKeys, i); in JsonObjGetObject()
2581 Local<JSValueRef> itemVal = val7Obj->Get(vm, itemKey); in JsonObjGetObject()
2582 …_LOG_(INFO) << "data7 : item index:" << i << " Key:" << itemKey->ToString(vm)->ToString(vm) << in JsonObjGetObject()
2583 " val:" << itemVal->ToString(vm)->ToString(vm); in JsonObjGetObject()
2937 Local<JSValueRef> ThrowErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowErrorFuncTest() argument
2939 int i = par->Int32Value(vm); in ThrowErrorFuncTest()
2942 Local<JSValueRef> error = Exception::Error(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowErrorFuncTest()
2943 JSNApi::ThrowException(vm, error); in ThrowErrorFuncTest()
2944 return JSValueRef::Undefined(vm); in ThrowErrorFuncTest()
2947 return NumberRef::New(vm, i * num); in ThrowErrorFuncTest()
2950 Local<JSValueRef> ThrowRangeErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowRangeErrorFuncTest() argument
2952 int i = par->Int32Value(vm); in ThrowRangeErrorFuncTest()
2955 … Local<JSValueRef> error = Exception::RangeError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowRangeErrorFuncTest()
2956 JSNApi::ThrowException(vm, error); in ThrowRangeErrorFuncTest()
2957 return JSValueRef::Undefined(vm); in ThrowRangeErrorFuncTest()
2960 return NumberRef::New(vm, i * num); in ThrowRangeErrorFuncTest()
2963 Local<JSValueRef> ThrowReferenceErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowReferenceErrorFuncTest() argument
2965 int i = par->Int32Value(vm); in ThrowReferenceErrorFuncTest()
2968 …Local<JSValueRef> error = Exception::ReferenceError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())… in ThrowReferenceErrorFuncTest()
2969 JSNApi::ThrowException(vm, error); in ThrowReferenceErrorFuncTest()
2970 return JSValueRef::Undefined(vm); in ThrowReferenceErrorFuncTest()
2973 return NumberRef::New(vm, i * num); in ThrowReferenceErrorFuncTest()
2976 Local<JSValueRef> ThrowSyntaxErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowSyntaxErrorFuncTest() argument
2978 int i = par->Int32Value(vm); in ThrowSyntaxErrorFuncTest()
2981 … Local<JSValueRef> error = Exception::SyntaxError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowSyntaxErrorFuncTest()
2982 JSNApi::ThrowException(vm, error); in ThrowSyntaxErrorFuncTest()
2983 return JSValueRef::Undefined(vm); in ThrowSyntaxErrorFuncTest()
2986 return NumberRef::New(vm, i * num); in ThrowSyntaxErrorFuncTest()
2989 Local<JSValueRef> ThrowTypeErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowTypeErrorFuncTest() argument
2991 int i = par->Int32Value(vm); in ThrowTypeErrorFuncTest()
2994 … Local<JSValueRef> error = Exception::TypeError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowTypeErrorFuncTest()
2995 JSNApi::ThrowException(vm, error); in ThrowTypeErrorFuncTest()
2996 return JSValueRef::Undefined(vm); in ThrowTypeErrorFuncTest()
2999 return NumberRef::New(vm, i * num); in ThrowTypeErrorFuncTest()
3002 Local<JSValueRef> ThrowAggregateErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowAggregateErrorFuncTest() argument
3004 int i = par->Int32Value(vm); in ThrowAggregateErrorFuncTest()
3007 …Local<JSValueRef> error = Exception::AggregateError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())… in ThrowAggregateErrorFuncTest()
3008 JSNApi::ThrowException(vm, error); in ThrowAggregateErrorFuncTest()
3009 return JSValueRef::Undefined(vm); in ThrowAggregateErrorFuncTest()
3012 return NumberRef::New(vm, i * num); in ThrowAggregateErrorFuncTest()
3015 Local<JSValueRef> ThrowEvalErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowEvalErrorFuncTest() argument
3017 int i = par->Int32Value(vm); in ThrowEvalErrorFuncTest()
3020 … Local<JSValueRef> error = Exception::EvalError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowEvalErrorFuncTest()
3021 JSNApi::ThrowException(vm, error); in ThrowEvalErrorFuncTest()
3022 return JSValueRef::Undefined(vm); in ThrowEvalErrorFuncTest()
3025 return NumberRef::New(vm, i * num); in ThrowEvalErrorFuncTest()
3028 Local<JSValueRef> ThrowOOMErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowOOMErrorFuncTest() argument
3030 int i = par->Int32Value(vm); in ThrowOOMErrorFuncTest()
3033 … Local<JSValueRef> error = Exception::OOMError(vm, StringRef::NewFromUtf8(vm, errStr.c_str())); in ThrowOOMErrorFuncTest()
3034 JSNApi::ThrowException(vm, error); in ThrowOOMErrorFuncTest()
3035 return JSValueRef::Undefined(vm); in ThrowOOMErrorFuncTest()
3038 return NumberRef::New(vm, i * num); in ThrowOOMErrorFuncTest()
3041 Local<JSValueRef> ThrowTerminationErrorFuncTest(const EcmaVM *vm, Local<NumberRef> par) in ThrowTerminationErrorFuncTest() argument
3043 int i = par->Int32Value(vm); in ThrowTerminationErrorFuncTest()
3046 …Local<JSValueRef> error = Exception::TerminationError(vm, StringRef::NewFromUtf8(vm, errStr.c_str(… in ThrowTerminationErrorFuncTest()
3047 JSNApi::ThrowException(vm, error); in ThrowTerminationErrorFuncTest()
3048 return JSValueRef::Undefined(vm); in ThrowTerminationErrorFuncTest()
3051 return NumberRef::New(vm, i * num); in ThrowTerminationErrorFuncTest()
3055 void ClearAndPrintException4JSNApi(const EcmaVM *vm, const std::string log) in ClearAndPrintException4JSNApi() argument
3057 if (!JSNApi::HasPendingException(vm)) { in ClearAndPrintException4JSNApi()
3062 JSNApi::PrintExceptionInfo(vm); in ClearAndPrintException4JSNApi()
3063 Local<ObjectRef> exception = JSNApi::GetAndClearUncaughtException(vm); in ClearAndPrintException4JSNApi()
3064 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4JSNApi()
3065 std::string exceptionMessage = exception->Get(vm, StringRef::NewFromUtf8(vm, in ClearAndPrintException4JSNApi()
3066 "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4JSNApi()
3067 std::string exceptionStack = exception->Get(vm, in ClearAndPrintException4JSNApi()
3068 StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)->ToString(vm); in ClearAndPrintException4JSNApi()
3076 void ClearAndPrintException4TryCatch1(const EcmaVM *vm, const std::string log) in ClearAndPrintException4TryCatch1() argument
3078 TryCatch tryCatch(vm); in ClearAndPrintException4TryCatch1()
3084 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4TryCatch1()
3085 std::string exceptionMessage = exception->Get(vm, in ClearAndPrintException4TryCatch1()
3086 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4TryCatch1()
3087 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in ClearAndPrintException4TryCatch1()
3095 void ClearAndPrintException4TryCatch2(const EcmaVM *vm, const std::string log) in ClearAndPrintException4TryCatch2() argument
3097 TryCatch tryCatch(vm); in ClearAndPrintException4TryCatch2()
3105 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in ClearAndPrintException4TryCatch2()
3106 std::string exceptionMessage = exception->Get(vm, in ClearAndPrintException4TryCatch2()
3107 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in ClearAndPrintException4TryCatch2()
3108 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in ClearAndPrintException4TryCatch2()
3117 void PrintAndRethrowException4TryCatch3(const EcmaVM *vm, const std::string log) in PrintAndRethrowException4TryCatch3() argument
3119 TryCatch tryCatch(vm); in PrintAndRethrowException4TryCatch3()
3126 …std::string exceptionName = exception->Get(vm, StringRef::NewFromUtf8(vm, "name"))->ToString(vm)->… in PrintAndRethrowException4TryCatch3()
3127 std::string exceptionMessage = exception->Get(vm, in PrintAndRethrowException4TryCatch3()
3128 StringRef::NewFromUtf8(vm, "message"))->ToString(vm)->ToString(vm); in PrintAndRethrowException4TryCatch3()
3129 …td::string exceptionStack = exception->Get(vm, StringRef::NewFromUtf8(vm, "stack"))->ToString(vm)-… in PrintAndRethrowException4TryCatch3()