%FunctionSetPrototype(ArrayIterator, new $Object());
%FunctionSetInstanceClassName(ArrayIterator, 'Array Iterator');
- InstallFunctions(ArrayIterator.prototype, DONT_ENUM, $Array(
+ InstallFunctions(ArrayIterator.prototype, DONT_ENUM, [
'next', ArrayIteratorNext
- ));
+ ]);
%FunctionSetName(ArrayIteratorIterator, '[Symbol.iterator]');
%AddNamedProperty(ArrayIterator.prototype, symbolIterator,
ArrayIteratorIterator, DONT_ENUM);
function ExtendArrayPrototype() {
%CheckIsBootstrapping();
- InstallFunctions($Array.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Array.prototype, DONT_ENUM, [
// No 'values' since it breaks webcompat: http://crbug.com/409858
'entries', ArrayEntries,
'keys', ArrayKeys
- ));
+ ]);
%AddNamedProperty($Array.prototype, symbolIterator, ArrayValues, DONT_ENUM);
}
DONT_ENUM | READ_ONLY);
// Set up non-enumerable functions on the Array object.
- InstallFunctions($Array, DONT_ENUM, $Array(
+ InstallFunctions($Array, DONT_ENUM, [
"isArray", ArrayIsArray
- ));
+ ]);
var specialFunctions = %SpecialArrayFunctions();
// set their names.
// Manipulate the length of some of the functions to meet
// expectations set by ECMA-262 or Mozilla.
- InstallFunctions($Array.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Array.prototype, DONT_ENUM, [
"toString", getFunction("toString", ArrayToString),
"toLocaleString", getFunction("toLocaleString", ArrayToLocaleString),
"join", getFunction("join", ArrayJoin),
"lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
"reduce", getFunction("reduce", ArrayReduce, 1),
"reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
- ));
+ ]);
%FinishArrayPrototypeSetup($Array.prototype);
// The internal Array prototype doesn't need to be fancy, since it's never
// exposed to user code.
// Adding only the functions that are actually used.
- SetUpLockedPrototype(InternalArray, $Array(), $Array(
+ SetUpLockedPrototype(InternalArray, $Array(), [
"concat", getFunction("concat", ArrayConcatJS),
"indexOf", getFunction("indexOf", ArrayIndexOf),
"join", getFunction("join", ArrayJoin),
"pop", getFunction("pop", ArrayPop),
"push", getFunction("push", ArrayPush),
"splice", getFunction("splice", ArraySplice)
- ));
+ ]);
- SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
+ SetUpLockedPrototype(InternalPackedArray, $Array(), [
"join", getFunction("join", ArrayJoin),
"pop", getFunction("pop", ArrayPop),
"push", getFunction("push", ArrayPush)
- ));
+ ]);
}
SetUpArray();
InstallGetter($ArrayBuffer.prototype, "byteLength", ArrayBufferGetByteLen);
- InstallFunctions($ArrayBuffer, DONT_ENUM, $Array(
- "isView", ArrayBufferIsViewJS
- ));
+ InstallFunctions($ArrayBuffer, DONT_ENUM, [
+ "isView", ArrayBufferIsViewJS
+ ]);
- InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array(
- "slice", ArrayBufferSlice
- ));
+ InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, [
+ "slice", ArrayBufferSlice
+ ]);
}
SetUpArrayBuffer();
%SetCode(SetIterator, SetIteratorConstructor);
%FunctionSetPrototype(SetIterator, new $Object());
%FunctionSetInstanceClassName(SetIterator, 'Set Iterator');
- InstallFunctions(SetIterator.prototype, DONT_ENUM, $Array(
+ InstallFunctions(SetIterator.prototype, DONT_ENUM, [
'next', SetIteratorNextJS
- ));
+ ]);
%FunctionSetName(SetIteratorSymbolIterator, '[Symbol.iterator]');
%AddNamedProperty(SetIterator.prototype, symbolIterator,
function ExtendSetPrototype() {
%CheckIsBootstrapping();
- InstallFunctions($Set.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Set.prototype, DONT_ENUM, [
'entries', SetEntries,
'keys', SetValues,
'values', SetValues
- ));
+ ]);
%AddNamedProperty($Set.prototype, symbolIterator, SetValues, DONT_ENUM);
}
%SetCode(MapIterator, MapIteratorConstructor);
%FunctionSetPrototype(MapIterator, new $Object());
%FunctionSetInstanceClassName(MapIterator, 'Map Iterator');
- InstallFunctions(MapIterator.prototype, DONT_ENUM, $Array(
+ InstallFunctions(MapIterator.prototype, DONT_ENUM, [
'next', MapIteratorNextJS
- ));
+ ]);
%FunctionSetName(MapIteratorSymbolIterator, '[Symbol.iterator]');
%AddNamedProperty(MapIterator.prototype, symbolIterator,
function ExtendMapPrototype() {
%CheckIsBootstrapping();
- InstallFunctions($Map.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Map.prototype, DONT_ENUM, [
'entries', MapEntries,
'keys', MapKeys,
'values', MapValues
- ));
+ ]);
%AddNamedProperty($Map.prototype, symbolIterator, MapEntries, DONT_ENUM);
}
// Set up the non-enumerable functions on the Set prototype object.
InstallGetter($Set.prototype, "size", SetGetSize);
-InstallFunctions($Set.prototype, DONT_ENUM, $Array(
+InstallFunctions($Set.prototype, DONT_ENUM, [
"add", SetAdd,
"has", SetHas,
"delete", SetDelete,
"clear", SetClearJS,
"forEach", SetForEach
-));
+]);
// -------------------------------------------------------------------
// Set up the non-enumerable functions on the Map prototype object.
InstallGetter($Map.prototype, "size", MapGetSize);
-InstallFunctions($Map.prototype, DONT_ENUM, $Array(
+InstallFunctions($Map.prototype, DONT_ENUM, [
"get", MapGet,
"set", MapSet,
"has", MapHas,
"delete", MapDelete,
"clear", MapClearJS,
"forEach", MapForEach
-));
+]);
})();
// -------------------------------------------------------------------
// Reused output buffer. Used when parsing date strings.
-var parse_buffer = $Array(8);
+var parse_buffer = new InternalArray(8);
// ECMA 262 - 15.9.4.2
function DateParse(string) {
%FunctionSetPrototype(GlobalDate, new GlobalDate(NAN));
// Set up non-enumerable properties of the Date object itself.
-InstallFunctions(GlobalDate, DONT_ENUM, $Array(
+InstallFunctions(GlobalDate, DONT_ENUM, [
"UTC", DateUTC,
"parse", DateParse,
"now", DateNow
-));
+]);
// Set up non-enumerable constructor property of the Date prototype object.
%AddNamedProperty(GlobalDate.prototype, "constructor", GlobalDate, DONT_ENUM);
// Set up non-enumerable functions of the Date prototype object and
// set their names.
-InstallFunctions(GlobalDate.prototype, DONT_ENUM, $Array(
+InstallFunctions(GlobalDate.prototype, DONT_ENUM, [
"toString", DateToString,
"toDateString", DateToDateString,
"toTimeString", DateToTimeString,
"setYear", DateSetYear,
"toISOString", DateToISOString,
"toJSON", DateToJSON
-));
+]);
// Expose to the global scope.
$createDate = CreateDate;
%FunctionSetLength(ArrayIncludes, 1);
// Set up the non-enumerable functions on the Array prototype object.
- InstallFunctions($Array.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Array.prototype, DONT_ENUM, [
"includes", ArrayIncludes
- ));
+ ]);
}
HarmonyArrayIncludesExtendArrayPrototype();
function HarmonyArrayExtendSymbolPrototype() {
%CheckIsBootstrapping();
- InstallConstants(global.Symbol, $Array(
+ InstallConstants(global.Symbol, [
// TODO(dslomov, caitp): Move to symbol.js when shipping
- "isConcatSpreadable", symbolIsConcatSpreadable
- ));
+ "isConcatSpreadable", symbolIsConcatSpreadable
+ ]);
}
HarmonyArrayExtendSymbolPrototype();
%FunctionSetLength(ArrayFrom, 1);
// Set up non-enumerable functions on the Array object.
- InstallFunctions($Array, DONT_ENUM, $Array(
+ InstallFunctions($Array, DONT_ENUM, [
"from", ArrayFrom,
"of", ArrayOf
- ));
+ ]);
// Set up the non-enumerable functions on the Array prototype object.
- InstallFunctions($Array.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Array.prototype, DONT_ENUM, [
"find", ArrayFind,
"findIndex", ArrayFindIndex,
"fill", ArrayFill
- ));
+ ]);
}
HarmonyArrayExtendArrayPrototype();
function SetUpReflect() {
%CheckIsBootstrapping();
- InstallFunctions($Reflect, DONT_ENUM, $Array(
- "apply", ReflectApply,
- "construct", ReflectConstruct
- ));
+ InstallFunctions($Reflect, DONT_ENUM, [
+ "apply", ReflectApply,
+ "construct", ReflectConstruct
+ ]);
}
SetUpReflect();
function HarmonyToStringExtendSymbolPrototype() {
%CheckIsBootstrapping();
- InstallConstants(global.Symbol, $Array(
- // TODO(dslomov, caitp): Move to symbol.js when shipping
- "toStringTag", symbolToStringTag
- ));
+ InstallConstants(global.Symbol, [
+ // TODO(dslomov, caitp): Move to symbol.js when shipping
+ "toStringTag", symbolToStringTag
+ ]);
}
HarmonyToStringExtendSymbolPrototype();
%CheckIsBootstrapping();
// Set up non-enumerable functions on the object.
- InstallFunctions(global.NAME, DONT_ENUM | DONT_DELETE | READ_ONLY, $Array(
+ InstallFunctions(global.NAME, DONT_ENUM | DONT_DELETE | READ_ONLY, [
"of", NAMEOf
- ));
+ ]);
// Set up non-enumerable functions on the prototype object.
- InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
+ InstallFunctions(global.NAME.prototype, DONT_ENUM, [
"forEach", NAMEForEach
- ));
+ ]);
endmacro
TYPED_ARRAYS(EXTEND_TYPED_ARRAY)
function SerializeArray(value, replacer, stack, indent, gap) {
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', $Array());
+ throw MakeTypeError('circular_structure', []);
}
var stepback = indent;
indent += gap;
function SerializeObject(value, replacer, stack, indent, gap) {
if (!%PushIfAbsent(stack, value)) {
- throw MakeTypeError('circular_structure', $Array());
+ throw MakeTypeError('circular_structure', []);
}
var stepback = indent;
indent += gap;
%AddNamedProperty($JSON, symbolToStringTag, "JSON", READ_ONLY | DONT_ENUM);
// Set up non-enumerable properties of the JSON object.
- InstallFunctions($JSON, DONT_ENUM, $Array(
+ InstallFunctions($JSON, DONT_ENUM, [
"parse", JSONParse,
"stringify", JSONStringify
- ));
+ ]);
}
SetUpJSON();
%CheckIsBootstrapping();
var GlobalObject = global.Object;
-var GlobalArray = global.Array;
//-------------------------------------------------------------------
%AddNamedProperty(Math, symbolToStringTag, "Math", READ_ONLY | DONT_ENUM);
// Set up math constants.
-InstallConstants(Math, GlobalArray(
+InstallConstants(Math, [
// ECMA-262, section 15.8.1.1.
"E", 2.7182818284590452354,
// ECMA-262, section 15.8.1.2.
"PI", 3.1415926535897932,
"SQRT1_2", 0.7071067811865476,
"SQRT2", 1.4142135623730951
-));
+]);
// Set up non-enumerable functions of the Math object and
// set their names.
-InstallFunctions(Math, DONT_ENUM, GlobalArray(
+InstallFunctions(Math, DONT_ENUM, [
"random", MathRandom,
"abs", MathAbs,
"acos", MathAcosJS,
"fround", MathFroundJS,
"clz32", MathClz32JS,
"cbrt", MathCbrt
-));
+]);
%SetInlineBuiltinFlag(MathAbs);
%SetInlineBuiltinFlag(MathAcosJS);
}
-SetUpLockedPrototype(Script,
- $Array("source", "name", "source_url", "source_mapping_url", "line_ends",
- "line_offset", "column_offset"),
- $Array(
+SetUpLockedPrototype(Script, [
+ "source",
+ "name",
+ "source_url",
+ "source_mapping_url",
+ "line_ends",
+ "line_offset",
+ "column_offset"
+ ], [
"lineFromPosition", ScriptLineFromPosition,
"locationFromPosition", ScriptLocationFromPosition,
"locationFromLine", ScriptLocationFromLine,
"sourceLine", ScriptSourceLine,
"lineCount", ScriptLineCount,
"nameOrSourceURL", ScriptNameOrSourceURL
- )
+ ]
);
SetUpLockedPrototype(SourceLocation,
- $Array("script", "position", "line", "column", "start", "end"),
- $Array(
- "sourceText", SourceLocationSourceText
- )
+ ["script", "position", "line", "column", "start", "end"],
+ ["sourceText", SourceLocationSourceText]
);
}
SetUpLockedPrototype(SourceSlice,
- $Array("script", "from_line", "to_line", "from_position", "to_position"),
- $Array("sourceText", SourceSliceSourceText)
+ ["script", "from_line", "to_line", "from_position", "to_position"],
+ ["sourceText", SourceSliceSourceText]
);
return line;
}
-SetUpLockedPrototype(CallSite, $Array("receiver", "fun", "pos"), $Array(
+SetUpLockedPrototype(CallSite, ["receiver", "fun", "pos"], [
"getThis", CallSiteGetThis,
"getTypeName", CallSiteGetTypeName,
"isToplevel", CallSiteIsToplevel,
"getPosition", CallSiteGetPosition,
"isConstructor", CallSiteIsConstructor,
"toString", CallSiteToString
-));
+]);
function FormatEvalOrigin(script) {
function SetupObjectObserve() {
%CheckIsBootstrapping();
- InstallFunctions($Object, DONT_ENUM, $Array(
+ InstallFunctions($Object, DONT_ENUM, [
"deliverChangeRecords", ObjectDeliverChangeRecords,
"getNotifier", ObjectGetNotifier,
"observe", ObjectObserve,
"unobserve", ObjectUnobserve
- ));
- InstallFunctions($Array, DONT_ENUM, $Array(
+ ]);
+ InstallFunctions($Array, DONT_ENUM, [
"observe", ArrayObserve,
"unobserve", ArrayUnobserve
- ));
- InstallFunctions(notifierPrototype, DONT_ENUM, $Array(
+ ]);
+ InstallFunctions(notifierPrototype, DONT_ENUM, [
"notify", ObjectNotifierNotify,
"performChange", ObjectNotifierPerformChange
- ));
+ ]);
}
SetupObjectObserve();
%CheckIsBootstrapping();
var GlobalRegExp = global.RegExp;
-var GlobalArray = global.Array;
// Property of the builtins object for recording the result of the last
// regexp match. The property $regexpLastMatchInfo includes the matchIndices
GlobalRegExp.prototype, 'constructor', GlobalRegExp, DONT_ENUM);
%SetCode(GlobalRegExp, RegExpConstructor);
-InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalRegExp.prototype, DONT_ENUM, [
"exec", RegExpExecJS,
"test", RegExpTest,
"toString", RegExpToString,
"compile", RegExpCompileJS
-));
+]);
// The length of compile is 1 in SpiderMonkey.
%FunctionSetLength(GlobalRegExp.prototype.compile, 1);
FlushSkip(skip);
+ // Clear literal boilerplates.
+ if (obj->IsJSFunction() && !JSFunction::cast(obj)->shared()->bound()) {
+ FixedArray* literals = JSFunction::cast(obj)->literals();
+ for (int i = 0; i < literals->length(); i++) literals->set_undefined(i);
+ }
+
// Object has not yet been serialized. Serialize it here.
ObjectSerializer serializer(this, obj, sink_, how_to_code, where_to_point);
serializer.Serialize();
%CheckIsBootstrapping();
-var GlobalArray = global.Array;
var GlobalObject = global.Object;
var GlobalString = global.String;
%FunctionSetPrototype(StringIterator, new GlobalObject());
%FunctionSetInstanceClassName(StringIterator, 'String Iterator');
-InstallFunctions(StringIterator.prototype, DONT_ENUM, GlobalArray(
+InstallFunctions(StringIterator.prototype, DONT_ENUM, [
'next', StringIteratorNext
-));
+]);
%FunctionSetName(StringIteratorIterator, '[Symbol.iterator]');
%AddNamedProperty(StringIterator.prototype, symbolIterator,
StringIteratorIterator, DONT_ENUM);
%CheckIsBootstrapping();
-var GlobalArray = global.Array;
var GlobalRegExp = global.RegExp;
var GlobalString = global.String;
GlobalString.prototype, "constructor", GlobalString, DONT_ENUM);
// Set up the non-enumerable functions on the String object.
-InstallFunctions(GlobalString, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalString, DONT_ENUM, [
"fromCharCode", StringFromCharCode,
"fromCodePoint", StringFromCodePoint,
"raw", StringRaw
-));
+]);
// Set up the non-enumerable functions on the String prototype object.
-InstallFunctions(GlobalString.prototype, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalString.prototype, DONT_ENUM, [
"valueOf", StringValueOf,
"toString", StringToString,
"charAt", StringCharAtJS,
"strike", StringStrike,
"sub", StringSub,
"sup", StringSup
-));
+]);
$stringCharAt = StringCharAtJS;
$stringIndexOf = StringIndexOfJS;
%CheckIsBootstrapping();
-var GlobalArray = global.Array;
var GlobalObject = global.Object;
var GlobalSymbol = global.Symbol;
%SetCode(GlobalSymbol, SymbolConstructor);
%FunctionSetPrototype(GlobalSymbol, new GlobalObject());
-InstallConstants(GlobalSymbol, GlobalArray(
+InstallConstants(GlobalSymbol, [
// TODO(rossberg): expose when implemented.
// "hasInstance", symbolHasInstance,
// "isConcatSpreadable", symbolIsConcatSpreadable,
// Move here when shipping
// "toStringTag", symbolToStringTag,
"unscopables", symbolUnscopables
-));
+]);
-InstallFunctions(GlobalSymbol, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalSymbol, DONT_ENUM, [
"for", SymbolFor,
"keyFor", SymbolKeyFor
-));
+]);
%AddNamedProperty(
GlobalSymbol.prototype, "constructor", GlobalSymbol, DONT_ENUM);
%AddNamedProperty(
GlobalSymbol.prototype, symbolToStringTag, "Symbol", DONT_ENUM | READ_ONLY);
-InstallFunctions(GlobalSymbol.prototype, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalSymbol.prototype, DONT_ENUM, [
"toString", SymbolToString,
"valueOf", SymbolValueOf
-));
+]);
-InstallFunctions(GlobalObject, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalObject, DONT_ENUM, [
"getOwnPropertySymbols", ObjectGetOwnPropertySymbols
-));
+]);
$symbolToString = SymbolToString;
%CheckIsBootstrapping();
var GlobalMath = global.Math;
-var GlobalArray = global.Array;
//-------------------------------------------------------------------
if (hx >= 0x7ff00000) return x;
k += (hx >> 20) - 1023;
- i = (k & 0x80000000) >> 31;
+ var i = (k & 0x80000000) >> 31;
hx = (hx & 0x000fffff) | ((0x3ff - i) << 20);
- y = k + i;
+ var y = k + i;
x = %_ConstructDouble(hx, lx);
- z = y * LOG10_2LO + IVLN10 * %_MathLogRT(x);
+ var z = y * LOG10_2LO + IVLN10 * %_MathLogRT(x);
return z + y * LOG10_2HI;
}
//-------------------------------------------------------------------
-InstallFunctions(GlobalMath, DONT_ENUM, GlobalArray(
+InstallFunctions(GlobalMath, DONT_ENUM, [
"cos", MathCos,
"sin", MathSin,
"tan", MathTan,
"log2", MathLog2,
"log1p", MathLog1p,
"expm1", MathExpm1
-));
+]);
%SetInlineBuiltinFlag(MathSin);
%SetInlineBuiltinFlag(MathCos);
DONT_ENUM | DONT_DELETE);
InstallGetter(global.NAME.prototype, symbolToStringTag,
TypedArrayGetToStringTag);
- InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array(
- "subarray", NAMESubArray,
- "set", TypedArraySet
- ));
+ InstallFunctions(global.NAME.prototype, DONT_ENUM, [
+ "subarray", NAMESubArray,
+ "set", TypedArraySet
+ ]);
endmacro
TYPED_ARRAYS(SETUP_TYPED_ARRAY)
InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset);
InstallGetter($DataView.prototype, "byteLength", DataViewGetByteLength);
- InstallFunctions($DataView.prototype, DONT_ENUM, $Array(
- "getInt8", DataViewGetInt8JS,
- "setInt8", DataViewSetInt8JS,
+ InstallFunctions($DataView.prototype, DONT_ENUM, [
+ "getInt8", DataViewGetInt8JS,
+ "setInt8", DataViewSetInt8JS,
- "getUint8", DataViewGetUint8JS,
- "setUint8", DataViewSetUint8JS,
+ "getUint8", DataViewGetUint8JS,
+ "setUint8", DataViewSetUint8JS,
- "getInt16", DataViewGetInt16JS,
- "setInt16", DataViewSetInt16JS,
+ "getInt16", DataViewGetInt16JS,
+ "setInt16", DataViewSetInt16JS,
- "getUint16", DataViewGetUint16JS,
- "setUint16", DataViewSetUint16JS,
+ "getUint16", DataViewGetUint16JS,
+ "setUint16", DataViewSetUint16JS,
- "getInt32", DataViewGetInt32JS,
- "setInt32", DataViewSetInt32JS,
+ "getInt32", DataViewGetInt32JS,
+ "setInt32", DataViewSetInt32JS,
- "getUint32", DataViewGetUint32JS,
- "setUint32", DataViewSetUint32JS,
+ "getUint32", DataViewGetUint32JS,
+ "setUint32", DataViewSetUint32JS,
- "getFloat32", DataViewGetFloat32JS,
- "setFloat32", DataViewSetFloat32JS,
+ "getFloat32", DataViewGetFloat32JS,
+ "setFloat32", DataViewSetFloat32JS,
- "getFloat64", DataViewGetFloat64JS,
- "setFloat64", DataViewSetFloat64JS
- ));
+ "getFloat64", DataViewGetFloat64JS,
+ "setFloat64", DataViewSetFloat64JS
+ ]);
}
SetupDataView();
// Set up non-enumerable URI functions on the global object and set
// their names.
-InstallFunctions(global, DONT_ENUM, GlobalArray(
- "escape", URIEscapeJS,
- "unescape", URIUnescapeJS,
- "decodeURI", URIDecode,
- "decodeURIComponent", URIDecodeComponent,
- "encodeURI", URIEncode,
- "encodeURIComponent", URIEncodeComponent
-));
+InstallFunctions(global, DONT_ENUM, [
+ "escape", URIEscapeJS,
+ "unescape", URIUnescapeJS,
+ "decodeURI", URIDecode,
+ "decodeURIComponent", URIDecodeComponent,
+ "encodeURI", URIEncode,
+ "encodeURIComponent", URIEncodeComponent
+]);
})();
%AddNamedProperty(global, "undefined", UNDEFINED, attributes);
// Set up non-enumerable function on the global object.
- InstallFunctions(global, DONT_ENUM, $Array(
+ InstallFunctions(global, DONT_ENUM, [
"isNaN", GlobalIsNaN,
"isFinite", GlobalIsFinite,
"parseInt", GlobalParseInt,
"parseFloat", GlobalParseFloat,
"eval", GlobalEval
- ));
+ ]);
}
SetUpGlobal();
this.hasSetter_ = false;
}
-SetUpLockedPrototype(PropertyDescriptor, $Array(
- "value_",
- "hasValue_",
- "writable_",
- "hasWritable_",
- "enumerable_",
- "hasEnumerable_",
- "configurable_",
- "hasConfigurable_",
- "get_",
- "hasGetter_",
- "set_",
- "hasSetter_"
- ), $Array(
- "toString", function PropertyDescriptor_ToString() {
- return "[object PropertyDescriptor]";
- },
- "setValue", function PropertyDescriptor_SetValue(value) {
- this.value_ = value;
- this.hasValue_ = true;
- },
- "getValue", function PropertyDescriptor_GetValue() {
- return this.value_;
- },
- "hasValue", function PropertyDescriptor_HasValue() {
- return this.hasValue_;
- },
- "setEnumerable", function PropertyDescriptor_SetEnumerable(enumerable) {
- this.enumerable_ = enumerable;
- this.hasEnumerable_ = true;
- },
- "isEnumerable", function PropertyDescriptor_IsEnumerable() {
- return this.enumerable_;
- },
- "hasEnumerable", function PropertyDescriptor_HasEnumerable() {
- return this.hasEnumerable_;
- },
- "setWritable", function PropertyDescriptor_SetWritable(writable) {
- this.writable_ = writable;
- this.hasWritable_ = true;
- },
- "isWritable", function PropertyDescriptor_IsWritable() {
- return this.writable_;
- },
- "hasWritable", function PropertyDescriptor_HasWritable() {
- return this.hasWritable_;
- },
- "setConfigurable",
- function PropertyDescriptor_SetConfigurable(configurable) {
- this.configurable_ = configurable;
- this.hasConfigurable_ = true;
- },
- "hasConfigurable", function PropertyDescriptor_HasConfigurable() {
- return this.hasConfigurable_;
- },
- "isConfigurable", function PropertyDescriptor_IsConfigurable() {
- return this.configurable_;
- },
- "setGet", function PropertyDescriptor_SetGetter(get) {
- this.get_ = get;
- this.hasGetter_ = true;
- },
- "getGet", function PropertyDescriptor_GetGetter() {
- return this.get_;
- },
- "hasGetter", function PropertyDescriptor_HasGetter() {
- return this.hasGetter_;
- },
- "setSet", function PropertyDescriptor_SetSetter(set) {
- this.set_ = set;
- this.hasSetter_ = true;
- },
- "getSet", function PropertyDescriptor_GetSetter() {
- return this.set_;
- },
- "hasSetter", function PropertyDescriptor_HasSetter() {
- return this.hasSetter_;
- }));
+SetUpLockedPrototype(PropertyDescriptor, [
+ "value_",
+ "hasValue_",
+ "writable_",
+ "hasWritable_",
+ "enumerable_",
+ "hasEnumerable_",
+ "configurable_",
+ "hasConfigurable_",
+ "get_",
+ "hasGetter_",
+ "set_",
+ "hasSetter_"
+], [
+ "toString", function PropertyDescriptor_ToString() {
+ return "[object PropertyDescriptor]";
+ },
+ "setValue", function PropertyDescriptor_SetValue(value) {
+ this.value_ = value;
+ this.hasValue_ = true;
+ },
+ "getValue", function PropertyDescriptor_GetValue() {
+ return this.value_;
+ },
+ "hasValue", function PropertyDescriptor_HasValue() {
+ return this.hasValue_;
+ },
+ "setEnumerable", function PropertyDescriptor_SetEnumerable(enumerable) {
+ this.enumerable_ = enumerable;
+ this.hasEnumerable_ = true;
+ },
+ "isEnumerable", function PropertyDescriptor_IsEnumerable() {
+ return this.enumerable_;
+ },
+ "hasEnumerable", function PropertyDescriptor_HasEnumerable() {
+ return this.hasEnumerable_;
+ },
+ "setWritable", function PropertyDescriptor_SetWritable(writable) {
+ this.writable_ = writable;
+ this.hasWritable_ = true;
+ },
+ "isWritable", function PropertyDescriptor_IsWritable() {
+ return this.writable_;
+ },
+ "hasWritable", function PropertyDescriptor_HasWritable() {
+ return this.hasWritable_;
+ },
+ "setConfigurable",
+ function PropertyDescriptor_SetConfigurable(configurable) {
+ this.configurable_ = configurable;
+ this.hasConfigurable_ = true;
+ },
+ "hasConfigurable", function PropertyDescriptor_HasConfigurable() {
+ return this.hasConfigurable_;
+ },
+ "isConfigurable", function PropertyDescriptor_IsConfigurable() {
+ return this.configurable_;
+ },
+ "setGet", function PropertyDescriptor_SetGetter(get) {
+ this.get_ = get;
+ this.hasGetter_ = true;
+ },
+ "getGet", function PropertyDescriptor_GetGetter() {
+ return this.get_;
+ },
+ "hasGetter", function PropertyDescriptor_HasGetter() {
+ return this.hasGetter_;
+ },
+ "setSet", function PropertyDescriptor_SetSetter(set) {
+ this.set_ = set;
+ this.hasSetter_ = true;
+ },
+ "getSet", function PropertyDescriptor_GetSetter() {
+ return this.set_;
+ },
+ "hasSetter", function PropertyDescriptor_HasSetter() {
+ return this.hasSetter_;
+ }
+]);
// Converts an array returned from Runtime_GetOwnProperty to an actual
%AddNamedProperty($Object.prototype, "constructor", $Object, DONT_ENUM);
// Set up non-enumerable functions on the Object.prototype object.
- InstallFunctions($Object.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Object.prototype, DONT_ENUM, [
"toString", ObjectToString,
"toLocaleString", ObjectToLocaleString,
"valueOf", ObjectValueOf,
"__lookupGetter__", ObjectLookupGetter,
"__defineSetter__", ObjectDefineSetter,
"__lookupSetter__", ObjectLookupSetter
- ));
+ ]);
InstallGetterSetter($Object.prototype, "__proto__",
ObjectGetProto, ObjectSetProto);
// Set up non-enumerable functions in the Object object.
- InstallFunctions($Object, DONT_ENUM, $Array(
+ InstallFunctions($Object, DONT_ENUM, [
"keys", ObjectKeys,
"create", ObjectCreate,
"defineProperty", ObjectDefineProperty,
"seal", ObjectSealJS
// deliverChangeRecords, getNotifier, observe and unobserve are added
// in object-observe.js.
- ));
+ ]);
}
SetUpObject();
%FunctionSetPrototype($Boolean, new $Object());
%AddNamedProperty($Boolean.prototype, "constructor", $Boolean, DONT_ENUM);
- InstallFunctions($Boolean.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Boolean.prototype, DONT_ENUM, [
"toString", BooleanToString,
"valueOf", BooleanValueOf
- ));
+ ]);
}
SetUpBoolean();
// Set up the constructor property on the Number prototype object.
%AddNamedProperty($Number.prototype, "constructor", $Number, DONT_ENUM);
- InstallConstants($Number, $Array(
- // ECMA-262 section 15.7.3.1.
- "MAX_VALUE", 1.7976931348623157e+308,
- // ECMA-262 section 15.7.3.2.
- "MIN_VALUE", 5e-324,
- // ECMA-262 section 15.7.3.3.
- "NaN", NAN,
- // ECMA-262 section 15.7.3.4.
- "NEGATIVE_INFINITY", -INFINITY,
- // ECMA-262 section 15.7.3.5.
- "POSITIVE_INFINITY", INFINITY,
-
- // --- Harmony constants (no spec refs until settled.)
-
- "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1,
- "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1,
- "EPSILON", %_MathPow(2, -52)
- ));
+ InstallConstants($Number, [
+ // ECMA-262 section 15.7.3.1.
+ "MAX_VALUE", 1.7976931348623157e+308,
+ // ECMA-262 section 15.7.3.2.
+ "MIN_VALUE", 5e-324,
+ // ECMA-262 section 15.7.3.3.
+ "NaN", NAN,
+ // ECMA-262 section 15.7.3.4.
+ "NEGATIVE_INFINITY", -INFINITY,
+ // ECMA-262 section 15.7.3.5.
+ "POSITIVE_INFINITY", INFINITY,
+
+ // --- Harmony constants (no spec refs until settled.)
+
+ "MAX_SAFE_INTEGER", %_MathPow(2, 53) - 1,
+ "MIN_SAFE_INTEGER", -%_MathPow(2, 53) + 1,
+ "EPSILON", %_MathPow(2, -52)
+ ]);
// Set up non-enumerable functions on the Number prototype object.
- InstallFunctions($Number.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Number.prototype, DONT_ENUM, [
"toString", NumberToStringJS,
"toLocaleString", NumberToLocaleString,
"valueOf", NumberValueOf,
"toFixed", NumberToFixedJS,
"toExponential", NumberToExponentialJS,
"toPrecision", NumberToPrecisionJS
- ));
+ ]);
// Harmony Number constructor additions
- InstallFunctions($Number, DONT_ENUM, $Array(
+ InstallFunctions($Number, DONT_ENUM, [
"isFinite", NumberIsFinite,
"isInteger", NumberIsInteger,
"isNaN", NumberIsNaN,
"isSafeInteger", NumberIsSafeInteger,
"parseInt", GlobalParseInt,
"parseFloat", GlobalParseFloat
- ));
+ ]);
%SetInlineBuiltinFlag(NumberIsNaN);
}
%SetCode($Function, FunctionConstructor);
%AddNamedProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
- InstallFunctions($Function.prototype, DONT_ENUM, $Array(
+ InstallFunctions($Function.prototype, DONT_ENUM, [
"bind", FunctionBind,
"toString", FunctionToString
- ));
+ ]);
}
SetUpFunction();
$WeakMap.prototype, symbolToStringTag, "WeakMap", DONT_ENUM | READ_ONLY);
// Set up the non-enumerable functions on the WeakMap prototype object.
- InstallFunctions($WeakMap.prototype, DONT_ENUM, $Array(
+ InstallFunctions($WeakMap.prototype, DONT_ENUM, [
"get", WeakMapGet,
"set", WeakMapSet,
"has", WeakMapHas,
"delete", WeakMapDelete
- ));
+ ]);
}
SetUpWeakMap();
$WeakSet.prototype, symbolToStringTag, "WeakSet", DONT_ENUM | READ_ONLY);
// Set up the non-enumerable functions on the WeakSet prototype object.
- InstallFunctions($WeakSet.prototype, DONT_ENUM, $Array(
+ InstallFunctions($WeakSet.prototype, DONT_ENUM, [
"add", WeakSetAdd,
"has", WeakSetHas,
"delete", WeakSetDelete
- ));
+ ]);
}
SetUpWeakSet();