Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: src/code-stubs.cc

Issue 352583002: The IC exposes a register definition. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add an assert on parameter count for stubs that implement KeyedLoadIC. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index f61035e248a2c11a21b563696d40910337bd602a..e2ceb1cf11aa38b085f835d55f19b421f16f716c 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -21,14 +21,61 @@ 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];
+ }
+
+ // Also the register parameter representations array if one is specified.
Jakob Kummerow 2014/06/25 10:31:56 nit: this sentence no verb.
mvstanton 2014/06/25 12:29:00 Done.
+ 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 +559,37 @@ void JSEntryStub::FinishCode(Handle<Code> code) {
}
+void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
+ CodeStubInterfaceDescriptor* descriptor) {
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(),
+ KeyedLoadIC::NameRegister() };
+ ASSERT_EQ(KeyedLoadIC::kRegisterArgumentCount, 2);
Jakob Kummerow 2014/06/25 10:31:56 nit: not sure I see the value of this ASSERT... bu
mvstanton 2014/06/25 12:29:00 Done (static assert). The reason for it is that th
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure));
+}
+
+
+void KeyedLoadDictionaryElementStub::InitializeInterfaceDescriptor(
+ CodeStubInterfaceDescriptor* descriptor) {
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(),
+ KeyedLoadIC::NameRegister() };
+ ASSERT_EQ(KeyedLoadIC::kRegisterArgumentCount, 2);
+ descriptor->Initialize(ARRAY_SIZE(registers), registers,
+ FUNCTION_ADDR(KeyedLoadIC_MissFromStubFailure));
+}
+
+
+void KeyedLoadGenericElementStub::InitializeInterfaceDescriptor(
+ CodeStubInterfaceDescriptor* descriptor) {
+ Register registers[] = { KeyedLoadIC::ReceiverRegister(),
+ KeyedLoadIC::NameRegister() };
+ ASSERT_EQ(KeyedLoadIC::kRegisterArgumentCount, 2);
+ descriptor->Initialize(
+ ARRAY_SIZE(registers), registers,
+ Runtime::FunctionForId(Runtime::kKeyedGetProperty)->entry);
+}
+
+
void KeyedLoadDictionaryElementPlatformStub::Generate(
MacroAssembler* masm) {
KeyedLoadStubCompiler::GenerateLoadDictionaryElement(masm);
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | src/ia32/code-stubs-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698