[stubs] Don't pass name to Load/StoreGlobalViaContext stubs.
authorbmeurer <bmeurer@chromium.org>
Tue, 28 Jul 2015 06:04:04 +0000 (23:04 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 28 Jul 2015 06:04:29 +0000 (06:04 +0000)
No need to pass the name explicitly to the stubs; the runtime can
extract the name from the ScopeInfo (the extension of the
ScriptContext) on-demand easily without any performance impact.

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

Cr-Commit-Position: refs/heads/master@{#29886}

46 files changed:
src/arm/code-stubs-arm.cc
src/arm/interface-descriptors-arm.cc
src/arm/lithium-arm.cc
src/arm/lithium-arm.h
src/arm/lithium-codegen-arm.cc
src/arm64/code-stubs-arm64.cc
src/arm64/interface-descriptors-arm64.cc
src/arm64/lithium-arm64.cc
src/arm64/lithium-arm64.h
src/arm64/lithium-codegen-arm64.cc
src/compiler/js-generic-lowering.cc
src/full-codegen/arm/full-codegen-arm.cc
src/full-codegen/arm64/full-codegen-arm64.cc
src/full-codegen/ia32/full-codegen-ia32.cc
src/full-codegen/mips/full-codegen-mips.cc
src/full-codegen/mips64/full-codegen-mips64.cc
src/full-codegen/x64/full-codegen-x64.cc
src/hydrogen-instructions.cc
src/hydrogen-instructions.h
src/hydrogen.cc
src/ia32/code-stubs-ia32.cc
src/ia32/interface-descriptors-ia32.cc
src/ia32/lithium-codegen-ia32.cc
src/ia32/lithium-ia32.cc
src/ia32/lithium-ia32.h
src/interface-descriptors.cc
src/interface-descriptors.h
src/mips/code-stubs-mips.cc
src/mips/interface-descriptors-mips.cc
src/mips/lithium-codegen-mips.cc
src/mips/lithium-mips.cc
src/mips/lithium-mips.h
src/mips64/code-stubs-mips64.cc
src/mips64/interface-descriptors-mips64.cc
src/mips64/lithium-codegen-mips64.cc
src/mips64/lithium-mips64.cc
src/mips64/lithium-mips64.h
src/objects.h
src/runtime/runtime-object.cc
src/runtime/runtime.h
src/scopeinfo.cc
src/x64/code-stubs-x64.cc
src/x64/interface-descriptors-x64.cc
src/x64/lithium-codegen-x64.cc
src/x64/lithium-x64.cc
src/x64/lithium-x64.h

index e201134..cc090d5 100644 (file)
@@ -5061,8 +5061,6 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context = cp;
   Register result = r0;
   Register slot = r2;
-  Register name = r3;
-  Label slow_case;
 
   // Go up the context chain to the script context.
   for (int i = 0; i < depth(); ++i) {
@@ -5080,18 +5078,15 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ Ret(ne);
 
   // Fallback to runtime.
-  __ bind(&slow_case);
   __ SmiTag(slot);
   __ push(slot);
-  __ push(name);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register value = r0;
   Register slot = r2;
-  Register name = r3;
 
   Register cell = r1;
   Register cell_details = r4;
@@ -5107,7 +5102,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   if (FLAG_debug_code) {
     __ CompareRoot(value, Heap::kTheHoleValueRootIndex);
     __ Check(ne, kUnexpectedValue);
-    __ AssertName(name);
   }
 
   // Go up the context chain to the script context.
@@ -5207,13 +5201,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to runtime.
   __ bind(&slow_case);
   __ SmiTag(slot);
-  __ push(slot);
-  __ push(name);
-  __ push(value);
+  __ Push(slot, value);
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index 5e98b98..e54dd5c 100644 (file)
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return r3; }
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return r2; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return r3; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return r2; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return r3; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return r0; }
 
 
index ad34013..946efed 100644 (file)
@@ -331,8 +331,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -355,10 +354,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index 4eeca33..0f999c5 100644 (file)
@@ -1717,7 +1717,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2240,7 +2239,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }
index 97881ba..39df587 100644 (file)
@@ -2991,15 +2991,12 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
     __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
-           Operand(instr->name()));
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -4257,20 +4254,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
     __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
-           Operand(instr->name()));
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(instr->language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index d8b1532..d349383 100644 (file)
@@ -5498,7 +5498,6 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context = cp;
   Register result = x0;
   Register slot = x2;
-  Register name = x3;
   Label slow_case;
 
   // Go up the context chain to the script context.
@@ -5519,8 +5518,8 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to runtime.
   __ Bind(&slow_case);
   __ SmiTag(slot);
-  __ Push(slot, name);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ Push(slot);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
@@ -5528,7 +5527,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context = cp;
   Register value = x0;
   Register slot = x2;
-  Register name = x3;
   Register context_temp = x10;
   Register cell = x10;
   Register cell_details = x11;
@@ -5540,7 +5538,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   if (FLAG_debug_code) {
     __ CompareRoot(value, Heap::kTheHoleValueRootIndex);
     __ Check(ne, kUnexpectedValue);
-    __ AssertName(name);
   }
 
   // Go up the context chain to the script context.
@@ -5639,11 +5636,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fall back to the runtime.
   __ Bind(&slow_case);
   __ SmiTag(slot);
-  __ Push(slot, name, value);
+  __ Push(slot, value);
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index a3366cd..d344783 100644 (file)
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return x3; }
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return x2; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return x3; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return x2; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return x3; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return x0; }
 
 
index e1119c2..c432f24 100644 (file)
@@ -297,8 +297,7 @@ void LStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -322,10 +321,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index 6ab7ebf..7033777 100644 (file)
@@ -1686,7 +1686,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2490,7 +2489,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }
index cac7f92..47dd999 100644 (file)
@@ -3388,15 +3388,12 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
     __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ Mov(LoadGlobalViaContextDescriptor::NameRegister(),
-           Operand(instr->name()));
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -5548,20 +5545,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
     __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ Mov(StoreGlobalViaContextDescriptor::NameRegister(),
-           Operand(instr->name()));
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(instr->language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index 29a2a4a..e823b35 100644 (file)
@@ -339,9 +339,9 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
     Callable callable = CodeFactory::LoadGlobalViaContext(isolate(), 0);
     Node* script_context = node->InputAt(0);
     node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
-    node->ReplaceInput(1, jsgraph()->HeapConstant(p.name()));
-    node->ReplaceInput(2, script_context);  // Set new context...
-    node->RemoveInput(3);                   // ...instead of old one.
+    node->ReplaceInput(1, script_context);  // Set new context...
+    node->RemoveInput(2);
+    node->RemoveInput(2);  // ...instead of old one.
     ReplaceWithStubCall(node, callable, flags);
 
   } else {
@@ -402,10 +402,10 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
     Node* script_context = node->InputAt(0);
     Node* value = node->InputAt(2);
     node->ReplaceInput(0, jsgraph()->Int32Constant(p.slot_index()));
-    node->ReplaceInput(1, jsgraph()->HeapConstant(p.name()));
-    node->ReplaceInput(2, value);
-    node->ReplaceInput(3, script_context);  // Set new context...
-    node->RemoveInput(4);                   // ...instead of old one.
+    node->ReplaceInput(1, value);
+    node->ReplaceInput(2, script_context);  // Set new context...
+    node->RemoveInput(3);
+    node->RemoveInput(3);  // ...instead of old one.
     ReplaceWithStubCall(node, callable, flags);
 
   } else {
index 047ffb5..705e2b7 100644 (file)
@@ -1419,14 +1419,11 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
     const int depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ mov(LoadGlobalViaContextDescriptor::NameRegister(),
-             Operand(var->name()));
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
   } else {
     __ ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
@@ -2721,19 +2718,16 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     const int depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ mov(StoreGlobalViaContextDescriptor::NameRegister(),
-             Operand(var->name()));
       DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(r0));
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ push(r0);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
   } else if (var->mode() == LET && op != Token::INIT_LET) {
     // Non-initializing assignment to let variable needs a write barrier.
index 9aec582..78681b4 100644 (file)
@@ -1402,13 +1402,11 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
-      __ Mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
   } else {
     __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
@@ -2406,18 +2404,16 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
-      __ Mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
       DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0));
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ Push(x0);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
   } else if (var->mode() == LET && op != Token::INIT_LET) {
     // Non-initializing assignment to let variable needs a write barrier.
index e4d9d04..bebd0fb 100644 (file)
@@ -1345,13 +1345,11 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
-      __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
 
   } else {
@@ -2627,18 +2625,16 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
-      __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
       DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax));
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ Push(eax);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
 
   } else if (var->mode() == LET && op != Token::INIT_LET) {
index 467c834..35e6da2 100644 (file)
@@ -1411,13 +1411,11 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
 
   } else {
@@ -2710,17 +2708,15 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ Push(a0);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
 
   } else if (var->mode() == LET && op != Token::INIT_LET) {
index afee137..7b2cda3 100644 (file)
@@ -1407,13 +1407,11 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ li(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
 
   } else {
@@ -2707,17 +2705,15 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-      __ li(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ Push(a0);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
 
   } else if (var->mode() == LET && op != Token::INIT_LET) {
index 3e18978..1839d2c 100644 (file)
@@ -1369,18 +1369,15 @@ void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
   if (var->IsGlobalSlot()) {
     DCHECK(var->index() > 0);
     DCHECK(var->IsStaticGlobalObjectProperty());
-    // Each var occupies two slots in the context: for reads and writes.
     int const slot = var->index();
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
       __ Set(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
-      __ Move(LoadGlobalViaContextDescriptor::NameRegister(), var->name());
       LoadGlobalViaContextStub stub(isolate(), depth);
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
-      __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+      __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
     }
 
   } else {
@@ -2622,18 +2619,16 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
     int const depth = scope()->ContextChainLength(var->scope());
     if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
       __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
-      __ Move(StoreGlobalViaContextDescriptor::NameRegister(), var->name());
       DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(rax));
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ Push(rax);
       __ CallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3);
+                     2);
     }
 
   } else if (var->mode() == LET && op != Token::INIT_LET) {
index 24259c8..b729985 100644 (file)
@@ -3601,8 +3601,8 @@ std::ostream& HStoreNamedGeneric::PrintDataTo(
 
 std::ostream& HStoreGlobalViaContext::PrintDataTo(
     std::ostream& os) const {  // NOLINT
-  return os << name()->ToCString().get() << " = " << NameOf(value())
-            << " depth:" << depth() << " slot:" << slot_index();
+  return os << " depth:" << depth() << " slot:" << slot_index() << " = "
+            << NameOf(value());
 }
 
 
@@ -3658,8 +3658,7 @@ std::ostream& HLoadGlobalGeneric::PrintDataTo(
 
 std::ostream& HLoadGlobalViaContext::PrintDataTo(
     std::ostream& os) const {  // NOLINT
-  return os << name()->ToCString().get() << " "
-            << "depth:" << depth() << " slot:" << slot_index();
+  return os << "depth:" << depth() << " slot:" << slot_index();
 }
 
 
index 3d3c56c..63ddf27 100644 (file)
@@ -5496,11 +5496,9 @@ class HLoadGlobalGeneric final : public HTemplateInstruction<2> {
 
 class HLoadGlobalViaContext final : public HTemplateInstruction<1> {
  public:
-  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P3(HLoadGlobalViaContext,
-                                              Handle<String>, int, int);
+  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HLoadGlobalViaContext, int, int);
 
   HValue* context() { return OperandAt(0); }
-  Handle<String> name() const { return name_; }
   int depth() const { return depth_; }
   int slot_index() const { return slot_index_; }
 
@@ -5513,17 +5511,15 @@ class HLoadGlobalViaContext final : public HTemplateInstruction<1> {
   DECLARE_CONCRETE_INSTRUCTION(LoadGlobalViaContext)
 
  private:
-  HLoadGlobalViaContext(HValue* context, Handle<String> name, int depth,
-                        int slot_index)
-      : name_(name), depth_(depth), slot_index_(slot_index) {
+  HLoadGlobalViaContext(HValue* context, int depth, int slot_index)
+      : depth_(depth), slot_index_(slot_index) {
     SetOperandAt(0, context);
     set_representation(Representation::Tagged());
     SetAllSideEffects();
   }
 
-  Handle<String> name_;
-  int depth_;
-  int slot_index_;
+  int const depth_;
+  int const slot_index_;
 };
 
 
@@ -7069,12 +7065,10 @@ class HStoreNamedGeneric final : public HTemplateInstruction<3> {
 
 class HStoreGlobalViaContext final : public HTemplateInstruction<2> {
  public:
-  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P5(HStoreGlobalViaContext,
-                                              Handle<String>, HValue*, int, int,
-                                              LanguageMode);
+  DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreGlobalViaContext, HValue*,
+                                              int, int, LanguageMode);
   HValue* context() const { return OperandAt(0); }
   HValue* value() const { return OperandAt(1); }
-  Handle<String> name() const { return name_; }
   int depth() const { return depth_; }
   int slot_index() const { return slot_index_; }
   LanguageMode language_mode() const { return language_mode_; }
@@ -7088,21 +7082,17 @@ class HStoreGlobalViaContext final : public HTemplateInstruction<2> {
   DECLARE_CONCRETE_INSTRUCTION(StoreGlobalViaContext)
 
  private:
-  HStoreGlobalViaContext(HValue* context, Handle<String> name, HValue* value,
-                         int depth, int slot_index, LanguageMode language_mode)
-      : name_(name),
-        depth_(depth),
-        slot_index_(slot_index),
-        language_mode_(language_mode) {
+  HStoreGlobalViaContext(HValue* context, HValue* value, int depth,
+                         int slot_index, LanguageMode language_mode)
+      : depth_(depth), slot_index_(slot_index), language_mode_(language_mode) {
     SetOperandAt(0, context);
     SetOperandAt(1, value);
     SetAllSideEffects();
   }
 
-  Handle<String> name_;
-  int depth_;
-  int slot_index_;
-  LanguageMode language_mode_;
+  int const depth_;
+  int const slot_index_;
+  LanguageMode const language_mode_;
 };
 
 
index f4bd417..f652b31 100644 (file)
@@ -5569,7 +5569,7 @@ void HOptimizedGraphBuilder::VisitVariableProxy(VariableProxy* expr) {
         int depth = scope()->ContextChainLength(variable->scope());
 
         HLoadGlobalViaContext* instr =
-            New<HLoadGlobalViaContext>(variable->name(), depth, slot_index);
+            New<HLoadGlobalViaContext>(depth, slot_index);
         return ast_context()->ReturnInstruction(instr, expr->id());
 
       } else {
@@ -6801,7 +6801,7 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
     int depth = scope()->ContextChainLength(var->scope());
 
     HStoreGlobalViaContext* instr = Add<HStoreGlobalViaContext>(
-        var->name(), value, depth, slot_index, function_language_mode());
+        value, depth, slot_index, function_language_mode());
     USE(instr);
     DCHECK(instr->HasObservableSideEffects());
     Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
index 944206b..525edea 100644 (file)
@@ -5119,7 +5119,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = esi;
   Register slot_reg = ebx;
-  Register name_reg = ecx;
   Register result_reg = eax;
   Label slow_case;
 
@@ -5143,25 +5142,23 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ SmiTag(slot_reg);
   __ Pop(result_reg);  // Pop return address.
   __ Push(slot_reg);
-  __ Push(name_reg);
   __ Push(result_reg);  // Push return address.
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = esi;
   Register slot_reg = ebx;
-  Register name_reg = ecx;
   Register value_reg = eax;
   Register cell_reg = edi;
   Register cell_details_reg = edx;
+  Register cell_value_reg = ecx;
   Label fast_heapobject_case, fast_smi_case, slow_case;
 
   if (FLAG_debug_code) {
     __ CompareRoot(value_reg, Heap::kTheHoleValueRootIndex);
     __ Check(not_equal, kUnexpectedValue);
-    __ AssertName(name_reg);
   }
 
   // Go up context chain to the script context.
@@ -5203,7 +5200,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Check if PropertyCell value matches the new value (relevant for Constant,
   // ConstantType and Undefined cells).
   Label not_same_value;
-  __ cmp(value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
+  __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
+  __ cmp(cell_value_reg, value_reg);
   __ j(not_equal, &not_same_value,
        FLAG_debug_code ? Label::kFar : Label::kNear);
   // Make sure the PropertyCell is not marked READ_ONLY.
@@ -5245,9 +5243,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Now either both old and new values must be SMIs or both must be heap
   // objects with same map.
   Label value_is_heap_object;
-  // TODO(bmeurer): use ecx (name_reg) when name parameter is removed.
-  Register cell_value_reg = cell_details_reg;
-  __ mov(cell_value_reg, FieldOperand(cell_reg, PropertyCell::kValueOffset));
   __ JumpIfNotSmi(value_reg, &value_is_heap_object, Label::kNear);
   __ JumpIfNotSmi(cell_value_reg, &slow_case, Label::kNear);
   // Old and new values are SMIs, no need for a write barrier here.
@@ -5267,13 +5262,12 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ SmiTag(slot_reg);
   __ Pop(cell_reg);  // Pop return address.
   __ Push(slot_reg);
-  __ Push(name_reg);
   __ Push(value_reg);
   __ Push(cell_reg);  // Push return address.
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index a91e1ef..61508ee 100644 (file)
@@ -38,11 +38,9 @@ const Register StoreTransitionDescriptor::MapRegister() {
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return ebx; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return ecx; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return ebx; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return ecx; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return eax; }
 
 
index db2602c..7f1a983 100644 (file)
@@ -2873,15 +2873,13 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const slot = instr->slot_index();
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
-    __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
-    __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name());
+    __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -4150,20 +4148,18 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const slot = instr->slot_index();
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
-    __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
-    __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name());
+    __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot));
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(instr->language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index eeccdd0..e07c1e8 100644 (file)
@@ -380,8 +380,7 @@ LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -404,10 +403,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index ac544a6..9bcc5f4 100644 (file)
@@ -1730,7 +1730,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2244,7 +2243,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }
index 0526bf9..89ee975 100644 (file)
@@ -117,16 +117,15 @@ Type::FunctionType*
 LoadGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType(
     Isolate* isolate, int paramater_count) {
   Type::FunctionType* function = Type::FunctionType::New(
-      AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
+      AnyTagged(), Type::Undefined(), 1, isolate->interface_descriptor_zone());
   function->InitParameter(0, UntaggedSigned32());
-  function->InitParameter(1, AnyTagged());
   return function;
 }
 
 
 void LoadGlobalViaContextDescriptor::InitializePlatformSpecific(
     CallInterfaceDescriptorData* data) {
-  Register registers[] = {SlotRegister(), NameRegister()};
+  Register registers[] = {SlotRegister()};
   data->InitializePlatformSpecific(arraysize(registers), registers);
 }
 
@@ -135,17 +134,16 @@ Type::FunctionType*
 StoreGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType(
     Isolate* isolate, int paramater_count) {
   Type::FunctionType* function = Type::FunctionType::New(
-      AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
+      AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
   function->InitParameter(0, UntaggedSigned32());
   function->InitParameter(1, AnyTagged());
-  function->InitParameter(2, AnyTagged());
   return function;
 }
 
 
 void StoreGlobalViaContextDescriptor::InitializePlatformSpecific(
     CallInterfaceDescriptorData* data) {
-  Register registers[] = {SlotRegister(), NameRegister(), ValueRegister()};
+  Register registers[] = {SlotRegister(), ValueRegister()};
   data->InitializePlatformSpecific(arraysize(registers), registers);
 }
 
index 94b1a81..c5e104f 100644 (file)
@@ -424,7 +424,6 @@ class LoadGlobalViaContextDescriptor : public CallInterfaceDescriptor {
                                                CallInterfaceDescriptor)
 
   static const Register SlotRegister();
-  static const Register NameRegister();
 };
 
 
@@ -434,7 +433,6 @@ class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor {
                                                CallInterfaceDescriptor)
 
   static const Register SlotRegister();
-  static const Register NameRegister();
   static const Register ValueRegister();
 };
 
index cb6d67f..5ebb70e 100644 (file)
@@ -5273,7 +5273,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = cp;
   Register slot_reg = a2;
-  Register name_reg = a3;
   Register result_reg = v0;
   Label slow_case;
 
@@ -5286,8 +5285,7 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Load the PropertyCell value at the specified slot.
   __ sll(at, slot_reg, kPointerSizeLog2);
   __ Addu(at, at, Operand(context_reg));
-  __ Addu(at, at, Context::SlotOffset(0));
-  __ lw(result_reg, MemOperand(at));
+  __ lw(result_reg, ContextOperand(at, 0));
   __ lw(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset));
 
   // Check that value is not the_hole.
@@ -5298,15 +5296,14 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to the runtime.
   __ bind(&slow_case);
   __ SmiTag(slot_reg);
-  __ Push(slot_reg, name_reg);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ Push(slot_reg);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = cp;
   Register slot_reg = a2;
-  Register name_reg = a3;
   Register value_reg = a0;
   Register cell_reg = t0;
   Register cell_value_reg = t1;
@@ -5316,7 +5313,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   if (FLAG_debug_code) {
     __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
     __ Check(ne, kUnexpectedValue, value_reg, Operand(at));
-    __ AssertName(name_reg);
   }
 
   // Go up context chain to the script context.
@@ -5328,8 +5324,7 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Load the PropertyCell at the specified slot.
   __ sll(at, slot_reg, kPointerSizeLog2);
   __ Addu(at, at, Operand(context_reg));
-  __ Addu(at, at, Context::SlotOffset(0));
-  __ lw(cell_reg, MemOperand(at));
+  __ lw(cell_reg, ContextOperand(at, 0));
 
   // Load PropertyDetails for the cell (actually only the cell_type and kind).
   __ lw(cell_details_reg,
@@ -5413,11 +5408,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to the runtime.
   __ bind(&slow_case);
   __ SmiTag(slot_reg);
-  __ Push(slot_reg, name_reg, value_reg);
+  __ Push(slot_reg, value_reg);
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index 9169049..f0618ad 100644 (file)
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return a3; }
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return a2; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return a3; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return a2; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return a3; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return a0; }
 
 
index c5db715..838cd1c 100644 (file)
@@ -2903,15 +2903,12 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
     __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ li(LoadGlobalViaContextDescriptor::NameRegister(),
-          Operand(instr->name()));
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -4218,20 +4215,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
     __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ li(StoreGlobalViaContextDescriptor::NameRegister(),
-          Operand(instr->name()));
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index 5506109..9c15d39 100644 (file)
@@ -338,8 +338,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -362,10 +361,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index 1b8b5e5..406f877 100644 (file)
@@ -1680,7 +1680,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2203,7 +2202,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }
index fdbae1f..494d947 100644 (file)
@@ -5304,7 +5304,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = cp;
   Register slot_reg = a2;
-  Register name_reg = a3;
   Register result_reg = v0;
   Label slow_case;
 
@@ -5317,8 +5316,7 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Load the PropertyCell value at the specified slot.
   __ dsll(at, slot_reg, kPointerSizeLog2);
   __ Daddu(at, at, Operand(context_reg));
-  __ Daddu(at, at, Context::SlotOffset(0));
-  __ ld(result_reg, MemOperand(at));
+  __ ld(result_reg, ContextOperand(at, 0));
   __ ld(result_reg, FieldMemOperand(result_reg, PropertyCell::kValueOffset));
 
   // Check that value is not the_hole.
@@ -5329,15 +5327,14 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to the runtime.
   __ bind(&slow_case);
   __ SmiTag(slot_reg);
-  __ Push(slot_reg, name_reg);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ Push(slot_reg);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = cp;
   Register slot_reg = a2;
-  Register name_reg = a3;
   Register value_reg = a0;
   Register cell_reg = a4;
   Register cell_value_reg = a5;
@@ -5347,7 +5344,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   if (FLAG_debug_code) {
     __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
     __ Check(ne, kUnexpectedValue, value_reg, Operand(at));
-    __ AssertName(name_reg);
   }
 
   // Go up context chain to the script context.
@@ -5359,8 +5355,7 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Load the PropertyCell at the specified slot.
   __ dsll(at, slot_reg, kPointerSizeLog2);
   __ Daddu(at, at, Operand(context_reg));
-  __ Daddu(at, at, Context::SlotOffset(0));
-  __ ld(cell_reg, MemOperand(at));
+  __ ld(cell_reg, ContextOperand(at, 0));
 
   // Load PropertyDetails for the cell (actually only the cell_type and kind).
   __ ld(cell_details_reg,
@@ -5444,11 +5439,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to the runtime.
   __ bind(&slow_case);
   __ SmiTag(slot_reg);
-  __ Push(slot_reg, name_reg, value_reg);
+  __ Push(slot_reg, value_reg);
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index 13a09c3..87c8ffb 100644 (file)
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return a3; }
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return a2; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return a3; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return a2; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return a3; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return a0; }
 
 
index 0313878..f87c852 100644 (file)
@@ -3007,15 +3007,12 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
     __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ li(LoadGlobalViaContextDescriptor::NameRegister(),
-          Operand(instr->name()));
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -4411,20 +4408,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
     __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot));
-    __ li(StoreGlobalViaContextDescriptor::NameRegister(),
-          Operand(instr->name()));
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index 0605825..f6a0f8d 100644 (file)
@@ -338,8 +338,7 @@ void LAccessArgumentsAt::PrintDataTo(StringStream* stream) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -362,10 +361,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index 2408869..ce40377 100644 (file)
@@ -1742,7 +1742,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2249,7 +2248,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }
index 342a00e..9d3a062 100644 (file)
@@ -3992,6 +3992,9 @@ class ScopeInfo : public FixedArray {
                               InitializationFlag* init_flag,
                               MaybeAssignedFlag* maybe_assigned_flag);
 
+  // Lookup the name of a certain context slot by its index.
+  String* ContextSlotName(int slot_index);
+
   // Lookup support for serialized scope info. Returns the
   // parameter index for a given parameter name if the parameter is present;
   // otherwise returns a value < 0. The name must be an internalized string.
index ebaf006..b9c3fdf 100644 (file)
@@ -420,9 +420,8 @@ RUNTIME_FUNCTION(Runtime_ObjectSeal) {
 
 RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) {
   HandleScope scope(isolate);
-  DCHECK_EQ(2, args.length());
+  DCHECK_EQ(1, args.length());
   CONVERT_SMI_ARG_CHECKED(slot, 0);
-  CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
 
   // Go up context chain to the script context.
   Handle<Context> script_context(isolate->context()->script_context(), isolate);
@@ -430,12 +429,15 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) {
   DCHECK(script_context->get(slot)->IsPropertyCell());
 
   // Lookup the named property on the global object.
+  Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()),
+                               isolate);
+  Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
   Handle<GlobalObject> global_object(script_context->global_object(), isolate);
   LookupIterator it(global_object, name, LookupIterator::HIDDEN);
 
   // Switch to fast mode only if there is a data property and it's not on
   // a hidden prototype.
-  if (it.state() == LookupIterator::DATA &&
+  if (LookupIterator::DATA == it.state() &&
       it.GetHolder<Object>()->IsJSGlobalObject()) {
     // Now update the cell in the script context.
     Handle<PropertyCell> cell = it.GetPropertyCell();
@@ -454,8 +456,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalViaContext) {
 
 namespace {
 
-Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name,
-                              Handle<Object> value,
+Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Object> value,
                               LanguageMode language_mode) {
   // Go up context chain to the script context.
   Handle<Context> script_context(isolate->context()->script_context(), isolate);
@@ -463,6 +464,9 @@ Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name,
   DCHECK(script_context->get(slot)->IsPropertyCell());
 
   // Lookup the named property on the global object.
+  Handle<ScopeInfo> scope_info(ScopeInfo::cast(script_context->extension()),
+                               isolate);
+  Handle<Name> name(scope_info->ContextSlotName(slot), isolate);
   Handle<GlobalObject> global_object(script_context->global_object(), isolate);
   LookupIterator it(global_object, name, LookupIterator::HIDDEN);
   // Switch to fast mode only if there is a data property and it's not on
@@ -491,23 +495,21 @@ Object* StoreGlobalViaContext(Isolate* isolate, int slot, Handle<Name> name,
 
 RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Sloppy) {
   HandleScope scope(isolate);
-  DCHECK_EQ(3, args.length());
+  DCHECK_EQ(2, args.length());
   CONVERT_SMI_ARG_CHECKED(slot, 0);
-  CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
-  CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
+  CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
 
-  return StoreGlobalViaContext(isolate, slot, name, value, SLOPPY);
+  return StoreGlobalViaContext(isolate, slot, value, SLOPPY);
 }
 
 
 RUNTIME_FUNCTION(Runtime_StoreGlobalViaContext_Strict) {
   HandleScope scope(isolate);
-  DCHECK_EQ(3, args.length());
+  DCHECK_EQ(2, args.length());
   CONVERT_SMI_ARG_CHECKED(slot, 0);
-  CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
-  CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
+  CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
 
-  return StoreGlobalViaContext(isolate, slot, name, value, STRICT);
+  return StoreGlobalViaContext(isolate, slot, value, STRICT);
 }
 
 
index 1e2471c..b393b77 100644 (file)
@@ -447,9 +447,9 @@ namespace internal {
   F(GetPropertyStrong, 2, 1)                         \
   F(KeyedGetProperty, 2, 1)                          \
   F(KeyedGetPropertyStrong, 2, 1)                    \
-  F(LoadGlobalViaContext, 2, 1)                      \
-  F(StoreGlobalViaContext_Sloppy, 3, 1)              \
-  F(StoreGlobalViaContext_Strict, 3, 1)              \
+  F(LoadGlobalViaContext, 1, 1)                      \
+  F(StoreGlobalViaContext_Sloppy, 2, 1)              \
+  F(StoreGlobalViaContext_Strict, 2, 1)              \
   F(AddNamedProperty, 4, 1)                          \
   F(SetProperty, 4, 1)                               \
   F(AddElement, 3, 1)                                \
index a621083..c79a980 100644 (file)
@@ -572,6 +572,19 @@ int ScopeInfo::ContextSlotIndex(Handle<ScopeInfo> scope_info,
 }
 
 
+String* ScopeInfo::ContextSlotName(int slot_index) {
+  // TODO(bmeurer): Simplify this once we have only a single slot for both reads
+  // and writes to context globals;  currently we have 2 slots per context
+  // global, and these are located after the common context slots (of which we
+  // always have Context::MIN_CONTEXT_SLOTS) and the context locals.
+  int const var =
+      slot_index - (Context::MIN_CONTEXT_SLOTS + ContextLocalCount());
+  DCHECK_LE(0, var);
+  DCHECK_LT(var, 2 * ContextGlobalCount());
+  return ContextLocalName(ContextLocalCount() + var / 2);
+}
+
+
 int ScopeInfo::ParameterIndex(String* name) {
   DCHECK(name->IsInternalizedString());
   if (length() > 0) {
index d7b7f40..7d71701 100644 (file)
@@ -5036,7 +5036,6 @@ void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
 void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = rsi;
   Register slot_reg = rbx;
-  Register name_reg = rcx;
   Register result_reg = rax;
   Label slow_case;
 
@@ -5060,16 +5059,14 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ Integer32ToSmi(slot_reg, slot_reg);
   __ PopReturnAddressTo(kScratchRegister);
   __ Push(slot_reg);
-  __ Push(name_reg);
   __ Push(kScratchRegister);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }
 
 
 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context_reg = rsi;
   Register slot_reg = rbx;
-  Register name_reg = rcx;
   Register value_reg = rax;
   Register cell_reg = r8;
   Register cell_details_reg = rdx;
@@ -5079,7 +5076,6 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   if (FLAG_debug_code) {
     __ CompareRoot(value_reg, Heap::kTheHoleValueRootIndex);
     __ Check(not_equal, kUnexpectedValue);
-    __ AssertName(name_reg);
   }
 
   // Go up context chain to the script context.
@@ -5183,13 +5179,12 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ Integer32ToSmi(slot_reg, slot_reg);
   __ PopReturnAddressTo(kScratchRegister);
   __ Push(slot_reg);
-  __ Push(name_reg);
   __ Push(value_reg);
   __ Push(kScratchRegister);
   __ TailCallRuntime(is_strict(language_mode())
                          ? Runtime::kStoreGlobalViaContext_Strict
                          : Runtime::kStoreGlobalViaContext_Sloppy,
-                     3, 1);
+                     2, 1);
 }
 
 
index e957989..da5e506 100644 (file)
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return rbx; }
 
 
 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return rbx; }
-const Register LoadGlobalViaContextDescriptor::NameRegister() { return rcx; }
 
 
 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return rbx; }
-const Register StoreGlobalViaContextDescriptor::NameRegister() { return rcx; }
 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return rax; }
 
 
index a4c36b8..a4da708 100644 (file)
@@ -2902,14 +2902,12 @@ void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
     __ Set(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
-    __ Move(LoadGlobalViaContextDescriptor::NameRegister(), instr->name());
     Handle<Code> stub =
         CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
-    __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
+    __ CallRuntime(Runtime::kLoadGlobalViaContext, 1);
   }
 }
 
@@ -4279,19 +4277,17 @@ void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
   int const depth = instr->depth();
   if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
     __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
-    __ Move(StoreGlobalViaContextDescriptor::NameRegister(), instr->name());
     Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
                             isolate(), depth, instr->language_mode())
                             .code();
     CallCode(stub, RelocInfo::CODE_TARGET, instr);
   } else {
     __ Push(Smi::FromInt(slot));
-    __ Push(instr->name());
     __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
     __ CallRuntime(is_strict(instr->language_mode())
                        ? Runtime::kStoreGlobalViaContext_Strict
                        : Runtime::kStoreGlobalViaContext_Sloppy,
-                   3);
+                   2);
   }
 }
 
index 46bb35a..1782845 100644 (file)
@@ -375,8 +375,7 @@ LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) {
 
 
 void LLoadGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
+  stream->Add("depth:%d slot:%d", depth(), slot_index());
 }
 
 
@@ -399,10 +398,8 @@ void LStoreNamedGeneric::PrintDataTo(StringStream* stream) {
 
 
 void LStoreGlobalViaContext::PrintDataTo(StringStream* stream) {
-  stream->Add(String::cast(*name())->ToCString().get());
-  stream->Add(" <- ");
+  stream->Add("depth:%d slot:%d <- ", depth(), slot_index());
   value()->PrintTo(stream);
-  stream->Add(" depth:%d slot:%d", depth(), slot_index());
 }
 
 
index 95d56be..cd51a4d 100644 (file)
@@ -1707,7 +1707,6 @@ class LLoadGlobalViaContext final : public LTemplateInstruction<1, 1, 1> {
 
   LOperand* context() { return inputs_[0]; }
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() const { return hydrogen()->depth(); }
   int slot_index() const { return hydrogen()->slot_index(); }
 };
@@ -2220,7 +2219,6 @@ class LStoreGlobalViaContext final : public LTemplateInstruction<0, 2, 0> {
 
   void PrintDataTo(StringStream* stream) override;
 
-  Handle<Object> name() const { return hydrogen()->name(); }
   int depth() { return hydrogen()->depth(); }
   int slot_index() { return hydrogen()->slot_index(); }
   LanguageMode language_mode() { return hydrogen()->language_mode(); }