Reviewers: Weiliang,

Message:
PTAL

Description:
X87: [stubs] Don't pass name to Load/StoreGlobalViaContext stubs.

port 5dff4bdff06c0463db1e876af7541af2b715392c (r29886).

original commit message:

    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.

BUG=

Please review this at https://codereview.chromium.org/1259063004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+13, -34 lines):
  M src/full-codegen/x87/full-codegen-x87.cc
  M src/x87/code-stubs-x87.cc
  M src/x87/interface-descriptors-x87.cc
  M src/x87/lithium-codegen-x87.cc
  M src/x87/lithium-x87.h
  M src/x87/lithium-x87.cc


Index: src/full-codegen/x87/full-codegen-x87.cc
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 1e93fe1fa86a029e662a5f6e5fe76d20c7fde88b..3c4ba361df3d57d34d71013190759c27e6d6fed7 100644
--- a/src/full-codegen/x87/full-codegen-x87.cc
+++ b/src/full-codegen/x87/full-codegen-x87.cc
@@ -1338,13 +1338,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 {
@@ -2618,18 +2616,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: src/x87/code-stubs-x87.cc
diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc
index 0fe2cd93c5b47f14d387160f27418fc9232f8a72..5a0cff157b5d4dab2c239f258fb2fabf6761fadf 100644
--- a/src/x87/code-stubs-x87.cc
+++ b/src/x87/code-stubs-x87.cc
@@ -4799,7 +4799,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;

@@ -4823,25 +4822,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.
@@ -4892,7 +4889,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);
   if (FLAG_debug_code) {
@@ -4929,9 +4927,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.
@@ -4951,13 +4946,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: src/x87/interface-descriptors-x87.cc
diff --git a/src/x87/interface-descriptors-x87.cc b/src/x87/interface-descriptors-x87.cc index 0cbec94f5c1363ef85803b6cfcdb9a1c35de4a34..dacbf1061d29b3f69ce5dc90c197491b60b6d645 100644
--- a/src/x87/interface-descriptors-x87.cc
+++ b/src/x87/interface-descriptors-x87.cc
@@ -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: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index ee96cf698801e8c1c0deb3c6e53baad5459891ad..bfb72b972187aa8f99bb8dc3e4073e1c7bc5f6c6 100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -3153,15 +3153,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);
   }
 }

@@ -4553,20 +4551,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: src/x87/lithium-x87.cc
diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc
index 2f5f15f2887132d12d63a30090ee82f8713c54e9..7a31cf6c62d90e095faa6d30626ceda7be12c236 100644
--- a/src/x87/lithium-x87.cc
+++ b/src/x87/lithium-x87.cc
@@ -391,8 +391,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());
 }


@@ -415,10 +414,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: src/x87/lithium-x87.h
diff --git a/src/x87/lithium-x87.h b/src/x87/lithium-x87.h
index b8f881ddab66388ccc4824ec5da51f4aa879f823..020ec53066cee2bd474fc3ff2f7253fb6bceebbf 100644
--- a/src/x87/lithium-x87.h
+++ b/src/x87/lithium-x87.h
@@ -1738,7 +1738,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(); }
 };
@@ -2248,7 +2247,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(); }


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to