diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 6121a985e8..d4e2707f4a 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -18,180 +18,128 @@ namespace internal { void FastNewClosureStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a2 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry; + Register registers[] = { a2 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry); } void FastNewContextStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a1 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void ToNumberStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void NumberToStringStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry; + Register registers[] = { a0 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry); } void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a3, a2, a1 }; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers; - static Representation representations[] = { + Register registers[] = { a3, a2, a1 }; + Representation representations[] = { Representation::Tagged(), Representation::Smi(), Representation::Tagged() }; - descriptor->register_param_representations_ = representations; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId( + Runtime::kHiddenCreateArrayLiteralStubBailout)->entry, + representations); } void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a3, a2, a1, a0 }; - descriptor->register_param_count_ = 4; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry; + Register registers[] = { a3, a2, a1, a0 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry); } void CreateAllocationSiteStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a2, a3 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; -} - - -void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( - CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); -} - - -void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( - CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = {a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); + Register registers[] = { a2, a3 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void RegExpConstructResultStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a2, a1, a0 }; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry; -} - - -void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( - CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; + Register registers[] = { a2, a1, a0 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry); } void LoadFieldStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void KeyedLoadFieldStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a1 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void StringLengthStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0, a2 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a0, a2 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void KeyedStringLengthStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = NULL; + Register registers[] = { a1, a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers); } void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a2, a1, a0 }; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); + Register registers[] = { a2, a1, a0 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure)); } void TransitionElementsKindStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0, a1 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; + Register registers[] = { a0, a1 }; Address entry = Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; - descriptor->deoptimization_handler_ = FUNCTION_ADDR(entry); + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(entry)); } void CompareNilICStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(CompareNilIC_Miss); + Register registers[] = { a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(CompareNilIC_Miss)); descriptor->SetMissHandler( ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); } @@ -204,29 +152,31 @@ static void InitializeArrayConstructorDescriptor( // a0 -- number of arguments // a1 -- function // a2 -- allocation site with elements kind - static Register registers_variable_args[] = { a1, a2, a0 }; - static Register registers_no_args[] = { a1, a2 }; + Address deopt_handler = Runtime::FunctionForId( + Runtime::kHiddenArrayConstructor)->entry; if (constant_stack_parameter_count == 0) { - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers_no_args; + Register registers[] = { a1, a2 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + deopt_handler, + NULL, + constant_stack_parameter_count, + JS_FUNCTION_STUB_MODE); } else { // stack param count needs (constructor pointer, and single argument) - descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; - descriptor->stack_parameter_count_ = a0; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers_variable_args; - static Representation representations[] = { + Register registers[] = { a1, a2, a0 }; + Representation representations[] = { Representation::Tagged(), Representation::Tagged(), Representation::Integer32() }; - descriptor->register_param_representations_ = representations; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + a0, + deopt_handler, + representations, + constant_stack_parameter_count, + JS_FUNCTION_STUB_MODE, + PASS_ARGUMENTS); } - - descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; - descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kArrayConstructor)->entry; } @@ -236,28 +186,30 @@ static void InitializeInternalArrayConstructorDescriptor( // register state // a0 -- number of arguments // a1 -- constructor function - static Register registers_variable_args[] = { a1, a0 }; - static Register registers_no_args[] = { a1 }; + Address deopt_handler = Runtime::FunctionForId( + Runtime::kHiddenInternalArrayConstructor)->entry; if (constant_stack_parameter_count == 0) { - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers_no_args; + Register registers[] = { a1 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + deopt_handler, + NULL, + constant_stack_parameter_count, + JS_FUNCTION_STUB_MODE); } else { // stack param count needs (constructor pointer, and single argument) - descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; - descriptor->stack_parameter_count_ = a0; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers_variable_args; - static Representation representations[] = { + Register registers[] = { a1, a0 }; + Representation representations[] = { Representation::Tagged(), Representation::Integer32() }; - descriptor->register_param_representations_ = representations; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + a0, + deopt_handler, + representations, + constant_stack_parameter_count, + JS_FUNCTION_STUB_MODE, + PASS_ARGUMENTS); } - - descriptor->hint_stack_parameter_count_ = constant_stack_parameter_count; - descriptor->function_mode_ = JS_FUNCTION_STUB_MODE; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kInternalArrayConstructor)->entry; } @@ -281,11 +233,9 @@ void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void ToBooleanStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0 }; - descriptor->register_param_count_ = 1; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(ToBooleanIC_Miss); + Register registers[] = { a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(ToBooleanIC_Miss)); descriptor->SetMissHandler( ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); } @@ -311,30 +261,25 @@ void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( void StoreGlobalStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a2, a0 }; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(StoreIC_MissFromStubFailure); + Register registers[] = { a1, a2, a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(StoreIC_MissFromStubFailure)); } void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a0, a3, a1, a2 }; - descriptor->register_param_count_ = 4; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); + Register registers[] = { a0, a3, a1, a2 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss)); } void BinaryOpICStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); + Register registers[] = { a1, a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(BinaryOpIC_Miss)); descriptor->SetMissHandler( ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); } @@ -342,21 +287,18 @@ void BinaryOpICStub::InitializeInterfaceDescriptor( void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a2, a1, a0 }; - descriptor->register_param_count_ = 3; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); + Register registers[] = { a2, a1, a0 }; + descriptor->Initialize(ARRAY_SIZE(registers), registers, + FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); } void StringAddStub::InitializeInterfaceDescriptor( CodeStubInterfaceDescriptor* descriptor) { - static Register registers[] = { a1, a0 }; - descriptor->register_param_count_ = 2; - descriptor->register_params_ = registers; - descriptor->deoptimization_handler_ = - Runtime::FunctionForId(Runtime::kStringAdd)->entry; + Register registers[] = { a1, a0 }; + descriptor->Initialize( + ARRAY_SIZE(registers), registers, + Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry); } @@ -466,21 +408,21 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm) { isolate()->counters()->code_stubs()->Increment(); CodeStubInterfaceDescriptor* descriptor = GetInterfaceDescriptor(); - int param_count = descriptor->register_param_count_; + int param_count = descriptor->register_param_count(); { // Call the runtime system in a fresh internal frame. FrameScope scope(masm, StackFrame::INTERNAL); - ASSERT(descriptor->register_param_count_ == 0 || - a0.is(descriptor->register_params_[param_count - 1])); + ASSERT(descriptor->register_param_count() == 0 || + a0.is(descriptor->GetParameterRegister(param_count - 1))); // Push arguments, adjust sp. __ Subu(sp, sp, Operand(param_count * kPointerSize)); for (int i = 0; i < param_count; ++i) { // Store argument to stack. - __ sw(descriptor->register_params_[i], + __ sw(descriptor->GetParameterRegister(i), MemOperand(sp, (param_count-1-i) * kPointerSize)); } ExternalReference miss = descriptor->miss_handler(); - __ CallExternalReference(miss, descriptor->register_param_count_); + __ CallExternalReference(miss, descriptor->register_param_count()); } __ Ret(); diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc index 71c82fb8af..5723136c84 100644 --- a/src/mips/deoptimizer-mips.cc +++ b/src/mips/deoptimizer-mips.cc @@ -101,7 +101,7 @@ void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { void Deoptimizer::SetPlatformCompiledStubRegisters( FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) { - ApiFunction function(descriptor->deoptimization_handler_); + ApiFunction function(descriptor->deoptimization_handler()); ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); intptr_t handler = reinterpret_cast(xref.address()); int params = descriptor->GetHandlerParameterCount(); diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc index cbf721adb8..080631aaa8 100644 --- a/src/mips/ic-mips.cc +++ b/src/mips/ic-mips.cc @@ -560,6 +560,13 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { } +// IC register specifications +const Register LoadIC::ReceiverRegister() { return a0; } +const Register LoadIC::NameRegister() { return a2; } +const Register KeyedLoadIC::ReceiverRegister() { return a1; } +const Register KeyedLoadIC::NameRegister() { return a0; } + + void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { // ---------- S t a t e -------------- // -- ra : return address diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc index d7e7b2e325..bc8a50cfb0 100644 --- a/src/mips/stub-cache-mips.cc +++ b/src/mips/stub-cache-mips.cc @@ -1253,14 +1253,18 @@ Handle LoadStubCompiler::CompileLoadNonexistent(Handle type, Register* LoadStubCompiler::registers() { // receiver, name, scratch1, scratch2, scratch3, scratch4. - static Register registers[] = { a0, a2, a3, a1, t0, t1 }; + Register receiver = LoadIC::ReceiverRegister(); + Register name = LoadIC::NameRegister(); + static Register registers[] = { receiver, name, a3, a1, t0, t1 }; return registers; } Register* KeyedLoadStubCompiler::registers() { // receiver, name, scratch1, scratch2, scratch3, scratch4. - static Register registers[] = { a1, a0, a2, a3, t0, t1 }; + Register receiver = KeyedLoadIC::ReceiverRegister(); + Register name = KeyedLoadIC::NameRegister(); + static Register registers[] = { receiver, name, a2, a3, t0, t1 }; return registers; }