Reviewers: Benedikt Meurer, dstence, michael_dawson,

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

Port 5dff4bdff06c0463db1e876af7541af2b715392c

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.

[email protected], [email protected], [email protected]
BUG=

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

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

Affected files (+16, -40 lines):
  M src/full-codegen/ppc/full-codegen-ppc.cc
  M src/ppc/code-stubs-ppc.cc
  M src/ppc/interface-descriptors-ppc.cc
  M src/ppc/lithium-codegen-ppc.cc
  M src/ppc/lithium-ppc.h
  M src/ppc/lithium-ppc.cc


Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc index 68a0dc0bdee861b76a0e9e910a0d7c6dfdceae5f..81478804d9e740967acd8d1e6cad2efc94d92827 100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -1381,14 +1381,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 {
     __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
@@ -2718,19 +2715,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(r3));
       StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
       __ CallStub(&stub);
     } else {
       __ Push(Smi::FromInt(slot));
-      __ Push(var->name());
       __ push(r3);
       __ 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: src/ppc/code-stubs-ppc.cc
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc
index c2cc1e91764e04a68f6eab8d02118157de3b4cc2..d092e9472609be9ec3ce5b48323afca26b5daed6 100644
--- a/src/ppc/code-stubs-ppc.cc
+++ b/src/ppc/code-stubs-ppc.cc
@@ -5317,8 +5317,6 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register context = cp;
   Register result = r3;
   Register slot = r5;
-  Register name = r6;
-  Label slow_case;

   // Go up the context chain to the script context.
   for (int i = 0; i < depth(); ++i) {
@@ -5337,23 +5335,21 @@ void LoadGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ Ret(ne);

   // Fallback to runtime.
-  __ bind(&slow_case);
   __ SmiTag(slot);
-  __ Push(slot, name);
-  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 2, 1);
+  __ Push(slot);
+  __ TailCallRuntime(Runtime::kLoadGlobalViaContext, 1, 1);
 }


 void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   Register value = r3;
   Register slot = r5;
-  Register name = r6;

   Register cell = r4;
-  Register cell_details = r7;
-  Register cell_value = r8;
-  Register cell_value_map = r9;
-  Register scratch = r10;
+  Register cell_details = r6;
+  Register cell_value = r7;
+  Register cell_value_map = r8;
+  Register scratch = r9;

   Register context = cp;
   Register context_temp = cell;
@@ -5363,7 +5359,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.
@@ -5397,8 +5392,8 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   __ StoreP(value, FieldMemOperand(cell, PropertyCell::kValueOffset), r0);
   // RecordWriteField clobbers the value register, so we copy it before the
   // call.
-  __ mr(r7, value);
-  __ RecordWriteField(cell, PropertyCell::kValueOffset, r7, scratch,
+  __ mr(r6, value);
+  __ RecordWriteField(cell, PropertyCell::kValueOffset, r6, scratch,
kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
                       OMIT_SMI_CHECK);
   __ Ret();
@@ -5467,11 +5462,11 @@ void StoreGlobalViaContextStub::Generate(MacroAssembler* masm) {
   // Fallback to 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: src/ppc/interface-descriptors-ppc.cc
diff --git a/src/ppc/interface-descriptors-ppc.cc b/src/ppc/interface-descriptors-ppc.cc index c2cb84a552380a5b020098026137926c3992af5f..c59fc56d248ad99a672cb3dc53c691bc19080d6d 100644
--- a/src/ppc/interface-descriptors-ppc.cc
+++ b/src/ppc/interface-descriptors-ppc.cc
@@ -37,11 +37,9 @@ const Register StoreTransitionDescriptor::MapRegister() { return r6; }


const Register LoadGlobalViaContextDescriptor::SlotRegister() { return r5; } -const Register LoadGlobalViaContextDescriptor::NameRegister() { return r6; }


const Register StoreGlobalViaContextDescriptor::SlotRegister() { return r5; } -const Register StoreGlobalViaContextDescriptor::NameRegister() { return r6; } const Register StoreGlobalViaContextDescriptor::ValueRegister() { return r3; }


Index: src/ppc/lithium-codegen-ppc.cc
diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc
index dc9790b98847155ae52166718461fddd3ad73ac5..74a486f54543f239cf4218987dc7246287c2ccc3 100644
--- a/src/ppc/lithium-codegen-ppc.cc
+++ b/src/ppc/lithium-codegen-ppc.cc
@@ -3068,15 +3068,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);
   }
 }

@@ -4480,19 +4477,16 @@ 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: src/ppc/lithium-ppc.cc
diff --git a/src/ppc/lithium-ppc.cc b/src/ppc/lithium-ppc.cc
index 19ea818a35d0985425920c4c12d01a042ee3fd3a..d95a3e813a7c0e96b1dad91caba9a8d21e62b183 100644
--- a/src/ppc/lithium-ppc.cc
+++ b/src/ppc/lithium-ppc.cc
@@ -344,8 +344,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());
 }


@@ -368,10 +367,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/ppc/lithium-ppc.h
diff --git a/src/ppc/lithium-ppc.h b/src/ppc/lithium-ppc.h
index dbf980321e0a96e3c01e5f554e13184d810d0e53..99ff9fedb7b75754c69638976e4a748d61662b0e 100644
--- a/src/ppc/lithium-ppc.h
+++ b/src/ppc/lithium-ppc.h
@@ -1651,7 +1651,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(); }
 };
@@ -2149,7 +2148,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
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to