Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index 2700dbbe9c505c4e42a667695fe5ea409646c9d9..b826d2a7340736db7572637357049021d603e4b7 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -573,6 +573,45 @@ Handle<Code> KeyedLoadFieldStub::GenerateCode(Isolate* isolate) { |
} |
+template<> |
+HValue* CodeStubGraphBuilder<KeyedArrayCallStub>::BuildCodeStub() { |
+ info()->SetGlobalScope(new(zone()) Scope(NULL, GLOBAL_SCOPE, zone())); |
+ Scope* scope = new(zone()) Scope( |
+ info()->global_scope(), FUNCTION_SCOPE, zone()); |
+ info()->SetScope(scope); |
+ |
+ int argc = casted_stub()->argc() + 1; |
+ for (int i = 0; i < argc; i++) { |
+ scope->DeclareParameter(isolate()->factory()->empty_string(), VAR); |
+ } |
danno
2013/10/02 08:49:11
This is a total hack. I am not sure how to do it b
Toon Verwaest
2013/10/02 16:28:16
Done.
|
+ |
+ HValue* receiver = Add<HParameter>(1); |
+ |
+ // Load the expected array map from the context. |
+ HValue* native_context = BuildGetNativeContext(); |
+ HValue* index = Add<HConstant>( |
+ static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); |
+ HValue* map_array = Add<HLoadKeyed>( |
+ native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
+ HValue* kind_index = Add<HConstant>(casted_stub()->elements_kind()); |
+ HValue* map = Add<HLoadKeyed>( |
+ map_array, kind_index, static_cast<HValue*>(NULL), FAST_ELEMENTS); |
danno
2013/10/02 08:49:11
Please find a way to share this code in some way w
Toon Verwaest
2013/10/02 16:28:16
Done.
|
+ |
+ HValue* checked_receiver = Add<HCheckMapValue>(receiver, map); |
+ |
+ HValue* function = BuildUncheckedMonomorphicElementAccess( |
+ checked_receiver, GetParameter(0), |
+ NULL, true, casted_stub()->elements_kind(), |
+ false, NEVER_RETURN_HOLE, STANDARD_STORE); |
+ return Add<HCallFunction>(function, argc, true); |
+} |
+ |
+ |
+Handle<Code> KeyedArrayCallStub::GenerateCode(Isolate* isolate) { |
+ return DoGenerateCode(isolate, this); |
+} |
+ |
+ |
template <> |
HValue* CodeStubGraphBuilder<KeyedStoreFastElementStub>::BuildCodeStub() { |
BuildUncheckedMonomorphicElementAccess( |