Index: src/code-stubs.cc |
diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
index f61035e248a2c11a21b563696d40910337bd602a..e1d771e32030c08341d0d10a80fe23a4778643bc 100644 |
--- a/src/code-stubs.cc |
+++ b/src/code-stubs.cc |
@@ -21,14 +21,62 @@ CodeStubInterfaceDescriptor::CodeStubInterfaceDescriptor() |
stack_parameter_count_(no_reg), |
hint_stack_parameter_count_(-1), |
function_mode_(NOT_JS_FUNCTION_STUB_MODE), |
- register_params_(NULL), |
- register_param_representations_(NULL), |
deoptimization_handler_(NULL), |
handler_arguments_mode_(DONT_PASS_ARGUMENTS), |
miss_handler_(), |
has_miss_handler_(false) { } |
+void CodeStubInterfaceDescriptor::Initialize( |
+ int register_parameter_count, |
+ Register* registers, |
+ Address deoptimization_handler, |
+ Representation* register_param_representations, |
+ int hint_stack_parameter_count, |
+ StubFunctionMode function_mode) { |
+ // CodeStubInterfaceDescriptor owns a copy of the registers array. |
+ register_param_count_ = register_parameter_count; |
+ register_params_.Reset(NewArray<Register>(register_parameter_count)); |
+ for (int i = 0; i < register_parameter_count; i++) { |
+ register_params_[i] = registers[i]; |
+ } |
+ |
+ // If a representations array is specified, then the descriptor owns that as |
+ // well. |
+ if (register_param_representations != NULL) { |
+ register_param_representations_.Reset( |
+ NewArray<Representation>(register_parameter_count)); |
+ for (int i = 0; i < register_parameter_count; i++) { |
+ register_param_representations_[i] = register_param_representations[i]; |
+ } |
+ } |
+ |
+ deoptimization_handler_ = deoptimization_handler; |
+ |
+ hint_stack_parameter_count_ = hint_stack_parameter_count; |
+ function_mode_ = function_mode; |
+} |
+ |
+ |
+void CodeStubInterfaceDescriptor::Initialize( |
+ int register_parameter_count, |
+ Register* registers, |
+ Register stack_parameter_count, |
+ Address deoptimization_handler, |
+ Representation* register_param_representations, |
+ int hint_stack_parameter_count, |
+ StubFunctionMode function_mode, |
+ HandlerArgumentsMode handler_mode) { |
+ Initialize(register_parameter_count, registers, |
+ deoptimization_handler, |
+ register_param_representations, |
+ hint_stack_parameter_count, |
+ function_mode); |
+ stack_parameter_count_ = stack_parameter_count; |
+ handler_arguments_mode_ = handler_mode; |
+} |
+ |
+ |
bool CodeStub::FindCodeInCache(Code** code_out) { |
UnseededNumberDictionary* stubs = isolate()->heap()->code_stubs(); |
int index = stubs->FindEntry(GetKey()); |
@@ -512,6 +560,37 @@ void JSEntryStub::FinishCode(Handle<Code> code) { |
} |
+void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
+ KeyedLoadIC::NameRegister() }; |
+ STATIC_ASSERT(KeyedLoadIC::kRegisterArgumentCount == 2); |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
+} |
+ |
+ |
+void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor( |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
+ KeyedLoadIC::NameRegister() }; |
+ STATIC_ASSERT(KeyedLoadIC::kRegisterArgumentCount == 2); |
+ descriptor->Initialize(ARRAY_SIZE(registers), registers, |
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure)); |
+} |
+ |
+ |
+void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor( |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(), |
+ KeyedLoadIC::NameRegister() }; |
+ STATIC_ASSERT(KeyedLoadIC::kRegisterArgumentCount == 2); |
+ descriptor->Initialize( |
+ ARRAY_SIZE(registers), registers, |
+ Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry); |
+} |
+ |
+ |
void KeyedLoadDictionaryElementPlatformStub::Generate( |
MacroAssembler* masm) { |
KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm); |