Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 0bc57390ecedc08840e4f5d9e571ce799aca4435..84f3f990bee3bd0388a7ada297a3a46a5b26ec10 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -18,170 +18,120 @@ namespace internal { |
void FastNewClosureStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rbx }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry; |
+ Register registers[] = { rbx }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kHiddenNewClosureFromStubFailure)->entry); |
} |
void FastNewContextStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdi }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rdi }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void ToNumberStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void NumberToStringStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry; |
+ Register registers[] = { rax }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kHiddenNumberToString)->entry); |
} |
void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax, rbx, rcx }; |
- descriptor->register_param_count_ = 3; |
- descriptor->register_params_ = registers; |
- static Representation representations[] = { |
+ Register registers[] = { rax, rbx, rcx }; |
+ Representation representations[] = { |
Representation::Tagged(), |
Representation::Smi(), |
Representation::Tagged() }; |
- descriptor->register_param_representations_ = representations; |
- descriptor->deoptimization_handler_ = |
+ |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
Runtime::FunctionForId( |
- Runtime::kHiddenCreateArrayLiteralStubBailout)->entry; |
+ Runtime::kHiddenCreateArrayLiteralStubBailout)->entry, |
+ representations); |
} |
void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax, rbx, rcx, rdx }; |
- descriptor->register_param_count_ = 4; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry; |
+ Register registers[] = { rax, rbx, rcx, rdx }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kHiddenCreateObjectLiteral)->entry); |
} |
void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rbx, rdx }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
-} |
- |
- |
-void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
- CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
-} |
- |
- |
-void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( |
- CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure); |
+ Register registers[] = { rbx, rdx }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rcx, rbx, rax }; |
- descriptor->register_param_count_ = 3; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry; |
-} |
- |
- |
-void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( |
- CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry; |
+ Register registers[] = { rcx, rbx, rax }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kHiddenRegExpConstructResult)->entry); |
} |
void LoadFieldStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void KeyedLoadFieldStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rdx }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void StringLengthStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax, rcx }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rax, rcx }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void KeyedStringLengthStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = NULL; |
+ Register registers[] = { rdx, rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers); |
} |
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rcx, rax }; |
- descriptor->register_param_count_ = 3; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure); |
+ Register registers[] = { rdx, rcx, rax }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(KeyedStoreIC_MissFromStubFailure)); |
} |
void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax, rbx }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
+ Register registers[] = { rax, rbx }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry); |
} |
@@ -192,29 +142,31 @@ static void InitializeArrayConstructorDescriptor( |
// rax -- number of arguments |
// rdi -- function |
// rbx -- allocation site with elements kind |
- static Register registers_variable_args[] = { rdi, rbx, rax }; |
- static Register registers_no_args[] = { rdi, rbx }; |
+ 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[] = { rdi, rbx }; |
+ 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_ = rax; |
- descriptor->register_param_count_ = 3; |
- static Representation representations[] = { |
+ Register registers[] = { rdi, rbx, rax }; |
+ Representation representations[] = { |
Representation::Tagged(), |
Representation::Tagged(), |
Representation::Integer32() }; |
- descriptor->register_param_representations_ = representations; |
- descriptor->register_params_ = registers_variable_args; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ rax, |
+ 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::kHiddenArrayConstructor)->entry; |
} |
@@ -224,28 +176,30 @@ static void InitializeInternalArrayConstructorDescriptor( |
// register state |
// rax -- number of arguments |
// rdi -- constructor function |
- static Register registers_variable_args[] = { rdi, rax }; |
- static Register registers_no_args[] = { rdi }; |
+ 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[] = { rdi }; |
+ 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_ = rax; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers_variable_args; |
- static Representation representations[] = { |
+ Register registers[] = { rdi, rax }; |
+ Representation representations[] = { |
Representation::Tagged(), |
Representation::Integer32() }; |
- descriptor->register_param_representations_ = representations; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ rax, |
+ 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::kHiddenInternalArrayConstructor)->entry; |
} |
@@ -287,11 +241,9 @@ void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
void CompareNilICStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(CompareNilIC_Miss); |
+ Register registers[] = { rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(CompareNilIC_Miss)); |
descriptor->SetMissHandler( |
ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); |
} |
@@ -299,11 +251,9 @@ void CompareNilICStub::InitializeInterfaceDescriptor( |
void ToBooleanStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax }; |
- descriptor->register_param_count_ = 1; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(ToBooleanIC_Miss); |
+ Register registers[] = { rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(ToBooleanIC_Miss)); |
descriptor->SetMissHandler( |
ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); |
} |
@@ -311,30 +261,25 @@ void ToBooleanStub::InitializeInterfaceDescriptor( |
void StoreGlobalStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rcx, rax }; |
- descriptor->register_param_count_ = 3; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(StoreIC_MissFromStubFailure); |
+ Register registers[] = { rdx, rcx, rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(StoreIC_MissFromStubFailure)); |
} |
void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rax, rbx, rcx, rdx }; |
- descriptor->register_param_count_ = 4; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); |
+ Register registers[] = { rax, rbx, rcx, rdx }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss)); |
} |
void BinaryOpICStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
+ Register registers[] = { rdx, rax }; |
+ 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[] = { rcx, rdx, rax }; |
- descriptor->register_param_count_ = 3; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); |
+ Register registers[] = { rcx, rdx, rax }; |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); |
} |
void StringAddStub::InitializeInterfaceDescriptor( |
CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = |
- Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry; |
+ Register registers[] = { rdx, rax }; |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kHiddenStringAdd)->entry); |
} |
@@ -452,18 +394,18 @@ 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 || |
- rax.is(descriptor->register_params_[param_count - 1])); |
+ ASSERT(descriptor->register_param_count() == 0 || |
+ rax.is(descriptor->GetParameterRegister(param_count - 1))); |
// Push arguments |
for (int i = 0; i < param_count; ++i) { |
- __ Push(descriptor->register_params_[i]); |
+ __ Push(descriptor->GetParameterRegister(i)); |
} |
ExternalReference miss = descriptor->miss_handler(); |
- __ CallExternalReference(miss, descriptor->register_param_count_); |
+ __ CallExternalReference(miss, descriptor->register_param_count()); |
} |
__ Ret(); |