From ef21aa93b7a6ad16619b1e8bc892b31f1201b0c6 Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Wed, 27 Aug 2014 04:49:41 +0000 Subject: [PATCH] X87: Move register conventions out of the IC classes. port r23391. original commit message: Move register conventions out of the IC classes. A change to a convention shouldn't require recompilation of ic.h/.cc. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/513533003 Patch from Chunyang Dai . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23428 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/ic/x87/access-compiler-x87.cc | 10 +-- src/ic/x87/handler-compiler-x87.cc | 16 +++-- src/ic/x87/ic-compiler-x87.cc | 13 ++-- src/ic/x87/ic-conventions-x87.cc | 40 +++++++++++ src/ic/x87/ic-x87.cc | 94 ++++++++++--------------- src/x87/builtins-x87.cc | 6 +- src/x87/code-stubs-x87.cc | 2 +- src/x87/debug-x87.cc | 16 ++--- src/x87/full-codegen-x87.cc | 108 +++++++++++++++-------------- src/x87/lithium-codegen-x87.cc | 31 +++++---- src/x87/lithium-x87.cc | 31 +++++---- tools/gyp/v8.gyp | 1 + 12 files changed, 197 insertions(+), 171 deletions(-) create mode 100644 src/ic/x87/ic-conventions-x87.cc diff --git a/src/ic/x87/access-compiler-x87.cc b/src/ic/x87/access-compiler-x87.cc index d30c257341..563cd6aa37 100644 --- a/src/ic/x87/access-compiler-x87.cc +++ b/src/ic/x87/access-compiler-x87.cc @@ -21,8 +21,8 @@ void PropertyAccessCompiler::GenerateTailCall(MacroAssembler* masm, Register* PropertyAccessCompiler::load_calling_convention() { // receiver, name, scratch1, scratch2, scratch3, scratch4. - Register receiver = LoadIC::ReceiverRegister(); - Register name = LoadIC::NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register name = LoadConvention::NameRegister(); static Register registers[] = {receiver, name, ebx, eax, edi, no_reg}; return registers; } @@ -30,9 +30,9 @@ Register* PropertyAccessCompiler::load_calling_convention() { Register* PropertyAccessCompiler::store_calling_convention() { // receiver, name, scratch1, scratch2, scratch3. - Register receiver = StoreIC::ReceiverRegister(); - Register name = StoreIC::NameRegister(); - DCHECK(ebx.is(KeyedStoreIC::MapRegister())); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + DCHECK(ebx.is(StoreConvention::MapRegister())); static Register registers[] = {receiver, name, ebx, edi, no_reg}; return registers; } diff --git a/src/ic/x87/handler-compiler-x87.cc b/src/ic/x87/handler-compiler-x87.cc index f0c35e2a71..f5267076ec 100644 --- a/src/ic/x87/handler-compiler-x87.cc +++ b/src/ic/x87/handler-compiler-x87.cc @@ -22,8 +22,8 @@ void ElementHandlerCompiler::GenerateLoadDictionaryElement( // -- edx : receiver // -- esp[0] : return address // ----------------------------------- - DCHECK(edx.is(LoadIC::ReceiverRegister())); - DCHECK(ecx.is(LoadIC::NameRegister())); + DCHECK(edx.is(LoadConvention::ReceiverRegister())); + DCHECK(ecx.is(LoadConvention::NameRegister())); Label slow, miss; // This stub is meant to be tail-jumped to, the receiver must already @@ -327,9 +327,9 @@ static void CompileCallLoadPropertyWithInterceptor( static void StoreIC_PushArgs(MacroAssembler* masm) { - Register receiver = StoreIC::ReceiverRegister(); - Register name = StoreIC::NameRegister(); - Register value = StoreIC::ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); @@ -854,7 +854,9 @@ Handle NamedStoreHandlerCompiler::CompileStoreInterceptor( } -Register NamedStoreHandlerCompiler::value() { return StoreIC::ValueRegister(); } +Register NamedStoreHandlerCompiler::value() { + return StoreConvention::ValueRegister(); +} Handle NamedLoadHandlerCompiler::CompileLoadGlobal( @@ -863,7 +865,7 @@ Handle NamedLoadHandlerCompiler::CompileLoadGlobal( FrontendHeader(receiver(), name, &miss); // Get the value from the cell. - Register result = StoreIC::ValueRegister(); + Register result = StoreConvention::ValueRegister(); if (masm()->serializer_enabled()) { __ mov(result, Immediate(cell)); __ mov(result, FieldOperand(result, PropertyCell::kValueOffset)); diff --git a/src/ic/x87/ic-compiler-x87.cc b/src/ic/x87/ic-compiler-x87.cc index 65e3b5a7b5..3656c6332e 100644 --- a/src/ic/x87/ic-compiler-x87.cc +++ b/src/ic/x87/ic-compiler-x87.cc @@ -17,12 +17,13 @@ namespace internal { void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm, StrictMode strict_mode) { // Return address is on the stack. - DCHECK(!ebx.is(StoreIC::ReceiverRegister()) && - !ebx.is(StoreIC::NameRegister()) && !ebx.is(StoreIC::ValueRegister())); + DCHECK(!ebx.is(StoreConvention::ReceiverRegister()) && + !ebx.is(StoreConvention::NameRegister()) && + !ebx.is(StoreConvention::ValueRegister())); __ pop(ebx); - __ push(StoreIC::ReceiverRegister()); - __ push(StoreIC::NameRegister()); - __ push(StoreIC::ValueRegister()); + __ push(StoreConvention::ReceiverRegister()); + __ push(StoreConvention::NameRegister()); + __ push(StoreConvention::ValueRegister()); __ push(Immediate(Smi::FromInt(strict_mode))); __ push(ebx); // return address @@ -60,7 +61,7 @@ Handle PropertyICCompiler::CompilePolymorphic(TypeHandleList* types, // Polymorphic keyed stores may use the map register Register map_reg = scratch1(); DCHECK(kind() != Code::KEYED_STORE_IC || - map_reg.is(KeyedStoreIC::MapRegister())); + map_reg.is(StoreConvention::MapRegister())); __ mov(map_reg, FieldOperand(receiver(), HeapObject::kMapOffset)); int receiver_count = types->length(); int number_of_handled_maps = 0; diff --git a/src/ic/x87/ic-conventions-x87.cc b/src/ic/x87/ic-conventions-x87.cc new file mode 100644 index 0000000000..435c93b68a --- /dev/null +++ b/src/ic/x87/ic-conventions-x87.cc @@ -0,0 +1,40 @@ +// Copyright 2014 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/v8.h" + +#if V8_TARGET_ARCH_X87 + +#include "src/codegen.h" +#include "src/ic/ic-conventions.h" + +namespace v8 { +namespace internal { + +// IC register specifications + +const Register LoadConvention::ReceiverRegister() { return edx; } +const Register LoadConvention::NameRegister() { return ecx; } + + +const Register VectorLoadConvention::SlotRegister() { + DCHECK(FLAG_vector_ics); + return eax; +} + + +const Register FullVectorLoadConvention::VectorRegister() { + DCHECK(FLAG_vector_ics); + return ebx; +} + + +const Register StoreConvention::ReceiverRegister() { return edx; } +const Register StoreConvention::NameRegister() { return ecx; } +const Register StoreConvention::ValueRegister() { return eax; } +const Register StoreConvention::MapRegister() { return ebx; } +} +} // namespace v8::internal + +#endif // V8_TARGET_ARCH_X87 diff --git a/src/ic/x87/ic-x87.cc b/src/ic/x87/ic-x87.cc index bb0aa27a78..d43d059250 100644 --- a/src/ic/x87/ic-x87.cc +++ b/src/ic/x87/ic-x87.cc @@ -312,8 +312,8 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { Label slow, check_name, index_smi, index_name, property_array_property; Label probe_dictionary, check_number_dictionary; - Register receiver = ReceiverRegister(); - Register key = NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register key = LoadConvention::NameRegister(); DCHECK(receiver.is(edx)); DCHECK(key.is(ecx)); @@ -482,8 +482,8 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { // Return address is on the stack. Label miss; - Register receiver = ReceiverRegister(); - Register index = NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register index = LoadConvention::NameRegister(); Register scratch = ebx; DCHECK(!scratch.is(receiver) && !scratch.is(index)); Register result = eax; @@ -509,8 +509,8 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { // Return address is on the stack. Label slow; - Register receiver = ReceiverRegister(); - Register key = NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register key = LoadConvention::NameRegister(); Register scratch = eax; DCHECK(!scratch.is(receiver) && !scratch.is(key)); @@ -549,8 +549,8 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { // The return address is on the stack. - Register receiver = ReceiverRegister(); - Register key = NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register key = LoadConvention::NameRegister(); DCHECK(receiver.is(edx)); DCHECK(key.is(ecx)); @@ -576,9 +576,9 @@ void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { // Return address is on the stack. Label slow, notin; - Register receiver = ReceiverRegister(); - Register name = NameRegister(); - Register value = ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); DCHECK(receiver.is(edx)); DCHECK(name.is(ecx)); DCHECK(value.is(eax)); @@ -610,9 +610,9 @@ static void KeyedStoreGenerateGenericHelper( Label transition_smi_elements; Label finish_object_store, non_double_value, transition_double_elements; Label fast_double_without_map_check; - Register receiver = KeyedStoreIC::ReceiverRegister(); - Register key = KeyedStoreIC::NameRegister(); - Register value = KeyedStoreIC::ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register key = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); DCHECK(receiver.is(edx)); DCHECK(key.is(ecx)); DCHECK(value.is(eax)); @@ -747,8 +747,8 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, Label slow, fast_object, fast_object_grow; Label fast_double, fast_double_grow; Label array, extra, check_if_double_array; - Register receiver = ReceiverRegister(); - Register key = NameRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register key = StoreConvention::NameRegister(); DCHECK(receiver.is(edx)); DCHECK(key.is(ecx)); @@ -827,8 +827,8 @@ void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { // The return address is on the stack. - Register receiver = ReceiverRegister(); - Register name = NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register name = LoadConvention::NameRegister(); DCHECK(receiver.is(edx)); DCHECK(name.is(ecx)); @@ -845,15 +845,15 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { void LoadIC::GenerateNormal(MacroAssembler* masm) { Register dictionary = eax; - DCHECK(!dictionary.is(ReceiverRegister())); - DCHECK(!dictionary.is(NameRegister())); + DCHECK(!dictionary.is(LoadConvention::ReceiverRegister())); + DCHECK(!dictionary.is(LoadConvention::NameRegister())); Label slow; - __ mov(dictionary, - FieldOperand(ReceiverRegister(), JSObject::kPropertiesOffset)); - GenerateDictionaryLoad(masm, &slow, dictionary, NameRegister(), edi, ebx, - eax); + __ mov(dictionary, FieldOperand(LoadConvention::ReceiverRegister(), + JSObject::kPropertiesOffset)); + GenerateDictionaryLoad(masm, &slow, dictionary, + LoadConvention::NameRegister(), edi, ebx, eax); __ ret(0); // Dictionary load failed, go slow (but don't miss). @@ -863,8 +863,8 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { static void LoadIC_PushArgs(MacroAssembler* masm) { - Register receiver = LoadIC::ReceiverRegister(); - Register name = LoadIC::NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register name = LoadConvention::NameRegister(); DCHECK(!ebx.is(receiver) && !ebx.is(name)); __ pop(ebx); @@ -909,31 +909,6 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { } -// IC register specifications -const Register LoadIC::ReceiverRegister() { return edx; } -const Register LoadIC::NameRegister() { return ecx; } - - -const Register LoadIC::SlotRegister() { - DCHECK(FLAG_vector_ics); - return eax; -} - - -const Register LoadIC::VectorRegister() { - DCHECK(FLAG_vector_ics); - return ebx; -} - - -const Register StoreIC::ReceiverRegister() { return edx; } -const Register StoreIC::NameRegister() { return ecx; } -const Register StoreIC::ValueRegister() { return eax; } - - -const Register KeyedStoreIC::MapRegister() { return ebx; } - - void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { // Return address is on the stack. LoadIC_PushArgs(masm); @@ -947,8 +922,9 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { // Return address is on the stack. Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( Code::ComputeHandlerFlags(Code::STORE_IC)); - masm->isolate()->stub_cache()->GenerateProbe(masm, flags, ReceiverRegister(), - NameRegister(), ebx, no_reg); + masm->isolate()->stub_cache()->GenerateProbe( + masm, flags, StoreConvention::ReceiverRegister(), + StoreConvention::NameRegister(), ebx, no_reg); // Cache miss: Jump to runtime. GenerateMiss(masm); @@ -956,9 +932,9 @@ void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { static void StoreIC_PushArgs(MacroAssembler* masm) { - Register receiver = StoreIC::ReceiverRegister(); - Register name = StoreIC::NameRegister(); - Register value = StoreIC::ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); DCHECK(!ebx.is(receiver) && !ebx.is(name) && !ebx.is(value)); @@ -983,9 +959,9 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) { void StoreIC::GenerateNormal(MacroAssembler* masm) { Label restore_miss; - Register receiver = ReceiverRegister(); - Register name = NameRegister(); - Register value = ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); Register dictionary = ebx; __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc index f7feaffbf8..94ec194d90 100644 --- a/src/x87/builtins-x87.cc +++ b/src/x87/builtins-x87.cc @@ -994,8 +994,8 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { // Copy all arguments from the array to the stack. Label entry, loop; - Register receiver = LoadIC::ReceiverRegister(); - Register key = LoadIC::NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register key = LoadConvention::NameRegister(); __ mov(key, Operand(ebp, kIndexOffset)); __ jmp(&entry); __ bind(&loop); @@ -1003,7 +1003,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { // Use inline caching to speed up access to arguments. if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), Immediate(Smi::FromInt(0))); + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(0))); } Handle ic = masm->isolate()->builtins()->KeyedLoadIC_Initialize(); __ call(ic, RelocInfo::CODE_TARGET); diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc index 8777174cc8..cac0b5dd6e 100644 --- a/src/x87/code-stubs-x87.cc +++ b/src/x87/code-stubs-x87.cc @@ -568,7 +568,7 @@ void MathPowStub::Generate(MacroAssembler* masm) { void FunctionPrototypeStub::Generate(MacroAssembler* masm) { Label miss; - Register receiver = LoadIC::ReceiverRegister(); + Register receiver = LoadConvention::ReceiverRegister(); NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, eax, ebx, &miss); diff --git a/src/x87/debug-x87.cc b/src/x87/debug-x87.cc index 3f94edd217..a18b20bb0c 100644 --- a/src/x87/debug-x87.cc +++ b/src/x87/debug-x87.cc @@ -180,17 +180,17 @@ void DebugCodegen::GenerateCallICStubDebugBreak(MacroAssembler* masm) { void DebugCodegen::GenerateLoadICDebugBreak(MacroAssembler* masm) { // Register state for IC load call (from ic-x87.cc). - Register receiver = LoadIC::ReceiverRegister(); - Register name = LoadIC::NameRegister(); + Register receiver = LoadConvention::ReceiverRegister(); + Register name = LoadConvention::NameRegister(); Generate_DebugBreakCallHelper(masm, receiver.bit() | name.bit(), 0, false); } void DebugCodegen::GenerateStoreICDebugBreak(MacroAssembler* masm) { // Register state for IC store call (from ic-x87.cc). - Register receiver = StoreIC::ReceiverRegister(); - Register name = StoreIC::NameRegister(); - Register value = StoreIC::ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); Generate_DebugBreakCallHelper( masm, receiver.bit() | name.bit() | value.bit(), 0, false); } @@ -204,9 +204,9 @@ void DebugCodegen::GenerateKeyedLoadICDebugBreak(MacroAssembler* masm) { void DebugCodegen::GenerateKeyedStoreICDebugBreak(MacroAssembler* masm) { // Register state for keyed IC store call (from ic-x87.cc). - Register receiver = KeyedStoreIC::ReceiverRegister(); - Register name = KeyedStoreIC::NameRegister(); - Register value = KeyedStoreIC::ValueRegister(); + Register receiver = StoreConvention::ReceiverRegister(); + Register name = StoreConvention::NameRegister(); + Register value = StoreConvention::ValueRegister(); Generate_DebugBreakCallHelper( masm, receiver.bit() | name.bit() | value.bit(), 0, false); } diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index a9ea85a598..b8803c6cc3 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -1324,10 +1324,10 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, // All extension objects were empty and it is safe to use a global // load IC call. - __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); - __ mov(LoadIC::NameRegister(), proxy->var()->name()); + __ mov(LoadConvention::ReceiverRegister(), GlobalObjectOperand()); + __ mov(LoadConvention::NameRegister(), proxy->var()->name()); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); } @@ -1411,10 +1411,10 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { switch (var->location()) { case Variable::UNALLOCATED: { Comment cmnt(masm_, "[ Global variable"); - __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); - __ mov(LoadIC::NameRegister(), var->name()); + __ mov(LoadConvention::ReceiverRegister(), GlobalObjectOperand()); + __ mov(LoadConvention::NameRegister(), var->name()); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); } CallLoadIC(CONTEXTUAL); @@ -1630,9 +1630,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { if (key->value()->IsInternalizedString()) { if (property->emit_store()) { VisitForAccumulatorValue(value); - DCHECK(StoreIC::ValueRegister().is(eax)); - __ mov(StoreIC::NameRegister(), Immediate(key->value())); - __ mov(StoreIC::ReceiverRegister(), Operand(esp, 0)); + DCHECK(StoreConvention::ValueRegister().is(eax)); + __ mov(StoreConvention::NameRegister(), Immediate(key->value())); + __ mov(StoreConvention::ReceiverRegister(), Operand(esp, 0)); CallStoreIC(key->LiteralFeedbackId()); PrepareForBailoutForId(key->id(), NO_REGISTERS); } else { @@ -1810,7 +1810,7 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { if (expr->is_compound()) { // We need the receiver both on the stack and in the register. VisitForStackValue(property->obj()); - __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); } else { VisitForStackValue(property->obj()); } @@ -1819,8 +1819,8 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) { if (expr->is_compound()) { VisitForStackValue(property->obj()); VisitForStackValue(property->key()); - __ mov(LoadIC::ReceiverRegister(), Operand(esp, kPointerSize)); - __ mov(LoadIC::NameRegister(), Operand(esp, 0)); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, kPointerSize)); + __ mov(LoadConvention::NameRegister(), Operand(esp, 0)); } else { VisitForStackValue(property->obj()); VisitForStackValue(property->key()); @@ -1960,8 +1960,8 @@ void FullCodeGenerator::VisitYield(Yield* expr) { Label l_catch, l_try, l_suspend, l_continuation, l_resume; Label l_next, l_call, l_loop; - Register load_receiver = LoadIC::ReceiverRegister(); - Register load_name = LoadIC::NameRegister(); + Register load_receiver = LoadConvention::ReceiverRegister(); + Register load_name = LoadConvention::NameRegister(); // Initial send value is undefined. __ mov(eax, isolate()->factory()->undefined_value()); @@ -2017,7 +2017,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ bind(&l_call); __ mov(load_receiver, Operand(esp, kPointerSize)); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(expr->KeyedLoadFeedbackSlot()))); } Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); @@ -2037,7 +2037,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ mov(load_name, isolate()->factory()->done_string()); // "done" if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(expr->DoneFeedbackSlot()))); } CallLoadIC(NOT_CONTEXTUAL); // result.done in eax @@ -2051,7 +2051,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) { __ mov(load_name, isolate()->factory()->value_string()); // "value" if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(expr->ValueFeedbackSlot()))); } CallLoadIC(NOT_CONTEXTUAL); // result.value in eax @@ -2213,9 +2213,9 @@ void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); Literal* key = prop->key()->AsLiteral(); DCHECK(!key->value()->IsSmi()); - __ mov(LoadIC::NameRegister(), Immediate(key->value())); + __ mov(LoadConvention::NameRegister(), Immediate(key->value())); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); CallLoadIC(NOT_CONTEXTUAL); } else { @@ -2228,7 +2228,7 @@ void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { SetSourcePosition(prop->position()); Handle ic = isolate()->builtins()->KeyedLoadIC_Initialize(); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); CallIC(ic); } else { @@ -2368,9 +2368,10 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { case NAMED_PROPERTY: { __ push(eax); // Preserve value. VisitForAccumulatorValue(prop->obj()); - __ Move(StoreIC::ReceiverRegister(), eax); - __ pop(StoreIC::ValueRegister()); // Restore value. - __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value()); + __ Move(StoreConvention::ReceiverRegister(), eax); + __ pop(StoreConvention::ValueRegister()); // Restore value. + __ mov(StoreConvention::NameRegister(), + prop->key()->AsLiteral()->value()); CallStoreIC(); break; } @@ -2378,9 +2379,9 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { __ push(eax); // Preserve value. VisitForStackValue(prop->obj()); VisitForAccumulatorValue(prop->key()); - __ Move(KeyedStoreIC::NameRegister(), eax); - __ pop(KeyedStoreIC::ReceiverRegister()); // Receiver. - __ pop(KeyedStoreIC::ValueRegister()); // Restore value. + __ Move(StoreConvention::NameRegister(), eax); + __ pop(StoreConvention::ReceiverRegister()); // Receiver. + __ pop(StoreConvention::ValueRegister()); // Restore value. Handle ic = strict_mode() == SLOPPY ? isolate()->builtins()->KeyedStoreIC_Initialize() : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); @@ -2407,8 +2408,8 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { if (var->IsUnallocated()) { // Global var, const, or let. - __ mov(StoreIC::NameRegister(), var->name()); - __ mov(StoreIC::ReceiverRegister(), GlobalObjectOperand()); + __ mov(StoreConvention::NameRegister(), var->name()); + __ mov(StoreConvention::ReceiverRegister(), GlobalObjectOperand()); CallStoreIC(); } else if (op == Token::INIT_CONST_LEGACY) { @@ -2481,8 +2482,8 @@ void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { // Record source code position before IC call. SetSourcePosition(expr->position()); - __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value()); - __ pop(StoreIC::ReceiverRegister()); + __ mov(StoreConvention::NameRegister(), prop->key()->AsLiteral()->value()); + __ pop(StoreConvention::ReceiverRegister()); CallStoreIC(expr->AssignmentFeedbackId()); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); context()->Plug(eax); @@ -2495,9 +2496,9 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { // esp[0] : key // esp[kPointerSize] : receiver - __ pop(KeyedStoreIC::NameRegister()); // Key. - __ pop(KeyedStoreIC::ReceiverRegister()); - DCHECK(KeyedStoreIC::ValueRegister().is(eax)); + __ pop(StoreConvention::NameRegister()); // Key. + __ pop(StoreConvention::ReceiverRegister()); + DCHECK(StoreConvention::ValueRegister().is(eax)); // Record source code position before IC call. SetSourcePosition(expr->position()); Handle ic = strict_mode() == SLOPPY @@ -2516,15 +2517,15 @@ void FullCodeGenerator::VisitProperty(Property* expr) { if (key->IsPropertyName()) { VisitForAccumulatorValue(expr->obj()); - __ Move(LoadIC::ReceiverRegister(), result_register()); + __ Move(LoadConvention::ReceiverRegister(), result_register()); EmitNamedPropertyLoad(expr); PrepareForBailoutForId(expr->LoadId(), TOS_REG); context()->Plug(eax); } else { VisitForStackValue(expr->obj()); VisitForAccumulatorValue(expr->key()); - __ pop(LoadIC::ReceiverRegister()); // Object. - __ Move(LoadIC::NameRegister(), result_register()); // Key. + __ pop(LoadConvention::ReceiverRegister()); // Object. + __ Move(LoadConvention::NameRegister(), result_register()); // Key. EmitKeyedPropertyLoad(expr); context()->Plug(eax); } @@ -2557,7 +2558,7 @@ void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { } else { // Load the function from the receiver. DCHECK(callee->IsProperty()); - __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); EmitNamedPropertyLoad(callee->AsProperty()); PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); // Push the target function under the receiver. @@ -2579,8 +2580,8 @@ void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, // Load the function from the receiver. DCHECK(callee->IsProperty()); - __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); - __ mov(LoadIC::NameRegister(), eax); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); + __ mov(LoadConvention::NameRegister(), eax); EmitKeyedPropertyLoad(callee->AsProperty()); PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); @@ -4037,10 +4038,10 @@ void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); // Load the function from the receiver. - __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); - __ mov(LoadIC::NameRegister(), Immediate(expr->name())); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); + __ mov(LoadConvention::NameRegister(), Immediate(expr->name())); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(expr->CallRuntimeFeedbackSlot()))); CallLoadIC(NOT_CONTEXTUAL); } else { @@ -4227,14 +4228,14 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { if (assign_type == NAMED_PROPERTY) { // Put the object both on the stack and in the register. VisitForStackValue(prop->obj()); - __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); + __ mov(LoadConvention::ReceiverRegister(), Operand(esp, 0)); EmitNamedPropertyLoad(prop); } else { VisitForStackValue(prop->obj()); VisitForStackValue(prop->key()); - __ mov(LoadIC::ReceiverRegister(), - Operand(esp, kPointerSize)); // Object. - __ mov(LoadIC::NameRegister(), Operand(esp, 0)); // Key. + __ mov(LoadConvention::ReceiverRegister(), + Operand(esp, kPointerSize)); // Object. + __ mov(LoadConvention::NameRegister(), Operand(esp, 0)); // Key. EmitKeyedPropertyLoad(prop); } } @@ -4349,8 +4350,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { } break; case NAMED_PROPERTY: { - __ mov(StoreIC::NameRegister(), prop->key()->AsLiteral()->value()); - __ pop(StoreIC::ReceiverRegister()); + __ mov(StoreConvention::NameRegister(), + prop->key()->AsLiteral()->value()); + __ pop(StoreConvention::ReceiverRegister()); CallStoreIC(expr->CountStoreFeedbackId()); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); if (expr->is_postfix()) { @@ -4363,8 +4365,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { break; } case KEYED_PROPERTY: { - __ pop(KeyedStoreIC::NameRegister()); - __ pop(KeyedStoreIC::ReceiverRegister()); + __ pop(StoreConvention::NameRegister()); + __ pop(StoreConvention::ReceiverRegister()); Handle ic = strict_mode() == SLOPPY ? isolate()->builtins()->KeyedStoreIC_Initialize() : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); @@ -4391,10 +4393,10 @@ void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { if (proxy != NULL && proxy->var()->IsUnallocated()) { Comment cmnt(masm_, "[ Global variable"); - __ mov(LoadIC::ReceiverRegister(), GlobalObjectOperand()); - __ mov(LoadIC::NameRegister(), Immediate(proxy->name())); + __ mov(LoadConvention::ReceiverRegister(), GlobalObjectOperand()); + __ mov(LoadConvention::NameRegister(), Immediate(proxy->name())); if (FLAG_vector_ics) { - __ mov(LoadIC::SlotRegister(), + __ mov(VectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(proxy->VariableFeedbackSlot()))); } // Use a regular load, not a contextual load, to avoid a reference diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index 40a14a4fd4..a7e432ffa6 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -2967,21 +2967,22 @@ template void LCodeGen::EmitVectorLoadICRegisters(T* instr) { DCHECK(FLAG_vector_ics); Register vector = ToRegister(instr->temp_vector()); - DCHECK(vector.is(LoadIC::VectorRegister())); + DCHECK(vector.is(FullVectorLoadConvention::VectorRegister())); __ mov(vector, instr->hydrogen()->feedback_vector()); // No need to allocate this register. - DCHECK(LoadIC::SlotRegister().is(eax)); - __ mov(LoadIC::SlotRegister(), + DCHECK(FullVectorLoadConvention::SlotRegister().is(eax)); + __ mov(FullVectorLoadConvention::SlotRegister(), Immediate(Smi::FromInt(instr->hydrogen()->slot()))); } void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); - DCHECK(ToRegister(instr->global_object()).is(LoadIC::ReceiverRegister())); + DCHECK(ToRegister(instr->global_object()) + .is(LoadConvention::ReceiverRegister())); DCHECK(ToRegister(instr->result()).is(eax)); - __ mov(LoadIC::NameRegister(), instr->name()); + __ mov(LoadConvention::NameRegister(), instr->name()); if (FLAG_vector_ics) { EmitVectorLoadICRegisters(instr); } @@ -3113,10 +3114,10 @@ void LCodeGen::EmitPushTaggedOperand(LOperand* operand) { void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); - DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); + DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); DCHECK(ToRegister(instr->result()).is(eax)); - __ mov(LoadIC::NameRegister(), instr->name()); + __ mov(LoadConvention::NameRegister(), instr->name()); if (FLAG_vector_ics) { EmitVectorLoadICRegisters(instr); } @@ -3338,8 +3339,8 @@ Operand LCodeGen::BuildFastArrayOperand( void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); - DCHECK(ToRegister(instr->object()).is(LoadIC::ReceiverRegister())); - DCHECK(ToRegister(instr->key()).is(LoadIC::NameRegister())); + DCHECK(ToRegister(instr->object()).is(LoadConvention::ReceiverRegister())); + DCHECK(ToRegister(instr->key()).is(LoadConvention::NameRegister())); if (FLAG_vector_ics) { EmitVectorLoadICRegisters(instr); @@ -3974,10 +3975,10 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField* instr) { void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); - DCHECK(ToRegister(instr->object()).is(StoreIC::ReceiverRegister())); - DCHECK(ToRegister(instr->value()).is(StoreIC::ValueRegister())); + DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); + DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); - __ mov(StoreIC::NameRegister(), instr->name()); + __ mov(StoreConvention::NameRegister(), instr->name()); Handle ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); CallCode(ic, RelocInfo::CODE_TARGET, instr); } @@ -4185,9 +4186,9 @@ void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { DCHECK(ToRegister(instr->context()).is(esi)); - DCHECK(ToRegister(instr->object()).is(KeyedStoreIC::ReceiverRegister())); - DCHECK(ToRegister(instr->key()).is(KeyedStoreIC::NameRegister())); - DCHECK(ToRegister(instr->value()).is(KeyedStoreIC::ValueRegister())); + DCHECK(ToRegister(instr->object()).is(StoreConvention::ReceiverRegister())); + DCHECK(ToRegister(instr->key()).is(StoreConvention::NameRegister())); + DCHECK(ToRegister(instr->value()).is(StoreConvention::ValueRegister())); Handle ic = instr->strict_mode() == STRICT ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() diff --git a/src/x87/lithium-x87.cc b/src/x87/lithium-x87.cc index f2eb9f0a00..35d3e3f5b4 100644 --- a/src/x87/lithium-x87.cc +++ b/src/x87/lithium-x87.cc @@ -2079,11 +2079,11 @@ LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) { LInstruction* LChunkBuilder::DoLoadGlobalGeneric(HLoadGlobalGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); - LOperand* global_object = UseFixed(instr->global_object(), - LoadIC::ReceiverRegister()); + LOperand* global_object = + UseFixed(instr->global_object(), LoadConvention::ReceiverRegister()); LOperand* vector = NULL; if (FLAG_vector_ics) { - vector = FixedTemp(LoadIC::VectorRegister()); + vector = FixedTemp(FullVectorLoadConvention::VectorRegister()); } LLoadGlobalGeneric* result = @@ -2140,10 +2140,11 @@ LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); - LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); + LOperand* object = + UseFixed(instr->object(), LoadConvention::ReceiverRegister()); LOperand* vector = NULL; if (FLAG_vector_ics) { - vector = FixedTemp(LoadIC::VectorRegister()); + vector = FixedTemp(FullVectorLoadConvention::VectorRegister()); } LLoadNamedGeneric* result = new(zone()) LLoadNamedGeneric( context, object, vector); @@ -2203,11 +2204,12 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); - LOperand* object = UseFixed(instr->object(), LoadIC::ReceiverRegister()); - LOperand* key = UseFixed(instr->key(), LoadIC::NameRegister()); + LOperand* object = + UseFixed(instr->object(), LoadConvention::ReceiverRegister()); + LOperand* key = UseFixed(instr->key(), LoadConvention::NameRegister()); LOperand* vector = NULL; if (FLAG_vector_ics) { - vector = FixedTemp(LoadIC::VectorRegister()); + vector = FixedTemp(FullVectorLoadConvention::VectorRegister()); } LLoadKeyedGeneric* result = new(zone()) LLoadKeyedGeneric(context, object, key, vector); @@ -2292,10 +2294,10 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); - LOperand* object = UseFixed(instr->object(), - KeyedStoreIC::ReceiverRegister()); - LOperand* key = UseFixed(instr->key(), KeyedStoreIC::NameRegister()); - LOperand* value = UseFixed(instr->value(), KeyedStoreIC::ValueRegister()); + LOperand* object = + UseFixed(instr->object(), StoreConvention::ReceiverRegister()); + LOperand* key = UseFixed(instr->key(), StoreConvention::NameRegister()); + LOperand* value = UseFixed(instr->value(), StoreConvention::ValueRegister()); DCHECK(instr->object()->representation().IsTagged()); DCHECK(instr->key()->representation().IsTagged()); @@ -2397,8 +2399,9 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { LOperand* context = UseFixed(instr->context(), esi); - LOperand* object = UseFixed(instr->object(), StoreIC::ReceiverRegister()); - LOperand* value = UseFixed(instr->value(), StoreIC::ValueRegister()); + LOperand* object = + UseFixed(instr->object(), StoreConvention::ReceiverRegister()); + LOperand* value = UseFixed(instr->value(), StoreConvention::ValueRegister()); LStoreNamedGeneric* result = new(zone()) LStoreNamedGeneric(context, object, value); diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index fdde2666d0..dc812854af 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -929,6 +929,7 @@ '../../src/ic/x87/handler-compiler-x87.cc', '../../src/ic/x87/ic-x87.cc', '../../src/ic/x87/ic-compiler-x87.cc', + '../../src/ic/x87/ic-conventions-x87.cc', '../../src/ic/x87/stub-cache-x87.cc', ], }],