Title: [152677] branches/safari-537-branch

Diff

Modified: branches/safari-537-branch/LayoutTests/ChangeLog (152676 => 152677)


--- branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/LayoutTests/ChangeLog	2013-07-15 23:54:29 UTC (rev 152677)
@@ -1,5 +1,21 @@
 2013-07-15  Lucas Forschler  <[email protected]>
 
+        Merge r152573
+
+    2013-07-10  Oliver Hunt  <[email protected]>
+
+            NativeExecutable cache needs to use both call and construct functions for key
+            https://bugs.webkit.org/show_bug.cgi?id=118545
+
+            Reviewed by Geoffrey Garen.
+
+            Make sure we don't decide that all bound functions aren't constructors.
+
+            * fast/js/function-bind-expected.txt:
+            * fast/js/script-tests/function-bind.js:
+
+2013-07-15  Lucas Forschler  <[email protected]>
+
         Merge r152554
 
     2013-07-10  Sam Weinig  <[email protected]>

Modified: branches/safari-537-branch/LayoutTests/fast/js/function-bind-expected.txt (152676 => 152677)


--- branches/safari-537-branch/LayoutTests/fast/js/function-bind-expected.txt	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/LayoutTests/fast/js/function-bind-expected.txt	2013-07-15 23:54:29 UTC (rev 152677)
@@ -3,6 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS new (decodeURI.bind())() threw exception TypeError: 'function decodeURI() {
+    [native code]
+}' is not a constructor (evaluating 'new (decodeURI.bind())()').
+PASS (new (String.bind())('foo')).toString() is 'foo'
 PASS result is "[object Window] -> x:1, y:2"
 PASS result is "'a' -> x:'b', y:1"
 PASS result is "'a' -> x:'b', y:'c'"

Modified: branches/safari-537-branch/LayoutTests/fast/js/script-tests/function-bind.js (152676 => 152677)


--- branches/safari-537-branch/LayoutTests/fast/js/script-tests/function-bind.js	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/LayoutTests/fast/js/script-tests/function-bind.js	2013-07-15 23:54:29 UTC (rev 152677)
@@ -1,5 +1,8 @@
 description("Tests Function.bind.");
 
+shouldThrow("new (decodeURI.bind())()");
+shouldBe("(new (String.bind())('foo')).toString()", "'foo'");
+
 var result;
 
 function F(x, y)

Modified: branches/safari-537-branch/Source/_javascript_Core/ChangeLog (152676 => 152677)


--- branches/safari-537-branch/Source/_javascript_Core/ChangeLog	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/Source/_javascript_Core/ChangeLog	2013-07-15 23:54:29 UTC (rev 152677)
@@ -1,3 +1,26 @@
+2013-07-15  Lucas Forschler  <[email protected]>
+
+        Merge r152573
+
+    2013-07-10  Oliver Hunt  <[email protected]>
+
+            NativeExecutable cache needs to use both call and construct functions for key
+            https://bugs.webkit.org/show_bug.cgi?id=118545
+
+            Reviewed by Geoffrey Garen.
+
+            Make the native executable cache make use a key pair so we don't decide to
+            treat all subsequent functions as not being constructors.
+
+            * jit/JITThunks.cpp:
+            (JSC::JITThunks::hostFunctionStub):
+            * jit/JITThunks.h:
+            * runtime/JSBoundFunction.cpp:
+            (JSC::JSBoundFunction::create):
+            * runtime/JSCell.cpp:
+            (JSC::JSCell::getCallData):
+            (JSC::JSCell::getConstructData):
+
 2013-07-09  Lucas Forschler  <[email protected]>
 
         Merge r152497

Modified: branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.cpp (152676 => 152677)


--- branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.cpp	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.cpp	2013-07-15 23:54:29 UTC (rev 152677)
@@ -71,17 +71,17 @@
 
 NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, NativeFunction constructor)
 {
-    if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(function))
+    if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_pair(function, constructor)))
         return nativeExecutable;
 
     NativeExecutable* nativeExecutable = NativeExecutable::create(*vm, JIT::compileCTINativeCall(vm, function), function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), constructor, NoIntrinsic);
-    weakAdd(*m_hostFunctionStubMap, function, PassWeak<NativeExecutable>(nativeExecutable));
+    weakAdd(*m_hostFunctionStubMap, std::make_pair(function, constructor), PassWeak<NativeExecutable>(nativeExecutable));
     return nativeExecutable;
 }
 
 NativeExecutable* JITThunks::hostFunctionStub(VM* vm, NativeFunction function, ThunkGenerator generator, Intrinsic intrinsic)
 {
-    if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(function))
+    if (NativeExecutable* nativeExecutable = m_hostFunctionStubMap->get(std::make_pair(function, callHostFunctionAsConstructor)))
         return nativeExecutable;
 
     MacroAssemblerCodeRef code;
@@ -94,7 +94,7 @@
         code = JIT::compileCTINativeCall(vm, function);
 
     NativeExecutable* nativeExecutable = NativeExecutable::create(*vm, code, function, MacroAssemblerCodeRef::createSelfManagedCodeRef(ctiNativeConstruct(vm)), callHostFunctionAsConstructor, intrinsic);
-    weakAdd(*m_hostFunctionStubMap, function, PassWeak<NativeExecutable>(nativeExecutable));
+    weakAdd(*m_hostFunctionStubMap, std::make_pair(function, callHostFunctionAsConstructor), PassWeak<NativeExecutable>(nativeExecutable));
     return nativeExecutable;
 }
 

Modified: branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.h (152676 => 152677)


--- branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.h	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/Source/_javascript_Core/jit/JITThunks.h	2013-07-15 23:54:29 UTC (rev 152677)
@@ -64,7 +64,7 @@
 private:
     typedef HashMap<ThunkGenerator, MacroAssemblerCodeRef> CTIStubMap;
     CTIStubMap m_ctiStubMap;
-    typedef HashMap<NativeFunction, Weak<NativeExecutable> > HostFunctionStubMap;
+    typedef HashMap<pair<NativeFunction, NativeFunction>, Weak<NativeExecutable> > HostFunctionStubMap;
     OwnPtr<HostFunctionStubMap> m_hostFunctionStubMap;
 };
 

Modified: branches/safari-537-branch/Source/_javascript_Core/runtime/JSBoundFunction.cpp (152676 => 152677)


--- branches/safari-537-branch/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/Source/_javascript_Core/runtime/JSBoundFunction.cpp	2013-07-15 23:54:29 UTC (rev 152677)
@@ -79,7 +79,6 @@
     ConstructData constructData;
     ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
     bool canConstruct = constructType != ConstructTypeNone;
-
     NativeExecutable* executable = exec->vm().getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
     JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(*exec->heap())) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
 

Modified: branches/safari-537-branch/Source/_javascript_Core/runtime/JSCell.cpp (152676 => 152677)


--- branches/safari-537-branch/Source/_javascript_Core/runtime/JSCell.cpp	2013-07-15 23:47:51 UTC (rev 152676)
+++ branches/safari-537-branch/Source/_javascript_Core/runtime/JSCell.cpp	2013-07-15 23:54:29 UTC (rev 152677)
@@ -66,13 +66,19 @@
     return isObject() ? static_cast<const JSObject*>(this) : 0;
 }
 
-CallType JSCell::getCallData(JSCell*, CallData&)
+CallType JSCell::getCallData(JSCell*, CallData& callData)
 {
+    callData.js.functionExecutable = 0;
+    callData.js.scope = 0;
+    callData.native.function = 0;
     return CallTypeNone;
 }
 
-ConstructType JSCell::getConstructData(JSCell*, ConstructData&)
+ConstructType JSCell::getConstructData(JSCell*, ConstructData& constructData)
 {
+    constructData.js.functionExecutable = 0;
+    constructData.js.scope = 0;
+    constructData.native.function = 0;
     return ConstructTypeNone;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to