[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.2.3-2-25-gb2c19be

Gustavo Noronha Silva gns at gnome.org
Mon Sep 6 13:09:40 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 243f04c23ba228ec5d28f59510d03e0ea4d4f546
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 1 22:02:59 2010 +0000

    Improve reentrancy logic in polymorphic cache stubs
    <https://bugs.webkit.org/show_bug.cgi?id=41482>
    <rdar://problem/8094380>
    
    Reviewed by Geoff Garen.
    
    JavaScriptCore:
    
    Make the polymorphic cache stubs handle reentrancy
    better.
    
    * jit/JITStubs.cpp:
    (JSC::DEFINE_STUB_FUNCTION):
    (JSC::getPolymorphicAccessStructureListSlot):
    
    LayoutTests:
    
    Test cases for cache reentry in the cache code.
    
    * fast/js/reentrant-caching-expected.txt: Added.
    * fast/js/reentrant-caching.html: Added.
    * fast/js/script-tests/reentrant-caching.js: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@62301 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index db45382..4199dfc 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-01  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Geoff Garen.
+
+        Improve reentrancy logic in polymorphic cache stubs
+        <https://bugs.webkit.org/show_bug.cgi?id=41482>
+        <rdar://problem/8094380>
+
+        Make the polymorphic cache stubs handle reentrancy
+        better.
+
+        * jit/JITStubs.cpp:
+        (JSC::DEFINE_STUB_FUNCTION):
+        (JSC::getPolymorphicAccessStructureListSlot):
+
 2010-05-07  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Darin Fisher.
diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp
index 8169268..03b16b4 100644
--- a/JavaScriptCore/jit/JITStubs.cpp
+++ b/JavaScriptCore/jit/JITStubs.cpp
@@ -1330,17 +1330,18 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_self_fail)
         if (stubInfo->accessType == access_get_by_id_self) {
             ASSERT(!stubInfo->stubRoutine);
             polymorphicStructureList = new PolymorphicAccessStructureList(CodeLocationLabel(), stubInfo->u.getByIdSelf.baseObjectStructure);
-            stubInfo->initGetByIdSelfList(polymorphicStructureList, 2);
+            stubInfo->initGetByIdSelfList(polymorphicStructureList, 1);
         } else {
             polymorphicStructureList = stubInfo->u.getByIdSelfList.structureList;
             listIndex = stubInfo->u.getByIdSelfList.listSize;
-            stubInfo->u.getByIdSelfList.listSize++;
         }
+        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+            stubInfo->u.getByIdSelfList.listSize++;
+            JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset());
 
-        JIT::compileGetByIdSelfList(callFrame->scopeChain()->globalData, codeBlock, stubInfo, polymorphicStructureList, listIndex, asCell(baseValue)->structure(), ident, slot, slot.cachedOffset());
-
-        if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
-            ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic));
+            if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+                ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic));
+        }
     } else
         ctiPatchCallByReturnAddress(callFrame->codeBlock(), STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_generic));
     return JSValue::encode(result);
@@ -1365,13 +1366,14 @@ static PolymorphicAccessStructureList* getPolymorphicAccessStructureListSlot(Str
     case access_get_by_id_proto_list:
         prototypeStructureList = stubInfo->u.getByIdProtoList.structureList;
         listIndex = stubInfo->u.getByIdProtoList.listSize;
-        stubInfo->u.getByIdProtoList.listSize++;
+        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE)
+            stubInfo->u.getByIdProtoList.listSize++;
         break;
     default:
         ASSERT_NOT_REACHED();
     }
     
-    ASSERT(listIndex < POLYMORPHIC_LIST_CACHE_SIZE);
+    ASSERT(listIndex <= POLYMORPHIC_LIST_CACHE_SIZE);
     return prototypeStructureList;
 }
 
@@ -1446,21 +1448,24 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_get_by_id_proto_list)
 
         int listIndex;
         PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
+        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+            JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset);
 
-        JIT::compileGetByIdProtoList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, slotBaseObject->structure(), propertyName, slot, offset);
-
-        if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
-            ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+            if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+                ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+        }
     } else if (size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase(), propertyName, offset)) {
         ASSERT(!asCell(baseValue)->structure()->isDictionary());
         int listIndex;
         PolymorphicAccessStructureList* prototypeStructureList = getPolymorphicAccessStructureListSlot(stubInfo, listIndex);
+        
+        if (listIndex < POLYMORPHIC_LIST_CACHE_SIZE) {
+            StructureChain* protoChain = structure->prototypeChain(callFrame);
+            JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset);
 
-        StructureChain* protoChain = structure->prototypeChain(callFrame);
-        JIT::compileGetByIdChainList(callFrame->scopeChain()->globalData, callFrame, codeBlock, stubInfo, prototypeStructureList, listIndex, structure, protoChain, count, propertyName, slot, offset);
-
-        if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
-            ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+            if (listIndex == (POLYMORPHIC_LIST_CACHE_SIZE - 1))
+                ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_list_full));
+        }
     } else
         ctiPatchCallByReturnAddress(codeBlock, STUB_RETURN_ADDRESS, FunctionPtr(cti_op_get_by_id_proto_fail));
 
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 33df148..8767f90 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-07-01  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Geoff Garen.
+
+        Improve reentrancy logic in polymorphic cache stubs
+        <https://bugs.webkit.org/show_bug.cgi?id=41482>
+        <rdar://problem/8094380>
+
+        Test cases for cache reentry in the cache code.
+
+        * fast/js/reentrant-caching-expected.txt: Added.
+        * fast/js/reentrant-caching.html: Added.
+        * fast/js/script-tests/reentrant-caching.js: Added.
+
 2010-07-01  Justin Schuh  <jschuh at chromium.org>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/js/reentrant-caching-expected.txt b/LayoutTests/fast/js/reentrant-caching-expected.txt
new file mode 100644
index 0000000..fd6674f
--- /dev/null
+++ b/LayoutTests/fast/js/reentrant-caching-expected.txt
@@ -0,0 +1,9 @@
+Test caching with re-entrancy.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/reentrant-caching.html b/LayoutTests/fast/js/reentrant-caching.html
new file mode 100644
index 0000000..b4d44eb
--- /dev/null
+++ b/LayoutTests/fast/js/reentrant-caching.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/reentrant-caching.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/script-tests/reentrant-caching.js b/LayoutTests/fast/js/script-tests/reentrant-caching.js
new file mode 100644
index 0000000..45077ce
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/reentrant-caching.js
@@ -0,0 +1,91 @@
+if (this.description)
+    description("Test caching with re-entrancy.");
+
+function test1() {
+    var objects = [{prop:1}, {get prop(){return 2}}];
+
+    function g(o) {
+        return o.prop;
+    }
+
+    for (var i = 0; i < 10000; i++) {
+        var o = {
+            get prop() {
+                try {
+                    g(objects[++j]);
+                }catch(e){
+                }
+                return 1;
+            }
+        };
+        o[i] = i;
+        objects.push(o);
+    }
+    var j=0;
+    g(objects[0]);
+    g(objects[1]);
+    g(objects[2]);
+    g(objects[3]);
+}
+
+
+function test2() {
+    var objects = [Object.create({prop:1}), Object.create({get prop(){return 2}})];
+
+    function g(o) {
+        return o.prop;
+    }
+    var proto = {
+        get prop() {
+            try {
+                g(objects[++j]);
+            }catch(e){
+            }
+            return 1;
+        }
+    };
+    for (var i = 0; i < 10000; i++) {
+        var o = Object.create(proto);
+        o[i] = i;
+        objects.push(o);
+    }
+    var j=0;
+    g(objects[0]);
+    g(objects[1]);
+    g(objects[2]);
+    g(objects[3]);
+}
+
+
+function test3() {
+    var objects = [Object.create(Object.create({prop:1})), Object.create(Object.create({get prop(){return 2}}))];
+
+    function g(o) {
+        return o.prop;
+    }
+    var proto = {
+        get prop() {
+            try {
+                g(objects[++j]);
+            }catch(e){
+            }
+            return 1;
+        }
+    };
+    for (var i = 0; i < 10000; i++) {
+        var o = Object.create(Object.create(proto));
+        o[i] = i;
+        objects.push(o);
+    }
+    var j=0;
+    g(objects[0]);
+    g(objects[1]);
+    g(objects[2]);
+    g(objects[3]);
+}
+
+test1();
+test2();
+test3();
+
+var successfullyParsed = true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list