Commit 029ca8ca authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

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

port 5dff4bdf (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=

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

Cr-Commit-Position: refs/heads/master@{#29892}
parent 02f09748
......@@ -1337,13 +1337,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 {
......@@ -2616,18 +2614,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) {
......
......@@ -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.
......@@ -4883,7 +4880,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.
......@@ -4925,9 +4923,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.
......@@ -4947,13 +4942,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);
}
......
......@@ -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; }
......
......@@ -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);
}
}
......
......@@ -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());
}
......
......@@ -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(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment