Title: [164925] trunk/Source/_javascript_Core
Revision
164925
Author
[email protected]
Date
2014-03-01 14:21:42 -0800 (Sat, 01 Mar 2014)

Log Message

Avoid going through ExecState for VM when we already have it (in some places.)
<https://webkit.org/b/129554>

Tweak some places that jump through unnecessary hoops to get the VM.
There are many more like this.

Reviewed by Sam Weinig.

* runtime/JSObject.cpp:
(JSC::JSObject::putByIndexBeyondVectorLength):
(JSC::JSObject::putDirectIndexBeyondVectorLength):
* runtime/ObjectPrototype.cpp:
(JSC::objectProtoFuncToString):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (164924 => 164925)


--- trunk/Source/_javascript_Core/ChangeLog	2014-03-01 22:09:48 UTC (rev 164924)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-03-01 22:21:42 UTC (rev 164925)
@@ -1,3 +1,19 @@
+2014-03-01  Andreas Kling  <[email protected]>
+
+        Avoid going through ExecState for VM when we already have it (in some places.)
+        <https://webkit.org/b/129554>
+
+        Tweak some places that jump through unnecessary hoops to get the VM.
+        There are many more like this.
+
+        Reviewed by Sam Weinig.
+
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::putByIndexBeyondVectorLength):
+        (JSC::JSObject::putDirectIndexBeyondVectorLength):
+        * runtime/ObjectPrototype.cpp:
+        (JSC::objectProtoFuncToString):
+
 2014-02-28  Filip Pizlo  <[email protected]>
 
         FTL should support PhantomArguments

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (164924 => 164925)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2014-03-01 22:09:48 UTC (rev 164924)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2014-03-01 22:21:42 UTC (rev 164925)
@@ -2020,7 +2020,7 @@
                 exec, i, value, shouldThrow, createArrayStorage(vm, 0, 0));
             break;
         }
-        if (structure(exec->vm())->needsSlowPutIndexing()) {
+        if (structure(vm)->needsSlowPutIndexing()) {
             ArrayStorage* storage = createArrayStorage(vm, i + 1, getNewVectorLength(0, 0, i + 1));
             storage->m_vector[i].set(vm, this, value);
             storage->m_numValuesInVector++;
@@ -2168,7 +2168,7 @@
             return putDirectIndexBeyondVectorLengthWithArrayStorage(
                 exec, i, value, attributes, mode, createArrayStorage(vm, 0, 0));
         }
-        if (structure(exec->vm())->needsSlowPutIndexing()) {
+        if (structure(vm)->needsSlowPutIndexing()) {
             ArrayStorage* storage = createArrayStorage(vm, i + 1, getNewVectorLength(0, 0, i + 1));
             storage->m_vector[i].set(vm, this, value);
             storage->m_numValuesInVector++;

Modified: trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp (164924 => 164925)


--- trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2014-03-01 22:09:48 UTC (rev 164924)
+++ trunk/Source/_javascript_Core/runtime/ObjectPrototype.cpp	2014-03-01 22:21:42 UTC (rev 164925)
@@ -209,19 +209,20 @@
 
 EncodedJSValue JSC_HOST_CALL objectProtoFuncToString(ExecState* exec)
 {
+    VM& vm = exec->vm();
     JSValue thisValue = exec->hostThisValue().toThis(exec, StrictMode);
     if (thisValue.isUndefinedOrNull())
-        return JSValue::encode(jsNontrivialString(exec, String(thisValue.isUndefined() ? ASCIILiteral("[object Undefined]") : ASCIILiteral("[object Null]"))));
+        return JSValue::encode(jsNontrivialString(&vm, String(thisValue.isUndefined() ? ASCIILiteral("[object Undefined]") : ASCIILiteral("[object Null]"))));
     JSObject* thisObject = thisValue.toObject(exec);
 
-    JSString* result = thisObject->structure(exec->vm())->objectToStringValue();
+    JSString* result = thisObject->structure(vm)->objectToStringValue();
     if (!result) {
         RefPtr<StringImpl> newString = WTF::tryMakeString("[object ", thisObject->methodTable(exec->vm())->className(thisObject), "]");
         if (!newString)
             return JSValue::encode(throwOutOfMemoryError(exec));
 
-        result = jsNontrivialString(exec, newString.release());
-        thisObject->structure(exec->vm())->setObjectToStringValue(exec->vm(), thisObject, result);
+        result = jsNontrivialString(&vm, newString.release());
+        thisObject->structure(vm)->setObjectToStringValue(vm, thisObject, result);
     }
     return JSValue::encode(result);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to