Commit 019809c7 authored by akling@apple.com's avatar akling@apple.com

Pass VM instead of ExecState to StringObject constructor.

<https://webkit.org/b/122395>

Reviewed by Sam Weinig.

StringObject() only uses the ExecState to find the VM.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156998 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7fd68795
2013-10-05 Andreas Kling <akling@apple.com>
Pass VM instead of ExecState to StringObject constructor.
<https://webkit.org/b/122395>
Reviewed by Sam Weinig.
StringObject() only uses the ExecState to find the VM.
2013-10-05 Filip Pizlo <fpizlo@apple.com>
Compress DFG stack layout
......@@ -997,7 +997,7 @@ JSCell* JIT_OPERATION operationNewStringObject(ExecState* exec, JSString* string
VM& vm = exec->vm();
NativeCallFrameTracer tracer(&vm, exec);
return StringObject::create(exec, structure, string);
return StringObject::create(vm, structure, string);
}
JSCell* JIT_OPERATION operationToStringOnCell(ExecState* exec, JSCell* cell)
......
......@@ -262,23 +262,23 @@ double JSString::toNumber(ExecState* exec) const
return jsToNumber(value(exec));
}
inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string)
inline StringObject* StringObject::create(VM& vm, JSGlobalObject* globalObject, JSString* string)
{
StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->vm(), globalObject->stringObjectStructure());
object->finishCreation(exec->vm(), string);
StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, globalObject->stringObjectStructure());
object->finishCreation(vm, string);
return object;
}
JSObject* JSString::toObject(ExecState* exec, JSGlobalObject* globalObject) const
{
return StringObject::create(exec, globalObject, const_cast<JSString*>(this));
return StringObject::create(exec->vm(), globalObject, const_cast<JSString*>(this));
}
JSValue JSString::toThis(JSCell* cell, ExecState* exec, ECMAMode ecmaMode)
{
if (ecmaMode == StrictMode)
return cell;
return StringObject::create(exec, exec->lexicalGlobalObject(), jsCast<JSString*>(cell));
return StringObject::create(exec->vm(), exec->lexicalGlobalObject(), jsCast<JSString*>(cell));
}
bool JSString::getStringPropertyDescriptor(ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
......
......@@ -92,10 +92,12 @@ JSCell* JSC_HOST_CALL stringFromCharCode(ExecState* exec, int32_t arg)
static EncodedJSValue JSC_HOST_CALL constructWithStringConstructor(ExecState* exec)
{
JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject();
VM& vm = exec->vm();
if (!exec->argumentCount())
return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure()));
return JSValue::encode(StringObject::create(vm, globalObject->stringObjectStructure()));
return JSValue::encode(StringObject::create(exec, globalObject->stringObjectStructure(), exec->uncheckedArgument(0).toString(exec)));
return JSValue::encode(StringObject::create(vm, globalObject->stringObjectStructure(), exec->uncheckedArgument(0).toString(exec)));
}
ConstructType StringConstructor::getConstructData(JSCell*, ConstructData& constructData)
......
......@@ -155,10 +155,10 @@ void StringObject::getOwnPropertyNames(JSObject* object, ExecState* exec, Proper
return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
StringObject* constructString(ExecState* exec, JSGlobalObject* globalObject, JSValue string)
StringObject* constructString(VM& vm, JSGlobalObject* globalObject, JSValue string)
{
StringObject* object = StringObject::create(exec, globalObject->stringObjectStructure());
object->setInternalValue(exec->vm(), string);
StringObject* object = StringObject::create(vm, globalObject->stringObjectStructure());
object->setInternalValue(vm, string);
return object;
}
......
......@@ -30,20 +30,20 @@ namespace JSC {
public:
typedef JSWrapperObject Base;
static StringObject* create(ExecState* exec, Structure* structure)
static StringObject* create(VM& vm, Structure* structure)
{
JSString* string = jsEmptyString(exec);
StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->vm(), structure);
object->finishCreation(exec->vm(), string);
JSString* string = jsEmptyString(&vm);
StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
object->finishCreation(vm, string);
return object;
}
static StringObject* create(ExecState* exec, Structure* structure, JSString* string)
static StringObject* create(VM& vm, Structure* structure, JSString* string)
{
StringObject* object = new (NotNull, allocateCell<StringObject>(*exec->heap())) StringObject(exec->vm(), structure);
object->finishCreation(exec->vm(), string);
StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
object->finishCreation(vm, string);
return object;
}
static StringObject* create(ExecState*, JSGlobalObject*, JSString*);
static StringObject* create(VM&, JSGlobalObject*, JSString*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
......@@ -79,7 +79,7 @@ namespace JSC {
return static_cast<StringObject*>(asObject(value));
}
JS_EXPORT_PRIVATE StringObject* constructString(ExecState*, JSGlobalObject*, JSValue);
JS_EXPORT_PRIVATE StringObject* constructString(VM&, JSGlobalObject*, JSValue);
} // namespace JSC
......
......@@ -1591,12 +1591,13 @@ private:
CachedStringRef cachedString;
if (!readStringData(cachedString))
return JSValue();
StringObject* obj = constructString(m_exec, m_globalObject, cachedString->jsString(m_exec));
StringObject* obj = constructString(m_exec->vm(), m_globalObject, cachedString->jsString(m_exec));
m_gcBuffer.append(obj);
return obj;
}
case EmptyStringObjectTag: {
StringObject* obj = constructString(m_exec, m_globalObject, jsEmptyString(&m_exec->vm()));
VM& vm = m_exec->vm();
StringObject* obj = constructString(vm, m_globalObject, jsEmptyString(&vm));
m_gcBuffer.append(obj);
return obj;
}
......
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