Modified: trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp (155176 => 155177)
--- trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2013-09-06 05:48:40 UTC (rev 155176)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalObject.cpp 2013-09-06 05:50:33 UTC (rev 155177)
@@ -241,7 +241,6 @@
m_objectPrototype->putDirectAccessor(exec, exec->propertyNames().underscoreProto, protoAccessor, Accessor | DontEnum);
m_functionPrototype->structure()->setPrototypeWithoutTransition(exec->vm(), m_objectPrototype.get());
- m_arrayBufferPrototype.set(exec->vm(), this, JSArrayBufferPrototype::create(exec, this, JSArrayBufferPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
m_typedArrays[toIndex(TypeInt8)].prototype.set(exec->vm(), this, JSInt8ArrayPrototype::create(exec, this, JSInt8ArrayPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
m_typedArrays[toIndex(TypeInt16)].prototype.set(exec->vm(), this, JSInt16ArrayPrototype::create(exec, this, JSInt16ArrayPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
m_typedArrays[toIndex(TypeInt32)].prototype.set(exec->vm(), this, JSInt32ArrayPrototype::create(exec, this, JSInt32ArrayPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
@@ -253,7 +252,6 @@
m_typedArrays[toIndex(TypeFloat64)].prototype.set(exec->vm(), this, JSFloat64ArrayPrototype::create(exec, this, JSFloat64ArrayPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
m_typedArrays[toIndex(TypeDataView)].prototype.set(exec->vm(), this, JSDataViewPrototype::create(exec->vm(), JSDataViewPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_arrayBufferStructure.set(exec->vm(), this, JSArrayBuffer::createStructure(exec->vm(), this, m_arrayBufferPrototype.get()));
m_typedArrays[toIndex(TypeInt8)].structure.set(exec->vm(), this, JSInt8Array::createStructure(exec->vm(), this, m_typedArrays[toIndex(TypeInt8)].prototype.get()));
m_typedArrays[toIndex(TypeInt16)].structure.set(exec->vm(), this, JSInt16Array::createStructure(exec->vm(), this, m_typedArrays[toIndex(TypeInt16)].prototype.get()));
m_typedArrays[toIndex(TypeInt32)].structure.set(exec->vm(), this, JSInt32Array::createStructure(exec->vm(), this, m_typedArrays[toIndex(TypeInt32)].prototype.get()));
@@ -294,26 +292,11 @@
m_regExpMatchesArrayStructure.set(exec->vm(), this, RegExpMatchesArray::createStructure(exec->vm(), this, m_arrayPrototype.get()));
- m_stringPrototype.set(exec->vm(), this, StringPrototype::create(exec, this, StringPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_stringObjectStructure.set(exec->vm(), this, StringObject::createStructure(exec->vm(), this, m_stringPrototype.get()));
-
- m_booleanPrototype.set(exec->vm(), this, BooleanPrototype::create(exec, this, BooleanPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_booleanObjectStructure.set(exec->vm(), this, BooleanObject::createStructure(exec->vm(), this, m_booleanPrototype.get()));
-
- m_numberPrototype.set(exec->vm(), this, NumberPrototype::create(exec, this, NumberPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_numberObjectStructure.set(exec->vm(), this, NumberObject::createStructure(exec->vm(), this, m_numberPrototype.get()));
-
- m_datePrototype.set(exec->vm(), this, DatePrototype::create(exec, this, DatePrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_dateStructure.set(exec->vm(), this, DateInstance::createStructure(exec->vm(), this, m_datePrototype.get()));
-
RegExp* emptyRegex = RegExp::create(exec->vm(), "", NoFlags);
m_regExpPrototype.set(exec->vm(), this, RegExpPrototype::create(exec, this, RegExpPrototype::createStructure(exec->vm(), this, m_objectPrototype.get()), emptyRegex));
m_regExpStructure.set(exec->vm(), this, RegExpObject::createStructure(exec->vm(), this, m_regExpPrototype.get()));
- m_errorPrototype.set(exec->vm(), this, ErrorPrototype::create(exec, this, ErrorPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_errorStructure.set(exec->vm(), this, ErrorInstance::createStructure(exec->vm(), this, m_errorPrototype.get()));
-
#if ENABLE(PROMISES)
m_promisePrototype.set(exec->vm(), this, JSPromisePrototype::create(exec, this, JSPromisePrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
m_promiseStructure.set(exec->vm(), this, JSPromise::createStructure(exec->vm(), this, m_promisePrototype.get()));
@@ -326,33 +309,38 @@
m_mapDataStructure.set(exec->vm(), this, MapData::createStructure(exec->vm(), this, jsNull()));
- m_mapPrototype.set(exec->vm(), this, MapPrototype::create(exec, this, MapPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_mapStructure.set(exec->vm(), this, JSMap::createStructure(exec->vm(), this, m_mapPrototype.get()));
- m_setPrototype.set(exec->vm(), this, SetPrototype::create(exec, this, SetPrototype::createStructure(exec->vm(), this, m_objectPrototype.get())));
- m_setStructure.set(exec->vm(), this, JSSet::createStructure(exec->vm(), this, m_setPrototype.get()));
+#define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+ m_ ## lowerName ## Prototype.set(exec->vm(), this, capitalName##Prototype::create(exec, this, capitalName##Prototype::createStructure(exec->vm(), this, m_objectPrototype.get()))); \
+ m_ ## properName ## Structure.set(exec->vm(), this, instanceType::createStructure(exec->vm(), this, m_ ## lowerName ## Prototype.get()));
+ FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
+
+#undef CREATE_PROTOTYPE_FOR_SIMPLE_TYPE
+
// Constructors
JSCell* objectConstructor = ObjectConstructor::create(exec, this, ObjectConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_objectPrototype.get());
JSCell* functionConstructor = FunctionConstructor::create(exec, this, FunctionConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_functionPrototype.get());
JSCell* arrayConstructor = ArrayConstructor::create(exec, this, ArrayConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_arrayPrototype.get());
- JSCell* stringConstructor = StringConstructor::create(exec, this, StringConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_stringPrototype.get());
- JSCell* booleanConstructor = BooleanConstructor::create(exec, this, BooleanConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_booleanPrototype.get());
- JSCell* numberConstructor = NumberConstructor::create(exec, this, NumberConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_numberPrototype.get());
- JSCell* dateConstructor = DateConstructor::create(exec, this, DateConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_datePrototype.get());
#if ENABLE(PROMISES)
JSCell* promiseConstructor = JSPromiseConstructor::create(exec, this, JSPromiseConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_promisePrototype.get());
JSCell* promiseResolverConstructor = JSPromiseResolverConstructor::create(exec, this, JSPromiseResolverConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_promiseResolverPrototype.get());
#endif // ENABLE(PROMISES)
- JSCell* mapConstructor = MapConstructor::create(exec, this, MapConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_mapPrototype.get());
- JSCell* setConstructor = SetConstructor::create(exec, this, SetConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_setPrototype.get());
m_regExpConstructor.set(exec->vm(), this, RegExpConstructor::create(exec, this, RegExpConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_regExpPrototype.get()));
- m_errorConstructor.set(exec->vm(), this, ErrorConstructor::create(exec, this, ErrorConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_errorPrototype.get()));
+#define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+ capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(exec, this, capitalName ## Constructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get()); \
+ m_ ## lowerName ## Prototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, lowerName ## Constructor, DontEnum); \
+ FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE)
+
+#undef CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE
+
+ m_errorConstructor.set(exec->vm(), this, errorConstructor);
+
Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(exec->vm(), this, m_errorPrototype.get());
Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(exec->vm(), this, m_functionPrototype.get());
m_evalErrorConstructor.set(exec->vm(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError")));
@@ -365,28 +353,16 @@
m_objectPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, objectConstructor, DontEnum);
m_functionPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, functionConstructor, DontEnum);
m_arrayPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, arrayConstructor, DontEnum);
- m_booleanPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, booleanConstructor, DontEnum);
- m_stringPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, stringConstructor, DontEnum);
- m_numberPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, numberConstructor, DontEnum);
- m_datePrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, dateConstructor, DontEnum);
m_regExpPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);
- m_errorPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);
#if ENABLE(PROMISES)
m_promisePrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, promiseConstructor, DontEnum);
m_promiseResolverPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, promiseResolverConstructor, DontEnum);
#endif
- m_mapPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, mapConstructor, DontEnum);
- m_setPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, setConstructor, DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().Object, objectConstructor, DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().Function, functionConstructor, DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().Array, arrayConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Boolean, booleanConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().String, stringConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Number, numberConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Date, dateConstructor, DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().RegExp, m_regExpConstructor.get(), DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Error, m_errorConstructor.get(), DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().EvalError, m_evalErrorConstructor.get(), DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().RangeError, m_rangeErrorConstructor.get(), DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().ReferenceError, m_referenceErrorConstructor.get(), DontEnum);
@@ -397,16 +373,22 @@
putDirectWithoutTransition(exec->vm(), exec->propertyNames().Promise, promiseConstructor, DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().PromiseResolver, promiseResolverConstructor, DontEnum);
#endif
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Map, mapConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().Set, setConstructor, DontEnum);
+
+#define PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
+ putDirectWithoutTransition(exec->vm(), exec->propertyNames(). jsName, lowerName ## Constructor, DontEnum); \
+
+ FOR_EACH_SIMPLE_BUILTIN_TYPE(PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE)
+
+#undef PUT_CONSTRUCTOR_FOR_SIMPLE_TYPE
+
+
m_evalFunction.set(exec->vm(), this, JSFunction::create(exec, this, 1, exec->propertyNames().eval.string(), globalFuncEval));
putDirectWithoutTransition(exec->vm(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().JSON, JSONObject::create(exec, this, JSONObject::createStructure(exec->vm(), this, m_objectPrototype.get())), DontEnum);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().Math, MathObject::create(exec, this, MathObject::createStructure(exec->vm(), this, m_objectPrototype.get())), DontEnum);
- JSArrayBufferConstructor* arrayBufferConstructor = JSArrayBufferConstructor::create(this, JSArrayBufferConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_arrayBufferPrototype.get());
FixedArray<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(this, JSInt8ArrayConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(this, JSInt16ArrayConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
@@ -418,10 +400,7 @@
typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(this, JSFloat32ArrayConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(this, JSFloat64ArrayConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(this, JSDataViewConstructor::createStructure(exec->vm(), this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
-
- m_arrayBufferPrototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, arrayBufferConstructor, DontEnum);
- putDirectWithoutTransition(exec->vm(), exec->propertyNames().ArrayBuffer, arrayBufferConstructor, DontEnum);
-
+
for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) {
m_typedArrays[typedArrayIndex].prototype->putDirectWithoutTransition(exec->vm(), exec->propertyNames().constructor, typedArrayConstructors[typedArrayIndex], DontEnum);
putDirectWithoutTransition(exec->vm(), Identifier(exec, typedArrayConstructors[typedArrayIndex]->name(exec)), typedArrayConstructors[typedArrayIndex], DontEnum);
@@ -612,11 +591,6 @@
visitor.append(&thisObject->m_objectPrototype);
visitor.append(&thisObject->m_functionPrototype);
visitor.append(&thisObject->m_arrayPrototype);
- visitor.append(&thisObject->m_booleanPrototype);
- visitor.append(&thisObject->m_stringPrototype);
- visitor.append(&thisObject->m_numberPrototype);
- visitor.append(&thisObject->m_datePrototype);
- visitor.append(&thisObject->m_regExpPrototype);
visitor.append(&thisObject->m_errorPrototype);
#if ENABLE(PROMISES)
visitor.append(&thisObject->m_promisePrototype);
@@ -640,17 +614,14 @@
visitor.append(&thisObject->m_objcCallbackFunctionStructure);
visitor.append(&thisObject->m_objcWrapperObjectStructure);
#endif
- visitor.append(&thisObject->m_dateStructure);
visitor.append(&thisObject->m_nullPrototypeObjectStructure);
visitor.append(&thisObject->m_errorStructure);
visitor.append(&thisObject->m_functionStructure);
visitor.append(&thisObject->m_boundFunctionStructure);
visitor.append(&thisObject->m_namedFunctionStructure);
- visitor.append(&thisObject->m_numberObjectStructure);
visitor.append(&thisObject->m_privateNameStructure);
visitor.append(&thisObject->m_regExpMatchesArrayStructure);
visitor.append(&thisObject->m_regExpStructure);
- visitor.append(&thisObject->m_stringObjectStructure);
visitor.append(&thisObject->m_internalFunctionStructure);
#if ENABLE(PROMISES)
@@ -659,15 +630,17 @@
visitor.append(&thisObject->m_promiseCallbackStructure);
visitor.append(&thisObject->m_promiseWrapperCallbackStructure);
#endif // ENABLE(PROMISES)
- visitor.append(&thisObject->m_mapPrototype);
+
+#define VISIT_SIMPLE_TYPE(CapitalName, lowerName, properName, instanceType, jsName) \
+ visitor.append(&thisObject->m_ ## lowerName ## Prototype); \
+ visitor.append(&thisObject->m_ ## properName ## Structure); \
+
+ FOR_EACH_SIMPLE_BUILTIN_TYPE(VISIT_SIMPLE_TYPE)
+
+#undef VISIT_SIMPLE_TYPE
+
visitor.append(&thisObject->m_mapDataStructure);
- visitor.append(&thisObject->m_mapStructure);
- visitor.append(&thisObject->m_setPrototype);
- visitor.append(&thisObject->m_setStructure);
- visitor.append(&thisObject->m_arrayBufferPrototype);
- visitor.append(&thisObject->m_arrayBufferStructure);
-
for (unsigned i = NUMBER_OF_TYPED_ARRAY_TYPES; i--;) {
visitor.append(&thisObject->m_typedArrays[i].prototype);
visitor.append(&thisObject->m_typedArrays[i].structure);