mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
挑单6259 6287到4.0release
Signed-off-by: hwx1163501 <hanjing35@huawei.com> issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I98NB3
This commit is contained in:
parent
98bca29fab
commit
120ecabe52
@ -48,9 +48,9 @@ JSTaggedValue BuiltinsCollator::CollatorConstructor(EcmaRuntimeCallInfo *argv)
|
||||
// a. Append [[CaseFirst]] as the last element of internalSlotsList.
|
||||
|
||||
// 5. Let collator be ? OrdinaryCreateFromConstructor(newTarget, "%CollatorPrototype%", internalSlotsList).
|
||||
JSHandle<JSCollator> collator =
|
||||
JSHandle<JSCollator>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSCollator> collator = JSHandle<JSCollator>::Cast(newObject);
|
||||
|
||||
// 6. Return ? InitializeCollator(collator, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -95,9 +95,9 @@ JSTaggedValue BuiltinsDate::DateConstructor(EcmaRuntimeCallInfo *argv)
|
||||
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSFunction> constructor(GetConstructor(argv));
|
||||
JSHandle<JSDate> dateObject =
|
||||
JSHandle<JSDate>::Cast(factory->NewJSObjectByConstructor(constructor, newTarget));
|
||||
JSHandle<JSObject> obj = factory->NewJSObjectByConstructor(constructor, newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSDate> dateObject = JSHandle<JSDate>::Cast(obj);
|
||||
dateObject->SetTimeValue(thread, timeValue);
|
||||
return dateObject.GetTaggedValue();
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ JSTaggedValue BuiltinsDateTimeFormat::DateTimeFormatConstructor(EcmaRuntimeCallI
|
||||
// [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[Weekday]],
|
||||
// [[Era]], [[Year]], [[Month]], [[Day]], [[Hour]], [[Minute]], [[Second]], [[TimeZoneName]], [[HourCycle]],
|
||||
// [[Pattern]], [[BoundFormat]] »).
|
||||
JSHandle<JSDateTimeFormat> dateTimeFormat = JSHandle<JSDateTimeFormat>::Cast(
|
||||
factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSDateTimeFormat> dateTimeFormat = JSHandle<JSDateTimeFormat>::Cast(newObject);
|
||||
|
||||
// 3. Perform ? InitializeDateTimeFormat(dateTimeFormat, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -43,9 +43,9 @@ JSTaggedValue BuiltinsDisplayNames::DisplayNamesConstructor(EcmaRuntimeCallInfo
|
||||
// 2. Let displayNames be ? OrdinaryCreateFromConstructor(NewTarget, "%DisplayNames.prototype%",
|
||||
// « [[InitializedDisplayNames]], [[Locale]], [[Style]], [[Type]], [[Fallback]], [[Fields]] »).
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
JSHandle<JSDisplayNames> displayNames =
|
||||
JSHandle<JSDisplayNames>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSDisplayNames> displayNames = JSHandle<JSDisplayNames>::Cast(newObject);
|
||||
|
||||
// 3. Perform ? InitializeDisplayNames(displayNames, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -44,9 +44,9 @@ JSTaggedValue BuiltinsListFormat::ListFormatConstructor(EcmaRuntimeCallInfo *arg
|
||||
// [[Type]], [[Style]], [[Templates]] »).
|
||||
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
JSHandle<JSListFormat> listFormat = JSHandle<JSListFormat>::Cast(
|
||||
factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSListFormat> listFormat = JSHandle<JSListFormat>::Cast(newObject);
|
||||
|
||||
// 3. Perform ? InitializeListFormat(listFormat, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -39,9 +39,9 @@ JSTaggedValue BuiltinsLocale::LocaleConstructor(EcmaRuntimeCallInfo *argv)
|
||||
|
||||
// 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%, internalSlotsList).
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
JSHandle<JSLocale> locale =
|
||||
JSHandle<JSLocale>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSLocale> locale =JSHandle<JSLocale>::Cast(newObject);
|
||||
|
||||
// 7. If Type(tag) is not String or Object, throw a TypeError exception.
|
||||
JSHandle<JSTaggedValue> tag = GetCallArg(argv, 0);
|
||||
|
@ -48,9 +48,9 @@ JSTaggedValue BuiltinsNumberFormat::NumberFormatConstructor(EcmaRuntimeCallInfo
|
||||
// [[UnitDisplay]], [[Currency]], [[CurrencyDisplay]], [[CurrencySign]], [[MinimumIntegerDigits]],
|
||||
// [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]],
|
||||
// [[RoundingType]], [[Notation]], [[CompactDisplay]], [[UseGrouping]], [[SignDisplay]], [[BoundFormat]] »).
|
||||
JSHandle<JSNumberFormat> numberFormat =
|
||||
JSHandle<JSNumberFormat>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSNumberFormat> numberFormat = JSHandle<JSNumberFormat>::Cast(newObject);
|
||||
|
||||
// 3. Perform ? InitializeNumberFormat(numberFormat, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -41,9 +41,9 @@ JSTaggedValue BuiltinsPluralRules::PluralRulesConstructor(EcmaRuntimeCallInfo *a
|
||||
// 2. Let pluralRules be ? OrdinaryCreateFromConstructor(NewTarget, "%PluralRulesPrototype%",
|
||||
// « [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]],
|
||||
// [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]] »).
|
||||
JSHandle<JSPluralRules> pluralRules =
|
||||
JSHandle<JSPluralRules>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSPluralRules> pluralRules = JSHandle<JSPluralRules>::Cast(newObject);
|
||||
|
||||
// 3. Return ? InitializePluralRules(pluralRules, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -60,9 +60,9 @@ JSTaggedValue BuiltinsPromise::PromiseConstructor(EcmaRuntimeCallInfo *argv)
|
||||
// «[[PromiseState]], [[PromiseResult]], [[PromiseFulfillReactions]], [[PromiseRejectReactions]]» ).
|
||||
// 4. ReturnIfAbrupt(promise).
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
JSHandle<JSPromise> instancePromise =
|
||||
JSHandle<JSPromise>::Cast(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSPromise> instancePromise = JSHandle<JSPromise>::Cast(newObject);
|
||||
|
||||
// 5. Set promise's [[PromiseState]] internal slot to "pending".
|
||||
// 6. Set promise's [[PromiseFulfillReactions]] internal slot to a new empty List.
|
||||
|
@ -37,9 +37,9 @@ JSTaggedValue BuiltinsRelativeTimeFormat::RelativeTimeFormatConstructor(EcmaRunt
|
||||
// (NewTarget, "%RelativeTimeFormatPrototype%", « [[InitializedRelativeTimeFormat]],
|
||||
// [[Locale]], [[DataLocale]], [[Style]], [[Numeric]], [[NumberFormat]], [[NumberingSystem]], [[PluralRules]] »).
|
||||
JSHandle<JSTaggedValue> constructor = GetConstructor(argv);
|
||||
JSHandle<JSRelativeTimeFormat> relativeTimeFormat = JSHandle<JSRelativeTimeFormat>::Cast(
|
||||
factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget));
|
||||
JSHandle<JSObject> newObject = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(constructor), newTarget);
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
JSHandle<JSRelativeTimeFormat> relativeTimeFormat = JSHandle<JSRelativeTimeFormat>::Cast(newObject);
|
||||
|
||||
// 3. Perform ? InitializeRelativeTimeFormat(relativeTimeFormat, locales, options).
|
||||
JSHandle<JSTaggedValue> locales = GetCallArg(argv, 0);
|
||||
|
@ -619,6 +619,9 @@ bool JSHClass::UnregisterOnProtoChain(const JSThread *thread, const JSHandle<JSH
|
||||
JSTaggedValue proto = jshclass->GetPrototype();
|
||||
ASSERT(proto.IsECMAObject());
|
||||
JSTaggedValue protoDetailsValue = JSObject::Cast(proto.GetTaggedObject())->GetJSHClass()->GetProtoChangeDetails();
|
||||
if (protoDetailsValue.IsUndefined() || protoDetailsValue.IsNull()) {
|
||||
return false;
|
||||
}
|
||||
ASSERT(protoDetailsValue.IsProtoChangeDetails());
|
||||
JSTaggedValue listenersValue = ProtoChangeDetails::Cast(protoDetailsValue.GetTaggedObject())->GetChangeListener();
|
||||
ASSERT(!listenersValue.IsUndefined());
|
||||
|
@ -35,6 +35,7 @@ JSHandle<JSPrimitiveRef> JSPrimitiveRef::StringCreate(JSThread *thread, const JS
|
||||
// 6. Set S.[[OwnPropertyKeys]] as specified.
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSTaggedValue> str(factory->NewJSString(value, newTarget));
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPrimitiveRef, thread);
|
||||
// 7. Let length be the number of code unit elements in value.
|
||||
JSHandle<JSTaggedValue> lengthStr = thread->GlobalConstants()->GetHandledLengthString();
|
||||
uint32_t length = EcmaStringAccessor(value->GetTaggedObject()).GetLength();
|
||||
|
@ -1860,7 +1860,9 @@ JSHandle<JSPrimitiveRef> ObjectFactory::NewJSString(const JSHandle<JSTaggedValue
|
||||
if (newTarget->IsUndefined()) {
|
||||
obj = JSHandle<JSPrimitiveRef>::Cast(NewJSObjectByConstructor(stringFunc));
|
||||
} else {
|
||||
obj = JSHandle<JSPrimitiveRef>::Cast(NewJSObjectByConstructor(stringFunc, newTarget));
|
||||
JSHandle<JSObject> newObject = NewJSObjectByConstructor(stringFunc, newTarget);
|
||||
RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPrimitiveRef, thread_);
|
||||
obj = JSHandle<JSPrimitiveRef>::Cast(newObject);
|
||||
}
|
||||
obj->SetValue(thread_, str);
|
||||
return obj;
|
||||
|
@ -2443,6 +2443,7 @@ JSTaggedValue RuntimeStubs::RuntimeOptConstructGeneric(JSThread *thread, JSHandl
|
||||
if (ctor->IsBase()) {
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
obj = JSHandle<JSTaggedValue>(factory->NewJSObjectByConstructor(ctor, newTgt));
|
||||
RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
|
||||
}
|
||||
|
||||
uint32_t preArgsSize = preArgs->IsUndefined() ? 0 : JSHandle<TaggedArray>::Cast(preArgs)->GetLength();
|
||||
|
@ -159,3 +159,33 @@ const values = [1, 10, 21, 2];
|
||||
const sortedValues = values.toSorted((a, b) => {return a- b});
|
||||
print(sortedValues); // [1, 2, 10, 21]
|
||||
print(values); // [1, 10, 21, 2]
|
||||
|
||||
function fun1(obj, name, type) {
|
||||
return typeof type === 'undefined' || typeof desc.value === type;
|
||||
}
|
||||
function fun2(obj, type) {
|
||||
let properties = [];
|
||||
let proto = Object.getPrototypeOf(obj);
|
||||
while (proto && proto != Object.prototype) {
|
||||
Object.getOwnPropertyNames(proto).forEach(name => {
|
||||
if (name !== 'constructor') {
|
||||
if (fun1(proto, name, type)) properties.push(name);
|
||||
}
|
||||
});
|
||||
proto = Object.getPrototypeOf(proto);
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
function fun4(seed) {
|
||||
let objects = [Object, Error, AggregateError, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, String, BigInt, Function, Number, Boolean, Date, RegExp, Array, ArrayBuffer, DataView, Int8Array, Int16Array, Int32Array, Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array, Set, Map, WeakMap, WeakSet, Symbol, Proxy];
|
||||
return objects[seed % objects.length];
|
||||
}
|
||||
function fun8(obj, seed) {
|
||||
let properties = fun2(obj);
|
||||
}
|
||||
|
||||
fun4(694532)[fun8(fun4(694532), 527224)];
|
||||
Object.freeze(Object.prototype);
|
||||
|
||||
Array.prototype.length = 3000;
|
||||
print(Array.prototype.length)
|
||||
|
@ -83,3 +83,4 @@ Dec,Feb,Jan,Mar
|
||||
Mar,Jan,Feb,Dec
|
||||
1,2,10,21
|
||||
1,10,21,2
|
||||
3000
|
||||
|
@ -63,3 +63,16 @@ p28 28
|
||||
p29 29
|
||||
p30 30
|
||||
p31 31
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
Error: OK
|
||||
|
@ -22,15 +22,14 @@
|
||||
let a = '*'
|
||||
let s = ''
|
||||
|
||||
for (let i = 0; i < 10; i++)
|
||||
{
|
||||
for (let i = 0; i < 10; i++) {
|
||||
s += a
|
||||
print(s)
|
||||
}
|
||||
|
||||
let i = 10
|
||||
|
||||
while (i > 0) {
|
||||
while (i > 0) {
|
||||
print(i);
|
||||
i--;
|
||||
}
|
||||
@ -49,3 +48,38 @@ for (let index = 0; index < 32; index++) {
|
||||
for (let k in v5) {
|
||||
print(k, v5[k]);
|
||||
}
|
||||
|
||||
function f0(v1, v2) {
|
||||
try {
|
||||
v1();
|
||||
} catch (v5) {
|
||||
print(v5)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var v0 = function () { }.bind();
|
||||
} catch (e) {
|
||||
print(e)
|
||||
}
|
||||
|
||||
try {
|
||||
Object.defineProperty(v0, "prototype", {
|
||||
get() {
|
||||
throw Error("OK");
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
print(e)
|
||||
}
|
||||
|
||||
try {
|
||||
[Array, Date, Boolean, Number, String, RegExp, Error, Uint8Array, ArrayBuffer, Map, WeakMap, Set, WeakSet].
|
||||
forEach(function (v6) {
|
||||
f0(() => {
|
||||
Reflect.construct(v6, [], v0);
|
||||
}, `Error: OK`);
|
||||
});
|
||||
} catch (e) {
|
||||
print(e)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user