Title: [128276] releases/WebKitGTK/webkit-1.10/Source/_javascript_Core
Revision
128276
Author
[email protected]
Date
2012-09-12 01:52:32 -0700 (Wed, 12 Sep 2012)

Log Message

Merge r126692 - op_call should have ArrayProfiling for the benefit of array intrinsics
https://bugs.webkit.org/show_bug.cgi?id=95014

Reviewed by Sam Weinig.

This is a performance-neutral change that just adds the profiling but does not
use it, yet. If in the future we wanted to make this kind of profiling cheaper
we could move it into specialized thunks for the relevant array intrinsics, but
I figure that if this much simpler change gives us what we need without any
discernable performance penalty then that's for the best.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCall):
* jit/JITCall.cpp:
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileOpCall):
* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/ChangeLog (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/ChangeLog	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/ChangeLog	2012-09-12 08:52:32 UTC (rev 128276)
@@ -1,3 +1,26 @@
+2012-08-25  Filip Pizlo  <[email protected]>
+
+        op_call should have ArrayProfiling for the benefit of array intrinsics
+        https://bugs.webkit.org/show_bug.cgi?id=95014
+
+        Reviewed by Sam Weinig.
+
+        This is a performance-neutral change that just adds the profiling but does not
+        use it, yet. If in the future we wanted to make this kind of profiling cheaper
+        we could move it into specialized thunks for the relevant array intrinsics, but
+        I figure that if this much simpler change gives us what we need without any
+        discernable performance penalty then that's for the best.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::emitCall):
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileOpCall):
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::compileOpCall):
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+
 2012-08-28  Alban Browaeys <[email protected]>
 
         [GTK] LLint build fails with -g -02

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2012-09-12 08:52:32 UTC (rev 128276)
@@ -1925,6 +1925,7 @@
     emitExpressionInfo(divot, startOffset, endOffset);
 
     // Emit call.
+    ArrayProfile* arrayProfile = newArrayProfile();
     emitOpcode(opcodeID);
     instructions().append(func->index()); // func
     instructions().append(callArguments.argumentCountIncludingThis()); // argCount
@@ -1934,7 +1935,7 @@
 #else
     instructions().append(0);
 #endif
-    instructions().append(0);
+    instructions().append(arrayProfile);
     if (dst != ignoredResult()) {
         ValueProfile* profile = ""
         instructions().append(dst->index()); // dst

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall.cpp (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall.cpp	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall.cpp	2012-09-12 08:52:32 UTC (rev 128276)
@@ -160,6 +160,14 @@
         int argCount = instruction[2].u.operand;
         int registerOffset = instruction[3].u.operand;
 
+        if (opcodeID == op_call && shouldEmitProfiling()) {
+            emitGetVirtualRegister(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0);
+            Jump done = emitJumpIfNotJSCell(regT0);
+            loadPtr(Address(regT0, JSCell::structureOffset()), regT0);
+            storePtr(regT0, instruction[5].u.arrayProfile->addressOfLastSeenStructure());
+            done.link(this);
+        }
+    
         addPtr(TrustedImm32(registerOffset * sizeof(Register)), callFrameRegister, regT1);
         store32(TrustedImm32(argCount), Address(regT1, RegisterFile::ArgumentCount * static_cast<int>(sizeof(Register)) + OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.payload)));
     } // regT1 holds newCallFrame with ArgumentCount initialized.

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall32_64.cpp (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall32_64.cpp	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/jit/JITCall32_64.cpp	2012-09-12 08:52:32 UTC (rev 128276)
@@ -236,7 +236,15 @@
     else {
         int argCount = instruction[2].u.operand;
         int registerOffset = instruction[3].u.operand;
-
+        
+        if (opcodeID == op_call && shouldEmitProfiling()) {
+            emitLoad(registerOffset + CallFrame::argumentOffsetIncludingThis(0), regT0, regT1);
+            Jump done = branch32(NotEqual, regT0, TrustedImm32(JSValue::CellTag));
+            loadPtr(Address(regT1, JSCell::structureOffset()), regT1);
+            storePtr(regT1, instruction[5].u.arrayProfile->addressOfLastSeenStructure());
+            done.link(this);
+        }
+    
         addPtr(TrustedImm32(registerOffset * sizeof(Register)), callFrameRegister, regT3);
 
         store32(TrustedImm32(argCount), payloadFor(RegisterFile::ArgumentCount, regT3));

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter.asm (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-09-12 08:52:32 UTC (rev 128276)
@@ -641,6 +641,7 @@
 
 _llint_op_call:
     traceExecution()
+    arrayProfileForCall()
     doCall(_llint_slow_path_call)
 
 

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2012-09-12 08:52:32 UTC (rev 128276)
@@ -1560,6 +1560,18 @@
     dispatch(4)
 
 
+macro arrayProfileForCall()
+    if VALUE_PROFILER
+        loadi 12[PC], t3
+        bineq ThisArgumentOffset + TagOffset[cfr, t3, 8], CellTag, .done
+        loadi ThisArgumentOffset + PayloadOffset[cfr, t3, 8], t0
+        loadp JSCell::m_structure[t0], t0
+        loadp 20[PC], t1
+        storep t0, ArrayProfile::m_lastSeenStructure[t1]
+    .done:
+    end
+end
+
 macro doCall(slowPath)
     loadi 4[PC], t0
     loadi 16[PC], t1

Modified: releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (128275 => 128276)


--- releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2012-09-12 08:18:23 UTC (rev 128275)
+++ releases/WebKitGTK/webkit-1.10/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2012-09-12 08:52:32 UTC (rev 128276)
@@ -1406,6 +1406,18 @@
     dispatch(4)
 
 
+macro arrayProfileForCall()
+    if VALUE_PROFILER
+        loadis 24[PB, PC, 8], t3
+        loadp ThisArgumentOffset[cfr, t3, 8], t0
+        btpnz t0, tagMask, .done
+        loadp JSCell::m_structure[t0], t0
+        loadp 40[PB, PC, 8], t1
+        storep t0, ArrayProfile::m_lastSeenStructure[t1]
+    .done:
+    end
+end
+
 macro doCall(slowPath)
     loadis 8[PB, PC, 8], t0
     loadp 32[PB, PC, 8], t1
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to