PropertyICCompiler: expose monomorphic keyed load handler creation.
authormvstanton@chromium.org <mvstanton@chromium.org>
Fri, 24 Oct 2014 12:28:22 +0000 (12:28 +0000)
committermvstanton@chromium.org <mvstanton@chromium.org>
Fri, 24 Oct 2014 13:12:04 +0000 (13:12 +0000)
Simple refactoring that is useful for upcoming --vector-ic changes.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/673933005

Cr-Commit-Position: refs/heads/master@{#24866}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24866 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/ic/ic-compiler.cc
src/ic/ic-compiler.h

index 9ba566364bcaa0498ce915fa6bcfc7357f4d29d8..1f6eb4e0794777b90dfc239c930c3519335d3f2b 100644 (file)
@@ -92,6 +92,20 @@ Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic(
   Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate);
   if (probe->IsCode()) return Handle<Code>::cast(probe);
 
+  Handle<Code> stub = ComputeKeyedLoadMonomorphicHandler(receiver_map);
+  PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC);
+  Handle<Code> code =
+      compiler.CompileMonomorphic(HeapType::Class(receiver_map, isolate), stub,
+                                  isolate->factory()->empty_string(), ELEMENT);
+
+  Map::UpdateCodeCache(receiver_map, name, code);
+  return code;
+}
+
+
+Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(
+    Handle<Map> receiver_map) {
+  Isolate* isolate = receiver_map->GetIsolate();
   ElementsKind elements_kind = receiver_map->elements_kind();
   Handle<Code> stub;
   if (receiver_map->has_indexed_interceptor()) {
@@ -110,13 +124,7 @@ Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic(
   } else {
     stub = LoadDictionaryElementStub(isolate).GetCode();
   }
-  PropertyICCompiler compiler(isolate, Code::KEYED_LOAD_IC);
-  Handle<Code> code =
-      compiler.CompileMonomorphic(HeapType::Class(receiver_map, isolate), stub,
-                                  isolate->factory()->empty_string(), ELEMENT);
-
-  Map::UpdateCodeCache(receiver_map, name, code);
-  return code;
+  return stub;
 }
 
 
index 97c07d0ecaf65a55c110470cf07caf00a711b764..dd898aeed3c76e7585965fcc8dd0b89e375d5c33 100644 (file)
@@ -34,6 +34,8 @@ class PropertyICCompiler : public PropertyAccessCompiler {
                                          ExtraICState extra_ic_state);
 
   // Keyed
+  static Handle<Code> ComputeKeyedLoadMonomorphicHandler(
+      Handle<Map> receiver_map);
   static Handle<Code> ComputeKeyedLoadMonomorphic(Handle<Map> receiver_map);
 
   static Handle<Code> ComputeKeyedStoreMonomorphic(