Create activations eagerly
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Aug 2014 18:07:00 +0000 (18:07 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Aug 2014 18:07:00 +0000 (18:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135942

Reviewed by Geoffrey Garen.

Prepare to rewrite activation objects into a more
sane implementation. Step 1 is reverting to eager
creation of the activation object. This results in
a 1.35x regression in earley, but otherwise has a
minimal performance impact.

The earley regression is being tracked by bug #135943

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitNewFunctionInternal):
(JSC::BytecodeGenerator::emitNewFunctionExpression):
(JSC::BytecodeGenerator::emitCallEval):
(JSC::BytecodeGenerator::emitPushWithScope):
(JSC::BytecodeGenerator::emitPushCatchScope):
(JSC::BytecodeGenerator::createActivationIfNecessary): Deleted.
* bytecompiler/BytecodeGenerator.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_create_activation):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_create_activation):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172594 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

index 5fb659a..03a5c58 100644 (file)
@@ -1,3 +1,66 @@
+2014-08-14  Oliver Hunt  <oliver@apple.com>
+
+        Create activations eagerly
+        https://bugs.webkit.org/show_bug.cgi?id=135942
+
+        Reviewed by Geoffrey Garen.
+
+        Prepare to rewrite activation objects into a more
+        sane implementation. Step 1 is reverting to eager
+        creation of the activation object. This results in
+        a 1.35x regression in earley, but otherwise has a
+        minimal performance impact.
+
+        The earley regression is being tracked by bug #135943
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        (JSC::BytecodeGenerator::emitNewFunctionInternal):
+        (JSC::BytecodeGenerator::emitNewFunctionExpression):
+        (JSC::BytecodeGenerator::emitCallEval):
+        (JSC::BytecodeGenerator::emitPushWithScope):
+        (JSC::BytecodeGenerator::emitPushCatchScope):
+        (JSC::BytecodeGenerator::createActivationIfNecessary): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_create_activation):
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::emit_op_create_activation):
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+
+2014-08-14  Oliver Hunt  <oliver@apple.com>
+
+        Create activations eagerly
+        https://bugs.webkit.org/show_bug.cgi?id=135942
+
+        Reviewed by Geoffrey Garen.
+
+        Prepare to rewrite activation objects into a more
+        sane implementation. Step 1 is reverting to eager
+        creation of the activation object. This results in
+        a 1.35x regression in earley, but otherwise has a
+        minimal performance impact.
+
+        The earley regression is being tracked by 
+        http://webkit.org/b/135943
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        (JSC::BytecodeGenerator::emitNewFunctionInternal):
+        (JSC::BytecodeGenerator::emitNewFunctionExpression):
+        (JSC::BytecodeGenerator::emitCallEval):
+        (JSC::BytecodeGenerator::emitPushWithScope):
+        (JSC::BytecodeGenerator::emitPushCatchScope):
+        (JSC::BytecodeGenerator::createActivationIfNecessary): Deleted.
+        * bytecompiler/BytecodeGenerator.h:
+        * jit/JITOpcodes.cpp:
+        (JSC::JIT::emit_op_create_activation):
+        * jit/JITOpcodes32_64.cpp:
+        (JSC::JIT::emit_op_create_activation):
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+
 2014-08-14  Tomas Popela  <tpopela@redhat.com>
 
         Add support for ppc, ppc64, ppc64le, s390, s390x into the CMake build
index dbe511c..e7e04c9 100644 (file)
@@ -248,6 +248,8 @@ BytecodeGenerator::BytecodeGenerator(VM& vm, FunctionBodyNode* functionBody, Unl
         m_activationRegister = addVar();
         emitInitLazyRegister(m_activationRegister);
         m_codeBlock->setActivationRegister(m_activationRegister->virtualRegister());
+        emitOpcode(op_create_activation);
+        instructions().append(m_activationRegister->index());
     }
 
     m_symbolTable->setCaptureStart(virtualRegisterForLocal(m_codeBlock->m_numVars).offset());
@@ -1642,7 +1644,6 @@ RegisterID* BytecodeGenerator::emitLazyNewFunction(RegisterID* dst, FunctionBody
 
 RegisterID* BytecodeGenerator::emitNewFunctionInternal(RegisterID* dst, CaptureMode captureMode, unsigned index, bool doNullCheck)
 {
-    createActivationIfNecessary();
     emitOpcode(captureMode == IsCaptured ? op_new_captured_func : op_new_func);
     instructions().append(dst->index());
     instructions().append(index);
@@ -1666,8 +1667,7 @@ RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExp
 {
     FunctionBodyNode* function = n->body();
     unsigned index = m_codeBlock->addFunctionExpr(makeFunction(function));
-    
-    createActivationIfNecessary();
+
     emitOpcode(op_new_func_exp);
     instructions().append(r0->index());
     instructions().append(index);
@@ -1695,17 +1695,8 @@ void BytecodeGenerator::createArgumentsIfNecessary()
     ASSERT(!hasWatchableVariable(m_codeBlock->argumentsRegister().offset()));
 }
 
-void BytecodeGenerator::createActivationIfNecessary()
-{
-    if (!m_activationRegister)
-        return;
-    emitOpcode(op_create_activation);
-    instructions().append(m_activationRegister->index());
-}
-
 RegisterID* BytecodeGenerator::emitCallEval(RegisterID* dst, RegisterID* func, CallArguments& callArguments, const JSTextPosition& divot, const JSTextPosition& divotStart, const JSTextPosition& divotEnd)
 {
-    createActivationIfNecessary();
     return emitCall(op_call_eval, dst, func, NoExpectedFunction, callArguments, divot, divotStart, divotEnd);
 }
 
@@ -2010,7 +2001,6 @@ RegisterID* BytecodeGenerator::emitPushWithScope(RegisterID* scope)
     m_scopeContextStack.append(context);
     m_localScopeDepth++;
 
-    createActivationIfNecessary();
     return emitUnaryNoDstOp(op_push_with_scope, scope);
 }
 
@@ -2336,8 +2326,6 @@ void BytecodeGenerator::emitPushFunctionNameScope(const Identifier& property, Re
 
 void BytecodeGenerator::emitPushCatchScope(const Identifier& property, RegisterID* value, unsigned attributes)
 {
-    createActivationIfNecessary();
-
     ControlFlowContext context;
     context.isFinallyBlock = false;
     m_scopeContextStack.append(context);
index 60aa9af..128f31c 100644 (file)
@@ -678,7 +678,6 @@ namespace JSC {
         RegisterID* emitThrowExpressionTooDeepException();
 
         void createArgumentsIfNecessary();
-        void createActivationIfNecessary();
         RegisterID* createLazyRegisterIfNecessary(RegisterID*);
         
         unsigned watchableVariable(int operand)
index bcf4c26..2ef8dbb 100644 (file)
@@ -679,11 +679,9 @@ void JIT::emit_op_enter(Instruction*)
 void JIT::emit_op_create_activation(Instruction* currentInstruction)
 {
     int dst = currentInstruction[1].u.operand;
-    
-    Jump activationCreated = branchTest64(NonZero, Address(callFrameRegister, sizeof(Register) * dst));
+
     callOperation(operationCreateActivation, 0);
     emitStoreCell(dst, returnValueGPR);
-    activationCreated.link(this);
 }
 
 void JIT::emit_op_create_arguments(Instruction* currentInstruction)
index 0a5177c..1af0ec3 100644 (file)
@@ -905,11 +905,9 @@ void JIT::emit_op_enter(Instruction* currentInstruction)
 void JIT::emit_op_create_activation(Instruction* currentInstruction)
 {
     int activation = currentInstruction[1].u.operand;
-    
-    Jump activationCreated = branch32(NotEqual, tagFor(activation), TrustedImm32(JSValue::EmptyValueTag));
+
     callOperation(operationCreateActivation, 0);
     emitStoreCell(activation, returnValueGPR);
-    activationCreated.link(this);
 }
 
 void JIT::emit_op_create_arguments(Instruction* currentInstruction)
index 9345cda..16dec50 100644 (file)
@@ -697,9 +697,7 @@ _llint_op_enter:
 _llint_op_create_activation:
     traceExecution()
     loadi 4[PC], t0
-    bineq TagOffset[cfr, t0, 8], EmptyValueTag, .opCreateActivationDone
     callSlowPath(_llint_slow_path_create_activation)
-.opCreateActivationDone:
     dispatch(2)
 
 
index 087521c..9506eec 100644 (file)
@@ -624,9 +624,7 @@ _llint_op_enter:
 _llint_op_create_activation:
     traceExecution()
     loadisFromInstruction(1, t0)
-    bqneq [cfr, t0, 8], ValueEmpty, .opCreateActivationDone
     callSlowPath(_llint_slow_path_create_activation)
-.opCreateActivationDone:
     dispatch(2)