mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
Copy hclass when SetIsPrototype
issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8WH57 Signed-off-by: dov1s <maojunwei1@huawei.com> Change-Id: I24cee9682c95d909ecfa56bfeb43320fb3324db9
This commit is contained in:
parent
e3eb979704
commit
dd9c248cb9
@ -375,7 +375,7 @@ void Builtins::Initialize(const JSHandle<GlobalEnv> &env, JSThread *thread, bool
|
||||
// Object = new Function()
|
||||
JSHandle<JSObject> objectFunction(
|
||||
NewBuiltinConstructor(env, objFuncPrototype, Object::ObjectConstructor, "Object", FunctionLength::ONE));
|
||||
objectFunction.GetObject<JSFunction>()->SetFunctionPrototype(thread_, objFuncClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, JSHandle<JSFunction>(objectFunction), objFuncClass.GetTaggedValue());
|
||||
// initialize object method.
|
||||
env->SetObjectFunction(thread_, objectFunction);
|
||||
env->SetObjectFunctionPrototype(thread_, objFuncPrototype);
|
||||
@ -615,7 +615,7 @@ void Builtins::InitializeFunction(const JSHandle<GlobalEnv> &env, const JSHandle
|
||||
auto funcFuncPrototypeObj = JSHandle<JSObject>(funcFuncPrototype);
|
||||
InitializeCtor(env, funcFuncPrototypeObj, funcFunc, "Function", FunctionLength::ONE);
|
||||
|
||||
funcFunc->SetFunctionPrototype(thread_, funcFuncIntanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, funcFunc, funcFuncIntanceHClass.GetTaggedValue());
|
||||
env->SetFunctionFunction(thread_, funcFunc);
|
||||
env->SetFunctionPrototype(thread_, funcFuncPrototype);
|
||||
|
||||
@ -685,7 +685,8 @@ void Builtins::InitializeSymbol(const JSHandle<GlobalEnv> &env, const JSHandle<J
|
||||
// Symbol = new Function()
|
||||
JSHandle<JSObject> symbolFunction(
|
||||
NewBuiltinConstructor(env, symbolFuncPrototype, Symbol::SymbolConstructor, "Symbol", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(symbolFunction)->SetFunctionPrototype(thread_, symbolFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(symbolFunction), symbolFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -806,7 +807,8 @@ void Builtins::InitializeSymbolWithRealm(const JSHandle<GlobalEnv> &realm,
|
||||
// Symbol = new Function()
|
||||
JSHandle<JSObject> symbolFunction(
|
||||
NewBuiltinConstructor(realm, symbolFuncPrototype, Symbol::SymbolConstructor, "Symbol", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(symbolFunction)->SetFunctionPrototype(thread_, symbolFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(symbolFunction), symbolFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = thread_->GlobalConstants()->GetHandledConstructorString();
|
||||
@ -875,7 +877,8 @@ void Builtins::InitializeNumber(const JSHandle<GlobalEnv> &env, const JSHandle<J
|
||||
JSHandle<JSObject> numFunction(
|
||||
NewBuiltinConstructor(env, numFuncPrototype, Number::NumberConstructor, "Number", FunctionLength::ONE,
|
||||
BUILTINS_STUB_ID(NumberConstructor)));
|
||||
numFunction.GetObject<JSFunction>()->SetFunctionPrototype(thread_, numFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(numFunction), numFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Number.prototype method
|
||||
for (const base::BuiltinFunctionEntry &entry: Number::GetNumberPrototypeFunctions()) {
|
||||
@ -925,7 +928,8 @@ void Builtins::InitializeBigInt(const JSHandle<GlobalEnv> &env, const JSHandle<J
|
||||
JSHandle<JSObject> bigIntFunction(
|
||||
NewBuiltinConstructor(env, bigIntFuncPrototype,
|
||||
BuiltinsBigInt::BigIntConstructor, "BigInt", FunctionLength::ONE));
|
||||
JSHandle<JSFunction>(bigIntFunction)->SetFunctionPrototype(thread_, bigIntFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(bigIntFunction), bigIntFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// BigInt.prototype method
|
||||
SetFunction(env, bigIntFuncPrototype, "toLocaleString", BuiltinsBigInt::ToLocaleString, FunctionLength::ZERO);
|
||||
@ -958,7 +962,8 @@ void Builtins::InitializeDate(const JSHandle<GlobalEnv> &env, JSHandle<JSTaggedV
|
||||
JSHandle<JSObject> dateFunction(
|
||||
NewBuiltinConstructor(env, dateFuncPrototype, Date::DateConstructor, "Date", FunctionLength::ONE,
|
||||
BUILTINS_STUB_ID(DateConstructor)));
|
||||
JSHandle<JSFunction>(dateFunction)->SetFunctionPrototype(thread_, dateFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(dateFunction), dateFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Date.prototype method
|
||||
for (const base::BuiltinFunctionEntry &entry: Date::GetDatePrototypeFunctions()) {
|
||||
@ -1010,7 +1015,7 @@ void Builtins::InitializeBoolean(const JSHandle<GlobalEnv> &env, const JSHandle<
|
||||
// new Boolean Function()
|
||||
JSHandle<JSFunction> booleanFunction = NewBuiltinConstructor(env, booleanFuncPrototype, Boolean::BooleanConstructor,
|
||||
"Boolean", FunctionLength::ONE, BUILTINS_STUB_ID(BooleanConstructor));
|
||||
booleanFunction->SetFunctionPrototype(thread_, booleanFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, booleanFunction, booleanFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Boolean.prototype method
|
||||
SetFunction(env, booleanFuncPrototype, thread_->GlobalConstants()->GetHandledToStringString(),
|
||||
@ -1086,7 +1091,7 @@ void Builtins::InitializeAllTypeError(const JSHandle<GlobalEnv> &env, const JSHa
|
||||
// Error() = new Function()
|
||||
JSHandle<JSFunction> errorFunction(
|
||||
NewBuiltinConstructor(env, errorFuncPrototype, Error::ErrorConstructor, "Error", FunctionLength::ONE));
|
||||
errorFunction->SetFunctionPrototype(thread_, errorFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, errorFunction, errorFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Error.prototype method
|
||||
SetFunction(env, errorFuncPrototype, thread_->GlobalConstants()->GetHandledToStringString(), Error::ToString,
|
||||
@ -1266,7 +1271,7 @@ void Builtins::InitializeError(const JSHandle<GlobalEnv> &env, const JSHandle<JS
|
||||
InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.nativePropertyName,
|
||||
functionLength);
|
||||
|
||||
nativeErrorFunction->SetFunctionPrototype(thread_, nativeErrorFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, nativeErrorFunction, nativeErrorFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// NativeError.prototype method
|
||||
SetFunction(env, nativeErrorFuncPrototype, thread_->GlobalConstants()->GetHandledToStringString(),
|
||||
@ -1315,7 +1320,7 @@ void Builtins::InitializeCtor(const JSHandle<GlobalEnv> &env, const JSHandle<JSO
|
||||
JSObject::DefineOwnProperty(thread_, prototype, constructorKey, descriptor1);
|
||||
|
||||
/* set "prototype" in constructor */
|
||||
ctor->SetFunctionPrototype(thread_, prototype.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, ctor, prototype.GetTaggedValue());
|
||||
|
||||
if (!JSTaggedValue::SameValue(nameString, thread_->GlobalConstants()->GetHandledAsyncFunctionString())) {
|
||||
JSHandle<JSObject> globalObject(thread_, env->GetGlobalObject());
|
||||
@ -1339,7 +1344,8 @@ void Builtins::InitializeSet(const JSHandle<GlobalEnv> &env, JSHandle<JSTaggedVa
|
||||
// Set() = new Function()
|
||||
JSHandle<JSTaggedValue> setFunction(
|
||||
NewBuiltinConstructor(env, setFuncPrototype, BuiltinsSet::SetConstructor, "Set", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(setFunction)->SetFunctionPrototype(thread_, setFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(setFunction), setFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -1413,8 +1419,8 @@ void Builtins::InitializeMap(const JSHandle<GlobalEnv> &env, JSHandle<JSTaggedVa
|
||||
JSHandle<JSTaggedValue> mapFunction(
|
||||
NewBuiltinConstructor(env, mapFuncPrototype, BuiltinsMap::MapConstructor, "Map", FunctionLength::ZERO));
|
||||
// Map().prototype = Map.Prototype & Map.prototype.constructor = Map()
|
||||
JSFunction::Cast(mapFunction->GetTaggedObject())
|
||||
->SetFunctionPrototype(thread_, mapFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(mapFunction), mapFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -1723,7 +1729,8 @@ void Builtins::InitializeString(const JSHandle<GlobalEnv> &env, JSHandle<JSTagge
|
||||
// String = new Function()
|
||||
JSHandle<JSObject> stringFunction(NewBuiltinConstructor(env, stringFuncPrototype, BuiltinsString::StringConstructor,
|
||||
"String", FunctionLength::ONE));
|
||||
stringFunction.GetObject<JSFunction>()->SetFunctionPrototype(thread_, stringFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(stringFunction), stringFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// String.prototype method
|
||||
for (const base::BuiltinFunctionEntry &entry: BuiltinsString::GetStringPrototypeFunctions()) {
|
||||
@ -1764,7 +1771,7 @@ void Builtins::InitializeStringIterator(const JSHandle<GlobalEnv> &env,
|
||||
|
||||
JSHandle<JSFunction> strIterFunction(
|
||||
factory_->NewJSFunction(env, static_cast<void *>(nullptr), FunctionKind::BASE_CONSTRUCTOR));
|
||||
strIterFunction->SetFunctionPrototype(thread_, strIterFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, strIterFunction, strIterFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
SetFunction(env, strIterPrototype, "next", StringIterator::Next, FunctionLength::ZERO,
|
||||
BUILTINS_STUB_ID(STRING_ITERATOR_PROTO_NEXT));
|
||||
@ -1788,7 +1795,7 @@ void Builtins::InitializeAsyncFromSyncIterator(const JSHandle<GlobalEnv> &env,
|
||||
JSHandle<JSTaggedValue>(asyncItPrototype));
|
||||
JSHandle<JSFunction> iterFunction(
|
||||
factory_->NewJSFunction(env, static_cast<void *>(nullptr), FunctionKind::BASE_CONSTRUCTOR));
|
||||
iterFunction->SetFunctionPrototype(thread_, hclass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, iterFunction, hclass.GetTaggedValue());
|
||||
env->SetAsyncFromSyncIterator(thread_, iterFunction);
|
||||
env->SetAsyncFromSyncIteratorPrototype(thread_, asyncItPrototype);
|
||||
|
||||
@ -1956,7 +1963,8 @@ void Builtins::InitializeRegExp(const JSHandle<GlobalEnv> &env)
|
||||
// initialize RegExp.$1 .. $9 static and read-only attributes
|
||||
InitializeGlobalRegExp(regexpFunction);
|
||||
|
||||
JSHandle<JSFunction>(regexpFunction)->SetFunctionPrototype(thread_, regexpFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(regexpFunction), regexpFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
const GlobalEnvConstants *globalConstants = thread_->GlobalConstants();
|
||||
// RegExp.prototype method
|
||||
@ -2084,7 +2092,7 @@ void Builtins::InitializeArray(const JSHandle<GlobalEnv> &env, const JSHandle<JS
|
||||
lexicalEnv->SetParentEnv(thread_, env.GetTaggedValue());
|
||||
arrayFuncFunction->SetLexicalEnv(thread_, lexicalEnv.GetTaggedValue());
|
||||
|
||||
arrayFuncFunction->SetFunctionPrototype(thread_, arrFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, arrayFuncFunction, arrFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Array.prototype methods (excluding constructor and '@@' internal properties)
|
||||
for (const base::BuiltinFunctionEntry &entry: BuiltinsArray::GetArrayPrototypeFunctions()) {
|
||||
@ -2303,8 +2311,8 @@ void Builtins::InitializeArrayBuffer(const JSHandle<GlobalEnv> &env, const JSHan
|
||||
JSHandle<JSObject> arrayBufferFunction(NewBuiltinConstructor(
|
||||
env, arrayBufferFuncPrototype, ArrayBuffer::ArrayBufferConstructor, "ArrayBuffer", FunctionLength::ONE));
|
||||
|
||||
JSHandle<JSFunction>(arrayBufferFunction)
|
||||
->SetFunctionPrototype(thread_, arrayBufferFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(arrayBufferFunction), arrayBufferFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// ArrayBuffer prototype method
|
||||
SetFunction(env, arrayBufferFuncPrototype, "slice", ArrayBuffer::Slice, FunctionLength::TWO);
|
||||
@ -2383,8 +2391,8 @@ void Builtins::InitializeSharedArrayBuffer(const JSHandle<GlobalEnv> &env,
|
||||
JSHandle<JSObject> SharedArrayBufferFunction(NewBuiltinConstructor(env, sharedArrayBufferFuncPrototype,
|
||||
SharedArrayBuffer::SharedArrayBufferConstructor, "SharedArrayBuffer", FunctionLength::ONE));
|
||||
|
||||
JSHandle<JSFunction>(SharedArrayBufferFunction)
|
||||
->SetFunctionPrototype(thread_, sharedArrayBufferFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(SharedArrayBufferFunction), sharedArrayBufferFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// SharedArrayBuffer prototype method
|
||||
SetFunction(env, sharedArrayBufferFuncPrototype, "slice", SharedArrayBuffer::Slice, FunctionLength::TWO);
|
||||
@ -2434,7 +2442,8 @@ void Builtins::InitializePromise(const JSHandle<GlobalEnv> &env, const JSHandle<
|
||||
// Promise() = new Function()
|
||||
JSHandle<JSObject> promiseFunction(
|
||||
NewBuiltinConstructor(env, promiseFuncPrototype, Promise::PromiseConstructor, "Promise", FunctionLength::ONE));
|
||||
JSHandle<JSFunction>(promiseFunction)->SetFunctionPrototype(thread_, promiseFuncInstanceHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(promiseFunction), promiseFuncInstanceHClass.GetTaggedValue());
|
||||
|
||||
// Promise method
|
||||
for (const base::BuiltinFunctionEntry &entry: Promise::GetPromiseFunctions()) {
|
||||
@ -3096,7 +3105,7 @@ void Builtins::InitializeIntlCtor(const JSHandle<GlobalEnv> &env, const JSHandle
|
||||
JSObject::DefineOwnProperty(thread_, prototype, constructorKey, descriptor1);
|
||||
|
||||
// set "prototype" in constructor.
|
||||
ctor->SetFunctionPrototype(thread_, prototype.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, ctor, prototype.GetTaggedValue());
|
||||
|
||||
if (!JSTaggedValue::SameValue(nameString, thread_->GlobalConstants()->GetHandledAsyncFunctionString())) {
|
||||
JSHandle<JSObject> intlObject(thread_, env->GetIntlFunction().GetTaggedValue());
|
||||
@ -3143,7 +3152,8 @@ void Builtins::InitializeDateTimeFormat(const JSHandle<GlobalEnv> &env)
|
||||
// 13.4.1 Intl.DateTimeFormat.prototype.constructor
|
||||
JSHandle<JSObject> dtfFunction(NewIntlConstructor(env, dtfPrototype, DateTimeFormat::DateTimeFormatConstructor,
|
||||
"DateTimeFormat", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(dtfFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*dtfFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(dtfFunction), JSTaggedValue(*dtfFuncInstanceHClass));
|
||||
|
||||
// 13.3.2 Intl.DateTimeFormat.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, dtfFunction, "supportedLocalesOf", DateTimeFormat::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3186,7 +3196,8 @@ void Builtins::InitializeRelativeTimeFormat(const JSHandle<GlobalEnv> &env)
|
||||
JSHandle<JSObject> rtfFunction(NewIntlConstructor(env, rtfPrototype,
|
||||
RelativeTimeFormat::RelativeTimeFormatConstructor,
|
||||
"RelativeTimeFormat", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(rtfFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*rtfFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(rtfFunction), JSTaggedValue(*rtfFuncInstanceHClass));
|
||||
|
||||
// 14.3.2 Intl.RelativeTimeFormat.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, rtfFunction, "supportedLocalesOf", RelativeTimeFormat::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3222,7 +3233,8 @@ void Builtins::InitializeNumberFormat(const JSHandle<GlobalEnv> &env)
|
||||
// 12.4.1 Intl.NumberFormat.prototype.constructor
|
||||
JSHandle<JSObject> nfFunction(NewIntlConstructor(env, nfPrototype, NumberFormat::NumberFormatConstructor,
|
||||
"NumberFormat", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(nfFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*nfFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(nfFunction), JSTaggedValue(*nfFuncInstanceHClass));
|
||||
|
||||
// 12.3.2 Intl.NumberFormat.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, nfFunction, "supportedLocalesOf", NumberFormat::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3259,7 +3271,8 @@ void Builtins::InitializeLocale(const JSHandle<GlobalEnv> &env)
|
||||
// Locale = new Function()
|
||||
JSHandle<JSObject> localeFunction(
|
||||
NewIntlConstructor(env, localePrototype, Locale::LocaleConstructor, "Locale", FunctionLength::ONE));
|
||||
JSHandle<JSFunction>(localeFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*localeFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(localeFunction), JSTaggedValue(*localeFuncInstanceHClass));
|
||||
|
||||
// Locale.prototype method
|
||||
SetFunction(env, localePrototype, "maximize", Locale::Maximize, FunctionLength::ZERO);
|
||||
@ -3321,7 +3334,8 @@ void Builtins::InitializeCollator(const JSHandle<GlobalEnv> &env)
|
||||
// 11.1.2 Intl.Collator.prototype.constructor
|
||||
JSHandle<JSObject> collatorFunction(
|
||||
NewIntlConstructor(env, collatorPrototype, Collator::CollatorConstructor, "Collator", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(collatorFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*collatorFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(collatorFunction), JSTaggedValue(*collatorFuncInstanceHClass));
|
||||
|
||||
// 11.2.2 Intl.Collator.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, collatorFunction, "supportedLocalesOf", Collator::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3356,7 +3370,8 @@ void Builtins::InitializePluralRules(const JSHandle<GlobalEnv> &env)
|
||||
// 15.2.1 Intl.PluralRules.prototype.constructor
|
||||
JSHandle<JSObject> prFunction(
|
||||
NewIntlConstructor(env, prPrototype, PluralRules::PluralRulesConstructor, "PluralRules", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(prFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*prFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(prFunction), JSTaggedValue(*prFuncInstanceHClass));
|
||||
|
||||
// 15.3.2 Intl.PluralRules.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, prFunction, "supportedLocalesOf", PluralRules::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3389,7 +3404,8 @@ void Builtins::InitializeDisplayNames(const JSHandle<GlobalEnv> &env)
|
||||
// 12.4.1 Intl.DisplayNames.prototype.constructor
|
||||
JSHandle<JSObject> dnFunction(NewIntlConstructor(env, dnPrototype, DisplayNames::DisplayNamesConstructor,
|
||||
"DisplayNames", FunctionLength::TWO));
|
||||
JSHandle<JSFunction>(dnFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*dnFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(dnFunction), JSTaggedValue(*dnFuncInstanceHClass));
|
||||
|
||||
// 12.3.2 Intl.DisplayNames.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, dnFunction, "supportedLocalesOf", DisplayNames::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3422,7 +3438,8 @@ void Builtins::InitializeListFormat(const JSHandle<GlobalEnv> &env)
|
||||
// 13.4.1 Intl.ListFormat.prototype.constructor
|
||||
JSHandle<JSObject> lfFunction(NewIntlConstructor(env, lfPrototype, ListFormat::ListFormatConstructor,
|
||||
"ListFormat", FunctionLength::ZERO));
|
||||
JSHandle<JSFunction>(lfFunction)->SetFunctionPrototype(thread_, JSTaggedValue(*lfFuncInstanceHClass));
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(lfFunction), JSTaggedValue(*lfFuncInstanceHClass));
|
||||
|
||||
// 13.3.2 Intl.ListFormat.supportedLocalesOf ( locales [ , options ] )
|
||||
SetFunction(env, lfFunction, "supportedLocalesOf", ListFormat::SupportedLocalesOf, FunctionLength::ONE);
|
||||
@ -3571,7 +3588,8 @@ void Builtins::InitializeCjsModule(const JSHandle<GlobalEnv> &env) const
|
||||
NewBuiltinCjsCtor(env, cjsModulePrototype, BuiltinsCjsModule::CjsModuleConstructor, "Module",
|
||||
FunctionLength::TWO));
|
||||
|
||||
JSHandle<JSFunction>(cjsModuleFunction)->SetFunctionPrototype(thread_, cjsModuleHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(cjsModuleFunction), cjsModuleHClass.GetTaggedValue());
|
||||
|
||||
// CjsModule method
|
||||
SetFunction(env, cjsModuleFunction, "_load", BuiltinsCjsModule::Load, FunctionLength::ONE);
|
||||
@ -3626,7 +3644,8 @@ void Builtins::InitializeCjsExports(const JSHandle<GlobalEnv> &env) const
|
||||
NewBuiltinCjsCtor(env, cjsExportsPrototype, BuiltinsCjsExports::CjsExportsConstructor, "Exports",
|
||||
FunctionLength::TWO));
|
||||
|
||||
JSHandle<JSFunction>(cjsExportsFunction)->SetFunctionPrototype(thread_, cjsExportsHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(cjsExportsFunction), cjsExportsHClass.GetTaggedValue());
|
||||
|
||||
env->SetCjsExportsFunction(thread_, cjsExportsFunction);
|
||||
}
|
||||
@ -3647,7 +3666,8 @@ void Builtins::InitializeCjsRequire(const JSHandle<GlobalEnv> &env) const
|
||||
JSHandle<JSFunction> cjsRequireFunction =
|
||||
NewBuiltinCjsCtor(env, cjsRequirePrototype, BuiltinsCjsRequire::CjsRequireConstructor, "require",
|
||||
FunctionLength::ONE);
|
||||
JSHandle<JSFunction>(cjsRequireFunction)->SetFunctionPrototype(thread_, cjsRequireHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_,
|
||||
JSHandle<JSFunction>(cjsRequireFunction), cjsRequireHClass.GetTaggedValue());
|
||||
|
||||
// CjsModule.prototype method
|
||||
SetFunction(env, cjsRequirePrototype, "Main", BuiltinsCjsRequire::Main, FunctionLength::ONE);
|
||||
@ -3706,7 +3726,7 @@ void Builtins::InitializeSCtor(const JSHandle<JSHClass> &protoHClass, const JSHa
|
||||
JSHandle<JSObject> prototype(thread_, protoHClass->GetProto());
|
||||
JSObject::DefineOwnProperty(thread_, prototype, constructorKey, descriptor, SCheckMode::SKIP);
|
||||
|
||||
ctor->SetFunctionPrototype(thread_, protoHClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread_, ctor, protoHClass.GetTaggedValue());
|
||||
}
|
||||
|
||||
JSHandle<JSFunction> Builtins::NewSFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSTaggedValue> &key,
|
||||
|
@ -184,7 +184,7 @@ JSHandle<JSFunction> ContainersPrivate::NewContainerConstructor(JSThread *thread
|
||||
JSObject::DefineOwnProperty(thread, prototype, constructorKey, descriptor1);
|
||||
|
||||
/* set "prototype" in constructor */
|
||||
ctor->SetFunctionPrototype(thread, prototype.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread, ctor, prototype.GetTaggedValue());
|
||||
|
||||
return ctor;
|
||||
}
|
||||
@ -283,8 +283,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeArrayList(JSThread *thread)
|
||||
// ArrayList() = new Function()
|
||||
JSHandle<JSTaggedValue> arrayListFunction(NewContainerConstructor(
|
||||
thread, prototype, ContainersArrayList::ArrayListConstructor, "ArrayList", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(arrayListFunction)->SetFunctionPrototype(thread,
|
||||
arrayListInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(arrayListFunction), arrayListInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -357,8 +357,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLightWeightMap(JSThread *th
|
||||
JSHandle<JSTaggedValue> lightWeightMapFunction(NewContainerConstructor(
|
||||
thread, funcPrototype, ContainersLightWeightMap::LightWeightMapConstructor, "LightWeightMap",
|
||||
FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(lightWeightMapFunction)->
|
||||
SetFunctionPrototype(thread, lightWeightMapInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(lightWeightMapFunction), lightWeightMapInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -431,8 +431,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLightWeightSet(JSThread *th
|
||||
JSHandle<JSTaggedValue> lightweightSetFunction(
|
||||
NewContainerConstructor(thread, funcPrototype, ContainersLightWeightSet::LightWeightSetConstructor,
|
||||
"LightWeightSet", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(lightweightSetFunction)->SetFunctionPrototype(thread, lightweightSetInstanceClass.
|
||||
GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(lightweightSetFunction), lightweightSetInstanceClass.GetTaggedValue());
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(funcPrototype), constructorKey, lightweightSetFunction);
|
||||
@ -496,7 +496,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeTreeMap(JSThread *thread)
|
||||
// TreeMap() = new Function()
|
||||
JSHandle<JSTaggedValue> mapFunction(NewContainerConstructor(
|
||||
thread, mapFuncPrototype, ContainersTreeMap::TreeMapConstructor, "TreeMap", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(mapFunction)->SetFunctionPrototype(thread, mapInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(mapFunction), mapInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -572,7 +573,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeTreeSet(JSThread *thread)
|
||||
// TreeSet() = new Function()
|
||||
JSHandle<JSTaggedValue> setFunction(NewContainerConstructor(
|
||||
thread, setFuncPrototype, ContainersTreeSet::TreeSetConstructor, "TreeSet", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(setFunction)->SetFunctionPrototype(thread, setInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(setFunction), setInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -645,8 +647,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializePlainArray(JSThread *thread
|
||||
JSHandle<JSTaggedValue> plainArrayFunction(
|
||||
NewContainerConstructor(thread, plainArrayFuncPrototype, ContainersPlainArray::PlainArrayConstructor,
|
||||
"PlainArray", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(plainArrayFunction)->SetFunctionPrototype(thread,
|
||||
plainArrayInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(plainArrayFunction), plainArrayInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -719,7 +721,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeStack(JSThread *thread)
|
||||
// Stack() = new Function()
|
||||
JSHandle<JSTaggedValue> stackFunction(NewContainerConstructor(
|
||||
thread, stackFuncPrototype, ContainersStack::StackConstructor, "Stack", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(stackFunction)->SetFunctionPrototype(thread, stackInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(stackFunction), stackInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -777,7 +780,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeVector(JSThread *thread)
|
||||
// Vector() = new Function()
|
||||
JSHandle<JSTaggedValue> vectorFunction(NewContainerConstructor(
|
||||
thread, prototype, ContainersVector::VectorConstructor, "Vector", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(vectorFunction)->SetFunctionPrototype(thread, vectorInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(vectorFunction), vectorInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -858,7 +862,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeQueue(JSThread *thread)
|
||||
// Queue() = new Function()
|
||||
JSHandle<JSTaggedValue> queueFunction(NewContainerConstructor(
|
||||
thread, queueFuncPrototype, ContainersQueue::QueueConstructor, "Queue", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(queueFunction)->SetFunctionPrototype(thread, queueInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(queueFunction), queueInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -912,7 +917,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeDeque(JSThread *thread)
|
||||
// Deque() = new Function()
|
||||
JSHandle<JSTaggedValue> dequeFunction(NewContainerConstructor(
|
||||
thread, dequeFuncPrototype, ContainersDeque::DequeConstructor, "Deque", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(dequeFunction)->SetFunctionPrototype(thread, dequeInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(dequeFunction), dequeInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -965,7 +971,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeList(JSThread *thread)
|
||||
factory->NewEcmaHClass(JSAPIList::SIZE, JSType::JS_API_LIST, listFuncPrototypeValue);
|
||||
JSHandle<JSTaggedValue> listFunction(NewContainerConstructor(
|
||||
thread, listFuncPrototype, ContainersList::ListConstructor, "List", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(listFunction)->SetFunctionPrototype(thread, listInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(listFunction), listInstanceClass.GetTaggedValue());
|
||||
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(listFuncPrototype), constructorKey, listFunction);
|
||||
@ -1015,8 +1022,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeLinkedList(JSThread *thread
|
||||
factory->NewEcmaHClass(JSAPILinkedList::SIZE, JSType::JS_API_LINKED_LIST, linkedListFuncPrototypeValue);
|
||||
JSHandle<JSTaggedValue> linkedListFunction(NewContainerConstructor(
|
||||
thread, linkedListFuncPrototype, ContainersLinkedList::LinkedListConstructor, "LinkedList", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(linkedListFunction)->SetFunctionPrototype(thread,
|
||||
linkedListInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(linkedListFunction), linkedListInstanceClass.GetTaggedValue());
|
||||
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
JSObject::SetProperty(thread, JSHandle<JSTaggedValue>(linkedListFuncPrototype), constructorKey, linkedListFunction);
|
||||
@ -1101,7 +1108,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeHashMap(JSThread *thread)
|
||||
|
||||
JSHandle<JSTaggedValue> hashMapFunction(NewContainerConstructor(
|
||||
thread, hashMapFuncPrototype, ContainersHashMap::HashMapConstructor, "HashMap", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(hashMapFunction)->SetFunctionPrototype(thread, hashMapInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(hashMapFunction), hashMapInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -1183,7 +1191,8 @@ JSHandle<JSTaggedValue> ContainersPrivate::InitializeHashSet(JSThread *thread)
|
||||
|
||||
JSHandle<JSTaggedValue> hashSetFunction(NewContainerConstructor(
|
||||
thread, hashSetFuncPrototype, ContainersHashSet::HashSetConstructor, "HashSet", FuncLength::ZERO));
|
||||
JSHandle<JSFunction>::Cast(hashSetFunction)->SetFunctionPrototype(thread, hashSetInstanceClass.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread,
|
||||
JSHandle<JSFunction>::Cast(hashSetFunction), hashSetInstanceClass.GetTaggedValue());
|
||||
|
||||
// "constructor" property on the prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
|
@ -89,7 +89,7 @@ JSHandle<JSObject> JSFunction::NewJSFunctionPrototype(JSThread *thread, const JS
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
JSHandle<JSFunction> objFun(env->GetObjectFunction());
|
||||
JSHandle<JSObject> funPro = thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(objFun);
|
||||
func->SetFunctionPrototype(thread, funPro.GetTaggedValue());
|
||||
SetFunctionPrototype(thread, func, funPro.GetTaggedValue());
|
||||
|
||||
// set "constructor" in prototype
|
||||
JSHandle<JSTaggedValue> constructorKey = globalConst->GetHandledConstructorString();
|
||||
@ -153,7 +153,7 @@ bool JSFunction::PrototypeSetter(JSThread *thread, const JSHandle<JSObject> &sel
|
||||
}
|
||||
func->SetProtoOrHClass(thread, newClass);
|
||||
} else {
|
||||
func->SetFunctionPrototype(thread, value.GetTaggedValue());
|
||||
SetFunctionPrototype(thread, func, value.GetTaggedValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -342,7 +342,7 @@ bool JSFunction::MakeConstructor(JSThread *thread, const JSHandle<JSFunction> &f
|
||||
// func.prototype = proto
|
||||
// Let status be DefinePropertyOrThrow(F, "prototype", PropertyDescriptor{[[Value]]:
|
||||
// prototype, [[Writable]]: writablePrototype, [[Enumerable]]: false, [[Configurable]]: false}).
|
||||
func->SetFunctionPrototype(thread, proto.GetTaggedValue());
|
||||
SetFunctionPrototype(thread, func, proto.GetTaggedValue());
|
||||
|
||||
ASSERT_PRINT(status, "DefineProperty proto_type failed");
|
||||
return status;
|
||||
|
@ -136,14 +136,19 @@ public:
|
||||
return protoOrHClass;
|
||||
}
|
||||
|
||||
inline void SetFunctionPrototype(const JSThread *thread, JSTaggedValue proto)
|
||||
static void SetFunctionPrototype(const JSThread *thread, const JSHandle<JSFunction> &fun, JSTaggedValue proto)
|
||||
{
|
||||
SetProtoOrHClass(thread, proto);
|
||||
if (proto.IsJSHClass()) {
|
||||
proto = JSHClass::Cast(proto.GetTaggedObject())->GetPrototype();
|
||||
JSHandle<JSTaggedValue> protoHandle(thread, proto);
|
||||
fun->SetProtoOrHClass(thread, protoHandle.GetTaggedValue());
|
||||
if (protoHandle->IsJSHClass()) {
|
||||
protoHandle = JSHandle<JSTaggedValue>(thread,
|
||||
JSHClass::Cast(protoHandle->GetTaggedObject())->GetPrototype());
|
||||
}
|
||||
if (proto.IsECMAObject()) {
|
||||
proto.GetTaggedObject()->GetClass()->SetIsPrototype(true);
|
||||
if (protoHandle->IsECMAObject()) {
|
||||
auto hclass = JSHandle<JSHClass>(thread, protoHandle->GetTaggedObject()->GetClass());
|
||||
JSHandle<JSHClass> newJSHClass = JSHClass::Clone(thread, hclass);
|
||||
newJSHClass->SetIsPrototype(true);
|
||||
protoHandle->GetTaggedObject()->SynchronizedSetClass(*newJSHClass);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -818,7 +818,7 @@ JSTaggedValue RuntimeStubs::RuntimeCloneClassFromTemplate(JSThread *thread, cons
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
// After clone both, reset "constructor" and "prototype" properties.
|
||||
cloneClass->SetFunctionPrototype(thread, cloneClassPrototype.GetTaggedValue());
|
||||
JSFunction::SetFunctionPrototype(thread, cloneClass, cloneClassPrototype.GetTaggedValue());
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
|
||||
PropertyDescriptor ctorDesc(thread, JSHandle<JSTaggedValue>(cloneClass), true, false, true);
|
||||
|
@ -49,6 +49,7 @@ group("ark_js_moduletest") {
|
||||
"builtins",
|
||||
"callframe",
|
||||
"calltype",
|
||||
"changelistener",
|
||||
"class",
|
||||
"compareobjecthclass",
|
||||
"concurrent",
|
||||
@ -228,6 +229,7 @@ group("ark_asm_test") {
|
||||
"builtins",
|
||||
"callframe",
|
||||
"calltype",
|
||||
"changelistener",
|
||||
"class",
|
||||
"compareobjecthclass",
|
||||
"concurrent",
|
||||
@ -378,6 +380,7 @@ group("ark_asm_single_step_test") {
|
||||
"bitwiseop",
|
||||
"callframe",
|
||||
"calltype",
|
||||
"changelistener",
|
||||
"class",
|
||||
"compareobjecthclass",
|
||||
"concurrent",
|
||||
|
18
test/moduletest/changelistener/BUILD.gn
Normal file
18
test/moduletest/changelistener/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//arkcompiler/ets_runtime/test/test_helper.gni")
|
||||
|
||||
host_moduletest_action("changelistener") {
|
||||
deps = []
|
||||
}
|
38
test/moduletest/changelistener/changelistener.js
Normal file
38
test/moduletest/changelistener/changelistener.js
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @tc.name:changelistener
|
||||
* @tc.desc:test changelistener function
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
for (var a = 0; a < 100; a++) {
|
||||
}
|
||||
function f7(a8) {
|
||||
return a8;
|
||||
}
|
||||
class C9 extends f7{}
|
||||
|
||||
for (let v15 = 0; v15 < 5; v15++)
|
||||
{
|
||||
const o16 = {};
|
||||
const v18 = new Uint16Array();
|
||||
const t30 = v18.__proto__;
|
||||
print("222");
|
||||
t30.__proto__ = o16;
|
||||
print("111");
|
||||
o16.c += NaN;
|
||||
}
|
||||
|
23
test/moduletest/changelistener/expect_output.txt
Normal file
23
test/moduletest/changelistener/expect_output.txt
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
222
|
||||
111
|
||||
222
|
||||
111
|
||||
222
|
||||
111
|
||||
222
|
||||
111
|
||||
222
|
||||
111
|
Loading…
Reference in New Issue
Block a user