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

Unified Diff: src/ic.h

Issue 414443002: Always use the LoadStubCompiler for Load handlers, also for keyedload handlers. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ensure that LoadIC can be used to compile keyed load ICs with shared load handlers Created 6 years, 5 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
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | src/stub-cache.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.h
diff --git a/src/ic.h b/src/ic.h
index bb1ea3c2ab2a8c5311f66128f7e5710088c33862..44dd3c8c41a72f20bc0b2dcb6073f33dc6dceab0 100644
--- a/src/ic.h
+++ b/src/ic.h
@@ -192,30 +192,23 @@ class IC {
}
void UpdateMonomorphicIC(Handle<Code> handler, Handle<String> name);
-
bool UpdatePolymorphicIC(Handle<String> name, Handle<Code> code);
-
- virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code);
+ void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code);
void CopyICToMegamorphicCache(Handle<String> name);
bool IsTransitionOfMonomorphicTarget(Map* source_map, Map* target_map);
void PatchCache(Handle<String> name, Handle<Code> code);
- virtual Code::Kind kind() const {
- UNREACHABLE();
- return Code::STUB;
- }
- virtual Handle<Code> slow_stub() const {
- UNREACHABLE();
- return Handle<Code>::null();
+ Code::Kind kind() const { return kind_; }
+ Code::Kind handler_kind() const {
+ if (kind_ == Code::KEYED_LOAD_IC) return Code::LOAD_IC;
+ ASSERT(kind_ == Code::LOAD_IC || kind_ == Code::STORE_IC ||
+ kind_ == Code::KEYED_STORE_IC);
+ return kind_;
}
virtual Handle<Code> megamorphic_stub() {
UNREACHABLE();
return Handle<Code>::null();
}
- virtual Handle<Code> generic_stub() const {
- UNREACHABLE();
- return Handle<Code>::null();
- }
bool TryRemoveInvalidPrototypeDependentStub(Handle<Object> receiver,
Handle<String> name);
@@ -288,6 +281,7 @@ class IC {
Handle<Code> target_;
bool target_set_;
State state_;
+ Code::Kind kind_;
Handle<HeapType> receiver_type_;
MaybeHandle<Code> maybe_handler_;
@@ -442,8 +436,6 @@ class LoadIC: public IC {
Handle<String> name);
protected:
- virtual Code::Kind kind() const { return Code::LOAD_IC; }
-
void set_target(Code* code) {
// The contextual mode must be preserved across IC patching.
ASSERT(GetContextualMode(code->extra_ic_state()) ==
@@ -452,12 +444,16 @@ class LoadIC: public IC {
IC::set_target(code);
}
- virtual Handle<Code> slow_stub() const {
- return isolate()->builtins()->LoadIC_Slow();
+ Handle<Code> slow_stub() const {
+ if (kind() == Code::LOAD_IC) {
+ return isolate()->builtins()->LoadIC_Slow();
+ } else {
+ ASSERT_EQ(Code::KEYED_LOAD_IC, kind());
+ return isolate()->builtins()->KeyedLoadIC_Slow();
+ }
}
virtual Handle<Code> megamorphic_stub();
- virtual Handle<Code> generic_stub() const;
// Update the inline cache and the global stub cache based on the
// lookup result.
@@ -472,13 +468,9 @@ class LoadIC: public IC {
CacheHolderFlag cache_holder);
private:
- // Stub accessors.
+ virtual Handle<Code> pre_monomorphic_stub() const;
static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
- ExtraICState exstra_state);
-
- virtual Handle<Code> pre_monomorphic_stub() {
- return pre_monomorphic_stub(isolate(), extra_ic_state());
- }
+ ExtraICState extra_state);
Handle<Code> SimpleFieldLoad(FieldIndex index);
@@ -520,28 +512,17 @@ class KeyedLoadIC: public LoadIC {
static const int kSlowCaseBitFieldMask =
(1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor);
- protected:
- virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; }
+ static Handle<Code> generic_stub(Isolate* isolate);
+ static Handle<Code> pre_monomorphic_stub(Isolate* isolate);
+ protected:
Handle<Code> LoadElementStub(Handle<JSObject> receiver);
-
- virtual Handle<Code> megamorphic_stub();
- virtual Handle<Code> generic_stub() const;
-
- virtual Handle<Code> slow_stub() const {
- return isolate()->builtins()->KeyedLoadIC_Slow();
+ virtual Handle<Code> pre_monomorphic_stub() const {
+ return pre_monomorphic_stub(isolate());
}
- virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
-
private:
- // Stub accessors.
- static Handle<Code> pre_monomorphic_stub(Isolate* isolate) {
- return isolate->builtins()->KeyedLoadIC_PreMonomorphic();
- }
- virtual Handle<Code> pre_monomorphic_stub() {
- return pre_monomorphic_stub(isolate());
- }
+ Handle<Code> generic_stub() const { return generic_stub(isolate()); }
Handle<Code> indexed_interceptor_stub() {
return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
}
@@ -618,7 +599,6 @@ class StoreIC: public IC {
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED);
protected:
- virtual Code::Kind kind() const { return Code::STORE_IC; }
virtual Handle<Code> megamorphic_stub();
// Stub accessors.
@@ -628,7 +608,7 @@ class StoreIC: public IC {
return isolate()->builtins()->StoreIC_Slow();
}
- virtual Handle<Code> pre_monomorphic_stub() {
+ virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate(), strict_mode());
}
@@ -724,11 +704,7 @@ class KeyedStoreIC: public StoreIC {
static void GenerateSloppyArguments(MacroAssembler* masm);
protected:
- virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
-
- virtual void UpdateMegamorphicCache(HeapType* type, Name* name, Code* code) {}
-
- virtual Handle<Code> pre_monomorphic_stub() {
+ virtual Handle<Code> pre_monomorphic_stub() const {
return pre_monomorphic_stub(isolate(), strict_mode());
}
static Handle<Code> pre_monomorphic_stub(Isolate* isolate,
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/ic.cc » ('j') | src/stub-cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698