Commit 4418a7b9 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

Revert "[torque] introduce JSAny type for user-accessible JavaScript values"

This reverts commit 79b00555.

Reason for revert: needs more discussion

Original change's description:
> [torque] introduce JSAny type for user-accessible JavaScript values
> 
> This CL introduces a JSAny type for user-exposed JavaScript values and
> a few new types to define it. Especially, it splits Symbol into
> PrivateSymbol (not exposed) and PublicSymbol (JavaScript exposed
> symbols).
> 
> The change is mostly mechanical, but a few things are interesting:
> - PropertyKey and JSPrimitive were designed to coincide with the spec
>   notions of IsPropertyKey() and primitive value, respectively.
> - Since Name is an open type, we define AnyName to be the known
>   subtypes of Name. This is not too elegant, but by using AnyName
>   instead of Name, typeswitch can properly conclude something if a
>   subtype of Name is excluded.
> 
> Small drive-by changes, which were necessary:
> - Allow subtyping on label parameters.
> - Fix the formatting of typeswitch, it was broken with union types
>   in case types.
> 
> Bug: v8:7793
> Change-Id: I14b10507f8cf316ad85e048fe8d53d1df5e0bb13
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1735322
> Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#63114}

TBR=neis@chromium.org,jgruber@chromium.org,tebbi@chromium.org

Change-Id: Ifde7881d74afe407628f40047997339d54cb2424
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7793
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1741652Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63115}
parent 79b00555
...@@ -8,7 +8,7 @@ struct Arguments { ...@@ -8,7 +8,7 @@ struct Arguments {
const length: intptr; const length: intptr;
} }
extern operator '[]' macro GetArgumentValue(Arguments, intptr): JSAny; extern operator '[]' macro GetArgumentValue(Arguments, intptr): Object;
extern macro GetFrameArguments(FrameWithArguments, intptr): Arguments; extern macro GetFrameArguments(FrameWithArguments, intptr): Arguments;
......
...@@ -9,7 +9,7 @@ namespace array_copywithin { ...@@ -9,7 +9,7 @@ namespace array_copywithin {
// https://tc39.github.io/ecma262/#sec-array.prototype.copyWithin // https://tc39.github.io/ecma262/#sec-array.prototype.copyWithin
transitioning javascript builtin ArrayPrototypeCopyWithin( transitioning javascript builtin ArrayPrototypeCopyWithin(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver); const object: JSReceiver = ToObject_Inline(context, receiver);
...@@ -68,7 +68,7 @@ namespace array_copywithin { ...@@ -68,7 +68,7 @@ namespace array_copywithin {
// d. If fromPresent is true, then. // d. If fromPresent is true, then.
if (fromPresent == True) { if (fromPresent == True) {
// i. Let fromVal be ? Get(O, fromKey). // i. Let fromVal be ? Get(O, fromKey).
const fromVal: JSAny = GetProperty(object, from); const fromVal: Object = GetProperty(object, from);
// ii. Perform ? Set(O, toKey, fromVal, true). // ii. Perform ? Set(O, toKey, fromVal, true).
SetProperty(object, to, fromVal); SetProperty(object, to, fromVal);
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
namespace array { namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayEveryLoopEagerDeoptContinuation( ArrayEveryLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny): JSAny { callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -26,9 +27,9 @@ namespace array { ...@@ -26,9 +27,9 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayEveryLoopLazyDeoptContinuation( ArrayEveryLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny, callback: Object, thisArg: Object, initialK: Object, length: Object,
result: JSAny): JSAny { result: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -52,9 +53,9 @@ namespace array { ...@@ -52,9 +53,9 @@ namespace array {
} }
transitioning builtin ArrayEveryLoopContinuation(implicit context: Context)( transitioning builtin ArrayEveryLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: JSAny, o: JSReceiver, initialK: Number, length: Number, _array: Object, o: JSReceiver, initialK: Number, length: Number,
_initialTo: JSAny): JSAny { _initialTo: Object): Object {
// 5. Let k be 0. // 5. Let k be 0.
// 6. Repeat, while k < len // 6. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) { for (let k: Number = initialK; k < length; k++) {
...@@ -68,10 +69,10 @@ namespace array { ...@@ -68,10 +69,10 @@ namespace array {
// 6c. If kPresent is true, then // 6c. If kPresent is true, then
if (kPresent == True) { if (kPresent == True) {
// 6c. i. Let kValue be ? Get(O, Pk). // 6c. i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, k); const kValue: Object = GetProperty(o, k);
// 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>). // 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>).
const result: JSAny = Call(context, callbackfn, thisArg, kValue, k, o); const result: Object = Call(context, callbackfn, thisArg, kValue, k, o);
// iii. If selected is true, then... // iii. If selected is true, then...
if (!ToBoolean(result)) { if (!ToBoolean(result)) {
...@@ -85,7 +86,7 @@ namespace array { ...@@ -85,7 +86,7 @@ namespace array {
} }
transitioning macro FastArrayEvery(implicit context: Context)( transitioning macro FastArrayEvery(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, thisArg: JSAny): JSAny o: JSReceiver, len: Number, callbackfn: Callable, thisArg: Object): Object
labels Bailout(Smi) { labels Bailout(Smi) {
let k: Smi = 0; let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k); const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
...@@ -98,8 +99,8 @@ namespace array { ...@@ -98,8 +99,8 @@ namespace array {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k); if (k >= fastOW.Get().length) goto Bailout(k);
const value: JSAny = fastOW.LoadElementNoHole(k) otherwise continue; const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
const result: JSAny = const result: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
if (!ToBoolean(result)) { if (!ToBoolean(result)) {
return False; return False;
...@@ -110,8 +111,8 @@ namespace array { ...@@ -110,8 +111,8 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.every // https://tc39.github.io/ecma262/#sec-array.prototype.every
transitioning javascript builtin transitioning javascript builtin
ArrayEvery(js-implicit context: Context, receiver: JSAny)(...arguments): ArrayEvery(js-implicit context: Context, receiver: Object)(...arguments):
JSAny { Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.every'); RequireObjectCoercible(receiver, 'Array.prototype.every');
...@@ -128,7 +129,7 @@ namespace array { ...@@ -128,7 +129,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
// Special cases. // Special cases.
try { try {
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
namespace array_filter { namespace array_filter {
transitioning javascript builtin transitioning javascript builtin
ArrayFilterLoopEagerDeoptContinuation( ArrayFilterLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, array: JSAny, initialK: JSAny, callback: Object, thisArg: Object, array: Object, initialK: Object,
length: JSAny, initialTo: JSAny): JSAny { length: Object, initialTo: Object): Object {
// All continuation points in the optimized filter implementation are // All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -29,9 +29,10 @@ namespace array_filter { ...@@ -29,9 +29,10 @@ namespace array_filter {
transitioning javascript builtin transitioning javascript builtin
ArrayFilterLoopLazyDeoptContinuation( ArrayFilterLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, array: JSAny, initialK: JSAny, callback: Object, thisArg: Object, array: Object, initialK: Object,
length: JSAny, valueK: JSAny, initialTo: JSAny, result: JSAny): JSAny { length: Object, valueK: Object, initialTo: Object,
result: Object): Object {
// All continuation points in the optimized filter implementation are // All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -59,9 +60,9 @@ namespace array_filter { ...@@ -59,9 +60,9 @@ namespace array_filter {
} }
transitioning builtin ArrayFilterLoopContinuation(implicit context: Context)( transitioning builtin ArrayFilterLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: JSReceiver, o: JSReceiver, initialK: Number, length: Number, array: JSReceiver, o: JSReceiver, initialK: Number, length: Number,
initialTo: Number): JSAny { initialTo: Number): Object {
let to: Number = initialTo; let to: Number = initialTo;
// 5. Let k be 0. // 5. Let k be 0.
// 6. Repeat, while k < len // 6. Repeat, while k < len
...@@ -76,10 +77,10 @@ namespace array_filter { ...@@ -76,10 +77,10 @@ namespace array_filter {
// 6c. If kPresent is true, then // 6c. If kPresent is true, then
if (kPresent == True) { if (kPresent == True) {
// 6c. i. Let kValue be ? Get(O, Pk). // 6c. i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, k); const kValue: Object = GetProperty(o, k);
// 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>). // 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>).
const result: JSAny = Call(context, callbackfn, thisArg, kValue, k, o); const result: Object = Call(context, callbackfn, thisArg, kValue, k, o);
// iii. If selected is true, then... // iii. If selected is true, then...
if (ToBoolean(result)) { if (ToBoolean(result)) {
...@@ -96,7 +97,7 @@ namespace array_filter { ...@@ -96,7 +97,7 @@ namespace array_filter {
} }
transitioning macro FastArrayFilter(implicit context: Context)( transitioning macro FastArrayFilter(implicit context: Context)(
fastO: FastJSArray, len: Smi, callbackfn: Callable, thisArg: JSAny, fastO: FastJSArray, len: Smi, callbackfn: Callable, thisArg: Object,
output: FastJSArray) labels Bailout(Number, Number) { output: FastJSArray) labels Bailout(Number, Number) {
let k: Smi = 0; let k: Smi = 0;
let to: Smi = 0; let to: Smi = 0;
...@@ -111,8 +112,8 @@ namespace array_filter { ...@@ -111,8 +112,8 @@ namespace array_filter {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k, to); if (k >= fastOW.Get().length) goto Bailout(k, to);
const value: JSAny = fastOW.LoadElementNoHole(k) otherwise continue; const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
const result: JSAny = const result: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
if (ToBoolean(result)) { if (ToBoolean(result)) {
try { try {
...@@ -146,8 +147,8 @@ namespace array_filter { ...@@ -146,8 +147,8 @@ namespace array_filter {
// https://tc39.github.io/ecma262/#sec-array.prototype.filter // https://tc39.github.io/ecma262/#sec-array.prototype.filter
transitioning javascript builtin transitioning javascript builtin
ArrayFilter(js-implicit context: Context, receiver: JSAny)(...arguments): ArrayFilter(js-implicit context: Context, receiver: Object)(...arguments):
JSAny { Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.filter'); RequireObjectCoercible(receiver, 'Array.prototype.filter');
...@@ -164,7 +165,7 @@ namespace array_filter { ...@@ -164,7 +165,7 @@ namespace array_filter {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
let output: JSReceiver; let output: JSReceiver;
// Special cases. // Special cases.
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
namespace array_find { namespace array_find {
transitioning javascript builtin transitioning javascript builtin
ArrayFindLoopEagerDeoptContinuation( ArrayFindLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny): JSAny { callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized find implementation are // All continuation points in the optimized find implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -25,9 +26,9 @@ namespace array_find { ...@@ -25,9 +26,9 @@ namespace array_find {
transitioning javascript builtin transitioning javascript builtin
ArrayFindLoopLazyDeoptContinuation( ArrayFindLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
_callback: JSAny, _thisArg: JSAny, _initialK: JSAny, _length: JSAny, _callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
_result: JSAny): JSAny { _result: Object): Object {
// This deopt continuation point is never actually called, it just // This deopt continuation point is never actually called, it just
// exists to make stack traces correct from a ThrowTypeError if the // exists to make stack traces correct from a ThrowTypeError if the
// callback was found to be non-callable. // callback was found to be non-callable.
...@@ -39,9 +40,9 @@ namespace array_find { ...@@ -39,9 +40,9 @@ namespace array_find {
// before iteration continues. // before iteration continues.
transitioning javascript builtin transitioning javascript builtin
ArrayFindLoopAfterCallbackLazyDeoptContinuation( ArrayFindLoopAfterCallbackLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny, callback: Object, thisArg: Object, initialK: Object, length: Object,
foundValue: JSAny, isFound: JSAny): JSAny { foundValue: Object, isFound: Object): Object {
// All continuation points in the optimized find implementation are // All continuation points in the optimized find implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -64,8 +65,8 @@ namespace array_find { ...@@ -64,8 +65,8 @@ namespace array_find {
} }
transitioning builtin ArrayFindLoopContinuation(implicit context: Context)( transitioning builtin ArrayFindLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
o: JSReceiver, initialK: Number, length: Number): JSAny { o: JSReceiver, initialK: Number, length: Number): Object {
// 5. Let k be 0. // 5. Let k be 0.
// 6. Repeat, while k < len // 6. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) { for (let k: Number = initialK; k < length; k++) {
...@@ -74,11 +75,12 @@ namespace array_find { ...@@ -74,11 +75,12 @@ namespace array_find {
// side-effect free and HasProperty/GetProperty do the conversion inline. // side-effect free and HasProperty/GetProperty do the conversion inline.
// 6b. i. Let kValue be ? Get(O, Pk). // 6b. i. Let kValue be ? Get(O, Pk).
const value: JSAny = GetProperty(o, k); const value: Object = GetProperty(o, k);
// 6c. Let testResult be ToBoolean(? Call(predicate, T, <<kValue, k, // 6c. Let testResult be ToBoolean(? Call(predicate, T, <<kValue, k,
// O>>)). // O>>)).
const testResult: JSAny = Call(context, callbackfn, thisArg, value, k, o); const testResult: Object =
Call(context, callbackfn, thisArg, value, k, o);
// 6d. If testResult is true, return kValue. // 6d. If testResult is true, return kValue.
if (ToBoolean(testResult)) { if (ToBoolean(testResult)) {
...@@ -91,7 +93,7 @@ namespace array_find { ...@@ -91,7 +93,7 @@ namespace array_find {
} }
transitioning macro FastArrayFind(implicit context: Context)( transitioning macro FastArrayFind(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, thisArg: JSAny): JSAny o: JSReceiver, len: Number, callbackfn: Callable, thisArg: Object): Object
labels Bailout(Smi) { labels Bailout(Smi) {
let k: Smi = 0; let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k); const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
...@@ -105,8 +107,8 @@ namespace array_find { ...@@ -105,8 +107,8 @@ namespace array_find {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k); if (k >= fastOW.Get().length) goto Bailout(k);
const value: JSAny = fastOW.LoadElementOrUndefined(k); const value: Object = fastOW.LoadElementOrUndefined(k);
const testResult: JSAny = const testResult: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
if (ToBoolean(testResult)) { if (ToBoolean(testResult)) {
return value; return value;
...@@ -117,8 +119,8 @@ namespace array_find { ...@@ -117,8 +119,8 @@ namespace array_find {
// https://tc39.github.io/ecma262/#sec-array.prototype.find // https://tc39.github.io/ecma262/#sec-array.prototype.find
transitioning javascript builtin transitioning javascript builtin
ArrayPrototypeFind(js-implicit context: Context, receiver: JSAny)( ArrayPrototypeFind(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.find'); RequireObjectCoercible(receiver, 'Array.prototype.find');
...@@ -136,7 +138,7 @@ namespace array_find { ...@@ -136,7 +138,7 @@ namespace array_find {
Cast<Callable>(arguments[0]) otherwise NotCallableError; Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
// Special cases. // Special cases.
try { try {
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
namespace array_findindex { namespace array_findindex {
transitioning javascript builtin transitioning javascript builtin
ArrayFindIndexLoopEagerDeoptContinuation( ArrayFindIndexLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny): JSAny { callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized findIndex implementation are // All continuation points in the optimized findIndex implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -25,9 +26,9 @@ namespace array_findindex { ...@@ -25,9 +26,9 @@ namespace array_findindex {
transitioning javascript builtin transitioning javascript builtin
ArrayFindIndexLoopLazyDeoptContinuation( ArrayFindIndexLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
_callback: JSAny, _thisArg: JSAny, _initialK: JSAny, _length: JSAny, _callback: Object, _thisArg: Object, _initialK: Object, _length: Object,
_result: JSAny): JSAny { _result: Object): Object {
// This deopt continuation point is never actually called, it just // This deopt continuation point is never actually called, it just
// exists to make stack traces correct from a ThrowTypeError if the // exists to make stack traces correct from a ThrowTypeError if the
// callback was found to be non-callable. // callback was found to be non-callable.
...@@ -39,9 +40,9 @@ namespace array_findindex { ...@@ -39,9 +40,9 @@ namespace array_findindex {
// before iteration continues. // before iteration continues.
transitioning javascript builtin transitioning javascript builtin
ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation( ArrayFindIndexLoopAfterCallbackLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny, callback: Object, thisArg: Object, initialK: Object, length: Object,
foundValue: JSAny, isFound: JSAny): JSAny { foundValue: Object, isFound: Object): Object {
// All continuation points in the optimized findIndex implementation are // All continuation points in the optimized findIndex implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -65,7 +66,7 @@ namespace array_findindex { ...@@ -65,7 +66,7 @@ namespace array_findindex {
transitioning builtin ArrayFindIndexLoopContinuation(implicit context: transitioning builtin ArrayFindIndexLoopContinuation(implicit context:
Context)( Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
o: JSReceiver, initialK: Number, length: Number): Number { o: JSReceiver, initialK: Number, length: Number): Number {
// 5. Let k be 0. // 5. Let k be 0.
// 6. Repeat, while k < len // 6. Repeat, while k < len
...@@ -75,11 +76,12 @@ namespace array_findindex { ...@@ -75,11 +76,12 @@ namespace array_findindex {
// side-effect free and HasProperty/GetProperty do the conversion inline. // side-effect free and HasProperty/GetProperty do the conversion inline.
// 6b. i. Let kValue be ? Get(O, Pk). // 6b. i. Let kValue be ? Get(O, Pk).
const value: JSAny = GetProperty(o, k); const value: Object = GetProperty(o, k);
// 6c. Let testResult be ToBoolean(? Call(predicate, T, <<kValue, k, // 6c. Let testResult be ToBoolean(? Call(predicate, T, <<kValue, k,
// O>>)). // O>>)).
const testResult: JSAny = Call(context, callbackfn, thisArg, value, k, o); const testResult: Object =
Call(context, callbackfn, thisArg, value, k, o);
// 6d. If testResult is true, return k. // 6d. If testResult is true, return k.
if (ToBoolean(testResult)) { if (ToBoolean(testResult)) {
...@@ -92,7 +94,7 @@ namespace array_findindex { ...@@ -92,7 +94,7 @@ namespace array_findindex {
} }
transitioning macro FastArrayFindIndex(implicit context: Context)( transitioning macro FastArrayFindIndex(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, thisArg: JSAny): Number o: JSReceiver, len: Number, callbackfn: Callable, thisArg: Object): Number
labels Bailout(Smi) { labels Bailout(Smi) {
let k: Smi = 0; let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k); const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
...@@ -106,8 +108,8 @@ namespace array_findindex { ...@@ -106,8 +108,8 @@ namespace array_findindex {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k); if (k >= fastOW.Get().length) goto Bailout(k);
const value: JSAny = fastOW.LoadElementOrUndefined(k); const value: Object = fastOW.LoadElementOrUndefined(k);
const testResult: JSAny = const testResult: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
if (ToBoolean(testResult)) { if (ToBoolean(testResult)) {
return k; return k;
...@@ -118,8 +120,8 @@ namespace array_findindex { ...@@ -118,8 +120,8 @@ namespace array_findindex {
// https://tc39.github.io/ecma262/#sec-array.prototype.findIndex // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
transitioning javascript builtin transitioning javascript builtin
ArrayPrototypeFindIndex(js-implicit context: Context, receiver: JSAny)( ArrayPrototypeFindIndex(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.findIndex'); RequireObjectCoercible(receiver, 'Array.prototype.findIndex');
...@@ -137,7 +139,7 @@ namespace array_findindex { ...@@ -137,7 +139,7 @@ namespace array_findindex {
Cast<Callable>(arguments[0]) otherwise NotCallableError; Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
// Special cases. // Special cases.
try { try {
......
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
namespace array_foreach { namespace array_foreach {
transitioning javascript builtin transitioning javascript builtin
ArrayForEachLoopEagerDeoptContinuation( ArrayForEachLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny): JSAny { callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized forEach implemntation are // All continuation points in the optimized forEach implemntation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -22,9 +23,9 @@ namespace array_foreach { ...@@ -22,9 +23,9 @@ namespace array_foreach {
transitioning javascript builtin transitioning javascript builtin
ArrayForEachLoopLazyDeoptContinuation( ArrayForEachLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny, callback: Object, thisArg: Object, initialK: Object, length: Object,
_result: JSAny): JSAny { _result: Object): Object {
// All continuation points in the optimized forEach implemntation are // All continuation points in the optimized forEach implemntation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -39,9 +40,9 @@ namespace array_foreach { ...@@ -39,9 +40,9 @@ namespace array_foreach {
} }
transitioning builtin ArrayForEachLoopContinuation(implicit context: Context)( transitioning builtin ArrayForEachLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: JSAny, o: JSReceiver, initialK: Number, len: Number, _array: Object, o: JSReceiver, initialK: Number, len: Number,
_to: JSAny): JSAny { _to: Object): Object {
// variables {array} and {to} are ignored. // variables {array} and {to} are ignored.
// 5. Let k be 0. // 5. Let k be 0.
...@@ -57,7 +58,7 @@ namespace array_foreach { ...@@ -57,7 +58,7 @@ namespace array_foreach {
// 6c. If kPresent is true, then // 6c. If kPresent is true, then
if (kPresent == True) { if (kPresent == True) {
// 6c. i. Let kValue be ? Get(O, Pk). // 6c. i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, k); const kValue: Object = GetProperty(o, k);
// 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>). // 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>).
Call(context, callbackfn, thisArg, kValue, k, o); Call(context, callbackfn, thisArg, kValue, k, o);
...@@ -69,7 +70,7 @@ namespace array_foreach { ...@@ -69,7 +70,7 @@ namespace array_foreach {
} }
transitioning macro FastArrayForEach(implicit context: Context)( transitioning macro FastArrayForEach(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, thisArg: JSAny): JSAny o: JSReceiver, len: Number, callbackfn: Callable, thisArg: Object): Object
labels Bailout(Smi) { labels Bailout(Smi) {
let k: Smi = 0; let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k); const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
...@@ -82,7 +83,7 @@ namespace array_foreach { ...@@ -82,7 +83,7 @@ namespace array_foreach {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k); if (k >= fastOW.Get().length) goto Bailout(k);
const value: JSAny = fastOW.LoadElementNoHole(k) const value: Object = fastOW.LoadElementNoHole(k)
otherwise continue; otherwise continue;
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
} }
...@@ -91,8 +92,8 @@ namespace array_foreach { ...@@ -91,8 +92,8 @@ namespace array_foreach {
// https://tc39.github.io/ecma262/#sec-array.prototype.foreach // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
transitioning javascript builtin transitioning javascript builtin
ArrayForEach(js-implicit context: Context, receiver: JSAny)(...arguments): ArrayForEach(js-implicit context: Context, receiver: Object)(...arguments):
JSAny { Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.forEach'); RequireObjectCoercible(receiver, 'Array.prototype.forEach');
...@@ -109,7 +110,7 @@ namespace array_foreach { ...@@ -109,7 +110,7 @@ namespace array_foreach {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
// Special cases. // Special cases.
let k: Number = 0; let k: Number = 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
namespace array_join { namespace array_join {
type LoadJoinElementFn = builtin(Context, JSReceiver, Number) => JSAny; type LoadJoinElementFn = builtin(Context, JSReceiver, Number) => Object;
// Fast C call to write a fixed array (see Buffer.fixedArray) to a single // Fast C call to write a fixed array (see Buffer.fixedArray) to a single
// string. // string.
...@@ -12,12 +12,12 @@ namespace array_join { ...@@ -12,12 +12,12 @@ namespace array_join {
FixedArray, intptr, String, String): String; FixedArray, intptr, String, String): String;
transitioning builtin LoadJoinElement<T: type>( transitioning builtin LoadJoinElement<T: type>(
context: Context, receiver: JSReceiver, k: Number): JSAny { context: Context, receiver: JSReceiver, k: Number): Object {
return GetProperty(receiver, k); return GetProperty(receiver, k);
} }
transitioning LoadJoinElement<array::DictionaryElements>( transitioning LoadJoinElement<array::DictionaryElements>(
context: Context, receiver: JSReceiver, k: Number): JSAny { context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver); const array: JSArray = UnsafeCast<JSArray>(receiver);
const dict: NumberDictionary = UnsafeCast<NumberDictionary>(array.elements); const dict: NumberDictionary = UnsafeCast<NumberDictionary>(array.elements);
try { try {
...@@ -33,15 +33,15 @@ namespace array_join { ...@@ -33,15 +33,15 @@ namespace array_join {
} }
LoadJoinElement<array::FastSmiOrObjectElements>( LoadJoinElement<array::FastSmiOrObjectElements>(
context: Context, receiver: JSReceiver, k: Number): JSAny { context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver); const array: JSArray = UnsafeCast<JSArray>(receiver);
const fixedArray: FixedArray = UnsafeCast<FixedArray>(array.elements); const fixedArray: FixedArray = UnsafeCast<FixedArray>(array.elements);
const element: Object = fixedArray.objects[UnsafeCast<Smi>(k)]; const element: Object = fixedArray.objects[UnsafeCast<Smi>(k)];
return element == TheHole ? kEmptyString : UnsafeCast<JSAny>(element); return element == TheHole ? kEmptyString : element;
} }
LoadJoinElement<array::FastDoubleElements>( LoadJoinElement<array::FastDoubleElements>(
context: Context, receiver: JSReceiver, k: Number): JSAny { context: Context, receiver: JSReceiver, k: Number): Object {
const array: JSArray = UnsafeCast<JSArray>(receiver); const array: JSArray = UnsafeCast<JSArray>(receiver);
const fixedDoubleArray: FixedDoubleArray = const fixedDoubleArray: FixedDoubleArray =
UnsafeCast<FixedDoubleArray>(array.elements); UnsafeCast<FixedDoubleArray>(array.elements);
...@@ -51,7 +51,7 @@ namespace array_join { ...@@ -51,7 +51,7 @@ namespace array_join {
} }
builtin LoadJoinTypedElement<T: type>( builtin LoadJoinTypedElement<T: type>(
context: Context, receiver: JSReceiver, k: Number): JSAny { context: Context, receiver: JSReceiver, k: Number): Object {
const typedArray: JSTypedArray = UnsafeCast<JSTypedArray>(receiver); const typedArray: JSTypedArray = UnsafeCast<JSTypedArray>(receiver);
assert(!IsDetachedBuffer(typedArray.buffer)); assert(!IsDetachedBuffer(typedArray.buffer));
return typed_array::LoadFixedTypedArrayElementAsTagged( return typed_array::LoadFixedTypedArrayElementAsTagged(
...@@ -60,14 +60,14 @@ namespace array_join { ...@@ -60,14 +60,14 @@ namespace array_join {
} }
transitioning builtin ConvertToLocaleString( transitioning builtin ConvertToLocaleString(
context: Context, element: JSAny, locales: JSAny, context: Context, element: Object, locales: Object,
options: JSAny): String { options: Object): String {
if (IsNullOrUndefined(element)) return kEmptyString; if (IsNullOrUndefined(element)) return kEmptyString;
const prop: JSAny = GetProperty(element, 'toLocaleString'); const prop: Object = GetProperty(element, 'toLocaleString');
try { try {
const callable: Callable = Cast<Callable>(prop) otherwise TypeError; const callable: Callable = Cast<Callable>(prop) otherwise TypeError;
let result: JSAny; let result: Object;
if (IsNullOrUndefined(locales)) { if (IsNullOrUndefined(locales)) {
result = Call(context, callable, element); result = Call(context, callable, element);
} else if (IsNullOrUndefined(options)) { } else if (IsNullOrUndefined(options)) {
...@@ -257,7 +257,7 @@ namespace array_join { ...@@ -257,7 +257,7 @@ namespace array_join {
transitioning macro ArrayJoinImpl<T: type>(implicit context: Context)( transitioning macro ArrayJoinImpl<T: type>(implicit context: Context)(
receiver: JSReceiver, sep: String, lengthNumber: Number, receiver: JSReceiver, sep: String, lengthNumber: Number,
useToLocaleString: constexpr bool, locales: JSAny, options: JSAny, useToLocaleString: constexpr bool, locales: Object, options: Object,
initialLoadFn: LoadJoinElementFn): String { initialLoadFn: LoadJoinElementFn): String {
const initialMap: Map = receiver.map; const initialMap: Map = receiver.map;
const len: uintptr = Convert<uintptr>(lengthNumber); const len: uintptr = Convert<uintptr>(lengthNumber);
...@@ -283,7 +283,7 @@ namespace array_join { ...@@ -283,7 +283,7 @@ namespace array_join {
} }
// b. Let element be ? Get(O, ! ToString(k)). // b. Let element be ? Get(O, ! ToString(k)).
const element: JSAny = loadFn(context, receiver, Convert<Number>(k++)); const element: Object = loadFn(context, receiver, Convert<Number>(k++));
// c. If element is undefined or null, let next be the empty String; // c. If element is undefined or null, let next be the empty String;
// otherwise, let next be ? ToString(element). // otherwise, let next be ? ToString(element).
...@@ -300,7 +300,7 @@ namespace array_join { ...@@ -300,7 +300,7 @@ namespace array_join {
case (num: Number): { case (num: Number): {
next = NumberToString(num); next = NumberToString(num);
} }
case (obj: JSAny): { case (obj: HeapObject): {
if (IsNullOrUndefined(obj)) continue; if (IsNullOrUndefined(obj)) continue;
next = ToString(context, obj); next = ToString(context, obj);
} }
...@@ -321,11 +321,11 @@ namespace array_join { ...@@ -321,11 +321,11 @@ namespace array_join {
transitioning macro ArrayJoin<T: type>(implicit context: Context)( transitioning macro ArrayJoin<T: type>(implicit context: Context)(
useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String, useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String,
lenNumber: Number, locales: JSAny, options: JSAny): JSAny; lenNumber: Number, locales: Object, options: Object): Object;
transitioning ArrayJoin<JSArray>(implicit context: Context)( transitioning ArrayJoin<JSArray>(implicit context: Context)(
useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String, useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String,
lenNumber: Number, locales: JSAny, options: JSAny): JSAny { lenNumber: Number, locales: Object, options: Object): Object {
const map: Map = receiver.map; const map: Map = receiver.map;
const kind: ElementsKind = map.elements_kind; const kind: ElementsKind = map.elements_kind;
let loadFn: LoadJoinElementFn; let loadFn: LoadJoinElementFn;
...@@ -372,7 +372,7 @@ namespace array_join { ...@@ -372,7 +372,7 @@ namespace array_join {
transitioning ArrayJoin<JSTypedArray>(implicit context: Context)( transitioning ArrayJoin<JSTypedArray>(implicit context: Context)(
useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String, useToLocaleString: constexpr bool, receiver: JSReceiver, sep: String,
lenNumber: Number, locales: JSAny, options: JSAny): JSAny { lenNumber: Number, locales: Object, options: Object): Object {
const map: Map = receiver.map; const map: Map = receiver.map;
const kind: ElementsKind = map.elements_kind; const kind: ElementsKind = map.elements_kind;
let loadFn: LoadJoinElementFn; let loadFn: LoadJoinElementFn;
...@@ -486,7 +486,7 @@ namespace array_join { ...@@ -486,7 +486,7 @@ namespace array_join {
// Removes a receiver from the stack. The FixedArray will automatically shrink // Removes a receiver from the stack. The FixedArray will automatically shrink
// to Heap::kMinJoinStackSize once the stack becomes empty. // to Heap::kMinJoinStackSize once the stack becomes empty.
builtin JoinStackPop(implicit context: Context)( builtin JoinStackPop(implicit context: Context)(
stack: FixedArray, receiver: JSReceiver): JSAny { stack: FixedArray, receiver: JSReceiver): Object {
const len: intptr = stack.length_intptr; const len: intptr = stack.length_intptr;
for (let i: intptr = 0; i < len; i++) { for (let i: intptr = 0; i < len; i++) {
if (stack.objects[i] == receiver) { if (stack.objects[i] == receiver) {
...@@ -526,7 +526,7 @@ namespace array_join { ...@@ -526,7 +526,7 @@ namespace array_join {
transitioning macro CycleProtectedArrayJoin<T: type>(implicit context: transitioning macro CycleProtectedArrayJoin<T: type>(implicit context:
Context)( Context)(
useToLocaleString: constexpr bool, o: JSReceiver, len: Number, useToLocaleString: constexpr bool, o: JSReceiver, len: Number,
sepObj: JSAny, locales: JSAny, options: JSAny): JSAny { sepObj: Object, locales: Object, options: Object): Object {
// 3. If separator is undefined, let sep be the single-element String ",". // 3. If separator is undefined, let sep be the single-element String ",".
// 4. Else, let sep be ? ToString(separator). // 4. Else, let sep be ? ToString(separator).
const sep: String = const sep: String =
...@@ -536,7 +536,7 @@ namespace array_join { ...@@ -536,7 +536,7 @@ namespace array_join {
// the normal join algorithm. // the normal join algorithm.
if (len > 0 && JoinStackPushInline(o)) { if (len > 0 && JoinStackPushInline(o)) {
try { try {
const result: JSAny = const result: Object =
ArrayJoin<T>(useToLocaleString, o, sep, len, locales, options); ArrayJoin<T>(useToLocaleString, o, sep, len, locales, options);
JoinStackPopInline(o); JoinStackPopInline(o);
return result; return result;
...@@ -551,9 +551,9 @@ namespace array_join { ...@@ -551,9 +551,9 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.join // https://tc39.github.io/ecma262/#sec-array.prototype.join
transitioning javascript builtin transitioning javascript builtin
ArrayPrototypeJoin(js-implicit context: Context, receiver: JSAny)( ArrayPrototypeJoin(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
const separator: JSAny = arguments[0]; const separator: Object = arguments[0];
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver); const o: JSReceiver = ToObject_Inline(context, receiver);
...@@ -571,9 +571,9 @@ namespace array_join { ...@@ -571,9 +571,9 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.tolocalestring // https://tc39.github.io/ecma262/#sec-array.prototype.tolocalestring
transitioning javascript builtin ArrayPrototypeToLocaleString( transitioning javascript builtin ArrayPrototypeToLocaleString(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
const locales: JSAny = arguments[0]; const locales: Object = arguments[0];
const options: JSAny = arguments[1]; const options: Object = arguments[1];
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject_Inline(context, receiver); const o: JSReceiver = ToObject_Inline(context, receiver);
...@@ -591,12 +591,12 @@ namespace array_join { ...@@ -591,12 +591,12 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-array.prototype.tostring // https://tc39.github.io/ecma262/#sec-array.prototype.tostring
transitioning javascript builtin ArrayPrototypeToString( transitioning javascript builtin ArrayPrototypeToString(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let array be ? ToObject(this value). // 1. Let array be ? ToObject(this value).
const array: JSReceiver = ToObject_Inline(context, receiver); const array: JSReceiver = ToObject_Inline(context, receiver);
// 2. Let func be ? Get(array, "join"). // 2. Let func be ? Get(array, "join").
const prop: JSAny = GetProperty(array, 'join'); const prop: Object = GetProperty(array, 'join');
try { try {
// 3. If IsCallable(func) is false, let func be the intrinsic function // 3. If IsCallable(func) is false, let func be the intrinsic function
// %ObjProto_toString%. // %ObjProto_toString%.
...@@ -612,8 +612,8 @@ namespace array_join { ...@@ -612,8 +612,8 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.join
transitioning javascript builtin TypedArrayPrototypeJoin( transitioning javascript builtin TypedArrayPrototypeJoin(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
const separator: JSAny = arguments[0]; const separator: Object = arguments[0];
// Spec: ValidateTypedArray is applied to the this value prior to evaluating // Spec: ValidateTypedArray is applied to the this value prior to evaluating
// the algorithm. // the algorithm.
...@@ -627,9 +627,9 @@ namespace array_join { ...@@ -627,9 +627,9 @@ namespace array_join {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.tolocalestring
transitioning javascript builtin TypedArrayPrototypeToLocaleString( transitioning javascript builtin TypedArrayPrototypeToLocaleString(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
const locales: JSAny = arguments[0]; const locales: Object = arguments[0];
const options: JSAny = arguments[1]; const options: Object = arguments[1];
// Spec: ValidateTypedArray is applied to the this value prior to evaluating // Spec: ValidateTypedArray is applied to the this value prior to evaluating
// the algorithm. // the algorithm.
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
namespace array_lastindexof { namespace array_lastindexof {
macro LoadWithHoleCheck<Elements: type>( macro LoadWithHoleCheck<Elements: type>(
elements: FixedArrayBase, index: Smi): JSAny elements: FixedArrayBase, index: Smi): Object
labels IfHole; labels IfHole;
LoadWithHoleCheck<FixedArray>(implicit context: Context)( LoadWithHoleCheck<FixedArray>(implicit context: Context)(
elements: FixedArrayBase, index: Smi): JSAny elements: FixedArrayBase, index: Smi): Object
labels IfHole { labels IfHole {
const elements: FixedArray = UnsafeCast<FixedArray>(elements); const elements: FixedArray = UnsafeCast<FixedArray>(elements);
const element: Object = elements.objects[index]; const element: Object = elements.objects[index];
if (element == TheHole) goto IfHole; if (element == TheHole) goto IfHole;
return UnsafeCast<JSAny>(element); return element;
} }
LoadWithHoleCheck<FixedDoubleArray>(implicit context: Context)( LoadWithHoleCheck<FixedDoubleArray>(implicit context: Context)(
elements: FixedArrayBase, index: Smi): JSAny elements: FixedArrayBase, index: Smi): Object
labels IfHole { labels IfHole {
const elements: FixedDoubleArray = UnsafeCast<FixedDoubleArray>(elements); const elements: FixedDoubleArray = UnsafeCast<FixedDoubleArray>(elements);
const element: float64 = LoadDoubleWithHoleCheck(elements, index) const element: float64 = LoadDoubleWithHoleCheck(elements, index)
...@@ -26,7 +26,7 @@ namespace array_lastindexof { ...@@ -26,7 +26,7 @@ namespace array_lastindexof {
} }
macro FastArrayLastIndexOf<Elements: type>( macro FastArrayLastIndexOf<Elements: type>(
context: Context, array: JSArray, from: Smi, searchElement: JSAny): Smi { context: Context, array: JSArray, from: Smi, searchElement: Object): Smi {
const elements: FixedArrayBase = array.elements; const elements: FixedArrayBase = array.elements;
let k: Smi = from; let k: Smi = from;
...@@ -40,7 +40,7 @@ namespace array_lastindexof { ...@@ -40,7 +40,7 @@ namespace array_lastindexof {
while (k >= 0) { while (k >= 0) {
try { try {
const element: JSAny = LoadWithHoleCheck<Elements>(elements, k) const element: Object = LoadWithHoleCheck<Elements>(elements, k)
otherwise Hole; otherwise Hole;
const same: Boolean = StrictEqual(searchElement, element); const same: Boolean = StrictEqual(searchElement, element);
...@@ -80,8 +80,8 @@ namespace array_lastindexof { ...@@ -80,8 +80,8 @@ namespace array_lastindexof {
} }
macro TryFastArrayLastIndexOf( macro TryFastArrayLastIndexOf(
context: Context, receiver: JSReceiver, searchElement: JSAny, context: Context, receiver: JSReceiver, searchElement: Object,
from: Number): JSAny from: Number): Object
labels Slow { labels Slow {
const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow; const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow;
const length: Smi = array.length; const length: Smi = array.length;
...@@ -99,8 +99,8 @@ namespace array_lastindexof { ...@@ -99,8 +99,8 @@ namespace array_lastindexof {
} }
transitioning macro GenericArrayLastIndexOf( transitioning macro GenericArrayLastIndexOf(
context: Context, object: JSReceiver, searchElement: JSAny, context: Context, object: JSReceiver, searchElement: Object,
from: Number): JSAny { from: Number): Object {
let k: Number = from; let k: Number = from;
// 7. Repeat, while k >= 0. // 7. Repeat, while k >= 0.
...@@ -111,7 +111,7 @@ namespace array_lastindexof { ...@@ -111,7 +111,7 @@ namespace array_lastindexof {
// b. If kPresent is true, then. // b. If kPresent is true, then.
if (kPresent == True) { if (kPresent == True) {
// i. Let elementK be ? Get(O, ! ToString(k)). // i. Let elementK be ? Get(O, ! ToString(k)).
const element: JSAny = GetProperty(object, k); const element: Object = GetProperty(object, k);
// ii. Let same be the result of performing Strict Equality Comparison // ii. Let same be the result of performing Strict Equality Comparison
// searchElement === elementK. // searchElement === elementK.
...@@ -131,7 +131,7 @@ namespace array_lastindexof { ...@@ -131,7 +131,7 @@ namespace array_lastindexof {
// https://tc39.github.io/ecma262/#sec-array.prototype.lastIndexOf // https://tc39.github.io/ecma262/#sec-array.prototype.lastIndexOf
transitioning javascript builtin ArrayPrototypeLastIndexOf( transitioning javascript builtin ArrayPrototypeLastIndexOf(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver); const object: JSReceiver = ToObject_Inline(context, receiver);
...@@ -144,7 +144,7 @@ namespace array_lastindexof { ...@@ -144,7 +144,7 @@ namespace array_lastindexof {
// Step 4 - 6. // Step 4 - 6.
const from: Number = GetFromIndex(context, length, arguments); const from: Number = GetFromIndex(context, length, arguments);
const searchElement: JSAny = arguments[0]; const searchElement: Object = arguments[0];
try { try {
return TryFastArrayLastIndexOf(context, object, searchElement, from) return TryFastArrayLastIndexOf(context, object, searchElement, from)
......
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
namespace array_map { namespace array_map {
transitioning javascript builtin transitioning javascript builtin
ArrayMapLoopEagerDeoptContinuation( ArrayMapLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, array: JSAny, initialK: JSAny, callback: Object, thisArg: Object, array: Object, initialK: Object,
length: JSAny): JSAny { length: Object): Object {
// All continuation points in the optimized filter implementation are // All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -28,9 +28,9 @@ namespace array_map { ...@@ -28,9 +28,9 @@ namespace array_map {
transitioning javascript builtin transitioning javascript builtin
ArrayMapLoopLazyDeoptContinuation( ArrayMapLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, array: JSAny, initialK: JSAny, callback: Object, thisArg: Object, array: Object, initialK: Object,
length: JSAny, result: JSAny): JSAny { length: Object, result: Object): Object {
// All continuation points in the optimized filter implementation are // All continuation points in the optimized filter implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -57,9 +57,9 @@ namespace array_map { ...@@ -57,9 +57,9 @@ namespace array_map {
} }
transitioning builtin ArrayMapLoopContinuation(implicit context: Context)( transitioning builtin ArrayMapLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
array: JSReceiver, o: JSReceiver, initialK: Number, array: JSReceiver, o: JSReceiver, initialK: Number,
length: Number): JSAny { length: Number): Object {
// 6. Let k be 0. // 6. Let k be 0.
// 7. Repeat, while k < len // 7. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) { for (let k: Number = initialK; k < length; k++) {
...@@ -73,10 +73,10 @@ namespace array_map { ...@@ -73,10 +73,10 @@ namespace array_map {
// 7c. If kPresent is true, then: // 7c. If kPresent is true, then:
if (kPresent == True) { if (kPresent == True) {
// i. Let kValue be ? Get(O, Pk). // i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, k); const kValue: Object = GetProperty(o, k);
// ii. Let mapped_value be ? Call(callbackfn, T, kValue, k, O). // ii. Let mapped_value be ? Call(callbackfn, T, kValue, k, O).
const mappedValue: JSAny = const mappedValue: Object =
Call(context, callbackfn, thisArg, kValue, k, o); Call(context, callbackfn, thisArg, kValue, k, o);
// iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mapped_value). // iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mapped_value).
...@@ -127,12 +127,12 @@ namespace array_map { ...@@ -127,12 +127,12 @@ namespace array_map {
SmiUntag(length), kAllowLargeObjectAllocation); SmiUntag(length), kAllowLargeObjectAllocation);
a = NewJSArray(map, this.fixedArray); a = NewJSArray(map, this.fixedArray);
for (let i: Smi = 0; i < validLength; i++) { for (let i: Smi = 0; i < validLength; i++) {
typeswitch ( typeswitch (this.fixedArray.objects[i]) {
UnsafeCast<(Number | TheHole)>(this.fixedArray.objects[i])) {
case (n: Number): { case (n: Number): {
elements.floats[i] = Convert<float64>(n); elements.floats[i] = Convert<float64>(n);
} }
case (TheHole): { case (h: HeapObject): {
assert(h == TheHole);
} }
} }
} }
...@@ -147,7 +147,7 @@ namespace array_map { ...@@ -147,7 +147,7 @@ namespace array_map {
return a; return a;
} }
StoreResult(implicit context: Context)(index: Smi, result: JSAny) { StoreResult(implicit context: Context)(index: Smi, result: Object) {
typeswitch (result) { typeswitch (result) {
case (s: Smi): { case (s: Smi): {
this.fixedArray.objects[index] = s; this.fixedArray.objects[index] = s;
...@@ -156,7 +156,7 @@ namespace array_map { ...@@ -156,7 +156,7 @@ namespace array_map {
this.onlySmis = false; this.onlySmis = false;
this.fixedArray.objects[index] = s; this.fixedArray.objects[index] = s;
} }
case (s: JSAnyNotNumber): { case (s: HeapObject): {
this.onlySmis = false; this.onlySmis = false;
this.onlyNumbers = false; this.onlyNumbers = false;
this.fixedArray.objects[index] = s; this.fixedArray.objects[index] = s;
...@@ -185,7 +185,7 @@ namespace array_map { ...@@ -185,7 +185,7 @@ namespace array_map {
transitioning macro FastArrayMap(implicit context: Context)( transitioning macro FastArrayMap(implicit context: Context)(
fastO: FastJSArrayForRead, len: Smi, callbackfn: Callable, fastO: FastJSArrayForRead, len: Smi, callbackfn: Callable,
thisArg: JSAny): JSArray thisArg: Object): JSArray
labels Bailout(JSArray, Smi) { labels Bailout(JSArray, Smi) {
let k: Smi = 0; let k: Smi = 0;
let fastOW = NewFastJSArrayForReadWitness(fastO); let fastOW = NewFastJSArrayForReadWitness(fastO);
...@@ -201,9 +201,9 @@ namespace array_map { ...@@ -201,9 +201,9 @@ namespace array_map {
if (k >= fastOW.Get().length) goto PrepareBailout(k); if (k >= fastOW.Get().length) goto PrepareBailout(k);
try { try {
const value: JSAny = fastOW.LoadElementNoHole(k) const value: Object = fastOW.LoadElementNoHole(k)
otherwise FoundHole; otherwise FoundHole;
const result: JSAny = const result: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
vector.StoreResult(k, result); vector.StoreResult(k, result);
} }
...@@ -224,7 +224,8 @@ namespace array_map { ...@@ -224,7 +224,8 @@ namespace array_map {
// https://tc39.github.io/ecma262/#sec-array.prototype.map // https://tc39.github.io/ecma262/#sec-array.prototype.map
transitioning javascript builtin transitioning javascript builtin
ArrayMap(js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { ArrayMap(js-implicit context: Context, receiver: Object)(...arguments):
Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.map'); RequireObjectCoercible(receiver, 'Array.prototype.map');
...@@ -240,7 +241,7 @@ namespace array_map { ...@@ -240,7 +241,7 @@ namespace array_map {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
let array: JSReceiver; let array: JSReceiver;
let k: Number = 0; let k: Number = 0;
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
namespace array_of { namespace array_of {
// https://tc39.github.io/ecma262/#sec-array.of // https://tc39.github.io/ecma262/#sec-array.of
transitioning javascript builtin transitioning javascript builtin
ArrayOf(js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { ArrayOf(js-implicit context: Context, receiver: Object)(...arguments):
Object {
// 1. Let len be the actual number of arguments passed to this function. // 1. Let len be the actual number of arguments passed to this function.
const len: Smi = Convert<Smi>(arguments.length); const len: Smi = Convert<Smi>(arguments.length);
...@@ -13,7 +14,7 @@ namespace array_of { ...@@ -13,7 +14,7 @@ namespace array_of {
const items: Arguments = arguments; const items: Arguments = arguments;
// 3. Let C be the this value. // 3. Let C be the this value.
const c: JSAny = receiver; const c: Object = receiver;
let a: JSReceiver; let a: JSReceiver;
...@@ -23,7 +24,7 @@ namespace array_of { ...@@ -23,7 +24,7 @@ namespace array_of {
// a. Let A be ? Construct(C, « len »). // a. Let A be ? Construct(C, « len »).
a = Construct(c, len); a = Construct(c, len);
} }
case (JSAny): { case (Object): {
// a. Let A be ? ArrayCreate(len). // a. Let A be ? ArrayCreate(len).
a = ArrayCreate(len); a = ArrayCreate(len);
} }
...@@ -35,7 +36,7 @@ namespace array_of { ...@@ -35,7 +36,7 @@ namespace array_of {
// 7. Repeat, while k < len // 7. Repeat, while k < len
while (k < len) { while (k < len) {
// a. Let kValue be items[k]. // a. Let kValue be items[k].
const kValue: JSAny = items[Convert<intptr>(k)]; const kValue: Object = items[Convert<intptr>(k)];
// b. Let Pk be ! ToString(k). // b. Let Pk be ! ToString(k).
// c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue). // c. Perform ? CreateDataPropertyOrThrow(A, Pk, kValue).
......
...@@ -6,13 +6,13 @@ namespace array { ...@@ -6,13 +6,13 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReduceRightPreLoopEagerDeoptContinuation( ArrayReduceRightPreLoopEagerDeoptContinuation(
js-implicit context: Context, js-implicit context: Context,
receiver: JSAny)(callback: JSAny, length: JSAny): JSAny { receiver: Object)(callback: Object, length: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -27,15 +27,15 @@ namespace array { ...@@ -27,15 +27,15 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReduceRightLoopEagerDeoptContinuation( ArrayReduceRightLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, initialK: JSAny, length: JSAny, callback: Object, initialK: Object, length: Object,
accumulator: JSAny): JSAny { accumulator: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -48,8 +48,9 @@ namespace array { ...@@ -48,8 +48,9 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReduceRightLoopLazyDeoptContinuation( ArrayReduceRightLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, initialK: JSAny, length: JSAny, result: JSAny): JSAny { callback: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -66,9 +67,8 @@ namespace array { ...@@ -66,9 +67,8 @@ namespace array {
transitioning builtin ArrayReduceRightLoopContinuation(implicit context: transitioning builtin ArrayReduceRightLoopContinuation(implicit context:
Context)( Context)(
_receiver: JSReceiver, callbackfn: Callable, _receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number, o: JSReceiver, initialK: Number, _length: Number): Object {
_length: Number): JSAny {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
// 8b and 9. Repeat, while k >= 0 // 8b and 9. Repeat, while k >= 0
...@@ -83,20 +83,16 @@ namespace array { ...@@ -83,20 +83,16 @@ namespace array {
// 8b iii and 9c. If kPresent is true, then // 8b iii and 9c. If kPresent is true, then
if (present == True) { if (present == True) {
// 8b iii and 9c i. Let kValue be ? Get(O, Pk). // 8b iii and 9c i. Let kValue be ? Get(O, Pk).
const value: JSAny = GetProperty(o, k); const value: Object = GetProperty(o, k);
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { // 8b iii 1.
// 8b iii 1. accumulator = value;
accumulator = value; } else {
} // 9c. ii. Set accumulator to ? Call(callbackfn, undefined,
case (accumulatorNotHole: JSAny): { // <accumulator, kValue, k, O>).
// 9c. ii. Set accumulator to ? Call(callbackfn, undefined, accumulator =
// <accumulator, kValue, k, O>). Call(context, callbackfn, Undefined, accumulator, value, k, o);
accumulator = Call(
context, callbackfn, Undefined, accumulatorNotHole, value, k,
o);
}
} }
} }
...@@ -106,20 +102,16 @@ namespace array { ...@@ -106,20 +102,16 @@ namespace array {
// 8c. if kPresent is false, throw a TypeError exception. // 8c. if kPresent is false, throw a TypeError exception.
// If the accumulator is discovered with the sentinel hole value, // If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false. // this means kPresent is false.
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
transitioning macro FastArrayReduceRight(implicit context: Context)( transitioning macro FastArrayReduceRight(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny initialAccumulator: Object): Object
labels Bailout(Number, JSAny | TheHole) { labels Bailout(Number, Object) {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator); const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator);
const fastO = Cast<FastJSArrayForRead>(o) const fastO = Cast<FastJSArrayForRead>(o)
...@@ -133,32 +125,25 @@ namespace array { ...@@ -133,32 +125,25 @@ namespace array {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k, accumulator); if (k >= fastOW.Get().length) goto Bailout(k, accumulator);
const value: JSAny = fastOW.LoadElementNoHole(k) otherwise continue; const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { accumulator = value;
accumulator = value; } else {
} accumulator = Call(
case (accumulatorNotHole: JSAny): { context, callbackfn, Undefined, accumulator, value, k,
accumulator = Call( fastOW.Get());
context, callbackfn, Undefined, accumulatorNotHole, value, k,
fastOW.Get());
}
} }
} }
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
// https://tc39.github.io/ecma262/#sec-array.prototype.reduceRight // https://tc39.github.io/ecma262/#sec-array.prototype.reduceRight
transitioning javascript builtin transitioning javascript builtin
ArrayReduceRight(js-implicit context: Context, receiver: JSAny)(...arguments): ArrayReduceRight(js-implicit context: Context, receiver: Object)(
JSAny { ...arguments): Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.reduceRight'); RequireObjectCoercible(receiver, 'Array.prototype.reduceRight');
...@@ -178,14 +163,14 @@ namespace array { ...@@ -178,14 +163,14 @@ namespace array {
// exception. (This case is handled at the end of // exception. (This case is handled at the end of
// ArrayReduceRightLoopContinuation). // ArrayReduceRightLoopContinuation).
const initialValue: JSAny | TheHole = const initialValue: Object =
arguments.length > 1 ? arguments[1] : TheHole; arguments.length > 1 ? arguments[1] : TheHole;
try { try {
return FastArrayReduceRight(o, len, callbackfn, initialValue) return FastArrayReduceRight(o, len, callbackfn, initialValue)
otherwise Bailout; otherwise Bailout;
} }
label Bailout(value: Number, accumulator: JSAny | TheHole) { label Bailout(value: Number, accumulator: Object) {
return ArrayReduceRightLoopContinuation( return ArrayReduceRightLoopContinuation(
o, callbackfn, accumulator, o, value, len); o, callbackfn, accumulator, o, value, len);
} }
......
...@@ -6,13 +6,13 @@ namespace array { ...@@ -6,13 +6,13 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReducePreLoopEagerDeoptContinuation( ArrayReducePreLoopEagerDeoptContinuation(
js-implicit context: Context, js-implicit context: Context,
receiver: JSAny)(callback: JSAny, length: JSAny): JSAny { receiver: Object)(callback: Object, length: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -27,15 +27,15 @@ namespace array { ...@@ -27,15 +27,15 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReduceLoopEagerDeoptContinuation( ArrayReduceLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, initialK: JSAny, length: JSAny, callback: Object, initialK: Object, length: Object,
accumulator: JSAny): JSAny { accumulator: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -48,8 +48,9 @@ namespace array { ...@@ -48,8 +48,9 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArrayReduceLoopLazyDeoptContinuation( ArrayReduceLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, initialK: JSAny, length: JSAny, result: JSAny): JSAny { callback: Object, initialK: Object, length: Object,
result: Object): Object {
// All continuation points in the optimized every implementation are // All continuation points in the optimized every implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -65,9 +66,8 @@ namespace array { ...@@ -65,9 +66,8 @@ namespace array {
} }
transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)( transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, _receiver: JSReceiver, callbackfn: Callable, initialAccumulator: Object,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number, o: JSReceiver, initialK: Number, length: Number): Object {
length: Number): JSAny {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
// 8b and 9. Repeat, while k < len // 8b and 9. Repeat, while k < len
...@@ -82,20 +82,16 @@ namespace array { ...@@ -82,20 +82,16 @@ namespace array {
// 6c. If kPresent is true, then // 6c. If kPresent is true, then
if (present == True) { if (present == True) {
// 6c. i. Let kValue be ? Get(O, Pk). // 6c. i. Let kValue be ? Get(O, Pk).
const value: JSAny = GetProperty(o, k); const value: Object = GetProperty(o, k);
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { // 8b.
// 8b. accumulator = value;
accumulator = value; } else {
} // 9c. ii. Set accumulator to ? Call(callbackfn, undefined,
case (accumulatorNotHole: JSAny): { // <accumulator, kValue, k, O>).
// 9c. ii. Set accumulator to ? Call(callbackfn, undefined, accumulator =
// <accumulator, kValue, k, O>). Call(context, callbackfn, Undefined, accumulator, value, k, o);
accumulator = Call(
context, callbackfn, Undefined, accumulatorNotHole, value, k,
o);
}
} }
} }
...@@ -105,20 +101,16 @@ namespace array { ...@@ -105,20 +101,16 @@ namespace array {
// 8c. if kPresent is false, throw a TypeError exception. // 8c. if kPresent is false, throw a TypeError exception.
// If the accumulator is discovered with the sentinel hole value, // If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false. // this means kPresent is false.
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
transitioning macro FastArrayReduce(implicit context: Context)( transitioning macro FastArrayReduce(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny initialAccumulator: Object): Object
labels Bailout(Number, JSAny | TheHole) { labels Bailout(Number, Object) {
const k = 0; const k = 0;
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
Cast<Smi>(len) otherwise goto Bailout(k, accumulator); Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
...@@ -133,32 +125,25 @@ namespace array { ...@@ -133,32 +125,25 @@ namespace array {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k, accumulator); if (k >= fastOW.Get().length) goto Bailout(k, accumulator);
const value: JSAny = fastOW.LoadElementNoHole(k) otherwise continue; const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { accumulator = value;
accumulator = value; } else {
} accumulator = Call(
case (accumulatorNotHole: JSAny): { context, callbackfn, Undefined, accumulator, value, k,
accumulator = Call( fastOW.Get());
context, callbackfn, Undefined, accumulatorNotHole, value, k,
fastOW.Get());
}
} }
} }
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
// https://tc39.github.io/ecma262/#sec-array.prototype.reduce // https://tc39.github.io/ecma262/#sec-array.prototype.reduce
transitioning javascript builtin transitioning javascript builtin
ArrayReduce(js-implicit context: Context, receiver: JSAny)(...arguments): ArrayReduce(js-implicit context: Context, receiver: Object)(...arguments):
JSAny { Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.reduce'); RequireObjectCoercible(receiver, 'Array.prototype.reduce');
...@@ -178,14 +163,14 @@ namespace array { ...@@ -178,14 +163,14 @@ namespace array {
// exception. (This case is handled at the end of // exception. (This case is handled at the end of
// ArrayReduceLoopContinuation). // ArrayReduceLoopContinuation).
const initialValue: JSAny | TheHole = const initialValue: Object =
arguments.length > 1 ? arguments[1] : TheHole; arguments.length > 1 ? arguments[1] : TheHole;
try { try {
return FastArrayReduce(o, len, callbackfn, initialValue) return FastArrayReduce(o, len, callbackfn, initialValue)
otherwise Bailout; otherwise Bailout;
} }
label Bailout(value: Number, accumulator: JSAny | TheHole) { label Bailout(value: Number, accumulator: Object) {
return ArrayReduceLoopContinuation( return ArrayReduceLoopContinuation(
o, callbackfn, accumulator, o, value, len); o, callbackfn, accumulator, o, value, len);
} }
......
...@@ -12,10 +12,10 @@ namespace array_reverse { ...@@ -12,10 +12,10 @@ namespace array_reverse {
return UnsafeCast<Smi>(elements.objects[index]); return UnsafeCast<Smi>(elements.objects[index]);
} }
LoadElement<array::FastPackedObjectElements, JSAny>( LoadElement<array::FastPackedObjectElements, Object>(
implicit context: Context)(elements: FixedArrayBase, index: Smi): JSAny { implicit context: Context)(elements: FixedArrayBase, index: Smi): Object {
const elements: FixedArray = UnsafeCast<FixedArray>(elements); const elements: FixedArray = UnsafeCast<FixedArray>(elements);
return UnsafeCast<JSAny>(elements.objects[index]); return elements.objects[index];
} }
LoadElement<array::FastPackedDoubleElements, float64>( LoadElement<array::FastPackedDoubleElements, float64>(
...@@ -38,9 +38,9 @@ namespace array_reverse { ...@@ -38,9 +38,9 @@ namespace array_reverse {
StoreFixedArrayElement(elems, index, value, SKIP_WRITE_BARRIER); StoreFixedArrayElement(elems, index, value, SKIP_WRITE_BARRIER);
} }
StoreElement<array::FastPackedObjectElements, JSAny>( StoreElement<array::FastPackedObjectElements, Object>(
implicit context: implicit context:
Context)(elements: FixedArrayBase, index: Smi, value: JSAny) { Context)(elements: FixedArrayBase, index: Smi, value: Object) {
const elements: FixedArray = UnsafeCast<FixedArray>(elements); const elements: FixedArray = UnsafeCast<FixedArray>(elements);
elements.objects[index] = value; elements.objects[index] = value;
} }
...@@ -70,8 +70,8 @@ namespace array_reverse { ...@@ -70,8 +70,8 @@ namespace array_reverse {
} }
} }
transitioning macro GenericArrayReverse(context: Context, receiver: JSAny): transitioning macro GenericArrayReverse(context: Context, receiver: Object):
JSAny { Object {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver); const object: JSReceiver = ToObject_Inline(context, receiver);
...@@ -89,8 +89,8 @@ namespace array_reverse { ...@@ -89,8 +89,8 @@ namespace array_reverse {
let upper: Number = length - 1; let upper: Number = length - 1;
while (lower < upper) { while (lower < upper) {
let lowerValue: JSAny = Undefined; let lowerValue: Object = Undefined;
let upperValue: JSAny = Undefined; let upperValue: Object = Undefined;
// b. Let upperP be ! ToString(upper). // b. Let upperP be ! ToString(upper).
// c. Let lowerP be ! ToString(lower). // c. Let lowerP be ! ToString(lower).
...@@ -142,7 +142,7 @@ namespace array_reverse { ...@@ -142,7 +142,7 @@ namespace array_reverse {
return object; return object;
} }
macro TryFastPackedArrayReverse(implicit context: Context)(receiver: JSAny) macro TryFastPackedArrayReverse(implicit context: Context)(receiver: Object)
labels Slow { labels Slow {
const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow; const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow;
...@@ -153,7 +153,7 @@ namespace array_reverse { ...@@ -153,7 +153,7 @@ namespace array_reverse {
array.elements, array.length); array.elements, array.length);
} else if (kind == PACKED_ELEMENTS) { } else if (kind == PACKED_ELEMENTS) {
array::EnsureWriteableFastElements(array); array::EnsureWriteableFastElements(array);
FastPackedArrayReverse<array::FastPackedObjectElements, JSAny>( FastPackedArrayReverse<array::FastPackedObjectElements, Object>(
array.elements, array.length); array.elements, array.length);
} else if (kind == PACKED_DOUBLE_ELEMENTS) { } else if (kind == PACKED_DOUBLE_ELEMENTS) {
FastPackedArrayReverse<array::FastPackedDoubleElements, float64>( FastPackedArrayReverse<array::FastPackedDoubleElements, float64>(
...@@ -165,7 +165,7 @@ namespace array_reverse { ...@@ -165,7 +165,7 @@ namespace array_reverse {
// https://tc39.github.io/ecma262/#sec-array.prototype.reverse // https://tc39.github.io/ecma262/#sec-array.prototype.reverse
transitioning javascript builtin ArrayPrototypeReverse( transitioning javascript builtin ArrayPrototypeReverse(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
try { try {
TryFastPackedArrayReverse(receiver) otherwise Baseline; TryFastPackedArrayReverse(receiver) otherwise Baseline;
return receiver; return receiver;
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
namespace array_shift { namespace array_shift {
extern builtin ArrayShift(Context, JSFunction, JSAny, int32): JSAny; extern builtin ArrayShift(Context, JSFunction, Object, int32): Object;
macro TryFastArrayShift(implicit context: Context)(receiver: JSAny): JSAny macro TryFastArrayShift(implicit context: Context)(receiver: Object): Object
labels Slow, Runtime { labels Slow, Runtime {
const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow; const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow;
let witness = NewFastJSArrayWitness(array); let witness = NewFastJSArrayWitness(array);
...@@ -37,7 +37,7 @@ namespace array_shift { ...@@ -37,7 +37,7 @@ namespace array_shift {
} }
transitioning macro GenericArrayShift(implicit context: transitioning macro GenericArrayShift(implicit context:
Context)(receiver: JSAny): JSAny { Context)(receiver: Object): Object {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver); const object: JSReceiver = ToObject_Inline(context, receiver);
...@@ -70,7 +70,7 @@ namespace array_shift { ...@@ -70,7 +70,7 @@ namespace array_shift {
// d. If fromPresent is true, then // d. If fromPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// i. Let fromVal be ? Get(O, from). // i. Let fromVal be ? Get(O, from).
const fromValue: JSAny = GetProperty(object, from); const fromValue: Object = GetProperty(object, from);
// ii. Perform ? Set(O, to, fromValue, true). // ii. Perform ? Set(O, to, fromValue, true).
SetProperty(object, to, fromValue); SetProperty(object, to, fromValue);
...@@ -95,7 +95,7 @@ namespace array_shift { ...@@ -95,7 +95,7 @@ namespace array_shift {
// https://tc39.github.io/ecma262/#sec-array.prototype.shift // https://tc39.github.io/ecma262/#sec-array.prototype.shift
transitioning javascript builtin ArrayPrototypeShift( transitioning javascript builtin ArrayPrototypeShift(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
try { try {
return TryFastArrayShift(receiver) otherwise Slow, Runtime; return TryFastArrayShift(receiver) otherwise Slow, Runtime;
} }
......
...@@ -63,9 +63,9 @@ namespace array_slice { ...@@ -63,9 +63,9 @@ namespace array_slice {
for (let current: Smi = start; current < to; ++current) { for (let current: Smi = start; current < to; ++current) {
const e: Object = const e: Object =
sloppyElements.objects[current + kSloppyArgumentsParameterMapStart]; sloppyElements.objects[current + kSloppyArgumentsParameterMapStart];
const newElement: JSAny = UnsafeCast<JSAny>( const newElement: Object = e != TheHole ?
e != TheHole ? argumentsContext[UnsafeCast<Smi>(e)] : argumentsContext[UnsafeCast<Smi>(e)] :
unmappedElements.objects[current]); unmappedElements.objects[current];
// It is safe to skip the write barrier here because resultElements was // It is safe to skip the write barrier here because resultElements was
// allocated together with result in a folded allocation. // allocated together with result in a folded allocation.
// TODO(tebbi): The verification of this fails at the moment due to // TODO(tebbi): The verification of this fails at the moment due to
...@@ -86,7 +86,7 @@ namespace array_slice { ...@@ -86,7 +86,7 @@ namespace array_slice {
} }
macro HandleFastSlice( macro HandleFastSlice(
context: Context, o: JSAny, startNumber: Number, context: Context, o: Object, startNumber: Number,
countNumber: Number): JSArray countNumber: Number): JSArray
labels Bailout { labels Bailout {
const start: Smi = Cast<Smi>(startNumber) otherwise Bailout; const start: Smi = Cast<Smi>(startNumber) otherwise Bailout;
...@@ -114,7 +114,7 @@ namespace array_slice { ...@@ -114,7 +114,7 @@ namespace array_slice {
otherwise Bailout; otherwise Bailout;
} }
} }
case (JSAny): { case (Object): {
} }
} }
goto Bailout; goto Bailout;
...@@ -122,15 +122,15 @@ namespace array_slice { ...@@ -122,15 +122,15 @@ namespace array_slice {
// https://tc39.github.io/ecma262/#sec-array.prototype.slice // https://tc39.github.io/ecma262/#sec-array.prototype.slice
transitioning javascript builtin transitioning javascript builtin
ArrayPrototypeSlice(js-implicit context: Context, receiver: JSAny)( ArrayPrototypeSlice(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
// Handle array cloning case if the receiver is a fast array. // Handle array cloning case if the receiver is a fast array.
if (arguments.length == 0) { if (arguments.length == 0) {
typeswitch (receiver) { typeswitch (receiver) {
case (a: FastJSArrayForCopy): { case (a: FastJSArrayForCopy): {
return CloneFastJSArray(context, a); return CloneFastJSArray(context, a);
} }
case (JSAny): { case (Object): {
} }
} }
} }
...@@ -142,7 +142,7 @@ namespace array_slice { ...@@ -142,7 +142,7 @@ namespace array_slice {
const len: Number = GetLengthProperty(o); const len: Number = GetLengthProperty(o);
// 3. Let relativeStart be ? ToInteger(start). // 3. Let relativeStart be ? ToInteger(start).
const start: JSAny = arguments[0]; const start: Object = arguments[0];
const relativeStart: Number = ToInteger_Inline(context, start); const relativeStart: Number = ToInteger_Inline(context, start);
// 4. If relativeStart < 0, let k be max((len + relativeStart), 0); // 4. If relativeStart < 0, let k be max((len + relativeStart), 0);
...@@ -152,7 +152,7 @@ namespace array_slice { ...@@ -152,7 +152,7 @@ namespace array_slice {
// 5. If end is undefined, let relativeEnd be len; // 5. If end is undefined, let relativeEnd be len;
// else let relativeEnd be ? ToInteger(end). // else let relativeEnd be ? ToInteger(end).
const end: JSAny = arguments[1]; const end: Object = arguments[1];
const relativeEnd: Number = const relativeEnd: Number =
end == Undefined ? len : ToInteger_Inline(context, end); end == Undefined ? len : ToInteger_Inline(context, end);
...@@ -193,7 +193,7 @@ namespace array_slice { ...@@ -193,7 +193,7 @@ namespace array_slice {
// c. If kPresent is true, then // c. If kPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// i. Let kValue be ? Get(O, Pk). // i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, pK); const kValue: Object = GetProperty(o, pK);
// ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(n), kValue). // ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(n), kValue).
FastCreateDataProperty(a, n, kValue); FastCreateDataProperty(a, n, kValue);
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
namespace array { namespace array {
transitioning javascript builtin transitioning javascript builtin
ArraySomeLoopEagerDeoptContinuation( ArraySomeLoopEagerDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny): JSAny { callback: Object, thisArg: Object, initialK: Object,
length: Object): Object {
// All continuation points in the optimized some implementation are // All continuation points in the optimized some implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
// //
// Also, this great mass of casts is necessary because the signature // Also, this great mass of casts is necessary because the signature
// of Torque javascript builtins requires JSAny type for all parameters // of Torque javascript builtins requires Object type for all parameters
// other than {context}. // other than {context}.
const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable; const jsreceiver = Cast<JSReceiver>(receiver) otherwise unreachable;
const callbackfn = Cast<Callable>(callback) otherwise unreachable; const callbackfn = Cast<Callable>(callback) otherwise unreachable;
...@@ -26,9 +27,9 @@ namespace array { ...@@ -26,9 +27,9 @@ namespace array {
transitioning javascript builtin transitioning javascript builtin
ArraySomeLoopLazyDeoptContinuation( ArraySomeLoopLazyDeoptContinuation(
js-implicit context: Context, receiver: JSAny)( js-implicit context: Context, receiver: Object)(
callback: JSAny, thisArg: JSAny, initialK: JSAny, length: JSAny, callback: Object, thisArg: Object, initialK: Object, length: Object,
result: JSAny): JSAny { result: Object): Object {
// All continuation points in the optimized some implementation are // All continuation points in the optimized some implementation are
// after the ToObject(O) call that ensures we are dealing with a // after the ToObject(O) call that ensures we are dealing with a
// JSReceiver. // JSReceiver.
...@@ -52,9 +53,9 @@ namespace array { ...@@ -52,9 +53,9 @@ namespace array {
} }
transitioning builtin ArraySomeLoopContinuation(implicit context: Context)( transitioning builtin ArraySomeLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, thisArg: JSAny, _receiver: JSReceiver, callbackfn: Callable, thisArg: Object,
_array: JSAny, o: JSReceiver, initialK: Number, length: Number, _array: Object, o: JSReceiver, initialK: Number, length: Number,
_initialTo: JSAny): JSAny { _initialTo: Object): Object {
// 5. Let k be 0. // 5. Let k be 0.
// 6. Repeat, while k < len // 6. Repeat, while k < len
for (let k: Number = initialK; k < length; k++) { for (let k: Number = initialK; k < length; k++) {
...@@ -68,10 +69,10 @@ namespace array { ...@@ -68,10 +69,10 @@ namespace array {
// 6c. If kPresent is true, then // 6c. If kPresent is true, then
if (kPresent == True) { if (kPresent == True) {
// 6c. i. Let kValue be ? Get(O, Pk). // 6c. i. Let kValue be ? Get(O, Pk).
const kValue: JSAny = GetProperty(o, k); const kValue: Object = GetProperty(o, k);
// 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>). // 6c. ii. Perform ? Call(callbackfn, T, <kValue, k, O>).
const result: JSAny = Call(context, callbackfn, thisArg, kValue, k, o); const result: Object = Call(context, callbackfn, thisArg, kValue, k, o);
// iii. If selected is true, then... // iii. If selected is true, then...
if (ToBoolean(result)) { if (ToBoolean(result)) {
...@@ -85,7 +86,7 @@ namespace array { ...@@ -85,7 +86,7 @@ namespace array {
} }
transitioning macro FastArraySome(implicit context: Context)( transitioning macro FastArraySome(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, thisArg: JSAny): JSAny o: JSReceiver, len: Number, callbackfn: Callable, thisArg: Object): Object
labels Bailout(Smi) { labels Bailout(Smi) {
let k: Smi = 0; let k: Smi = 0;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(k); const smiLen = Cast<Smi>(len) otherwise goto Bailout(k);
...@@ -98,8 +99,8 @@ namespace array { ...@@ -98,8 +99,8 @@ namespace array {
// Ensure that we haven't walked beyond a possibly updated length. // Ensure that we haven't walked beyond a possibly updated length.
if (k >= fastOW.Get().length) goto Bailout(k); if (k >= fastOW.Get().length) goto Bailout(k);
const value: JSAny = fastOW.LoadElementNoHole(k) otherwise continue; const value: Object = fastOW.LoadElementNoHole(k) otherwise continue;
const result: JSAny = const result: Object =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
if (ToBoolean(result)) { if (ToBoolean(result)) {
return True; return True;
...@@ -110,8 +111,8 @@ namespace array { ...@@ -110,8 +111,8 @@ namespace array {
// https://tc39.github.io/ecma262/#sec-array.prototype.some // https://tc39.github.io/ecma262/#sec-array.prototype.some
transitioning javascript builtin transitioning javascript builtin
ArraySome(js-implicit context: Context, receiver: JSAny)(...arguments): ArraySome(js-implicit context: Context, receiver: Object)(...arguments):
JSAny { Object {
try { try {
RequireObjectCoercible(receiver, 'Array.prototype.some'); RequireObjectCoercible(receiver, 'Array.prototype.some');
...@@ -128,7 +129,7 @@ namespace array { ...@@ -128,7 +129,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined; const thisArg: Object = arguments.length > 1 ? arguments[1] : Undefined;
// Special cases. // Special cases.
try { try {
......
...@@ -95,7 +95,7 @@ namespace array_splice { ...@@ -95,7 +95,7 @@ namespace array_splice {
const typedNewElements: FixedArrayType = const typedNewElements: FixedArrayType =
UnsafeCast<FixedArrayType>(a.elements); UnsafeCast<FixedArrayType>(a.elements);
for (let i: intptr = 2; i < args.length; ++i) { for (let i: intptr = 2; i < args.length; ++i) {
const e: JSAny = args[i]; const e: Object = args[i];
// The argument elements were already validated to be an appropriate // The argument elements were already validated to be an appropriate
// {ElementType} to store in {FixedArrayType}. // {ElementType} to store in {FixedArrayType}.
typedNewElements[k++] = UnsafeCast<ElementType>(e); typedNewElements[k++] = UnsafeCast<ElementType>(e);
...@@ -109,7 +109,7 @@ namespace array_splice { ...@@ -109,7 +109,7 @@ namespace array_splice {
transitioning macro FastArraySplice( transitioning macro FastArraySplice(
context: Context, args: Arguments, o: JSReceiver, context: Context, args: Arguments, o: JSReceiver,
originalLengthNumber: Number, actualStartNumber: Number, insertCount: Smi, originalLengthNumber: Number, actualStartNumber: Number, insertCount: Smi,
actualDeleteCountNumber: Number): JSAny actualDeleteCountNumber: Number): Object
labels Bailout { labels Bailout {
const originalLength: Smi = const originalLength: Smi =
Cast<Smi>(originalLengthNumber) otherwise Bailout; Cast<Smi>(originalLengthNumber) otherwise Bailout;
...@@ -132,7 +132,7 @@ namespace array_splice { ...@@ -132,7 +132,7 @@ namespace array_splice {
const oldElementsKind: ElementsKind = elementsKind; const oldElementsKind: ElementsKind = elementsKind;
for (let i: intptr = 2; i < args.length; ++i) { for (let i: intptr = 2; i < args.length; ++i) {
const e: JSAny = args[i]; const e: Object = args[i];
if (IsFastSmiElementsKind(elementsKind)) { if (IsFastSmiElementsKind(elementsKind)) {
if (TaggedIsNotSmi(e)) { if (TaggedIsNotSmi(e)) {
const heapObject: HeapObject = UnsafeCast<HeapObject>(e); const heapObject: HeapObject = UnsafeCast<HeapObject>(e);
...@@ -166,7 +166,7 @@ namespace array_splice { ...@@ -166,7 +166,7 @@ namespace array_splice {
} }
if (IsFastSmiOrTaggedElementsKind(elementsKind)) { if (IsFastSmiOrTaggedElementsKind(elementsKind)) {
FastSplice<FixedArray, JSAny>( FastSplice<FixedArray, Object>(
args, a, length, newLength, actualStart, insertCount, args, a, length, newLength, actualStart, insertCount,
actualDeleteCount); actualDeleteCount);
} else { } else {
...@@ -180,7 +180,7 @@ namespace array_splice { ...@@ -180,7 +180,7 @@ namespace array_splice {
transitioning macro FillDeletedElementsArray( transitioning macro FillDeletedElementsArray(
context: Context, o: JSReceiver, actualStart: Number, context: Context, o: JSReceiver, actualStart: Number,
actualDeleteCount: Number, a: JSReceiver): JSAny { actualDeleteCount: Number, a: JSReceiver): Object {
// 10. Let k be 0. // 10. Let k be 0.
let k: Number = 0; let k: Number = 0;
...@@ -195,7 +195,7 @@ namespace array_splice { ...@@ -195,7 +195,7 @@ namespace array_splice {
// c. If fromPresent is true, then // c. If fromPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// i. Let fromValue be ? Get(O, from). // i. Let fromValue be ? Get(O, from).
const fromValue: JSAny = GetProperty(o, from); const fromValue: Object = GetProperty(o, from);
// ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(k), fromValue). // ii. Perform ? CreateDataPropertyOrThrow(A, ! ToString(k), fromValue).
FastCreateDataProperty(a, k, fromValue); FastCreateDataProperty(a, k, fromValue);
...@@ -231,7 +231,7 @@ namespace array_splice { ...@@ -231,7 +231,7 @@ namespace array_splice {
// iv. If fromPresent is true, then // iv. If fromPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// 1. Let fromValue be ? Get(O, from). // 1. Let fromValue be ? Get(O, from).
const fromValue: JSAny = GetProperty(o, from); const fromValue: Object = GetProperty(o, from);
// 2. Perform ? Set(O, to, fromValue, true). // 2. Perform ? Set(O, to, fromValue, true).
SetProperty(o, to, fromValue); SetProperty(o, to, fromValue);
...@@ -280,7 +280,7 @@ namespace array_splice { ...@@ -280,7 +280,7 @@ namespace array_splice {
// iv. If fromPresent is true, then // iv. If fromPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// 1. Let fromValue be ? Get(O, from). // 1. Let fromValue be ? Get(O, from).
const fromValue: JSAny = GetProperty(o, from); const fromValue: Object = GetProperty(o, from);
// 2. Perform ? Set(O, to, fromValue, true). // 2. Perform ? Set(O, to, fromValue, true).
SetProperty(o, to, fromValue); SetProperty(o, to, fromValue);
...@@ -298,7 +298,8 @@ namespace array_splice { ...@@ -298,7 +298,8 @@ namespace array_splice {
transitioning macro SlowSplice( transitioning macro SlowSplice(
context: Context, arguments: Arguments, o: JSReceiver, len: Number, context: Context, arguments: Arguments, o: JSReceiver, len: Number,
actualStart: Number, insertCount: Smi, actualDeleteCount: Number): JSAny { actualStart: Number, insertCount: Smi,
actualDeleteCount: Number): Object {
// 9. Let A be ? ArraySpeciesCreate(O, actualDeleteCount). // 9. Let A be ? ArraySpeciesCreate(O, actualDeleteCount).
const a: JSReceiver = ArraySpeciesCreate(context, o, actualDeleteCount); const a: JSReceiver = ArraySpeciesCreate(context, o, actualDeleteCount);
const itemCount: Number = insertCount; const itemCount: Number = insertCount;
...@@ -331,7 +332,7 @@ namespace array_splice { ...@@ -331,7 +332,7 @@ namespace array_splice {
// element. // element.
if (arguments.length > 2) { if (arguments.length > 2) {
for (let i: intptr = 2; i < arguments.length; ++i) { for (let i: intptr = 2; i < arguments.length; ++i) {
const e: JSAny = arguments[i]; const e: Object = arguments[i];
// b. Perform ? Set(O, ! ToString(k), E, true). // b. Perform ? Set(O, ! ToString(k), E, true).
SetProperty(o, k, e); SetProperty(o, k, e);
...@@ -349,8 +350,8 @@ namespace array_splice { ...@@ -349,8 +350,8 @@ namespace array_splice {
// https://tc39.github.io/ecma262/#sec-array.prototype.splice // https://tc39.github.io/ecma262/#sec-array.prototype.splice
transitioning javascript builtin transitioning javascript builtin
ArrayPrototypeSplice(js-implicit context: Context, receiver: JSAny)( ArrayPrototypeSplice(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const o: JSReceiver = ToObject(context, receiver); const o: JSReceiver = ToObject(context, receiver);
...@@ -358,7 +359,7 @@ namespace array_splice { ...@@ -358,7 +359,7 @@ namespace array_splice {
const len: Number = GetLengthProperty(o); const len: Number = GetLengthProperty(o);
// 3. Let relativeStart be ? ToInteger(start). // 3. Let relativeStart be ? ToInteger(start).
const start: JSAny = arguments[0]; const start: Object = arguments[0];
const relativeStart: Number = ToInteger_Inline(context, start); const relativeStart: Number = ToInteger_Inline(context, start);
// 4. If relativeStart < 0, let actualStart be max((len + relativeStart), // 4. If relativeStart < 0, let actualStart be max((len + relativeStart),
...@@ -387,7 +388,7 @@ namespace array_splice { ...@@ -387,7 +388,7 @@ namespace array_splice {
// a. Let insertCount be the Number of actual arguments minus 2. // a. Let insertCount be the Number of actual arguments minus 2.
insertCount = Convert<Smi>(arguments.length) - 2; insertCount = Convert<Smi>(arguments.length) - 2;
// b. Let dc be ? ToInteger(deleteCount). // b. Let dc be ? ToInteger(deleteCount).
const deleteCount: JSAny = arguments[1]; const deleteCount: Object = arguments[1];
const dc: Number = ToInteger_Inline(context, deleteCount); const dc: Number = ToInteger_Inline(context, deleteCount);
// c. Let actualDeleteCount be min(max(dc, 0), len - actualStart). // c. Let actualDeleteCount be min(max(dc, 0), len - actualStart).
actualDeleteCount = Min(Max(dc, 0), len - actualStart); actualDeleteCount = Min(Max(dc, 0), len - actualStart);
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
// found in the LICENSE file. // found in the LICENSE file.
namespace array_unshift { namespace array_unshift {
extern builtin ArrayUnshift(Context, JSFunction, JSAny, int32): JSAny; extern builtin ArrayUnshift(Context, JSFunction, Object, int32): Object;
transitioning macro GenericArrayUnshift( transitioning macro GenericArrayUnshift(
context: Context, receiver: JSAny, arguments: Arguments): Number { context: Context, receiver: Object, arguments: Arguments): Number {
// 1. Let O be ? ToObject(this value). // 1. Let O be ? ToObject(this value).
const object: JSReceiver = ToObject_Inline(context, receiver); const object: JSReceiver = ToObject_Inline(context, receiver);
...@@ -40,7 +40,7 @@ namespace array_unshift { ...@@ -40,7 +40,7 @@ namespace array_unshift {
// iv. If fromPresent is true, then // iv. If fromPresent is true, then
if (fromPresent == True) { if (fromPresent == True) {
// 1. Let fromValue be ? Get(O, from). // 1. Let fromValue be ? Get(O, from).
const fromValue: JSAny = GetProperty(object, from); const fromValue: Object = GetProperty(object, from);
// 2. Perform ? Set(O, to, fromValue, true). // 2. Perform ? Set(O, to, fromValue, true).
SetProperty(object, to, fromValue); SetProperty(object, to, fromValue);
...@@ -78,7 +78,7 @@ namespace array_unshift { ...@@ -78,7 +78,7 @@ namespace array_unshift {
// https://tc39.github.io/ecma262/#sec-array.prototype.unshift // https://tc39.github.io/ecma262/#sec-array.prototype.unshift
transitioning javascript builtin ArrayPrototypeUnshift( transitioning javascript builtin ArrayPrototypeUnshift(
js-implicit context: Context, receiver: JSAny)(...arguments): JSAny { js-implicit context: Context, receiver: Object)(...arguments): Object {
try { try {
const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow; const array: FastJSArray = Cast<FastJSArray>(receiver) otherwise Slow;
array::EnsureWriteableFastElements(array); array::EnsureWriteableFastElements(array);
......
...@@ -32,15 +32,30 @@ namespace array { ...@@ -32,15 +32,30 @@ namespace array {
assert(array.elements.map != kCOWMap); assert(array.elements.map != kCOWMap);
} }
macro LoadElementOrUndefined(implicit context: macro IsJSArray(implicit context: Context)(o: Object): bool {
Context)(a: FixedArray, i: Smi): JSAny { typeswitch (o) {
const e = UnsafeCast<(JSAny | TheHole)>(a.objects[i]); case (JSArray): {
return ReplaceTheHoleWithUndefined(e); return true;
}
case (Object): {
return false;
}
}
}
macro LoadElementOrUndefined(a: FixedArray, i: Smi): Object {
const e: Object = a.objects[i];
return e == TheHole ? Undefined : e;
} }
macro LoadElementOrUndefined(a: FixedDoubleArray, i: Smi): NumberOrUndefined { macro LoadElementOrUndefined(a: FixedDoubleArray, i: Smi): NumberOrUndefined {
const f: float64 = LoadDoubleWithHoleCheck(a, i) otherwise return Undefined; try {
return AllocateHeapNumberWithValue(f); const f: float64 = LoadDoubleWithHoleCheck(a, i) otherwise IfHole;
return AllocateHeapNumberWithValue(f);
}
label IfHole {
return Undefined;
}
} }
macro StoreArrayHole(elements: FixedDoubleArray, k: Smi): void { macro StoreArrayHole(elements: FixedDoubleArray, k: Smi): void {
...@@ -51,5 +66,5 @@ namespace array { ...@@ -51,5 +66,5 @@ namespace array {
elements.objects[k] = TheHole; elements.objects[k] = TheHole;
} }
extern macro SetPropertyLength(implicit context: Context)(JSAny, Number); extern macro SetPropertyLength(implicit context: Context)(Object, Number);
} }
This diff is collapsed.
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
namespace boolean { namespace boolean {
javascript builtin javascript builtin
BooleanConstructor( BooleanConstructor(
js-implicit context: Context, receiver: JSAny, newTarget: JSAny, js-implicit context: Context, receiver: Object, newTarget: Object,
target: JSFunction)(...arguments): JSAny { target: JSFunction)(...arguments): Object {
const value = SelectBooleanConstant(ToBoolean(arguments[0])); const value = SelectBooleanConstant(ToBoolean(arguments[0]));
if (newTarget == Undefined) { if (newTarget == Undefined) {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace collections { namespace collections {
@export @export
macro LoadKeyValuePairNoSideEffects(implicit context: Context)(o: JSAny): macro LoadKeyValuePairNoSideEffects(implicit context: Context)(o: Object):
KeyValuePair labels MayHaveSideEffects { KeyValuePair labels MayHaveSideEffects {
typeswitch (o) { typeswitch (o) {
case (a: FastJSArray): { case (a: FastJSArray): {
...@@ -28,7 +28,7 @@ namespace collections { ...@@ -28,7 +28,7 @@ namespace collections {
Undefined Undefined
}; };
} }
case (FixedArrayBase): deferred { case (Object): deferred {
unreachable; unreachable;
} }
} }
...@@ -36,14 +36,14 @@ namespace collections { ...@@ -36,14 +36,14 @@ namespace collections {
case (JSReceiver): { case (JSReceiver): {
goto MayHaveSideEffects; goto MayHaveSideEffects;
} }
case (o: JSAny): deferred { case (o: Object): deferred {
ThrowTypeError(kIteratorValueNotAnObject, o); ThrowTypeError(kIteratorValueNotAnObject, o);
} }
} }
} }
@export @export
transitioning macro LoadKeyValuePair(implicit context: Context)(o: JSAny): transitioning macro LoadKeyValuePair(implicit context: Context)(o: Object):
KeyValuePair { KeyValuePair {
try { try {
return LoadKeyValuePairNoSideEffects(o) otherwise Generic; return LoadKeyValuePairNoSideEffects(o) otherwise Generic;
......
This diff is collapsed.
...@@ -3,22 +3,23 @@ ...@@ -3,22 +3,23 @@
// found in the LICENSE file. // found in the LICENSE file.
namespace extras_utils { namespace extras_utils {
extern runtime CreatePrivateSymbol(Context, JSAny): HeapObject; extern runtime CreatePrivateSymbol(Context, Object): HeapObject;
extern runtime PromiseMarkAsHandled(Context, JSAny): Undefined; extern runtime PromiseMarkAsHandled(Context, Object): Undefined;
extern runtime PromiseStatus(Context, JSAny): Smi; extern runtime PromiseStatus(Context, Object): Smi;
javascript builtin ExtrasUtilsCreatePrivateSymbol( javascript builtin ExtrasUtilsCreatePrivateSymbol(
js-implicit context: Context, receiver: JSAny)(...arguments): HeapObject { js-implicit context: Context,
receiver: Object)(...arguments): HeapObject {
return CreatePrivateSymbol(context, arguments[0]); return CreatePrivateSymbol(context, arguments[0]);
} }
javascript builtin ExtrasUtilsMarkPromiseAsHandled( javascript builtin ExtrasUtilsMarkPromiseAsHandled(
js-implicit context: Context, receiver: JSAny)(...arguments): Undefined { js-implicit context: Context, receiver: Object)(...arguments): Undefined {
return PromiseMarkAsHandled(context, arguments[0]); return PromiseMarkAsHandled(context, arguments[0]);
} }
javascript builtin ExtrasUtilsPromiseState( javascript builtin ExtrasUtilsPromiseState(
js-implicit context: Context, receiver: JSAny)(...arguments): Smi { js-implicit context: Context, receiver: Object)(...arguments): Smi {
return PromiseStatus(context, arguments[0]); return PromiseStatus(context, arguments[0]);
} }
} }
...@@ -51,7 +51,7 @@ namespace internal_coverage { ...@@ -51,7 +51,7 @@ namespace internal_coverage {
} }
builtin IncBlockCounter(implicit context: Context)( builtin IncBlockCounter(implicit context: Context)(
function: JSFunction, coverageArraySlotIndex: Smi): Undefined { function: JSFunction, coverageArraySlotIndex: Smi): Object {
// It's quite possible that a function contains IncBlockCounter bytecodes, // It's quite possible that a function contains IncBlockCounter bytecodes,
// but no coverage info exists. This happens e.g. by selecting the // but no coverage info exists. This happens e.g. by selecting the
// best-effort coverage collection mode, which triggers deletion of all // best-effort coverage collection mode, which triggers deletion of all
......
...@@ -11,13 +11,13 @@ namespace iterator { ...@@ -11,13 +11,13 @@ namespace iterator {
object: JSReceiver; object: JSReceiver;
// iteratorRecord.[[NextMethod]] // iteratorRecord.[[NextMethod]]
next: JSAny; next: Object;
} }
extern macro IteratorBuiltinsAssembler::GetIteratorMethod( extern macro IteratorBuiltinsAssembler::GetIteratorMethod(
implicit context: Context)(JSAny): JSAny; implicit context: Context)(Object): Object;
extern macro IteratorBuiltinsAssembler::GetIterator( extern macro IteratorBuiltinsAssembler::GetIterator(
implicit context: Context)(JSAny): IteratorRecord; implicit context: Context)(Object): IteratorRecord;
extern macro IteratorBuiltinsAssembler::IteratorStep( extern macro IteratorBuiltinsAssembler::IteratorStep(
implicit context: Context)(IteratorRecord): JSReceiver implicit context: Context)(IteratorRecord): JSReceiver
...@@ -27,18 +27,18 @@ namespace iterator { ...@@ -27,18 +27,18 @@ namespace iterator {
labels Done; labels Done;
extern macro IteratorBuiltinsAssembler::IteratorValue( extern macro IteratorBuiltinsAssembler::IteratorValue(
implicit context: Context)(JSReceiver): JSAny; implicit context: Context)(JSReceiver): Object;
extern macro IteratorBuiltinsAssembler::IteratorValue( extern macro IteratorBuiltinsAssembler::IteratorValue(
implicit context: Context)(JSReceiver, Map): JSAny; implicit context: Context)(JSReceiver, Map): Object;
extern macro IteratorBuiltinsAssembler::IteratorCloseOnException( extern macro IteratorBuiltinsAssembler::IteratorCloseOnException(
implicit context: Context)(IteratorRecord, JSAny): never; implicit context: Context)(IteratorRecord, Object): never;
extern macro IteratorBuiltinsAssembler::IterableToList( extern macro IteratorBuiltinsAssembler::IterableToList(
implicit context: Context)(JSAny, JSAny): JSArray; implicit context: Context)(Object, Object): JSArray;
extern builtin IterableToListMayPreserveHoles(implicit context: extern builtin IterableToListMayPreserveHoles(implicit context:
Context)(JSAny, JSAny); Context)(Object, Object);
extern builtin IterableToListWithSymbolLookup(implicit context: extern builtin IterableToListWithSymbolLookup(implicit context:
Context)(JSAny); Context)(Object);
} }
...@@ -7,7 +7,7 @@ namespace math { ...@@ -7,7 +7,7 @@ namespace math {
extern macro Float64Acos(float64): float64; extern macro Float64Acos(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAcos(context: Context, _receiver: JSAny, x: JSAny): Number { MathAcos(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Acos(value)); return Convert<Number>(Float64Acos(value));
} }
...@@ -16,7 +16,7 @@ namespace math { ...@@ -16,7 +16,7 @@ namespace math {
extern macro Float64Acosh(float64): float64; extern macro Float64Acosh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAcosh(context: Context, _receiver: JSAny, x: JSAny): Number { MathAcosh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Acosh(value)); return Convert<Number>(Float64Acosh(value));
} }
...@@ -25,7 +25,7 @@ namespace math { ...@@ -25,7 +25,7 @@ namespace math {
extern macro Float64Asin(float64): float64; extern macro Float64Asin(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAsin(context: Context, _receiver: JSAny, x: JSAny): Number { MathAsin(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Asin(value)); return Convert<Number>(Float64Asin(value));
} }
...@@ -34,7 +34,7 @@ namespace math { ...@@ -34,7 +34,7 @@ namespace math {
extern macro Float64Asinh(float64): float64; extern macro Float64Asinh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAsinh(context: Context, _receiver: JSAny, x: JSAny): Number { MathAsinh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Asinh(value)); return Convert<Number>(Float64Asinh(value));
} }
...@@ -43,7 +43,7 @@ namespace math { ...@@ -43,7 +43,7 @@ namespace math {
extern macro Float64Atan(float64): float64; extern macro Float64Atan(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAtan(context: Context, _receiver: JSAny, x: JSAny): Number { MathAtan(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Atan(value)); return Convert<Number>(Float64Atan(value));
} }
...@@ -52,7 +52,7 @@ namespace math { ...@@ -52,7 +52,7 @@ namespace math {
extern macro Float64Atan2(float64, float64): float64; extern macro Float64Atan2(float64, float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAtan2(context: Context, _receiver: JSAny, y: JSAny, x: JSAny): Number { MathAtan2(context: Context, _receiver: Object, y: Object, x: Object): Number {
const yValue = Convert<float64>(ToNumber_Inline(context, y)); const yValue = Convert<float64>(ToNumber_Inline(context, y));
const xValue = Convert<float64>(ToNumber_Inline(context, x)); const xValue = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Atan2(yValue, xValue)); return Convert<Number>(Float64Atan2(yValue, xValue));
...@@ -62,7 +62,7 @@ namespace math { ...@@ -62,7 +62,7 @@ namespace math {
extern macro Float64Atanh(float64): float64; extern macro Float64Atanh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathAtanh(context: Context, _receiver: JSAny, x: JSAny): Number { MathAtanh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Atanh(value)); return Convert<Number>(Float64Atanh(value));
} }
...@@ -71,7 +71,7 @@ namespace math { ...@@ -71,7 +71,7 @@ namespace math {
extern macro Float64Cbrt(float64): float64; extern macro Float64Cbrt(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathCbrt(context: Context, _receiver: JSAny, x: JSAny): Number { MathCbrt(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Cbrt(value)); return Convert<Number>(Float64Cbrt(value));
} }
...@@ -80,7 +80,7 @@ namespace math { ...@@ -80,7 +80,7 @@ namespace math {
extern macro Word32Clz(int32): int32; extern macro Word32Clz(int32): int32;
transitioning javascript builtin transitioning javascript builtin
MathClz32(context: Context, _receiver: JSAny, x: JSAny): Number { MathClz32(context: Context, _receiver: Object, x: Object): Number {
const num = ToNumber_Inline(context, x); const num = ToNumber_Inline(context, x);
let value: int32; let value: int32;
...@@ -100,7 +100,7 @@ namespace math { ...@@ -100,7 +100,7 @@ namespace math {
extern macro Float64Cos(float64): float64; extern macro Float64Cos(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathCos(context: Context, _receiver: JSAny, x: JSAny): Number { MathCos(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Cos(value)); return Convert<Number>(Float64Cos(value));
} }
...@@ -109,7 +109,7 @@ namespace math { ...@@ -109,7 +109,7 @@ namespace math {
extern macro Float64Cosh(float64): float64; extern macro Float64Cosh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathCosh(context: Context, _receiver: JSAny, x: JSAny): Number { MathCosh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Cosh(value)); return Convert<Number>(Float64Cosh(value));
} }
...@@ -118,7 +118,7 @@ namespace math { ...@@ -118,7 +118,7 @@ namespace math {
extern macro Float64Exp(float64): float64; extern macro Float64Exp(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathExp(context: Context, _receiver: JSAny, x: JSAny): Number { MathExp(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Exp(value)); return Convert<Number>(Float64Exp(value));
} }
...@@ -127,14 +127,14 @@ namespace math { ...@@ -127,14 +127,14 @@ namespace math {
extern macro Float64Expm1(float64): float64; extern macro Float64Expm1(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathExpm1(context: Context, _receiver: JSAny, x: JSAny): Number { MathExpm1(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Expm1(value)); return Convert<Number>(Float64Expm1(value));
} }
// ES6 #sec-math.fround // ES6 #sec-math.fround
transitioning javascript builtin transitioning javascript builtin
MathFround(context: Context, _receiver: JSAny, x: JSAny): Number { MathFround(context: Context, _receiver: Object, x: Object): Number {
const x32 = Convert<float32>(ToNumber_Inline(context, x)); const x32 = Convert<float32>(ToNumber_Inline(context, x));
const x64 = Convert<float64>(x32); const x64 = Convert<float64>(x32);
return Convert<Number>(x64); return Convert<Number>(x64);
...@@ -144,7 +144,7 @@ namespace math { ...@@ -144,7 +144,7 @@ namespace math {
extern macro Float64Log(float64): float64; extern macro Float64Log(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathLog(context: Context, _receiver: JSAny, x: JSAny): Number { MathLog(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Log(value)); return Convert<Number>(Float64Log(value));
} }
...@@ -153,7 +153,7 @@ namespace math { ...@@ -153,7 +153,7 @@ namespace math {
extern macro Float64Log1p(float64): float64; extern macro Float64Log1p(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathLog1p(context: Context, _receiver: JSAny, x: JSAny): Number { MathLog1p(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Log1p(value)); return Convert<Number>(Float64Log1p(value));
} }
...@@ -162,7 +162,7 @@ namespace math { ...@@ -162,7 +162,7 @@ namespace math {
extern macro Float64Log10(float64): float64; extern macro Float64Log10(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathLog10(context: Context, _receiver: JSAny, x: JSAny): Number { MathLog10(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Log10(value)); return Convert<Number>(Float64Log10(value));
} }
...@@ -171,7 +171,7 @@ namespace math { ...@@ -171,7 +171,7 @@ namespace math {
extern macro Float64Log2(float64): float64; extern macro Float64Log2(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathLog2(context: Context, _receiver: JSAny, x: JSAny): Number { MathLog2(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Log2(value)); return Convert<Number>(Float64Log2(value));
} }
...@@ -180,14 +180,14 @@ namespace math { ...@@ -180,14 +180,14 @@ namespace math {
extern macro Float64Sin(float64): float64; extern macro Float64Sin(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathSin(context: Context, _receiver: JSAny, x: JSAny): Number { MathSin(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Sin(value)); return Convert<Number>(Float64Sin(value));
} }
// ES6 #sec-math.sign // ES6 #sec-math.sign
transitioning javascript builtin transitioning javascript builtin
MathSign(context: Context, _receiver: JSAny, x: JSAny): Number { MathSign(context: Context, _receiver: Object, x: Object): Number {
const num = ToNumber_Inline(context, x); const num = ToNumber_Inline(context, x);
const value = Convert<float64>(num); const value = Convert<float64>(num);
...@@ -204,7 +204,7 @@ namespace math { ...@@ -204,7 +204,7 @@ namespace math {
extern macro Float64Sinh(float64): float64; extern macro Float64Sinh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathSinh(context: Context, _receiver: JSAny, x: JSAny): Number { MathSinh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Sinh(value)); return Convert<Number>(Float64Sinh(value));
} }
...@@ -213,7 +213,7 @@ namespace math { ...@@ -213,7 +213,7 @@ namespace math {
extern macro Float64Sqrt(float64): float64; extern macro Float64Sqrt(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathSqrt(context: Context, _receiver: JSAny, x: JSAny): Number { MathSqrt(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Sqrt(value)); return Convert<Number>(Float64Sqrt(value));
} }
...@@ -222,7 +222,7 @@ namespace math { ...@@ -222,7 +222,7 @@ namespace math {
extern macro Float64Tan(float64): float64; extern macro Float64Tan(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathTan(context: Context, _receiver: JSAny, x: JSAny): Number { MathTan(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Tan(value)); return Convert<Number>(Float64Tan(value));
} }
...@@ -231,7 +231,7 @@ namespace math { ...@@ -231,7 +231,7 @@ namespace math {
extern macro Float64Tanh(float64): float64; extern macro Float64Tanh(float64): float64;
transitioning javascript builtin transitioning javascript builtin
MathTanh(context: Context, _receiver: JSAny, x: JSAny): Number { MathTanh(context: Context, _receiver: Object, x: Object): Number {
const value = Convert<float64>(ToNumber_Inline(context, x)); const value = Convert<float64>(ToNumber_Inline(context, x));
return Convert<Number>(Float64Tanh(value)); return Convert<Number>(Float64Tanh(value));
} }
...@@ -240,7 +240,7 @@ namespace math { ...@@ -240,7 +240,7 @@ namespace math {
// ES6 #sec-math.hypot // ES6 #sec-math.hypot
transitioning javascript builtin transitioning javascript builtin
MathHypot(js-implicit context: Context, receiver: JSAny)(...arguments): MathHypot(js-implicit context: Context, receiver: Object)(...arguments):
Number { Number {
const length = arguments.length; const length = arguments.length;
if (length == 0) { if (length == 0) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
namespace object { namespace object {
transitioning macro ObjectFromEntriesFastCase(implicit context: Context)( transitioning macro ObjectFromEntriesFastCase(implicit context: Context)(
iterable: JSAny): JSObject labels IfSlow { iterable: Object): JSObject labels IfSlow {
typeswitch (iterable) { typeswitch (iterable) {
case (array: FastJSArrayWithNoCustomIteration): { case (array: FastJSArrayWithNoCustomIteration): {
const elements: FixedArray = const elements: FixedArray =
...@@ -14,7 +14,7 @@ namespace object { ...@@ -14,7 +14,7 @@ namespace object {
const result: JSObject = NewJSObject(); const result: JSObject = NewJSObject();
for (let k: Smi = 0; k < length; ++k) { for (let k: Smi = 0; k < length; ++k) {
const value: JSAny = array::LoadElementOrUndefined(elements, k); const value: Object = array::LoadElementOrUndefined(elements, k);
const pair: KeyValuePair = const pair: KeyValuePair =
collections::LoadKeyValuePairNoSideEffects(value) collections::LoadKeyValuePairNoSideEffects(value)
otherwise IfSlow; otherwise IfSlow;
...@@ -26,16 +26,16 @@ namespace object { ...@@ -26,16 +26,16 @@ namespace object {
} }
return result; return result;
} }
case (JSAny): { case (Object): {
goto IfSlow; goto IfSlow;
} }
} }
} }
transitioning javascript builtin transitioning javascript builtin
ObjectFromEntries(js-implicit context: Context, receiver: JSAny)( ObjectFromEntries(js-implicit context: Context, receiver: Object)(
...arguments): JSAny { ...arguments): Object {
const iterable: JSAny = arguments[0]; const iterable: Object = arguments[0];
try { try {
if (IsNullOrUndefined(iterable)) goto Throw; if (IsNullOrUndefined(iterable)) goto Throw;
return ObjectFromEntriesFastCase(iterable) otherwise IfSlow; return ObjectFromEntriesFastCase(iterable) otherwise IfSlow;
...@@ -50,7 +50,7 @@ namespace object { ...@@ -50,7 +50,7 @@ namespace object {
const step: JSReceiver = const step: JSReceiver =
iterator::IteratorStep(i, fastIteratorResultMap) iterator::IteratorStep(i, fastIteratorResultMap)
otherwise return result; otherwise return result;
const iteratorValue: JSAny = const iteratorValue: Object =
iterator::IteratorValue(step, fastIteratorResultMap); iterator::IteratorValue(step, fastIteratorResultMap);
const pair: KeyValuePair = const pair: KeyValuePair =
collections::LoadKeyValuePair(iteratorValue); collections::LoadKeyValuePair(iteratorValue);
......
...@@ -4,31 +4,31 @@ ...@@ -4,31 +4,31 @@
namespace runtime { namespace runtime {
extern transitioning runtime extern transitioning runtime
ObjectIsExtensible(implicit context: Context)(JSAny): JSAny; ObjectIsExtensible(implicit context: Context)(Object): Object;
extern transitioning runtime extern transitioning runtime
JSReceiverPreventExtensionsThrow(implicit context: Context)(JSReceiver): JSReceiverPreventExtensionsThrow(implicit context: Context)(JSReceiver):
JSAny; Object;
extern transitioning runtime extern transitioning runtime
JSReceiverPreventExtensionsDontThrow(implicit context: Context)(JSReceiver): JSReceiverPreventExtensionsDontThrow(implicit context: Context)(JSReceiver):
JSAny; Object;
extern transitioning runtime extern transitioning runtime
JSReceiverGetPrototypeOf(implicit context: Context)(JSReceiver): JSAny; JSReceiverGetPrototypeOf(implicit context: Context)(JSReceiver): Object;
extern transitioning runtime extern transitioning runtime
JSReceiverSetPrototypeOfThrow(implicit context: Context)(JSReceiver, JSAny): JSReceiverSetPrototypeOfThrow(implicit context: Context)(JSReceiver, Object):
JSAny; Object;
extern transitioning runtime extern transitioning runtime
JSReceiverSetPrototypeOfDontThrow(implicit context: JSReceiverSetPrototypeOfDontThrow(implicit context:
Context)(JSReceiver, JSAny): JSAny; Context)(JSReceiver, Object): Object;
} // namespace runtime } // namespace runtime
namespace object { namespace object {
transitioning macro transitioning macro
ObjectIsExtensible(implicit context: Context)(object: JSAny): JSAny { ObjectIsExtensible(implicit context: Context)(object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::ObjectIsExtensible(objectJSReceiver); otherwise return runtime::ObjectIsExtensible(objectJSReceiver);
...@@ -36,8 +36,8 @@ namespace object { ...@@ -36,8 +36,8 @@ namespace object {
} }
transitioning macro transitioning macro
ObjectPreventExtensionsThrow(implicit context: Context)(object: JSAny): ObjectPreventExtensionsThrow(implicit context: Context)(object: Object):
JSAny { Object {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverPreventExtensionsThrow( otherwise return runtime::JSReceiverPreventExtensionsThrow(
...@@ -47,8 +47,8 @@ namespace object { ...@@ -47,8 +47,8 @@ namespace object {
} }
transitioning macro transitioning macro
ObjectPreventExtensionsDontThrow(implicit context: Context)(object: JSAny): ObjectPreventExtensionsDontThrow(implicit context: Context)(object: Object):
JSAny { Object {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverPreventExtensionsDontThrow( otherwise return runtime::JSReceiverPreventExtensionsDontThrow(
...@@ -57,14 +57,14 @@ namespace object { ...@@ -57,14 +57,14 @@ namespace object {
} }
transitioning macro transitioning macro
ObjectGetPrototypeOf(implicit context: Context)(object: JSAny): JSAny { ObjectGetPrototypeOf(implicit context: Context)(object: Object): Object {
const objectJSReceiver: JSReceiver = ToObject_Inline(context, object); const objectJSReceiver: JSReceiver = ToObject_Inline(context, object);
return object::JSReceiverGetPrototypeOf(objectJSReceiver); return object::JSReceiverGetPrototypeOf(objectJSReceiver);
} }
transitioning macro transitioning macro
JSReceiverGetPrototypeOf(implicit context: Context)(object: JSReceiver): JSReceiverGetPrototypeOf(implicit context: Context)(object: JSReceiver):
JSAny { Object {
const objectJSProxy = Cast<JSProxy>(object) const objectJSProxy = Cast<JSProxy>(object)
otherwise return runtime::JSReceiverGetPrototypeOf(object); otherwise return runtime::JSReceiverGetPrototypeOf(object);
return proxy::ProxyGetPrototypeOf(objectJSProxy); return proxy::ProxyGetPrototypeOf(objectJSProxy);
...@@ -72,7 +72,7 @@ namespace object { ...@@ -72,7 +72,7 @@ namespace object {
transitioning macro transitioning macro
ObjectSetPrototypeOfThrow(implicit context: Context)( ObjectSetPrototypeOfThrow(implicit context: Context)(
object: JSAny, proto: JSReceiver | Null): JSAny { object: Object, proto: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfThrow( otherwise return runtime::JSReceiverSetPrototypeOfThrow(
...@@ -83,7 +83,7 @@ namespace object { ...@@ -83,7 +83,7 @@ namespace object {
transitioning macro transitioning macro
ObjectSetPrototypeOfDontThrow(implicit context: Context)( ObjectSetPrototypeOfDontThrow(implicit context: Context)(
object: JSAny, proto: JSReceiver | Null): JSAny { object: Object, proto: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfDontThrow( otherwise return runtime::JSReceiverSetPrototypeOfDontThrow(
...@@ -95,7 +95,7 @@ namespace object { ...@@ -95,7 +95,7 @@ namespace object {
namespace object_isextensible { namespace object_isextensible {
// ES6 section 19.1.2.11 Object.isExtensible ( O ) // ES6 section 19.1.2.11 Object.isExtensible ( O )
transitioning javascript builtin ObjectIsExtensible( transitioning javascript builtin ObjectIsExtensible(
js-implicit context: Context)(_receiver: JSAny, object: JSAny): JSAny { js-implicit context: Context)(_receiver: Object, object: Object): Object {
return object::ObjectIsExtensible(object); return object::ObjectIsExtensible(object);
} }
} // namespace object_isextensible } // namespace object_isextensible
...@@ -103,7 +103,7 @@ namespace object_isextensible { ...@@ -103,7 +103,7 @@ namespace object_isextensible {
namespace object_preventextensions { namespace object_preventextensions {
// ES6 section 19.1.2.11 Object.isExtensible ( O ) // ES6 section 19.1.2.11 Object.isExtensible ( O )
transitioning javascript builtin ObjectPreventExtensions( transitioning javascript builtin ObjectPreventExtensions(
js-implicit context: Context)(_receiver: JSAny, object: JSAny): JSAny { js-implicit context: Context)(_receiver: Object, object: Object): Object {
return object::ObjectPreventExtensionsThrow(object); return object::ObjectPreventExtensionsThrow(object);
} }
} // namespace object_preventextensions } // namespace object_preventextensions
...@@ -111,7 +111,7 @@ namespace object_preventextensions { ...@@ -111,7 +111,7 @@ namespace object_preventextensions {
namespace object_getprototypeof { namespace object_getprototypeof {
// ES6 section 19.1.2.9 Object.getPrototypeOf ( O ) // ES6 section 19.1.2.9 Object.getPrototypeOf ( O )
transitioning javascript builtin ObjectGetPrototypeOf( transitioning javascript builtin ObjectGetPrototypeOf(
js-implicit context: Context)(_receiver: JSAny, object: JSAny): JSAny { js-implicit context: Context)(_receiver: Object, object: Object): Object {
return object::ObjectGetPrototypeOf(object); return object::ObjectGetPrototypeOf(object);
} }
} // namespace object_getprototypeof } // namespace object_getprototypeof
...@@ -120,7 +120,7 @@ namespace object_setprototypeof { ...@@ -120,7 +120,7 @@ namespace object_setprototypeof {
// ES6 section 19.1.2.21 Object.setPrototypeOf ( O, proto ) // ES6 section 19.1.2.21 Object.setPrototypeOf ( O, proto )
transitioning javascript builtin ObjectSetPrototypeOf( transitioning javascript builtin ObjectSetPrototypeOf(
js-implicit context: js-implicit context:
Context)(_receiver: JSAny, object: JSAny, proto: JSAny): JSAny { Context)(_receiver: Object, object: Object, proto: Object): Object {
// 1. Set O to ? RequireObjectCoercible(O). // 1. Set O to ? RequireObjectCoercible(O).
RequireObjectCoercible(object, 'Object.setPrototypeOf'); RequireObjectCoercible(object, 'Object.setPrototypeOf');
...@@ -130,13 +130,9 @@ namespace object_setprototypeof { ...@@ -130,13 +130,9 @@ namespace object_setprototypeof {
// 4. Let status be ? O.[[SetPrototypeOf]](proto). // 4. Let status be ? O.[[SetPrototypeOf]](proto).
// 5. If status is false, throw a TypeError exception. // 5. If status is false, throw a TypeError exception.
// 6. Return O. // 6. Return O.
typeswitch (proto) { if (proto == Null || Is<JSReceiver>(proto)) {
case (proto: JSReceiver | Null): { return object::ObjectSetPrototypeOfThrow(object, proto);
return object::ObjectSetPrototypeOfThrow(object, proto);
}
case (JSAny): {
ThrowTypeError(kProtoObjectOrNull, proto);
}
} }
ThrowTypeError(kProtoObjectOrNull, proto);
} }
} // namespace object_setprototypeof } // namespace object_setprototypeof
...@@ -10,8 +10,8 @@ namespace proxy { ...@@ -10,8 +10,8 @@ namespace proxy {
// https://tc39.github.io/ecma262/#sec-proxy-constructor // https://tc39.github.io/ecma262/#sec-proxy-constructor
transitioning javascript builtin transitioning javascript builtin
ProxyConstructor( ProxyConstructor(
js-implicit context: Context, receiver: JSAny, js-implicit context: Context, receiver: Object,
newTarget: JSAny)(target: JSAny, handler: JSAny): JSProxy { newTarget: Object)(target: Object, handler: Object): JSProxy {
try { try {
// 1. If NewTarget is undefined, throw a TypeError exception. // 1. If NewTarget is undefined, throw a TypeError exception.
if (newTarget == Undefined) { if (newTarget == Undefined) {
......
...@@ -10,7 +10,7 @@ namespace proxy { ...@@ -10,7 +10,7 @@ namespace proxy {
// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-delete-p // https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-delete-p
transitioning builtin transitioning builtin
ProxyDeleteProperty(implicit context: Context)( ProxyDeleteProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey, languageMode: LanguageMode): JSAny { proxy: JSProxy, name: Name, languageMode: LanguageMode): Object {
const kTrapName: constexpr string = 'deleteProperty'; const kTrapName: constexpr string = 'deleteProperty';
// Handle deeply nested proxy. // Handle deeply nested proxy.
PerformStackCheck(); PerformStackCheck();
...@@ -58,7 +58,7 @@ namespace proxy { ...@@ -58,7 +58,7 @@ namespace proxy {
// 15. Return true. // 15. Return true.
return True; return True;
} }
label TrapUndefined(target: JSAny) { label TrapUndefined(target: Object) {
// 7.a. Return ? target.[[Delete]](P). // 7.a. Return ? target.[[Delete]](P).
return DeleteProperty(target, name, languageMode); return DeleteProperty(target, name, languageMode);
} }
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
namespace proxy { namespace proxy {
extern transitioning builtin GetPropertyWithReceiver( extern transitioning builtin GetPropertyWithReceiver(
implicit context: Context)(JSAny, Name, JSAny, Smi): JSAny; implicit context: Context)(Object, Name, Object, Smi): Object;
// ES #sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver // ES #sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
transitioning builtin transitioning builtin
ProxyGetProperty(implicit context: Context)( ProxyGetProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey, receiverValue: JSAny, proxy: JSProxy, name: Name, receiverValue: Object,
onNonExistent: Smi): JSAny { onNonExistent: Smi): Object {
PerformStackCheck(); PerformStackCheck();
// 1. Assert: IsPropertyKey(P) is true. // 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name)); assert(TaggedIsNotSmi(name));
......
...@@ -9,7 +9,7 @@ namespace proxy { ...@@ -9,7 +9,7 @@ namespace proxy {
// ES #sec-proxy-object-internal-methods-and-internal-slots-isextensible // ES #sec-proxy-object-internal-methods-and-internal-slots-isextensible
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-isextensible // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-isextensible
transitioning builtin transitioning builtin
ProxyGetPrototypeOf(implicit context: Context)(proxy: JSProxy): JSAny { ProxyGetPrototypeOf(implicit context: Context)(proxy: JSProxy): Object {
PerformStackCheck(); PerformStackCheck();
const kTrapName: constexpr string = 'getPrototypeOf'; const kTrapName: constexpr string = 'getPrototypeOf';
try { try {
...@@ -39,7 +39,7 @@ namespace proxy { ...@@ -39,7 +39,7 @@ namespace proxy {
// 9. Let extensibleTarget be ? IsExtensible(target). // 9. Let extensibleTarget be ? IsExtensible(target).
// 10. If extensibleTarget is true, return handlerProto. // 10. If extensibleTarget is true, return handlerProto.
const extensibleTarget: JSAny = object::ObjectIsExtensible(target); const extensibleTarget: Object = object::ObjectIsExtensible(target);
assert(extensibleTarget == True || extensibleTarget == False); assert(extensibleTarget == True || extensibleTarget == False);
if (extensibleTarget == True) { if (extensibleTarget == True) {
return handlerProto; return handlerProto;
...@@ -56,7 +56,7 @@ namespace proxy { ...@@ -56,7 +56,7 @@ namespace proxy {
} }
ThrowTypeError(kProxyGetPrototypeOfNonExtensible); ThrowTypeError(kProxyGetPrototypeOfNonExtensible);
} }
label TrapUndefined(target: JSAny) { label TrapUndefined(target: Object) {
// 6.a. Return ? target.[[GetPrototypeOf]](). // 6.a. Return ? target.[[GetPrototypeOf]]().
return object::ObjectGetPrototypeOf(target); return object::ObjectGetPrototypeOf(target);
} }
......
...@@ -9,7 +9,7 @@ namespace proxy { ...@@ -9,7 +9,7 @@ namespace proxy {
// ES #sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p // ES #sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-hasproperty-p
transitioning builtin ProxyHasProperty(implicit context: Context)( transitioning builtin ProxyHasProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey): JSAny { proxy: JSProxy, name: Name): Object {
assert(IsJSProxy(proxy)); assert(IsJSProxy(proxy));
PerformStackCheck(); PerformStackCheck();
...@@ -46,7 +46,7 @@ namespace proxy { ...@@ -46,7 +46,7 @@ namespace proxy {
CheckHasTrapResult(target, proxy, name); CheckHasTrapResult(target, proxy, name);
return False; return False;
} }
label TrapUndefined(target: JSAny) { label TrapUndefined(target: Object) {
// 7.a. Return ? target.[[HasProperty]](P). // 7.a. Return ? target.[[HasProperty]](P).
tail HasProperty(target, name); tail HasProperty(target, name);
} }
......
...@@ -9,7 +9,7 @@ namespace proxy { ...@@ -9,7 +9,7 @@ namespace proxy {
// ES #sec-proxy-object-internal-methods-and-internal-slots-isextensible // ES #sec-proxy-object-internal-methods-and-internal-slots-isextensible
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-isextensible // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-isextensible
transitioning builtin ProxyIsExtensible(implicit context: transitioning builtin ProxyIsExtensible(implicit context:
Context)(proxy: JSProxy): JSAny { Context)(proxy: JSProxy): Object {
PerformStackCheck(); PerformStackCheck();
const kTrapName: constexpr string = 'isExtensible'; const kTrapName: constexpr string = 'isExtensible';
try { try {
...@@ -45,7 +45,7 @@ namespace proxy { ...@@ -45,7 +45,7 @@ namespace proxy {
// 10. Return booleanTrapResult. // 10. Return booleanTrapResult.
return SelectBooleanConstant(trapResult); return SelectBooleanConstant(trapResult);
} }
label TrapUndefined(target: JSAny) { label TrapUndefined(target: Object) {
// 6.a. Return ? IsExtensible(target). // 6.a. Return ? IsExtensible(target).
return object::ObjectIsExtensible(target); return object::ObjectIsExtensible(target);
} }
......
...@@ -9,8 +9,8 @@ namespace proxy { ...@@ -9,8 +9,8 @@ namespace proxy {
// ES #sec-proxy-object-internal-methods-and-internal-slots-preventextensions // ES #sec-proxy-object-internal-methods-and-internal-slots-preventextensions
// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions // https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-preventextensions
transitioning builtin transitioning builtin
ProxyPreventExtensions(implicit context: ProxyPreventExtensions(implicit context: Context)(
Context)(proxy: JSProxy, doThrow: Boolean): JSAny { proxy: JSProxy, doThrow: Boolean): Object {
PerformStackCheck(); PerformStackCheck();
const kTrapName: constexpr string = 'preventExtensions'; const kTrapName: constexpr string = 'preventExtensions';
try { try {
...@@ -37,7 +37,7 @@ namespace proxy { ...@@ -37,7 +37,7 @@ namespace proxy {
// 8.a. Let extensibleTarget be ? IsExtensible(target). // 8.a. Let extensibleTarget be ? IsExtensible(target).
// 8.b If extensibleTarget is true, throw a TypeError exception. // 8.b If extensibleTarget is true, throw a TypeError exception.
if (ToBoolean(trapResult)) { if (ToBoolean(trapResult)) {
const extensibleTarget: JSAny = object::ObjectIsExtensible(target); const extensibleTarget: Object = object::ObjectIsExtensible(target);
assert(extensibleTarget == True || extensibleTarget == False); assert(extensibleTarget == True || extensibleTarget == False);
if (extensibleTarget == True) { if (extensibleTarget == True) {
ThrowTypeError(kProxyPreventExtensionsExtensible); ThrowTypeError(kProxyPreventExtensionsExtensible);
...@@ -52,7 +52,7 @@ namespace proxy { ...@@ -52,7 +52,7 @@ namespace proxy {
// 9. Return booleanTrapResult. // 9. Return booleanTrapResult.
return True; return True;
} }
label TrapUndefined(target: JSAny) { label TrapUndefined(target: Object) {
// 6.a. Return ? target.[[PreventExtensions]](). // 6.a. Return ? target.[[PreventExtensions]]().
if (doThrow == True) { if (doThrow == True) {
return object::ObjectPreventExtensionsThrow(target); return object::ObjectPreventExtensionsThrow(target);
......
...@@ -12,8 +12,9 @@ namespace proxy { ...@@ -12,8 +12,9 @@ namespace proxy {
// Proxy.revocable(target, handler) // Proxy.revocable(target, handler)
// https://tc39.github.io/ecma262/#sec-proxy.revocable // https://tc39.github.io/ecma262/#sec-proxy.revocable
transitioning javascript builtin transitioning javascript builtin
ProxyRevocable(js-implicit context: Context)( ProxyRevocable(
_receiver: JSAny, target: JSAny, handler: JSAny): JSProxyRevocableResult { context: Context, _receiver: Object, target: Object,
handler: Object): JSProxyRevocableResult {
try { try {
const targetJSReceiver = const targetJSReceiver =
Cast<JSReceiver>(target) otherwise ThrowProxyNonObject; Cast<JSReceiver>(target) otherwise ThrowProxyNonObject;
......
...@@ -19,21 +19,15 @@ namespace proxy { ...@@ -19,21 +19,15 @@ namespace proxy {
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
transitioning builtin transitioning builtin
ProxySetProperty(implicit context: Context)( ProxySetProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey | PrivateSymbol, value: JSAny, proxy: JSProxy, name: Name, value: Object,
receiverValue: JSAny): JSAny { receiverValue: Object): Object {
// 1. Assert: IsPropertyKey(P) is true. // 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name)); assert(TaggedIsNotSmi(name));
assert(IsName(name)); assert(IsName(name));
let key: PropertyKey; if (IsPrivateSymbol(name)) {
typeswitch (name) { CallThrowTypeErrorIfStrict(kProxyPrivate);
case (PrivateSymbol): { return Undefined;
CallThrowTypeErrorIfStrict(kProxyPrivate);
return Undefined;
}
case (name: PropertyKey): {
key = name;
}
} }
try { try {
...@@ -67,7 +61,7 @@ namespace proxy { ...@@ -67,7 +61,7 @@ namespace proxy {
// exception. // exception.
// 12. Return true. // 12. Return true.
const trapResult = const trapResult =
Call(context, trap, handler, target, key, value, receiverValue); Call(context, trap, handler, target, name, value, receiverValue);
if (ToBoolean(trapResult)) { if (ToBoolean(trapResult)) {
CheckGetSetTrapResult(target, proxy, name, value, kProxySet); CheckGetSetTrapResult(target, proxy, name, value, kProxySet);
return value; return value;
......
...@@ -10,7 +10,7 @@ namespace proxy { ...@@ -10,7 +10,7 @@ namespace proxy {
// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v // https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v
transitioning builtin transitioning builtin
ProxySetPrototypeOf(implicit context: Context)( ProxySetPrototypeOf(implicit context: Context)(
proxy: JSProxy, proto: Null | JSReceiver, doThrow: Boolean): JSAny { proxy: JSProxy, proto: Object, doThrow: Boolean): Object {
PerformStackCheck(); PerformStackCheck();
const kTrapName: constexpr string = 'setPrototypeOf'; const kTrapName: constexpr string = 'setPrototypeOf';
try { try {
...@@ -63,7 +63,7 @@ namespace proxy { ...@@ -63,7 +63,7 @@ namespace proxy {
} }
ThrowTypeError(kProxySetPrototypeOfNonExtensible); ThrowTypeError(kProxySetPrototypeOfNonExtensible);
} }
label TrapUndefined(target: JSAny, proto: JSReceiver | Null) { label TrapUndefined(target: Object, proto: Object) {
// 7.a. Return ? target.[[SetPrototypeOf]](). // 7.a. Return ? target.[[SetPrototypeOf]]().
if (doThrow == True) { if (doThrow == True) {
return object::ObjectSetPrototypeOfThrow(target, proto); return object::ObjectSetPrototypeOfThrow(target, proto);
......
...@@ -9,7 +9,7 @@ namespace reflect { ...@@ -9,7 +9,7 @@ namespace reflect {
// ES6 section 26.1.10 Reflect.isExtensible // ES6 section 26.1.10 Reflect.isExtensible
transitioning javascript builtin ReflectIsExtensible( transitioning javascript builtin ReflectIsExtensible(
js-implicit context: Context)(_receiver: JSAny, object: Object): Object { js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.isExtensible'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.isExtensible');
return object::ObjectIsExtensible(objectJSReceiver); return object::ObjectIsExtensible(objectJSReceiver);
...@@ -17,7 +17,7 @@ namespace reflect { ...@@ -17,7 +17,7 @@ namespace reflect {
// ES6 section 26.1.12 Reflect.preventExtensions // ES6 section 26.1.12 Reflect.preventExtensions
transitioning javascript builtin ReflectPreventExtensions( transitioning javascript builtin ReflectPreventExtensions(
js-implicit context: Context)(_receiver: JSAny, object: Object): Object { js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.preventExtensions'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.preventExtensions');
return object::ObjectPreventExtensionsDontThrow(objectJSReceiver); return object::ObjectPreventExtensionsDontThrow(objectJSReceiver);
...@@ -25,7 +25,7 @@ namespace reflect { ...@@ -25,7 +25,7 @@ namespace reflect {
// ES6 section 26.1.8 Reflect.getPrototypeOf // ES6 section 26.1.8 Reflect.getPrototypeOf
transitioning javascript builtin ReflectGetPrototypeOf( transitioning javascript builtin ReflectGetPrototypeOf(
js-implicit context: Context)(_receiver: JSAny, object: Object): Object { js-implicit context: Context)(_receiver: Object, object: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.getPrototypeOf'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.getPrototypeOf');
return object::JSReceiverGetPrototypeOf(objectJSReceiver); return object::JSReceiverGetPrototypeOf(objectJSReceiver);
...@@ -34,21 +34,16 @@ namespace reflect { ...@@ -34,21 +34,16 @@ namespace reflect {
// ES6 section 26.1.14 Reflect.setPrototypeOf // ES6 section 26.1.14 Reflect.setPrototypeOf
transitioning javascript builtin ReflectSetPrototypeOf( transitioning javascript builtin ReflectSetPrototypeOf(
js-implicit context: js-implicit context:
Context)(_receiver: JSAny, object: JSAny, proto: JSAny): JSAny { Context)(_receiver: Object, object: Object, proto: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf');
typeswitch (proto) { if (proto == Null || Is<JSReceiver>(proto)) {
case (proto: JSReceiver | Null): { return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto);
return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto);
}
case (JSAny): {
ThrowTypeError(kProtoObjectOrNull, proto);
}
} }
ThrowTypeError(kProtoObjectOrNull, proto);
} }
extern transitioning builtin ToName(implicit context: Context)(Object): extern transitioning builtin ToName(implicit context: Context)(Object): Name;
AnyName;
type OnNonExistent constexpr 'OnNonExistent'; type OnNonExistent constexpr 'OnNonExistent';
const kReturnUndefined: constexpr OnNonExistent const kReturnUndefined: constexpr OnNonExistent
generates 'OnNonExistent::kReturnUndefined'; generates 'OnNonExistent::kReturnUndefined';
...@@ -64,8 +59,8 @@ namespace reflect { ...@@ -64,8 +59,8 @@ namespace reflect {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.get'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.get');
const propertyKey: Object = length > 1 ? arguments[1] : Undefined; const propertyKey: Object = length > 1 ? arguments[1] : Undefined;
const name: AnyName = ToName(propertyKey); const name: Name = ToName(propertyKey);
const receiver: JSAny = length > 2 ? arguments[2] : objectJSReceiver; const receiver: Object = length > 2 ? arguments[2] : objectJSReceiver;
return GetPropertyWithReceiver( return GetPropertyWithReceiver(
objectJSReceiver, name, receiver, SmiConstant(kReturnUndefined)); objectJSReceiver, name, receiver, SmiConstant(kReturnUndefined));
} }
...@@ -73,7 +68,7 @@ namespace reflect { ...@@ -73,7 +68,7 @@ namespace reflect {
// ES6 section 26.1.4 Reflect.deleteProperty // ES6 section 26.1.4 Reflect.deleteProperty
transitioning javascript builtin ReflectDeleteProperty( transitioning javascript builtin ReflectDeleteProperty(
js-implicit context: js-implicit context:
Context)(_receiver: JSAny, object: JSAny, key: JSAny): JSAny { Context)(_receiver: Object, object: Object, key: Object): Object {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.deleteProperty'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.deleteProperty');
return DeleteProperty(objectJSReceiver, key, kSloppy); return DeleteProperty(objectJSReceiver, key, kSloppy);
......
...@@ -57,7 +57,7 @@ namespace regexp_replace { ...@@ -57,7 +57,7 @@ namespace regexp_replace {
// Element represents the matched substring, which is then passed to the // Element represents the matched substring, which is then passed to the
// replace function. // replace function.
case (elString: String): { case (elString: String): {
const replacementObj: JSAny = const replacementObj: Object =
Call(context, replaceFn, Undefined, elString, matchStart, string); Call(context, replaceFn, Undefined, elString, matchStart, string);
const replacement: String = ToString_Inline(context, replacementObj); const replacement: String = ToString_Inline(context, replacementObj);
matchesElements.objects[i] = replacement; matchesElements.objects[i] = replacement;
...@@ -79,7 +79,7 @@ namespace regexp_replace { ...@@ -79,7 +79,7 @@ namespace regexp_replace {
// The JSArray is expanded into the function args by Reflect.apply(). // The JSArray is expanded into the function args by Reflect.apply().
// TODO(jgruber): Remove indirection through Call->ReflectApply. // TODO(jgruber): Remove indirection through Call->ReflectApply.
const replacementObj: JSAny = Call( const replacementObj: Object = Call(
context, GetReflectApply(), Undefined, replaceFn, Undefined, elArray); context, GetReflectApply(), Undefined, replaceFn, Undefined, elArray);
// Overwrite the i'th element in the results with the string // Overwrite the i'th element in the results with the string
...@@ -172,7 +172,7 @@ namespace regexp_replace { ...@@ -172,7 +172,7 @@ namespace regexp_replace {
} }
transitioning builtin RegExpReplace(implicit context: Context)( transitioning builtin RegExpReplace(implicit context: Context)(
regexp: FastJSRegExp, string: String, replaceValue: JSAny): String { regexp: FastJSRegExp, string: String, replaceValue: Object): String {
// TODO(pwong): Remove assert when all callers (StringPrototypeReplace) are // TODO(pwong): Remove assert when all callers (StringPrototypeReplace) are
// from Torque. // from Torque.
assert(Is<FastJSRegExp>(regexp)); assert(Is<FastJSRegExp>(regexp));
...@@ -184,7 +184,7 @@ namespace regexp_replace { ...@@ -184,7 +184,7 @@ namespace regexp_replace {
RegExpReplaceFastGlobalCallable(regexp, string, replaceFn) : RegExpReplaceFastGlobalCallable(regexp, string, replaceFn) :
StringReplaceNonGlobalRegExpWithFunction(string, regexp, replaceFn); StringReplaceNonGlobalRegExpWithFunction(string, regexp, replaceFn);
} }
case (JSAny): { case (Object): {
const stableRegexp: JSRegExp = regexp; const stableRegexp: JSRegExp = regexp;
const replaceString: String = ToString_Inline(context, replaceValue); const replaceString: String = ToString_Inline(context, replaceValue);
...@@ -208,7 +208,7 @@ namespace regexp_replace { ...@@ -208,7 +208,7 @@ namespace regexp_replace {
} }
transitioning javascript builtin RegExpPrototypeReplace( transitioning javascript builtin RegExpPrototypeReplace(
js-implicit context: Context, receiver: JSAny)(...arguments): Object { js-implicit context: Context, receiver: Object)(...arguments): Object {
const methodName: constexpr string = 'RegExp.prototype.@@replace'; const methodName: constexpr string = 'RegExp.prototype.@@replace';
// RegExpPrototypeReplace is a bit of a beast - a summary of dispatch logic: // RegExpPrototypeReplace is a bit of a beast - a summary of dispatch logic:
...@@ -229,8 +229,8 @@ namespace regexp_replace { ...@@ -229,8 +229,8 @@ namespace regexp_replace {
// } // }
// } // }
const string: JSAny = arguments[0]; const string: Object = arguments[0];
const replaceValue: JSAny = arguments[1]; const replaceValue: Object = arguments[1];
// Let rx be the this value. // Let rx be the this value.
// If Type(rx) is not Object, throw a TypeError exception. // If Type(rx) is not Object, throw a TypeError exception.
......
...@@ -28,13 +28,13 @@ namespace string { ...@@ -28,13 +28,13 @@ namespace string {
// https://tc39.github.io/ecma262/#sec-string.prototype.endswith // https://tc39.github.io/ecma262/#sec-string.prototype.endswith
transitioning javascript builtin StringPrototypeEndsWith( transitioning javascript builtin StringPrototypeEndsWith(
js-implicit context: Context, receiver: JSAny)(...arguments): Boolean { js-implicit context: Context, receiver: Object)(...arguments): Boolean {
const searchString: JSAny = arguments[0]; const searchString: Object = arguments[0];
const endPosition: JSAny = arguments[1]; const endPosition: Object = arguments[1];
const kBuiltinName: constexpr string = 'String.prototype.endsWith'; const kBuiltinName: constexpr string = 'String.prototype.endsWith';
// 1. Let O be ? RequireObjectCoercible(this value). // 1. Let O be ? RequireObjectCoercible(this value).
const object: JSAny = RequireObjectCoercible(receiver, kBuiltinName); const object: Object = RequireObjectCoercible(receiver, kBuiltinName);
// 2. Let S be ? ToString(O). // 2. Let S be ? ToString(O).
const string: String = ToString_Inline(context, object); const string: String = ToString_Inline(context, object);
......
...@@ -7,8 +7,8 @@ namespace string_html { ...@@ -7,8 +7,8 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-createhtml // https://tc39.github.io/ecma262/#sec-createhtml
transitioning builtin CreateHTML(implicit context: Context)( transitioning builtin CreateHTML(implicit context: Context)(
receiver: JSAny, methodName: String, tagName: String, attr: String, receiver: Object, methodName: String, tagName: String, attr: String,
attrValue: JSAny): String { attrValue: Object): String {
const tagContents: String = ToThisString(receiver, methodName); const tagContents: String = ToThisString(receiver, methodName);
let result = '<' + tagName; let result = '<' + tagName;
if (attr != kEmptyString) { if (attr != kEmptyString) {
...@@ -22,14 +22,14 @@ namespace string_html { ...@@ -22,14 +22,14 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.anchor // https://tc39.github.io/ecma262/#sec-string.prototype.anchor
transitioning javascript builtin StringPrototypeAnchor( transitioning javascript builtin StringPrototypeAnchor(
js-implicit context: Context, receiver: JSAny)(...arguments): String { js-implicit context: Context, receiver: Object)(...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.anchor', 'a', 'name', arguments[0]); receiver, 'String.prototype.anchor', 'a', 'name', arguments[0]);
} }
// https://tc39.github.io/ecma262/#sec-string.prototype.big // https://tc39.github.io/ecma262/#sec-string.prototype.big
transitioning javascript builtin transitioning javascript builtin
StringPrototypeBig(js-implicit context: Context, receiver: JSAny)( StringPrototypeBig(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.big', 'big', kEmptyString, kEmptyString); receiver, 'String.prototype.big', 'big', kEmptyString, kEmptyString);
...@@ -37,7 +37,7 @@ namespace string_html { ...@@ -37,7 +37,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.blink // https://tc39.github.io/ecma262/#sec-string.prototype.blink
transitioning javascript builtin transitioning javascript builtin
StringPrototypeBlink(js-implicit context: Context, receiver: JSAny)( StringPrototypeBlink(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.blink', 'blink', kEmptyString, receiver, 'String.prototype.blink', 'blink', kEmptyString,
...@@ -46,7 +46,7 @@ namespace string_html { ...@@ -46,7 +46,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.bold // https://tc39.github.io/ecma262/#sec-string.prototype.bold
transitioning javascript builtin transitioning javascript builtin
StringPrototypeBold(js-implicit context: Context, receiver: JSAny)( StringPrototypeBold(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.bold', 'b', kEmptyString, kEmptyString); receiver, 'String.prototype.bold', 'b', kEmptyString, kEmptyString);
...@@ -54,7 +54,7 @@ namespace string_html { ...@@ -54,7 +54,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor // https://tc39.github.io/ecma262/#sec-string.prototype.fontcolor
transitioning javascript builtin transitioning javascript builtin
StringPrototypeFontcolor(js-implicit context: Context, receiver: JSAny)( StringPrototypeFontcolor(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.fontcolor', 'font', 'color', arguments[0]); receiver, 'String.prototype.fontcolor', 'font', 'color', arguments[0]);
...@@ -62,7 +62,7 @@ namespace string_html { ...@@ -62,7 +62,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.fontsize // https://tc39.github.io/ecma262/#sec-string.prototype.fontsize
transitioning javascript builtin transitioning javascript builtin
StringPrototypeFontsize(js-implicit context: Context, receiver: JSAny)( StringPrototypeFontsize(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.fontsize', 'font', 'size', arguments[0]); receiver, 'String.prototype.fontsize', 'font', 'size', arguments[0]);
...@@ -70,7 +70,7 @@ namespace string_html { ...@@ -70,7 +70,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.fixed // https://tc39.github.io/ecma262/#sec-string.prototype.fixed
transitioning javascript builtin transitioning javascript builtin
StringPrototypeFixed(js-implicit context: Context, receiver: JSAny)( StringPrototypeFixed(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.fixed', 'tt', kEmptyString, kEmptyString); receiver, 'String.prototype.fixed', 'tt', kEmptyString, kEmptyString);
...@@ -78,7 +78,7 @@ namespace string_html { ...@@ -78,7 +78,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.italics // https://tc39.github.io/ecma262/#sec-string.prototype.italics
transitioning javascript builtin transitioning javascript builtin
StringPrototypeItalics(js-implicit context: Context, receiver: JSAny)( StringPrototypeItalics(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.italics', 'i', kEmptyString, kEmptyString); receiver, 'String.prototype.italics', 'i', kEmptyString, kEmptyString);
...@@ -86,7 +86,7 @@ namespace string_html { ...@@ -86,7 +86,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.link // https://tc39.github.io/ecma262/#sec-string.prototype.link
transitioning javascript builtin transitioning javascript builtin
StringPrototypeLink(js-implicit context: Context, receiver: JSAny)( StringPrototypeLink(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.link', 'a', 'href', arguments[0]); receiver, 'String.prototype.link', 'a', 'href', arguments[0]);
...@@ -94,7 +94,7 @@ namespace string_html { ...@@ -94,7 +94,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.small // https://tc39.github.io/ecma262/#sec-string.prototype.small
transitioning javascript builtin transitioning javascript builtin
StringPrototypeSmall(js-implicit context: Context, receiver: JSAny)( StringPrototypeSmall(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.small', 'small', kEmptyString, receiver, 'String.prototype.small', 'small', kEmptyString,
...@@ -103,7 +103,7 @@ namespace string_html { ...@@ -103,7 +103,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.strike // https://tc39.github.io/ecma262/#sec-string.prototype.strike
transitioning javascript builtin transitioning javascript builtin
StringPrototypeStrike(js-implicit context: Context, receiver: JSAny)( StringPrototypeStrike(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.strike', 'strike', kEmptyString, receiver, 'String.prototype.strike', 'strike', kEmptyString,
...@@ -112,7 +112,7 @@ namespace string_html { ...@@ -112,7 +112,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.sub // https://tc39.github.io/ecma262/#sec-string.prototype.sub
transitioning javascript builtin transitioning javascript builtin
StringPrototypeSub(js-implicit context: Context, receiver: JSAny)( StringPrototypeSub(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.sub', 'sub', kEmptyString, kEmptyString); receiver, 'String.prototype.sub', 'sub', kEmptyString, kEmptyString);
...@@ -120,7 +120,7 @@ namespace string_html { ...@@ -120,7 +120,7 @@ namespace string_html {
// https://tc39.github.io/ecma262/#sec-string.prototype.sup // https://tc39.github.io/ecma262/#sec-string.prototype.sup
transitioning javascript builtin transitioning javascript builtin
StringPrototypeSup(js-implicit context: Context, receiver: JSAny)( StringPrototypeSup(js-implicit context: Context, receiver: Object)(
...arguments): String { ...arguments): String {
return CreateHTML( return CreateHTML(
receiver, 'String.prototype.sup', 'sup', kEmptyString, kEmptyString); receiver, 'String.prototype.sup', 'sup', kEmptyString, kEmptyString);
......
...@@ -17,7 +17,7 @@ namespace string_iterator { ...@@ -17,7 +17,7 @@ namespace string_iterator {
// ES6 #sec-string.prototype-@@iterator // ES6 #sec-string.prototype-@@iterator
transitioning javascript builtin StringPrototypeIterator( transitioning javascript builtin StringPrototypeIterator(
js-implicit context: Context)(receiver: JSAny): JSStringIterator { js-implicit context: Context)(receiver: Object): JSStringIterator {
const name: String = const name: String =
ToThisString(receiver, 'String.prototype[Symbol.iterator]'); ToThisString(receiver, 'String.prototype[Symbol.iterator]');
const index: Smi = 0; const index: Smi = 0;
...@@ -26,7 +26,7 @@ namespace string_iterator { ...@@ -26,7 +26,7 @@ namespace string_iterator {
// ES6 #sec-%stringiteratorprototype%.next // ES6 #sec-%stringiteratorprototype%.next
transitioning javascript builtin StringIteratorPrototypeNext( transitioning javascript builtin StringIteratorPrototypeNext(
js-implicit context: Context)(receiver: JSAny): JSObject { js-implicit context: Context)(receiver: Object): JSObject {
const iterator = Cast<JSStringIterator>(receiver) otherwise ThrowTypeError( const iterator = Cast<JSStringIterator>(receiver) otherwise ThrowTypeError(
kIncompatibleMethodReceiver, 'String Iterator.prototype.next', kIncompatibleMethodReceiver, 'String Iterator.prototype.next',
receiver); receiver);
......
...@@ -28,7 +28,7 @@ namespace string_repeat { ...@@ -28,7 +28,7 @@ namespace string_repeat {
// https://tc39.github.io/ecma262/#sec-string.prototype.repeat // https://tc39.github.io/ecma262/#sec-string.prototype.repeat
transitioning javascript builtin StringPrototypeRepeat( transitioning javascript builtin StringPrototypeRepeat(
js-implicit context: Context, receiver: JSAny)(count: JSAny): String { js-implicit context: Context, receiver: Object)(count: Object): String {
// 1. Let O be ? RequireObjectCoercible(this value). // 1. Let O be ? RequireObjectCoercible(this value).
// 2. Let S be ? ToString(O). // 2. Let S be ? ToString(O).
const s: String = ToThisString(receiver, kBuiltinName); const s: String = ToThisString(receiver, kBuiltinName);
......
...@@ -9,7 +9,7 @@ namespace string_slice { ...@@ -9,7 +9,7 @@ namespace string_slice {
// ES6 #sec-string.prototype.slice ( start, end ) // ES6 #sec-string.prototype.slice ( start, end )
// https://tc39.github.io/ecma262/#sec-string.prototype.slice // https://tc39.github.io/ecma262/#sec-string.prototype.slice
transitioning javascript builtin StringPrototypeSlice( transitioning javascript builtin StringPrototypeSlice(
js-implicit context: Context, receiver: JSAny)(...arguments): String { js-implicit context: Context, receiver: Object)(...arguments): String {
// 1. Let O be ? RequireObjectCoercible(this value). // 1. Let O be ? RequireObjectCoercible(this value).
// 2. Let S be ? ToString(O). // 2. Let S be ? ToString(O).
const string: String = ToThisString(receiver, 'String.prototype.slice'); const string: String = ToThisString(receiver, 'String.prototype.slice');
......
...@@ -10,13 +10,13 @@ namespace string { ...@@ -10,13 +10,13 @@ namespace string {
// https://tc39.github.io/ecma262/#sec-string.prototype.startswith // https://tc39.github.io/ecma262/#sec-string.prototype.startswith
transitioning javascript builtin StringPrototypeStartsWith( transitioning javascript builtin StringPrototypeStartsWith(
js-implicit context: Context, receiver: JSAny)(...arguments): Boolean { js-implicit context: Context, receiver: Object)(...arguments): Boolean {
const searchString: JSAny = arguments[0]; const searchString: Object = arguments[0];
const position: JSAny = arguments[1]; const position: Object = arguments[1];
const kBuiltinName: constexpr string = 'String.prototype.startsWith'; const kBuiltinName: constexpr string = 'String.prototype.startsWith';
// 1. Let O be ? RequireObjectCoercible(this value). // 1. Let O be ? RequireObjectCoercible(this value).
const object: JSAny = RequireObjectCoercible(receiver, kBuiltinName); const object: Object = RequireObjectCoercible(receiver, kBuiltinName);
// 2. Let S be ? ToString(O). // 2. Let S be ? ToString(O).
const string: String = ToString_Inline(context, object); const string: String = ToString_Inline(context, object);
......
...@@ -7,7 +7,7 @@ namespace string_substring { ...@@ -7,7 +7,7 @@ namespace string_substring {
extern macro SubString(String, intptr, intptr): String; extern macro SubString(String, intptr, intptr): String;
transitioning macro ToSmiBetweenZeroAnd(implicit context: Context)( transitioning macro ToSmiBetweenZeroAnd(implicit context: Context)(
value: JSAny, limit: Smi): Smi { value: Object, limit: Smi): Smi {
const valueInt: Number = const valueInt: Number =
ToInteger_Inline(context, value, kTruncateMinusZero); ToInteger_Inline(context, value, kTruncateMinusZero);
typeswitch (valueInt) { typeswitch (valueInt) {
...@@ -28,7 +28,7 @@ namespace string_substring { ...@@ -28,7 +28,7 @@ namespace string_substring {
// ES6 #sec-string.prototype.substring // ES6 #sec-string.prototype.substring
transitioning javascript builtin StringPrototypeSubstring( transitioning javascript builtin StringPrototypeSubstring(
js-implicit context: Context, receiver: JSAny)(...arguments): String { js-implicit context: Context, receiver: Object)(...arguments): String {
// Check that {receiver} is coercible to Object and convert it to a String. // Check that {receiver} is coercible to Object and convert it to a String.
const string: String = ToThisString(receiver, 'String.prototype.substring'); const string: String = ToThisString(receiver, 'String.prototype.substring');
const length = string.length_smi; const length = string.length_smi;
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
namespace string { namespace string {
// ES6 #sec-string.prototype.tostring // ES6 #sec-string.prototype.tostring
transitioning javascript builtin transitioning javascript builtin
StringPrototypeToString(js-implicit context: Context)(receiver: JSAny): StringPrototypeToString(js-implicit context: Context)(receiver: Object):
Object { Object {
return ToThisValue(receiver, kString, 'String.prototype.toString'); return ToThisValue(receiver, kString, 'String.prototype.toString');
} }
// ES6 #sec-string.prototype.valueof // ES6 #sec-string.prototype.valueof
transitioning javascript builtin transitioning javascript builtin
StringPrototypeValueOf(js-implicit context: Context)(receiver: JSAny): StringPrototypeValueOf(js-implicit context: Context)(receiver: Object):
Object { Object {
return ToThisValue(receiver, kString, 'String.prototype.valueOf'); return ToThisValue(receiver, kString, 'String.prototype.valueOf');
} }
...@@ -53,7 +53,7 @@ namespace string { ...@@ -53,7 +53,7 @@ namespace string {
} }
transitioning macro GenerateStringAt(implicit context: Context)( transitioning macro GenerateStringAt(implicit context: Context)(
receiver: JSAny, position: JSAny, receiver: Object, position: Object,
methodName: constexpr string): never labels methodName: constexpr string): never labels
IfInBounds(String, intptr, intptr), IfOutOfBounds { IfInBounds(String, intptr, intptr), IfOutOfBounds {
// Check that {receiver} is coercible to Object and convert it to a String. // Check that {receiver} is coercible to Object and convert it to a String.
...@@ -71,7 +71,8 @@ namespace string { ...@@ -71,7 +71,8 @@ namespace string {
// ES6 #sec-string.prototype.charat // ES6 #sec-string.prototype.charat
transitioning javascript builtin StringPrototypeCharAt( transitioning javascript builtin StringPrototypeCharAt(
js-implicit context: Context, receiver: JSAny)(position: JSAny): Object { js-implicit context: Context,
receiver: Object)(position: Object): Object {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.charAt') GenerateStringAt(receiver, position, 'String.prototype.charAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
...@@ -87,7 +88,8 @@ namespace string { ...@@ -87,7 +88,8 @@ namespace string {
// ES6 #sec-string.prototype.charcodeat // ES6 #sec-string.prototype.charcodeat
transitioning javascript builtin StringPrototypeCharCodeAt( transitioning javascript builtin StringPrototypeCharCodeAt(
js-implicit context: Context, receiver: JSAny)(position: JSAny): Object { js-implicit context: Context,
receiver: Object)(position: Object): Object {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.charCodeAt') GenerateStringAt(receiver, position, 'String.prototype.charCodeAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
...@@ -103,7 +105,8 @@ namespace string { ...@@ -103,7 +105,8 @@ namespace string {
// ES6 #sec-string.prototype.codepointat // ES6 #sec-string.prototype.codepointat
transitioning javascript builtin StringPrototypeCodePointAt( transitioning javascript builtin StringPrototypeCodePointAt(
js-implicit context: Context, receiver: JSAny)(position: JSAny): Object { js-implicit context: Context,
receiver: Object)(position: Object): Object {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.codePointAt') GenerateStringAt(receiver, position, 'String.prototype.codePointAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
...@@ -122,7 +125,7 @@ namespace string { ...@@ -122,7 +125,7 @@ namespace string {
// ES6 String.prototype.concat(...args) // ES6 String.prototype.concat(...args)
// ES6 #sec-string.prototype.concat // ES6 #sec-string.prototype.concat
transitioning javascript builtin StringPrototypeConcat( transitioning javascript builtin StringPrototypeConcat(
js-implicit context: Context, receiver: JSAny)(...arguments): Object { js-implicit context: Context, receiver: Object)(...arguments): Object {
// Check that {receiver} is coercible to Object and convert it to a String. // Check that {receiver} is coercible to Object and convert it to a String.
let string: String = ToThisString(receiver, 'String.prototype.concat'); let string: String = ToThisString(receiver, 'String.prototype.concat');
......
...@@ -122,7 +122,7 @@ namespace typed_array_createtypedarray { ...@@ -122,7 +122,7 @@ namespace typed_array_createtypedarray {
// 22.2.4.2 TypedArray ( length ) // 22.2.4.2 TypedArray ( length )
// ES #sec-typedarray-length // ES #sec-typedarray-length
transitioning macro ConstructByLength(implicit context: Context)( transitioning macro ConstructByLength(implicit context: Context)(
map: Map, length: JSAny, map: Map, length: Object,
elementsInfo: typed_array::TypedArrayElementsInfo): JSTypedArray { elementsInfo: typed_array::TypedArrayElementsInfo): JSTypedArray {
const convertedLength: Number = const convertedLength: Number =
ToInteger_Inline(context, length, kTruncateMinusZero); ToInteger_Inline(context, length, kTruncateMinusZero);
...@@ -141,7 +141,7 @@ namespace typed_array_createtypedarray { ...@@ -141,7 +141,7 @@ namespace typed_array_createtypedarray {
// 22.2.4.4 TypedArray ( object ) // 22.2.4.4 TypedArray ( object )
// ES #sec-typedarray-object // ES #sec-typedarray-object
transitioning macro ConstructByArrayLike(implicit context: Context)( transitioning macro ConstructByArrayLike(implicit context: Context)(
map: Map, arrayLike: HeapObject, initialLength: JSAny, map: Map, arrayLike: HeapObject, initialLength: Object,
elementsInfo: typed_array::TypedArrayElementsInfo, elementsInfo: typed_array::TypedArrayElementsInfo,
bufferConstructor: JSReceiver): JSTypedArray { bufferConstructor: JSReceiver): JSTypedArray {
// The caller has looked up length on arrayLike, which is observable. // The caller has looked up length on arrayLike, which is observable.
...@@ -178,7 +178,7 @@ namespace typed_array_createtypedarray { ...@@ -178,7 +178,7 @@ namespace typed_array_createtypedarray {
// ES #sec-typedarray-object // ES #sec-typedarray-object
transitioning macro ConstructByIterable(implicit context: Context)( transitioning macro ConstructByIterable(implicit context: Context)(
iterable: JSReceiver, iteratorFn: Callable): never iterable: JSReceiver, iteratorFn: Callable): never
labels IfConstructByArrayLike(JSArray, Number, JSReceiver) { labels IfConstructByArrayLike(HeapObject, Object, JSReceiver) {
const array: JSArray = const array: JSArray =
IterableToListMayPreserveHoles(context, iterable, iteratorFn); IterableToListMayPreserveHoles(context, iterable, iteratorFn);
goto IfConstructByArrayLike(array, array.length, GetArrayBufferFunction()); goto IfConstructByArrayLike(array, array.length, GetArrayBufferFunction());
...@@ -188,7 +188,7 @@ namespace typed_array_createtypedarray { ...@@ -188,7 +188,7 @@ namespace typed_array_createtypedarray {
// ES #sec-typedarray-typedarray // ES #sec-typedarray-typedarray
transitioning macro ConstructByTypedArray(implicit context: Context)( transitioning macro ConstructByTypedArray(implicit context: Context)(
srcTypedArray: JSTypedArray): never srcTypedArray: JSTypedArray): never
labels IfConstructByArrayLike(JSTypedArray, Number, JSReceiver) { labels IfConstructByArrayLike(HeapObject, Object, JSReceiver) {
let bufferConstructor: JSReceiver = GetArrayBufferFunction(); let bufferConstructor: JSReceiver = GetArrayBufferFunction();
const srcBuffer: JSArrayBuffer = srcTypedArray.buffer; const srcBuffer: JSArrayBuffer = srcTypedArray.buffer;
// TODO(petermarshall): Throw on detached typedArray. // TODO(petermarshall): Throw on detached typedArray.
...@@ -210,7 +210,7 @@ namespace typed_array_createtypedarray { ...@@ -210,7 +210,7 @@ namespace typed_array_createtypedarray {
// 22.2.4.5 TypedArray ( buffer, byteOffset, length ) // 22.2.4.5 TypedArray ( buffer, byteOffset, length )
// ES #sec-typedarray-buffer-byteoffset-length // ES #sec-typedarray-buffer-byteoffset-length
transitioning macro ConstructByArrayBuffer(implicit context: Context)( transitioning macro ConstructByArrayBuffer(implicit context: Context)(
map: Map, buffer: JSArrayBuffer, byteOffset: JSAny, length: JSAny, map: Map, buffer: JSArrayBuffer, byteOffset: Object, length: Object,
elementsInfo: typed_array::TypedArrayElementsInfo): JSTypedArray { elementsInfo: typed_array::TypedArrayElementsInfo): JSTypedArray {
try { try {
let offset: uintptr = 0; let offset: uintptr = 0;
...@@ -294,7 +294,7 @@ namespace typed_array_createtypedarray { ...@@ -294,7 +294,7 @@ namespace typed_array_createtypedarray {
transitioning macro ConstructByJSReceiver(implicit context: transitioning macro ConstructByJSReceiver(implicit context:
Context)(obj: JSReceiver): never Context)(obj: JSReceiver): never
labels IfConstructByArrayLike(JSReceiver, Number, JSReceiver) { labels IfConstructByArrayLike(HeapObject, Object, JSReceiver) {
try { try {
const iteratorMethod: Object = const iteratorMethod: Object =
GetIteratorMethod(obj) otherwise IfIteratorUndefined; GetIteratorMethod(obj) otherwise IfIteratorUndefined;
...@@ -304,7 +304,7 @@ namespace typed_array_createtypedarray { ...@@ -304,7 +304,7 @@ namespace typed_array_createtypedarray {
otherwise IfConstructByArrayLike; otherwise IfConstructByArrayLike;
} }
label IfIteratorUndefined { label IfIteratorUndefined {
const lengthObj: JSAny = GetProperty(obj, kLengthString); const lengthObj: Object = GetProperty(obj, kLengthString);
const length: Smi = ToSmiLength(lengthObj) const length: Smi = ToSmiLength(lengthObj)
otherwise goto IfInvalidLength(lengthObj); otherwise goto IfInvalidLength(lengthObj);
goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction()); goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction());
...@@ -317,8 +317,8 @@ namespace typed_array_createtypedarray { ...@@ -317,8 +317,8 @@ namespace typed_array_createtypedarray {
// 22.2.4 The TypedArray Constructors // 22.2.4 The TypedArray Constructors
// ES #sec-typedarray-constructors // ES #sec-typedarray-constructors
transitioning builtin CreateTypedArray( transitioning builtin CreateTypedArray(
context: Context, target: JSFunction, newTarget: JSReceiver, arg1: JSAny, context: Context, target: JSFunction, newTarget: JSReceiver, arg1: Object,
arg2: JSAny, arg3: JSAny): JSTypedArray { arg2: Object, arg3: Object): JSTypedArray {
assert(IsConstructor(target)); assert(IsConstructor(target));
// 4. Let O be ? AllocateTypedArray(constructorName, NewTarget, // 4. Let O be ? AllocateTypedArray(constructorName, NewTarget,
// "%TypedArrayPrototype%"). // "%TypedArrayPrototype%").
...@@ -345,16 +345,16 @@ namespace typed_array_createtypedarray { ...@@ -345,16 +345,16 @@ namespace typed_array_createtypedarray {
} }
// The first argument was a number or fell through and is treated as // The first argument was a number or fell through and is treated as
// a number. https://tc39.github.io/ecma262/#sec-typedarray-length // a number. https://tc39.github.io/ecma262/#sec-typedarray-length
case (lengthObj: JSAny): { case (lengthObj: HeapObject): {
goto IfConstructByLength(lengthObj); goto IfConstructByLength(lengthObj);
} }
} }
} }
label IfConstructByLength(length: JSAny) { label IfConstructByLength(length: Object) {
return ConstructByLength(map, length, elementsInfo); return ConstructByLength(map, length, elementsInfo);
} }
label IfConstructByArrayLike( label IfConstructByArrayLike(
arrayLike: JSReceiver, length: Number, bufferConstructor: JSReceiver) { arrayLike: HeapObject, length: Object, bufferConstructor: JSReceiver) {
return ConstructByArrayLike( return ConstructByArrayLike(
map, arrayLike, length, elementsInfo, bufferConstructor); map, arrayLike, length, elementsInfo, bufferConstructor);
} }
...@@ -362,8 +362,8 @@ namespace typed_array_createtypedarray { ...@@ -362,8 +362,8 @@ namespace typed_array_createtypedarray {
transitioning macro TypedArraySpeciesCreate(implicit context: Context)( transitioning macro TypedArraySpeciesCreate(implicit context: Context)(
methodName: constexpr string, numArgs: constexpr int31, methodName: constexpr string, numArgs: constexpr int31,
exemplar: JSTypedArray, arg0: JSAny, arg1: JSAny, exemplar: JSTypedArray, arg0: Object, arg1: Object,
arg2: JSAny): JSTypedArray { arg2: Object): JSTypedArray {
const defaultConstructor = GetDefaultConstructor(exemplar); const defaultConstructor = GetDefaultConstructor(exemplar);
try { try {
...@@ -386,7 +386,7 @@ namespace typed_array_createtypedarray { ...@@ -386,7 +386,7 @@ namespace typed_array_createtypedarray {
// TODO(pwong): Simplify and remove numArgs when varargs are supported in // TODO(pwong): Simplify and remove numArgs when varargs are supported in
// macros. // macros.
let newObj: JSAny = Undefined; let newObj: Object = Undefined;
if constexpr (numArgs == 1) { if constexpr (numArgs == 1) {
newObj = Construct(constructor, arg0); newObj = Construct(constructor, arg0);
} else { } else {
......
...@@ -9,7 +9,7 @@ namespace typed_array_every { ...@@ -9,7 +9,7 @@ namespace typed_array_every {
transitioning macro EveryAllElements(implicit context: Context)( transitioning macro EveryAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
thisArg: JSAny): Boolean { thisArg: Object): Boolean {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -17,7 +17,7 @@ namespace typed_array_every { ...@@ -17,7 +17,7 @@ namespace typed_array_every {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
const result = const result =
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
if (!ToBoolean(result)) { if (!ToBoolean(result)) {
...@@ -29,7 +29,7 @@ namespace typed_array_every { ...@@ -29,7 +29,7 @@ namespace typed_array_every {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeEvery(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeEvery(js-implicit context: Context, receiver: Object)(
...arguments): Object { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = thisArg // arguments[1] = thisArg
......
...@@ -10,7 +10,7 @@ namespace typed_array_filter { ...@@ -10,7 +10,7 @@ namespace typed_array_filter {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.filter
transitioning javascript builtin TypedArrayPrototypeFilter( transitioning javascript builtin TypedArrayPrototypeFilter(
js-implicit context: Context, receiver: JSAny)(...arguments): Object { js-implicit context: Context, receiver: Object)(...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = thisArg // arguments[1] = thisArg
try { try {
...@@ -29,7 +29,7 @@ namespace typed_array_filter { ...@@ -29,7 +29,7 @@ namespace typed_array_filter {
otherwise ThrowTypeError(kCalledNonCallable, arguments[0]); otherwise ThrowTypeError(kCalledNonCallable, arguments[0]);
// 5. If thisArg is present, let T be thisArg; else let T be undefined. // 5. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments[1]; const thisArg: Object = arguments[1];
// 6. Let kept be a new empty List. // 6. Let kept be a new empty List.
let kept = growable_fixed_array::NewGrowableFixedArray(); let kept = growable_fixed_array::NewGrowableFixedArray();
...@@ -43,11 +43,11 @@ namespace typed_array_filter { ...@@ -43,11 +43,11 @@ namespace typed_array_filter {
// a. Let Pk be ! ToString(k). // a. Let Pk be ! ToString(k).
// b. Let kValue be ? Get(O, Pk). // b. Let kValue be ? Get(O, Pk).
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
// c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O // c. Let selected be ToBoolean(? Call(callbackfn, T, « kValue, k, O
// »)). // »)).
const selected: JSAny = const selected: Object =
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
// d. If selected is true, then // d. If selected is true, then
......
...@@ -9,7 +9,7 @@ namespace typed_array_find { ...@@ -9,7 +9,7 @@ namespace typed_array_find {
transitioning macro FindAllElements(implicit context: Context)( transitioning macro FindAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
thisArg: JSAny): Object { thisArg: Object): Object {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -17,7 +17,7 @@ namespace typed_array_find { ...@@ -17,7 +17,7 @@ namespace typed_array_find {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
const result = const result =
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
if (ToBoolean(result)) { if (ToBoolean(result)) {
...@@ -29,7 +29,7 @@ namespace typed_array_find { ...@@ -29,7 +29,7 @@ namespace typed_array_find {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.find
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeFind(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeFind(js-implicit context: Context, receiver: Object)(
...arguments): Object { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = thisArg // arguments[1] = thisArg
......
...@@ -9,7 +9,7 @@ namespace typed_array_findindex { ...@@ -9,7 +9,7 @@ namespace typed_array_findindex {
transitioning macro FindIndexAllElements(implicit context: Context)( transitioning macro FindIndexAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
thisArg: JSAny): Number { thisArg: Object): Number {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -17,7 +17,7 @@ namespace typed_array_findindex { ...@@ -17,7 +17,7 @@ namespace typed_array_findindex {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
const result = const result =
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
if (ToBoolean(result)) { if (ToBoolean(result)) {
...@@ -29,7 +29,7 @@ namespace typed_array_findindex { ...@@ -29,7 +29,7 @@ namespace typed_array_findindex {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findIndex // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.findIndex
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeFindIndex(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeFindIndex(js-implicit context: Context, receiver: Object)(
...arguments): Object { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = thisArg. // arguments[1] = thisArg.
......
...@@ -9,7 +9,7 @@ namespace typed_array_foreach { ...@@ -9,7 +9,7 @@ namespace typed_array_foreach {
transitioning macro ForEachAllElements(implicit context: Context)( transitioning macro ForEachAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
thisArg: JSAny): Undefined { thisArg: Object): Object {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -17,7 +17,7 @@ namespace typed_array_foreach { ...@@ -17,7 +17,7 @@ namespace typed_array_foreach {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
} }
return Undefined; return Undefined;
...@@ -25,8 +25,8 @@ namespace typed_array_foreach { ...@@ -25,8 +25,8 @@ namespace typed_array_foreach {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.every
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeForEach(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeForEach(js-implicit context: Context, receiver: Object)(
...arguments): Undefined { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = this_arg. // arguments[1] = this_arg.
......
...@@ -9,7 +9,7 @@ namespace typed_array_reduce { ...@@ -9,7 +9,7 @@ namespace typed_array_reduce {
transitioning macro ReduceAllElements(implicit context: Context)( transitioning macro ReduceAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny { initialValue: Object): Object {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -18,31 +18,24 @@ namespace typed_array_reduce { ...@@ -18,31 +18,24 @@ namespace typed_array_reduce {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { accumulator = value;
accumulator = value; } else {
} accumulator = Call(
case (accumulatorNotHole: JSAny): { context, callbackfn, Undefined, accumulator, value, k,
accumulator = Call( witness.GetStable());
context, callbackfn, Undefined, accumulatorNotHole, value, k,
witness.GetStable());
}
} }
} }
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, kBuiltinName);
ThrowTypeError(kReduceNoInitial, kBuiltinName);
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduce
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeReduce(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeReduce(js-implicit context: Context, receiver: Object)(
...arguments): Object { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = initialValue. // arguments[1] = initialValue.
......
...@@ -9,7 +9,7 @@ namespace typed_array_reduceright { ...@@ -9,7 +9,7 @@ namespace typed_array_reduceright {
transitioning macro ReduceRightAllElements(implicit context: Context)( transitioning macro ReduceRightAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny { initialValue: Object): Object {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -18,32 +18,25 @@ namespace typed_array_reduceright { ...@@ -18,32 +18,25 @@ namespace typed_array_reduceright {
for (let k: Smi = length - 1; k >= 0; k--) { for (let k: Smi = length - 1; k >= 0; k--) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { accumulator = value;
accumulator = value; } else {
} accumulator = Call(
case (accumulatorNotHole: JSAny): { context, callbackfn, Undefined, accumulator, value, k,
accumulator = Call( witness.GetStable());
context, callbackfn, Undefined, accumulatorNotHole, value, k,
witness.GetStable());
}
} }
} }
typeswitch (accumulator) { if (accumulator == TheHole) {
case (TheHole): { ThrowTypeError(kReduceNoInitial, kBuiltinName);
ThrowTypeError(kReduceNoInitial, kBuiltinName);
}
case (accumulator: JSAny): {
return accumulator;
}
} }
return accumulator;
} }
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.reduceright
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeReduceRight(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeReduceRight(
...arguments): Object { js-implicit context: Context, receiver: Object)(...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = initialValue. // arguments[1] = initialValue.
try { try {
......
...@@ -53,7 +53,7 @@ namespace typed_array_slice { ...@@ -53,7 +53,7 @@ namespace typed_array_slice {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.slice
transitioning javascript builtin TypedArrayPrototypeSlice( transitioning javascript builtin TypedArrayPrototypeSlice(
js-implicit context: Context, receiver: JSAny)(...arguments): Object { js-implicit context: Context, receiver: Object)(...arguments): Object {
// arguments[0] = start // arguments[0] = start
// arguments[1] = end // arguments[1] = end
......
...@@ -9,7 +9,7 @@ namespace typed_array_some { ...@@ -9,7 +9,7 @@ namespace typed_array_some {
transitioning macro SomeAllElements(implicit context: Context)( transitioning macro SomeAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
thisArg: JSAny): Boolean { thisArg: Object): Boolean {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
// TODO(v8:4153): Support huge TypedArrays here. // TODO(v8:4153): Support huge TypedArrays here.
const length = const length =
...@@ -17,7 +17,7 @@ namespace typed_array_some { ...@@ -17,7 +17,7 @@ namespace typed_array_some {
for (let k: Smi = 0; k < length; k++) { for (let k: Smi = 0; k < length; k++) {
// BUG(4895): We should throw on detached buffers rather than simply exit. // BUG(4895): We should throw on detached buffers rather than simply exit.
witness.Recheck() otherwise break; witness.Recheck() otherwise break;
const value: JSAny = witness.Load(k); const value: Object = witness.Load(k);
const result = const result =
Call(context, callbackfn, thisArg, value, k, witness.GetStable()); Call(context, callbackfn, thisArg, value, k, witness.GetStable());
if (ToBoolean(result)) { if (ToBoolean(result)) {
...@@ -29,7 +29,7 @@ namespace typed_array_some { ...@@ -29,7 +29,7 @@ namespace typed_array_some {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.some
transitioning javascript builtin transitioning javascript builtin
TypedArrayPrototypeSome(js-implicit context: Context, receiver: JSAny)( TypedArrayPrototypeSome(js-implicit context: Context, receiver: Object)(
...arguments): Object { ...arguments): Object {
// arguments[0] = callback // arguments[0] = callback
// arguments[1] = thisArg. // arguments[1] = thisArg.
......
...@@ -6,7 +6,7 @@ namespace typed_array_subarray { ...@@ -6,7 +6,7 @@ namespace typed_array_subarray {
// ES %TypedArray%.prototype.subarray // ES %TypedArray%.prototype.subarray
transitioning javascript builtin TypedArrayPrototypeSubArray( transitioning javascript builtin TypedArrayPrototypeSubArray(
js-implicit context: Context, js-implicit context: Context,
receiver: JSAny)(...arguments): JSTypedArray { receiver: Object)(...arguments): JSTypedArray {
const methodName: constexpr string = '%TypedArray%.prototype.subarray'; const methodName: constexpr string = '%TypedArray%.prototype.subarray';
// 1. Let O be the this value. // 1. Let O be the this value.
......
...@@ -51,9 +51,9 @@ namespace typed_array { ...@@ -51,9 +51,9 @@ namespace typed_array {
sizeLog2: uintptr; sizeLog2: uintptr;
kind: ElementsKind; kind: ElementsKind;
} }
extern runtime TypedArraySortFast(Context, JSAny): JSTypedArray; extern runtime TypedArraySortFast(Context, Object): JSTypedArray;
extern macro TypedArrayBuiltinsAssembler::ValidateTypedArray( extern macro TypedArrayBuiltinsAssembler::ValidateTypedArray(
Context, JSAny, constexpr string): JSTypedArray; Context, Object, constexpr string): JSTypedArray;
extern macro TypedArrayBuiltinsAssembler::CallCMemcpy( extern macro TypedArrayBuiltinsAssembler::CallCMemcpy(
RawPtr, RawPtr, uintptr): void; RawPtr, RawPtr, uintptr): void;
...@@ -72,10 +72,10 @@ namespace typed_array { ...@@ -72,10 +72,10 @@ namespace typed_array {
extern macro LoadFixedTypedArrayElementAsTagged( extern macro LoadFixedTypedArrayElementAsTagged(
RawPtr, Smi, constexpr ElementsKind): Numeric; RawPtr, Smi, constexpr ElementsKind): Numeric;
extern macro StoreJSTypedArrayElementFromTagged( extern macro StoreJSTypedArrayElementFromTagged(
Context, JSTypedArray, Smi, JSAny, constexpr ElementsKind); Context, JSTypedArray, Smi, Object, constexpr ElementsKind);
type LoadFn = builtin(Context, JSTypedArray, Smi) => JSAny; type LoadFn = builtin(Context, JSTypedArray, Smi) => Object;
type StoreFn = builtin(Context, JSTypedArray, Smi, JSAny) => JSAny; type StoreFn = builtin(Context, JSTypedArray, Smi, Object) => Object;
// AttachedJSTypedArray guards that the array's buffer is not detached. // AttachedJSTypedArray guards that the array's buffer is not detached.
transient type AttachedJSTypedArray extends JSTypedArray; transient type AttachedJSTypedArray extends JSTypedArray;
...@@ -100,7 +100,7 @@ namespace typed_array { ...@@ -100,7 +100,7 @@ namespace typed_array {
this.unstable = %RawDownCast<AttachedJSTypedArray>(this.stable); this.unstable = %RawDownCast<AttachedJSTypedArray>(this.stable);
} }
Load(implicit context: Context)(k: Smi): JSAny { Load(implicit context: Context)(k: Smi): Object {
const lf: LoadFn = this.loadfn; const lf: LoadFn = this.loadfn;
return lf(context, this.unstable, k); return lf(context, this.unstable, k);
} }
...@@ -190,14 +190,14 @@ namespace typed_array { ...@@ -190,14 +190,14 @@ namespace typed_array {
} }
builtin LoadFixedElement<T: type>( builtin LoadFixedElement<T: type>(
_context: Context, array: JSTypedArray, index: Smi): JSAny { _context: Context, array: JSTypedArray, index: Smi): Object {
return LoadFixedTypedArrayElementAsTagged( return LoadFixedTypedArrayElementAsTagged(
array.data_ptr, index, KindForArrayType<T>()); array.data_ptr, index, KindForArrayType<T>());
} }
builtin StoreFixedElement<T: type>( builtin StoreFixedElement<T: type>(
context: Context, typedArray: JSTypedArray, index: Smi, context: Context, typedArray: JSTypedArray, index: Smi,
value: JSAny): JSAny { value: Object): Object {
StoreJSTypedArrayElementFromTagged( StoreJSTypedArrayElementFromTagged(
context, typedArray, index, value, KindForArrayType<T>()); context, typedArray, index, value, KindForArrayType<T>());
return Undefined; return Undefined;
...@@ -205,7 +205,7 @@ namespace typed_array { ...@@ -205,7 +205,7 @@ namespace typed_array {
transitioning macro CallCompare( transitioning macro CallCompare(
implicit context: Context, array: JSTypedArray, implicit context: Context, array: JSTypedArray,
comparefn: Callable)(a: JSAny, b: JSAny): Number { comparefn: Callable)(a: Object, b: Object): Number {
// a. Let v be ? ToNumber(? Call(comparefn, undefined, x, y)). // a. Let v be ? ToNumber(? Call(comparefn, undefined, x, y)).
const v: Number = const v: Number =
ToNumber_Inline(context, Call(context, comparefn, Undefined, a, b)); ToNumber_Inline(context, Call(context, comparefn, Undefined, a, b));
...@@ -238,8 +238,8 @@ namespace typed_array { ...@@ -238,8 +238,8 @@ namespace typed_array {
target.objects[targetIndex] = source.objects[left++]; target.objects[targetIndex] = source.objects[left++];
} else if (left < middle) { } else if (left < middle) {
// If both have elements, we need to compare. // If both have elements, we need to compare.
const leftElement = UnsafeCast<JSAny>(source.objects[left]); const leftElement: Object = source.objects[left];
const rightElement = UnsafeCast<JSAny>(source.objects[right]); const rightElement: Object = source.objects[right];
if (CallCompare(leftElement, rightElement) <= 0) { if (CallCompare(leftElement, rightElement) <= 0) {
target.objects[targetIndex] = leftElement; target.objects[targetIndex] = leftElement;
left++; left++;
...@@ -259,7 +259,7 @@ namespace typed_array { ...@@ -259,7 +259,7 @@ namespace typed_array {
transitioning builtin transitioning builtin
TypedArrayMergeSort( TypedArrayMergeSort(
implicit context: Context, array: JSTypedArray, comparefn: Callable)( implicit context: Context, array: JSTypedArray, comparefn: Callable)(
source: FixedArray, from: Smi, to: Smi, target: FixedArray): JSAny { source: FixedArray, from: Smi, to: Smi, target: FixedArray): Object {
assert(to - from > 1); assert(to - from > 1);
const middle: Smi = from + ((to - from) >> 1); const middle: Smi = from + ((to - from) >> 1);
...@@ -277,16 +277,17 @@ namespace typed_array { ...@@ -277,16 +277,17 @@ namespace typed_array {
// https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort // https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.sort
transitioning javascript builtin TypedArrayPrototypeSort( transitioning javascript builtin TypedArrayPrototypeSort(
js-implicit context: Context, js-implicit context: Context,
receiver: JSAny)(...arguments): JSTypedArray { receiver: Object)(...arguments): JSTypedArray {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, // 1. If comparefn is not undefined and IsCallable(comparefn) is false,
// throw a TypeError exception. // throw a TypeError exception.
const comparefnObj: JSAny = arguments.length > 0 ? arguments[0] : Undefined; const comparefnObj: Object =
arguments.length > 0 ? arguments[0] : Undefined;
if (comparefnObj != Undefined && !TaggedIsCallable(comparefnObj)) { if (comparefnObj != Undefined && !TaggedIsCallable(comparefnObj)) {
ThrowTypeError(kBadSortComparisonFunction, comparefnObj); ThrowTypeError(kBadSortComparisonFunction, comparefnObj);
} }
// 2. Let obj be the this value. // 2. Let obj be the this value.
const obj: JSAny = receiver; const obj: Object = receiver;
// 3. Let buffer be ? ValidateTypedArray(obj). // 3. Let buffer be ? ValidateTypedArray(obj).
// ValidateTypedArray currently returns the array, not the ViewBuffer. // ValidateTypedArray currently returns the array, not the ViewBuffer.
...@@ -362,7 +363,7 @@ namespace typed_array { ...@@ -362,7 +363,7 @@ namespace typed_array {
const work2: FixedArray = AllocateZeroedFixedArray(Convert<intptr>(len)); const work2: FixedArray = AllocateZeroedFixedArray(Convert<intptr>(len));
for (let i: Smi = 0; i < len; ++i) { for (let i: Smi = 0; i < len; ++i) {
const element: JSAny = loadfn(context, array, i); const element: Object = loadfn(context, array, i);
work1.objects[i] = element; work1.objects[i] = element;
work2.objects[i] = element; work2.objects[i] = element;
} }
...@@ -371,7 +372,7 @@ namespace typed_array { ...@@ -371,7 +372,7 @@ namespace typed_array {
// work1 contains the sorted numbers. Write them back. // work1 contains the sorted numbers. Write them back.
for (let i: Smi = 0; i < len; ++i) for (let i: Smi = 0; i < len; ++i)
storefn(context, array, i, UnsafeCast<JSAny>(work1.objects[i])); storefn(context, array, i, work1.objects[i]);
return array; return array;
} }
......
...@@ -133,13 +133,6 @@ bool Object::IsNullOrUndefined() const { ...@@ -133,13 +133,6 @@ bool Object::IsNullOrUndefined() const {
bool Object::IsZero() const { return *this == Smi::zero(); } bool Object::IsZero() const { return *this == Smi::zero(); }
bool Object::IsPublicSymbol() const {
return IsSymbol() && !Symbol::cast(*this).is_private();
}
bool Object::IsPrivateSymbol() const {
return IsSymbol() && Symbol::cast(*this).is_private();
}
bool Object::IsNoSharedNameSentinel() const { bool Object::IsNoSharedNameSentinel() const {
return *this == SharedFunctionInfo::kNoSharedNameSentinel; return *this == SharedFunctionInfo::kNoSharedNameSentinel;
} }
......
...@@ -289,8 +289,6 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> { ...@@ -289,8 +289,6 @@ class Object : public TaggedImpl<HeapObjectReferenceType::STRONG, Address> {
V8_INLINE bool IsZero() const; V8_INLINE bool IsZero() const;
V8_INLINE bool IsNoSharedNameSentinel() const; V8_INLINE bool IsNoSharedNameSentinel() const;
V8_INLINE bool IsPrivateSymbol() const;
V8_INLINE bool IsPublicSymbol() const;
enum class Conversion { kToNumber, kToNumeric }; enum class Conversion { kToNumber, kToNumeric };
......
...@@ -28,7 +28,6 @@ static const char* const JS_FUNCTION_TYPE_STRING = "JSFunction"; ...@@ -28,7 +28,6 @@ static const char* const JS_FUNCTION_TYPE_STRING = "JSFunction";
static const char* const MAP_TYPE_STRING = "Map"; static const char* const MAP_TYPE_STRING = "Map";
static const char* const OBJECT_TYPE_STRING = "Object"; static const char* const OBJECT_TYPE_STRING = "Object";
static const char* const HEAP_OBJECT_TYPE_STRING = "HeapObject"; static const char* const HEAP_OBJECT_TYPE_STRING = "HeapObject";
static const char* const JSANY_TYPE_STRING = "JSAny";
static const char* const JSOBJECT_TYPE_STRING = "JSObject"; static const char* const JSOBJECT_TYPE_STRING = "JSObject";
static const char* const SMI_TYPE_STRING = "Smi"; static const char* const SMI_TYPE_STRING = "Smi";
static const char* const TAGGED_TYPE_STRING = "Tagged"; static const char* const TAGGED_TYPE_STRING = "Tagged";
......
...@@ -468,13 +468,13 @@ void ImplementationVisitor::Visit(Builtin* builtin) { ...@@ -468,13 +468,13 @@ void ImplementationVisitor::Visit(Builtin* builtin) {
: "UncheckedCast<Object>(Parameter(Descriptor::kReceiver))") : "UncheckedCast<Object>(Parameter(Descriptor::kReceiver))")
<< ";\n"; << ";\n";
source_out() << "USE(" << generated_name << ");\n"; source_out() << "USE(" << generated_name << ");\n";
expected_type = TypeOracle::GetJSAnyType(); expected_type = TypeOracle::GetObjectType();
} else if (param_name == "newTarget") { } else if (param_name == "newTarget") {
source_out() << " TNode<Object> " << generated_name source_out() << " TNode<Object> " << generated_name
<< " = UncheckedCast<Object>(Parameter(" << " = UncheckedCast<Object>(Parameter("
<< "Descriptor::kJSNewTarget));\n"; << "Descriptor::kJSNewTarget));\n";
source_out() << "USE(" << generated_name << ");\n"; source_out() << "USE(" << generated_name << ");\n";
expected_type = TypeOracle::GetJSAnyType(); expected_type = TypeOracle::GetObjectType();
} else if (param_name == "target") { } else if (param_name == "target") {
source_out() << " TNode<JSFunction> " << generated_name source_out() << " TNode<JSFunction> " << generated_name
<< " = UncheckedCast<JSFunction>(Parameter(" << " = UncheckedCast<JSFunction>(Parameter("
...@@ -2264,10 +2264,9 @@ VisitResult ImplementationVisitor::GenerateCall( ...@@ -2264,10 +2264,9 @@ VisitResult ImplementationVisitor::GenerateCall(
size_t j = 0; size_t j = 0;
for (auto t : callable->signature().labels[i].types) { for (auto t : callable->signature().labels[i].types) {
const Type* parameter_type = label->parameter_types[j]; const Type* parameter_type = label->parameter_types[j];
if (!t->IsSubtypeOf(parameter_type)) { if (parameter_type != t) {
ReportError("mismatch of label parameters (label expects ", ReportError("mismatch of label parameters (expected ", *t, " got ",
*parameter_type, " but macro produces ", *t, parameter_type, " for parameter ", i + 1, ")");
" for parameter ", i + 1, ")");
} }
j++; j++;
} }
......
...@@ -133,7 +133,7 @@ void CallCsaMacroInstruction::TypeInstruction(Stack<const Type*>* stack, ...@@ -133,7 +133,7 @@ void CallCsaMacroInstruction::TypeInstruction(Stack<const Type*>* stack,
if (catch_block) { if (catch_block) {
Stack<const Type*> catch_stack = *stack; Stack<const Type*> catch_stack = *stack;
catch_stack.Push(TypeOracle::GetJSAnyType()); catch_stack.Push(TypeOracle::GetObjectType());
(*catch_block)->SetInputTypes(catch_stack); (*catch_block)->SetInputTypes(catch_stack);
} }
...@@ -170,7 +170,7 @@ void CallCsaMacroAndBranchInstruction::TypeInstruction( ...@@ -170,7 +170,7 @@ void CallCsaMacroAndBranchInstruction::TypeInstruction(
if (catch_block) { if (catch_block) {
Stack<const Type*> catch_stack = *stack; Stack<const Type*> catch_stack = *stack;
catch_stack.Push(TypeOracle::GetJSAnyType()); catch_stack.Push(TypeOracle::GetObjectType());
(*catch_block)->SetInputTypes(catch_stack); (*catch_block)->SetInputTypes(catch_stack);
} }
...@@ -201,7 +201,7 @@ void CallBuiltinInstruction::TypeInstruction(Stack<const Type*>* stack, ...@@ -201,7 +201,7 @@ void CallBuiltinInstruction::TypeInstruction(Stack<const Type*>* stack,
if (catch_block) { if (catch_block) {
Stack<const Type*> catch_stack = *stack; Stack<const Type*> catch_stack = *stack;
catch_stack.Push(TypeOracle::GetJSAnyType()); catch_stack.Push(TypeOracle::GetObjectType());
(*catch_block)->SetInputTypes(catch_stack); (*catch_block)->SetInputTypes(catch_stack);
} }
...@@ -236,7 +236,7 @@ void CallRuntimeInstruction::TypeInstruction(Stack<const Type*>* stack, ...@@ -236,7 +236,7 @@ void CallRuntimeInstruction::TypeInstruction(Stack<const Type*>* stack,
if (catch_block) { if (catch_block) {
Stack<const Type*> catch_stack = *stack; Stack<const Type*> catch_stack = *stack;
catch_stack.Push(TypeOracle::GetJSAnyType()); catch_stack.Push(TypeOracle::GetObjectType());
(*catch_block)->SetInputTypes(catch_stack); (*catch_block)->SetInputTypes(catch_stack);
} }
......
...@@ -1136,7 +1136,7 @@ base::Optional<ParseResult> MakeCatchBlock(ParseResultIterator* child_results) { ...@@ -1136,7 +1136,7 @@ base::Optional<ParseResult> MakeCatchBlock(ParseResultIterator* child_results) {
ParameterList parameters; ParameterList parameters;
parameters.names.push_back(MakeNode<Identifier>(variable)); parameters.names.push_back(MakeNode<Identifier>(variable));
parameters.types.push_back(MakeNode<BasicTypeExpression>( parameters.types.push_back(MakeNode<BasicTypeExpression>(
std::vector<std::string>{}, "JSAny", std::vector<TypeExpression*>{})); std::vector<std::string>{}, "Object", std::vector<TypeExpression*>{}));
parameters.has_varargs = false; parameters.has_varargs = false;
LabelBlock* result = MakeNode<LabelBlock>( LabelBlock* result = MakeNode<LabelBlock>(
MakeNode<Identifier>(kCatchLabelName), std::move(parameters), body); MakeNode<Identifier>(kCatchLabelName), std::move(parameters), body);
......
...@@ -143,10 +143,6 @@ class TypeOracle : public ContextualClass<TypeOracle> { ...@@ -143,10 +143,6 @@ class TypeOracle : public ContextualClass<TypeOracle> {
return Get().GetBuiltinType(HEAP_OBJECT_TYPE_STRING); return Get().GetBuiltinType(HEAP_OBJECT_TYPE_STRING);
} }
static const Type* GetJSAnyType() {
return Get().GetBuiltinType(JSANY_TYPE_STRING);
}
static const Type* GetJSObjectType() { static const Type* GetJSObjectType() {
return Get().GetBuiltinType(JSOBJECT_TYPE_STRING); return Get().GetBuiltinType(JSOBJECT_TYPE_STRING);
} }
......
...@@ -83,11 +83,11 @@ namespace test { ...@@ -83,11 +83,11 @@ namespace test {
} }
} }
builtin GenericBuiltinTest<T: type>(_c: Context, _param: T): JSAny { builtin GenericBuiltinTest<T: type>(_c: Context, _param: T): Object {
return Null; return Null;
} }
GenericBuiltinTest<JSAny>(_c: Context, param: JSAny): JSAny { GenericBuiltinTest<Object>(_c: Context, param: Object): Object {
return param; return param;
} }
...@@ -95,8 +95,8 @@ namespace test { ...@@ -95,8 +95,8 @@ namespace test {
macro TestBuiltinSpecialization(c: Context) { macro TestBuiltinSpecialization(c: Context) {
check(GenericBuiltinTest<Smi>(c, 0) == Null); check(GenericBuiltinTest<Smi>(c, 0) == Null);
check(GenericBuiltinTest<Smi>(c, 1) == Null); check(GenericBuiltinTest<Smi>(c, 1) == Null);
check(GenericBuiltinTest<JSAny>(c, Undefined) == Undefined); check(GenericBuiltinTest<Object>(c, Undefined) == Undefined);
check(GenericBuiltinTest<JSAny>(c, Undefined) == Undefined); check(GenericBuiltinTest<Object>(c, Undefined) == Undefined);
} }
macro LabelTestHelper4(flag: constexpr bool): never macro LabelTestHelper4(flag: constexpr bool): never
...@@ -202,8 +202,9 @@ namespace test { ...@@ -202,8 +202,9 @@ namespace test {
@export @export
macro TestFunctionPointerToGeneric(c: Context) { macro TestFunctionPointerToGeneric(c: Context) {
const fptr1: builtin(Context, Smi) => JSAny = GenericBuiltinTest<Smi>; const fptr1: builtin(Context, Smi) => Object = GenericBuiltinTest<Smi>;
const fptr2: builtin(Context, JSAny) => JSAny = GenericBuiltinTest<JSAny>; const fptr2: builtin(Context, Object) => Object =
GenericBuiltinTest<Object>;
check(fptr1(c, 0) == Null); check(fptr1(c, 0) == Null);
check(fptr1(c, 1) == Null); check(fptr1(c, 1) == Null);
...@@ -211,7 +212,7 @@ namespace test { ...@@ -211,7 +212,7 @@ namespace test {
check(fptr2(c, Undefined) == Undefined); check(fptr2(c, Undefined) == Undefined);
} }
type ObjectToObject = builtin(Context, JSAny) => JSAny; type ObjectToObject = builtin(Context, Object) => Object;
@export @export
macro TestTypeAlias(x: ObjectToObject): BuiltinPtr { macro TestTypeAlias(x: ObjectToObject): BuiltinPtr {
return x; return x;
...@@ -451,7 +452,7 @@ namespace test { ...@@ -451,7 +452,7 @@ namespace test {
@export @export
macro TestSubtyping(x: Smi) { macro TestSubtyping(x: Smi) {
const _foo: JSAny = x; const _foo: Object = x;
} }
macro IncrementIfSmi<A: type>(x: A): A { macro IncrementIfSmi<A: type>(x: A): A {
...@@ -626,7 +627,7 @@ namespace test { ...@@ -626,7 +627,7 @@ namespace test {
@export @export
macro TestQualifiedAccess(implicit context: Context)() { macro TestQualifiedAccess(implicit context: Context)() {
const s: Smi = 0; const s: Smi = 0;
check(!Is<JSArray>(s)); check(!array::IsJSArray(s));
} }
@export @export
...@@ -684,14 +685,14 @@ namespace test { ...@@ -684,14 +685,14 @@ namespace test {
@export @export
macro TestIterator(implicit context: Context)(o: JSReceiver, map: Map) { macro TestIterator(implicit context: Context)(o: JSReceiver, map: Map) {
try { try {
const t1: JSAny = iterator::GetIteratorMethod(o); const t1: Object = iterator::GetIteratorMethod(o);
const t2: iterator::IteratorRecord = iterator::GetIterator(o); const t2: iterator::IteratorRecord = iterator::GetIterator(o);
const _t3: JSAny = iterator::IteratorStep(t2) otherwise Fail; const _t3: Object = iterator::IteratorStep(t2) otherwise Fail;
const _t4: JSAny = iterator::IteratorStep(t2, map) otherwise Fail; const _t4: Object = iterator::IteratorStep(t2, map) otherwise Fail;
const t5: JSAny = iterator::IteratorValue(o); const t5: Object = iterator::IteratorValue(o);
const _t6: JSAny = iterator::IteratorValue(o, map); const _t6: Object = iterator::IteratorValue(o, map);
const _t7: JSArray = iterator::IterableToList(t1, t1); const _t7: JSArray = iterator::IterableToList(t1, t1);
......
This diff is collapsed.
...@@ -20,9 +20,18 @@ kPercentEscape = r'α'; # Unicode alpha ...@@ -20,9 +20,18 @@ kPercentEscape = r'α'; # Unicode alpha
def preprocess(input): def preprocess(input):
input = re.sub(r'(if\s+)constexpr(\s*\()', r'\1/*COxp*/\2', input) input = re.sub(r'(if\s+)constexpr(\s*\()', r'\1/*COxp*/\2', input)
input = re.sub(r'(\s+)operator\s*(\'[^\']+\')', r'\1/*_OPE \2*/', input) input = re.sub(r'(\s+)operator\s*(\'[^\']+\')', r'\1/*_OPE \2*/', input)
input = re.sub(r'\btypeswitch\s*(\([^{]*\))\s{', r' if /*tPsW*/ \1 {', input)
input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*deferred\s*{', r' if /*cAsEdEfF*/ \1 {', input) # Mangle typeswitches to look like switch statements with the extra type
input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*{', r' if /*cA*/ \1 {', input) # information and syntax encoded in comments.
input = re.sub(r'(\s+)typeswitch\s*\(', r'\1/*_TYPE*/switch (', input)
input = re.sub(r'(\s+)case\s*\(\s*([^\:]+)\s*\)(\s*)\:\s*deferred',
r'\1case \2: /*_TSXDEFERRED_*/', input)
input = re.sub(r'(\s+)case\s*\(\s*([^\:]+)\s*\)(\s*)\:',
r'\1case \2: /*_TSX*/', input)
input = re.sub(r'(\s+)case\s*\(\s*([^\s]+)\s*\:\s*([^\:]+)\s*\)(\s*)\:\s*deferred',
r'\1case \3: /*_TSVDEFERRED_\2:*/', input)
input = re.sub(r'(\s+)case\s*\(\s*([^\s]+)\s*\:\s*([^\:]+)\s*\)(\s*)\:',
r'\1case \3: /*_TSV\2:*/', input)
# Add extra space around | operators to fix union types later. # Add extra space around | operators to fix union types later.
while True: while True:
...@@ -56,9 +65,15 @@ def postprocess(output): ...@@ -56,9 +65,15 @@ def postprocess(output):
output = re.sub(r'(\S+)\s*: type([,>])', r'\1: type\2', output) output = re.sub(r'(\S+)\s*: type([,>])', r'\1: type\2', output)
output = re.sub(r'(\n\s*)labels( [A-Z])', r'\1 labels\2', output) output = re.sub(r'(\n\s*)labels( [A-Z])', r'\1 labels\2', output)
output = re.sub(r'\/\*_OPE \'([^\']+)\'\*\/', r"operator '\1'", output) output = re.sub(r'\/\*_OPE \'([^\']+)\'\*\/', r"operator '\1'", output)
output = re.sub(r'\bif\s*\/\*tPsW\*\/', r'typeswitch', output) output = re.sub(r'\/\*_TYPE\*\/(\s*)switch', r'typeswitch', output)
output = re.sub(r'\bif\s*\/\*cA\*\/\s*(\([^{]*\))\s*{', r'case \1: {', output) output = re.sub(r'case (\w+)\:\s*\/\*_TSXDEFERRED_\*\/',
output = re.sub(r'\bif\s*\/\*cAsEdEfF\*\/\s*(\([^{]*\))\s*{', r'case \1: deferred {', output) r'case (\1): deferred', output)
output = re.sub(r'case (\w+)\:\s*\/\*_TSX\*\/',
r'case (\1):', output)
output = re.sub(r'case (\w+)\:\s*\/\*_TSVDEFERRED_([^\:]+)\:\*\/',
r'case (\2: \1): deferred', output)
output = re.sub(r'case (\w+)\:\s*\/\*_TSV([^\:]+)\:\*\/',
r'case (\2: \1):', output)
output = re.sub(r'\n_GeNeRaTeS00_\s*\/\*([^@]+)@\*\/', output = re.sub(r'\n_GeNeRaTeS00_\s*\/\*([^@]+)@\*\/',
r"\n generates '\1'", output) r"\n generates '\1'", output)
output = re.sub(r'_GeNeRaTeS00_\s*\/\*([^@]+)@\*\/', output = re.sub(r'_GeNeRaTeS00_\s*\/\*([^@]+)@\*\/',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment