Improved variable-related assembler comments in fullcode.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/157033012

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19320 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2014-02-12 12:06:11 +00:00
parent 10ae9eb247
commit ad536f2afc
4 changed files with 24 additions and 22 deletions

View File

@ -1482,7 +1482,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
// variables. // variables.
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: { case Variable::UNALLOCATED: {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
// Use inline caching. Variable name is passed in r2 and the global // Use inline caching. Variable name is passed in r2 and the global
// object (receiver) in r0. // object (receiver) in r0.
__ ldr(r0, GlobalObjectOperand()); __ ldr(r0, GlobalObjectOperand());
@ -1495,9 +1495,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
case Variable::PARAMETER: case Variable::PARAMETER:
case Variable::LOCAL: case Variable::LOCAL:
case Variable::CONTEXT: { case Variable::CONTEXT: {
Comment cmnt(masm_, var->IsContextSlot() Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
? "Context variable" : "[ Stack variable");
: "Stack variable");
if (var->binding_needs_init()) { if (var->binding_needs_init()) {
// var->scope() may be NULL when the proxy is located in eval code and // var->scope() may be NULL when the proxy is located in eval code and
// refers to a potential outside binding. Currently those bindings are // refers to a potential outside binding. Currently those bindings are
@ -1560,12 +1559,12 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
} }
case Variable::LOOKUP: { case Variable::LOOKUP: {
Comment cmnt(masm_, "[ Lookup variable");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed
// by eval-introduced variables. // by eval-introduced variables.
EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done);
__ bind(&slow); __ bind(&slow);
Comment cmnt(masm_, "Lookup variable");
__ mov(r1, Operand(var->name())); __ mov(r1, Operand(var->name()));
__ Push(cp, r1); // Context and name. __ Push(cp, r1); // Context and name.
__ CallRuntime(Runtime::kLoadContextSlot, 2); __ CallRuntime(Runtime::kLoadContextSlot, 2);
@ -4476,7 +4475,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
ASSERT(!context()->IsTest()); ASSERT(!context()->IsTest());
VariableProxy* proxy = expr->AsVariableProxy(); VariableProxy* proxy = expr->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsUnallocated()) { if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
__ ldr(r0, GlobalObjectOperand()); __ ldr(r0, GlobalObjectOperand());
__ mov(r2, Operand(proxy->name())); __ mov(r2, Operand(proxy->name()));
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
@ -4485,6 +4484,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
PrepareForBailout(expr, TOS_REG); PrepareForBailout(expr, TOS_REG);
context()->Plug(r0); context()->Plug(r0);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
Comment cmnt(masm_, "[ Lookup slot");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed

View File

@ -1419,7 +1419,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
// variables. // variables.
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: { case Variable::UNALLOCATED: {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
// Use inline caching. Variable name is passed in ecx and the global // Use inline caching. Variable name is passed in ecx and the global
// object in eax. // object in eax.
__ mov(edx, GlobalObjectOperand()); __ mov(edx, GlobalObjectOperand());
@ -1432,9 +1432,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
case Variable::PARAMETER: case Variable::PARAMETER:
case Variable::LOCAL: case Variable::LOCAL:
case Variable::CONTEXT: { case Variable::CONTEXT: {
Comment cmnt(masm_, var->IsContextSlot() Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
? "Context variable" : "[ Stack variable");
: "Stack variable");
if (var->binding_needs_init()) { if (var->binding_needs_init()) {
// var->scope() may be NULL when the proxy is located in eval code and // var->scope() may be NULL when the proxy is located in eval code and
// refers to a potential outside binding. Currently those bindings are // refers to a potential outside binding. Currently those bindings are
@ -1496,12 +1495,12 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
} }
case Variable::LOOKUP: { case Variable::LOOKUP: {
Comment cmnt(masm_, "[ Lookup variable");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed
// by eval-introduced variables. // by eval-introduced variables.
EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done);
__ bind(&slow); __ bind(&slow);
Comment cmnt(masm_, "Lookup variable");
__ push(esi); // Context. __ push(esi); // Context.
__ push(Immediate(var->name())); __ push(Immediate(var->name()));
__ CallRuntime(Runtime::kLoadContextSlot, 2); __ CallRuntime(Runtime::kLoadContextSlot, 2);
@ -4489,7 +4488,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
ASSERT(!context()->IsTest()); ASSERT(!context()->IsTest());
if (proxy != NULL && proxy->var()->IsUnallocated()) { if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
__ mov(edx, GlobalObjectOperand()); __ mov(edx, GlobalObjectOperand());
__ mov(ecx, Immediate(proxy->name())); __ mov(ecx, Immediate(proxy->name()));
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
@ -4498,6 +4497,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
PrepareForBailout(expr, TOS_REG); PrepareForBailout(expr, TOS_REG);
context()->Plug(eax); context()->Plug(eax);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
Comment cmnt(masm_, "[ Lookup slot");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed

View File

@ -1490,7 +1490,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
// variables. // variables.
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: { case Variable::UNALLOCATED: {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
// Use inline caching. Variable name is passed in a2 and the global // Use inline caching. Variable name is passed in a2 and the global
// object (receiver) in a0. // object (receiver) in a0.
__ lw(a0, GlobalObjectOperand()); __ lw(a0, GlobalObjectOperand());
@ -1503,9 +1503,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
case Variable::PARAMETER: case Variable::PARAMETER:
case Variable::LOCAL: case Variable::LOCAL:
case Variable::CONTEXT: { case Variable::CONTEXT: {
Comment cmnt(masm_, var->IsContextSlot() Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
? "Context variable" : "[ Stack variable");
: "Stack variable");
if (var->binding_needs_init()) { if (var->binding_needs_init()) {
// var->scope() may be NULL when the proxy is located in eval code and // var->scope() may be NULL when the proxy is located in eval code and
// refers to a potential outside binding. Currently those bindings are // refers to a potential outside binding. Currently those bindings are
@ -1570,12 +1569,12 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
} }
case Variable::LOOKUP: { case Variable::LOOKUP: {
Comment cmnt(masm_, "[ Lookup variable");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed
// by eval-introduced variables. // by eval-introduced variables.
EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done);
__ bind(&slow); __ bind(&slow);
Comment cmnt(masm_, "Lookup variable");
__ li(a1, Operand(var->name())); __ li(a1, Operand(var->name()));
__ Push(cp, a1); // Context and name. __ Push(cp, a1); // Context and name.
__ CallRuntime(Runtime::kLoadContextSlot, 2); __ CallRuntime(Runtime::kLoadContextSlot, 2);
@ -4538,7 +4537,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
ASSERT(!context()->IsTest()); ASSERT(!context()->IsTest());
VariableProxy* proxy = expr->AsVariableProxy(); VariableProxy* proxy = expr->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsUnallocated()) { if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
__ lw(a0, GlobalObjectOperand()); __ lw(a0, GlobalObjectOperand());
__ li(a2, Operand(proxy->name())); __ li(a2, Operand(proxy->name()));
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
@ -4547,6 +4546,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
PrepareForBailout(expr, TOS_REG); PrepareForBailout(expr, TOS_REG);
context()->Plug(v0); context()->Plug(v0);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
Comment cmnt(masm_, "[ Lookup slot");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed

View File

@ -1444,7 +1444,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
// variables. // variables.
switch (var->location()) { switch (var->location()) {
case Variable::UNALLOCATED: { case Variable::UNALLOCATED: {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
// Use inline caching. Variable name is passed in rcx and the global // Use inline caching. Variable name is passed in rcx and the global
// object on the stack. // object on the stack.
__ Move(rcx, var->name()); __ Move(rcx, var->name());
@ -1457,7 +1457,8 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
case Variable::PARAMETER: case Variable::PARAMETER:
case Variable::LOCAL: case Variable::LOCAL:
case Variable::CONTEXT: { case Variable::CONTEXT: {
Comment cmnt(masm_, var->IsContextSlot() ? "Context slot" : "Stack slot"); Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot"
: "[ Stack slot");
if (var->binding_needs_init()) { if (var->binding_needs_init()) {
// var->scope() may be NULL when the proxy is located in eval code and // var->scope() may be NULL when the proxy is located in eval code and
// refers to a potential outside binding. Currently those bindings are // refers to a potential outside binding. Currently those bindings are
@ -1519,12 +1520,12 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
} }
case Variable::LOOKUP: { case Variable::LOOKUP: {
Comment cmnt(masm_, "[ Lookup slot");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed
// by eval-introduced variables. // by eval-introduced variables.
EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done);
__ bind(&slow); __ bind(&slow);
Comment cmnt(masm_, "Lookup slot");
__ push(rsi); // Context. __ push(rsi); // Context.
__ Push(var->name()); __ Push(var->name());
__ CallRuntime(Runtime::kLoadContextSlot, 2); __ CallRuntime(Runtime::kLoadContextSlot, 2);
@ -4479,7 +4480,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
ASSERT(!context()->IsTest()); ASSERT(!context()->IsTest());
if (proxy != NULL && proxy->var()->IsUnallocated()) { if (proxy != NULL && proxy->var()->IsUnallocated()) {
Comment cmnt(masm_, "Global variable"); Comment cmnt(masm_, "[ Global variable");
__ Move(rcx, proxy->name()); __ Move(rcx, proxy->name());
__ movp(rax, GlobalObjectOperand()); __ movp(rax, GlobalObjectOperand());
// Use a regular load, not a contextual load, to avoid a reference // Use a regular load, not a contextual load, to avoid a reference
@ -4488,6 +4489,7 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
PrepareForBailout(expr, TOS_REG); PrepareForBailout(expr, TOS_REG);
context()->Plug(rax); context()->Plug(rax);
} else if (proxy != NULL && proxy->var()->IsLookupSlot()) { } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
Comment cmnt(masm_, "[ Lookup slot");
Label done, slow; Label done, slow;
// Generate code for loading from variables potentially shadowed // Generate code for loading from variables potentially shadowed