WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-74718-20120118193648.patch (text/plain), 10.01 KB, created by
Andy Wingo
on 2012-01-18 10:36:50 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Wingo
Created:
2012-01-18 10:36:50 PST
Size:
10.01 KB
patch
obsolete
>Subversion Revision: 105249 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index e0a01bbabf55e26bb2fe23ca5a1a5cb218b80a64..9d22adec4efc957a9e76b1d77b694fece88efee3 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,5 +1,40 @@ > 2011-12-16 Andy Wingo <wingo@igalia.com> > >+ Remove the `value' argument to op_push_new_scope >+ https://bugs.webkit.org/show_bug.cgi?id=74718 >+ >+ For exception scopes, instead of pushing a scope with a value >+ already set in it, push a fresh scope and use op_put_scoped_var to >+ bind the var. This will allow op_push_new_scope to be used for >+ multi-variable scopes, like ES6 block scopes. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * bytecode/CodeBlock.cpp (JSC::CodeBlock::dump): Update dump. >+ * bytecode/Opcode.h: >+ * bytecompiler/BytecodeGenerator.cpp: >+ (JSC::BytecodeGenerator::emitPushBlockScope): Use the variant of >+ JSStaticScope::clone that doesn't bind a variable. (The other one >+ is used by named function expressions.) >+ (JSC::BytecodeGenerator::emitInitializeBlockScopedLocal): New >+ helper to initialize a variable known to be at the last-pushed >+ block scope. >+ * bytecompiler/BytecodeGenerator.h: Update declarations. >+ * bytecompiler/NodesCodegen.cpp: >+ (JSC::TryNode::emitBytecode): Use emitInitializeBlockScopedLocal >+ to initialize exception var. >+ * interpreter/Interpreter.cpp: >+ (JSC::Interpreter::createExceptionScope): Simplify. >+ (JSC::Interpreter::privateExecute): >+ * jit/JITOpcodes.cpp: >+ (JSC::JIT::emit_op_push_new_scope): >+ * jit/JITOpcodes32_64.cpp: >+ (JSC::JIT::emit_op_push_new_scope): >+ * jit/JITStubs.cpp: >+ (JSC::DEFINE_STUB_FUNCTION): Adapt to op_push_new_scope change. >+ >+2011-12-16 Andy Wingo <wingo@igalia.com> >+ > Optimize access to block-scoped local variables > https://bugs.webkit.org/show_bug.cgi?id=74708 > >diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >index 7869e99259b5ec714448f2b134e035fe3506219b..f1bb5cd101ec4ec619924b0d23311b04f7acf83b 100644 >--- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp >+++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp >@@ -1220,8 +1220,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& > case op_push_new_scope: { > int r0 = (++it)->u.operand; > int r1 = (++it)->u.operand; >- int r2 = (++it)->u.operand; >- printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data(), registerName(exec, r2).data()); >+ printf("[%4d] push_new_scope \t%s, %s\n", location, registerName(exec, r0).data(), registerName(exec, r1).data()); > break; > } > case op_jmp_scopes: { >diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h >index 4801e4c321f3230d64483c67390e861be612a6d2..b6b3f91ff5c9154497abdea84d82cb2efb763aa4 100644 >--- a/Source/JavaScriptCore/bytecode/Opcode.h >+++ b/Source/JavaScriptCore/bytecode/Opcode.h >@@ -183,7 +183,7 @@ namespace JSC { > \ > macro(op_push_scope, 2) \ > macro(op_pop_scope, 1) \ >- macro(op_push_new_scope, 4) \ >+ macro(op_push_new_scope, 3) \ > \ > macro(op_catch, 2) \ > macro(op_throw, 2) \ >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >index a5fccb893f9c0694e86a2c818542d26fb2364f80..e335fafc7f82a2435d4c6caada073c6e07cf09ed 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp >@@ -2245,7 +2245,7 @@ void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc) > instructions().append(retAddrSrc->index()); > } > >-void BytecodeGenerator::emitPushBlockScope(RegisterID* dst, JSStaticScopeObject *scopeTemplate, RegisterID* value) >+void BytecodeGenerator::emitPushBlockScope(RegisterID* dst, JSStaticScopeObject *scopeTemplate) > { > ControlFlowContext context; > context.blockType = ScopeBlock; >@@ -2257,7 +2257,6 @@ void BytecodeGenerator::emitPushBlockScope(RegisterID* dst, JSStaticScopeObject > emitOpcode(op_push_new_scope); > instructions().append(dst->index()); > instructions().append(templ->index()); >- instructions().append(value->index()); > } > > void BytecodeGenerator::emitPopBlockScope() >diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >index be871ed56f4f5ae6fa94cc3fe8ab9b8096f23551..104b7b8ebc5cbda223905bed89a45a9244231829 100644 >--- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >+++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h >@@ -456,7 +456,7 @@ namespace JSC { > > void emitThrowReferenceError(const UString& message); > >- void emitPushBlockScope(RegisterID* dst, JSStaticScopeObject *scopeTemplate, RegisterID* value); >+ void emitPushBlockScope(RegisterID* dst, JSStaticScopeObject *scopeTemplate); > void emitPopBlockScope(); > > RegisterID* emitPushScope(RegisterID* scope); >diff --git a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >index 029c680f491de0dc4da2232bfd1c6c55065e2733..9b0bed4671a4670eb5c311650b7476b89d269666 100644 >--- a/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >+++ b/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp >@@ -1926,7 +1926,8 @@ RegisterID* TryNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) > } else { > JSStaticScopeObject* scopeTemplate = JSStaticScopeObject::create(generator.scopeChain()->globalObject->globalExec()); > scopeTemplate->addVariable(m_exceptionIdent, DontDelete); >- generator.emitPushBlockScope(exceptionRegister.get(), scopeTemplate, exceptionRegister.get()); >+ generator.emitPushBlockScope(generator.newTemporary(), scopeTemplate); >+ generator.emitPutStaticVar(generator.resolve(m_exceptionIdent), exceptionRegister.get()); > } > generator.emitNode(dst, m_catchBlock); > if (m_catchHasEval) >diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp >index 10c85fd73c272d5d6c0363bcb62950f7684b38b2..3c785e6934673076f6208e87d006df62ad87ac86 100644 >--- a/Source/JavaScriptCore/interpreter/Interpreter.cpp >+++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp >@@ -1440,12 +1440,11 @@ NEVER_INLINE ScopeChainNode* Interpreter::createExceptionScope(CallFrame* callFr > { > int dst = vPC[1].u.operand; > int templ = vPC[2].u.operand; >- int value = vPC[3].u.operand; > > ASSERT(callFrame->r(templ).jsValue().isObject()); > JSObject* scopeTemplate = asObject(callFrame->r(templ).jsValue()); > ASSERT(scopeTemplate->isStaticScopeObject()); >- JSStaticScopeObject* newScope = static_cast<JSStaticScopeObject*>(scopeTemplate)->clone(callFrame, callFrame->r(value).jsValue()); >+ JSStaticScopeObject* newScope = static_cast<JSStaticScopeObject*>(scopeTemplate)->clone(callFrame); > callFrame->uncheckedR(dst) = newScope; > > return callFrame->scopeChain()->push(newScope); >@@ -4906,11 +4905,11 @@ skip_id_custom_self: > goto *(&&skip_new_scope); > #endif > DEFINE_OPCODE(op_push_new_scope) { >- /* new_scope dst(r) templ(r) value(r) >+ /* new_scope dst(r) templ(r) > >- Constructs a new StaticScopeObject whose one property is set to >- value. That scope object is then pushed onto the ScopeChain. The >- scope object is then stored in dst for GC. >+ Constructs a new StaticScopeObject, using templ as a template. That >+ scope object is then pushed onto the ScopeChain. The scope object is >+ then stored in dst for GC. > */ > callFrame->setScopeChain(createExceptionScope(callFrame, vPC)); > >diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp >index 221a9b085d87d1959ceb047c77e2c108c934b57b..263b67d83326aea1e65eb1f036ef1b60b3f91e67 100644 >--- a/Source/JavaScriptCore/jit/JITOpcodes.cpp >+++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp >@@ -1013,7 +1013,6 @@ void JIT::emit_op_push_new_scope(Instruction* currentInstruction) > { > JITStubCall stubCall(this, cti_op_push_new_scope); > stubCall.addArgument(currentInstruction[2].u.operand, regT1); >- stubCall.addArgument(currentInstruction[3].u.operand, regT2); > stubCall.call(currentInstruction[1].u.operand); > } > >diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp >index 831f9f6a4b1b81269cf1db7b7cdc341d97b0e4e7..e7346e13f2da12c67fe8a2bf3406d255834df5bc 100644 >--- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp >+++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp >@@ -1332,7 +1332,6 @@ void JIT::emit_op_push_new_scope(Instruction* currentInstruction) > { > JITStubCall stubCall(this, cti_op_push_new_scope); > stubCall.addArgument(currentInstruction[2].u.operand); >- stubCall.addArgument(currentInstruction[3].u.operand); > stubCall.call(currentInstruction[1].u.operand); > } > >diff --git a/Source/JavaScriptCore/jit/JITStubs.cpp b/Source/JavaScriptCore/jit/JITStubs.cpp >index 7e5e0ab50e4f7252532a8b7c03bbb2e27f15c88c..4f619380547351c12a6e08651afec6b4e0b51db9 100644 >--- a/Source/JavaScriptCore/jit/JITStubs.cpp >+++ b/Source/JavaScriptCore/jit/JITStubs.cpp >@@ -3400,8 +3400,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_push_new_scope) > ASSERT(scopeTemplate->isStaticScopeObject()); > > CallFrame* callFrame = stackFrame.callFrame; >- JSValue value = stackFrame.args[1].jsValue(); >- JSStaticScopeObject* newScope = static_cast<JSStaticScopeObject*>(scopeTemplate)->clone(callFrame, value); >+ JSStaticScopeObject* newScope = static_cast<JSStaticScopeObject*>(scopeTemplate)->clone(callFrame); > callFrame->setScopeChain(callFrame->scopeChain()->push(newScope)); > return newScope; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 74718
:
119611
|
119620
| 122961