Commit 122b2081 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Encapsulate IC::State into the IC.

BUG=
R=ulan@chromium.org

Review URL: https://chromiumcodereview.appspot.com/25228005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17039 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b9b528e0
This diff is collapsed.
...@@ -98,10 +98,14 @@ class IC { ...@@ -98,10 +98,14 @@ class IC {
Handle<Code> target() const { return target_; } Handle<Code> target() const { return target_; }
Code* raw_target() const { return GetTargetAtAddress(address()); } Code* raw_target() const { return GetTargetAtAddress(address()); }
State state() const { return state_; }
inline Address address() const; inline Address address() const;
// Compute the current IC state based on the target stub, receiver and name. // Compute the current IC state based on the target stub, receiver and name.
static State StateFrom(Code* target, Object* receiver, Object* name); void UpdateState(Object* receiver, Object* name);
void MarkMonomorphicPrototypeFailure() {
state_ = MONOMORPHIC_PROTOTYPE_FAILURE;
}
// Clear the inline cache to initial state. // Clear the inline cache to initial state.
static void Clear(Isolate* isolate, Address address); static void Clear(Isolate* isolate, Address address);
...@@ -160,7 +164,6 @@ class IC { ...@@ -160,7 +164,6 @@ class IC {
void TraceIC(const char* type, void TraceIC(const char* type,
Handle<Object> name, Handle<Object> name,
State old_state,
Code* new_target); Code* new_target);
#endif #endif
...@@ -178,15 +181,13 @@ class IC { ...@@ -178,15 +181,13 @@ class IC {
Handle<Code> handler, Handle<Code> handler,
Handle<String> name); Handle<String> name);
bool UpdatePolymorphicIC(State state, bool UpdatePolymorphicIC(Handle<HeapObject> receiver,
Handle<HeapObject> receiver,
Handle<String> name, Handle<String> name,
Handle<Code> code); Handle<Code> code);
void CopyICToMegamorphicCache(Handle<String> name); void CopyICToMegamorphicCache(Handle<String> name);
bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map);
void PatchCache(State state, void PatchCache(Handle<HeapObject> receiver,
Handle<HeapObject> receiver,
Handle<String> name, Handle<String> name,
Handle<Code> code); Handle<Code> code);
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code);
...@@ -214,6 +215,7 @@ class IC { ...@@ -214,6 +215,7 @@ class IC {
// The original code target that missed. // The original code target that missed.
Handle<Code> target_; Handle<Code> target_;
State state_;
DISALLOW_IMPLICIT_CONSTRUCTORS(IC); DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
}; };
...@@ -241,8 +243,7 @@ class CallICBase: public IC { ...@@ -241,8 +243,7 @@ class CallICBase: public IC {
class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
// Returns a JSFunction or a Failure. // Returns a JSFunction or a Failure.
MUST_USE_RESULT MaybeObject* LoadFunction(State state, MUST_USE_RESULT MaybeObject* LoadFunction(Code::ExtraICState extra_ic_state,
Code::ExtraICState extra_ic_state,
Handle<Object> object, Handle<Object> object,
Handle<String> name); Handle<String> name);
...@@ -256,7 +257,6 @@ class CallICBase: public IC { ...@@ -256,7 +257,6 @@ class CallICBase: public IC {
// Compute a monomorphic stub if possible, otherwise return a null handle. // Compute a monomorphic stub if possible, otherwise return a null handle.
Handle<Code> ComputeMonomorphicStub(LookupResult* lookup, Handle<Code> ComputeMonomorphicStub(LookupResult* lookup,
State state,
Code::ExtraICState extra_state, Code::ExtraICState extra_state,
Handle<Object> object, Handle<Object> object,
Handle<String> name); Handle<String> name);
...@@ -264,7 +264,6 @@ class CallICBase: public IC { ...@@ -264,7 +264,6 @@ class CallICBase: public IC {
// Update the inline cache and the global stub cache based on the lookup // Update the inline cache and the global stub cache based on the lookup
// result. // result.
void UpdateCaches(LookupResult* lookup, void UpdateCaches(LookupResult* lookup,
State state,
Code::ExtraICState extra_ic_state, Code::ExtraICState extra_ic_state,
Handle<Object> object, Handle<Object> object,
Handle<String> name); Handle<String> name);
...@@ -335,8 +334,7 @@ class KeyedCallIC: public CallICBase { ...@@ -335,8 +334,7 @@ class KeyedCallIC: public CallICBase {
ASSERT(target()->is_keyed_call_stub()); ASSERT(target()->is_keyed_call_stub());
} }
MUST_USE_RESULT MaybeObject* LoadFunction(State state, MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object,
Handle<Object> object,
Handle<Object> key); Handle<Object> key);
// Code generator routines. // Code generator routines.
...@@ -371,8 +369,7 @@ class LoadIC: public IC { ...@@ -371,8 +369,7 @@ class LoadIC: public IC {
static void GenerateNormal(MacroAssembler* masm); static void GenerateNormal(MacroAssembler* masm);
static void GenerateRuntimeGetProperty(MacroAssembler* masm); static void GenerateRuntimeGetProperty(MacroAssembler* masm);
MUST_USE_RESULT MaybeObject* Load(State state, MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
Handle<Object> object,
Handle<String> name); Handle<String> name);
protected: protected:
...@@ -389,7 +386,6 @@ class LoadIC: public IC { ...@@ -389,7 +386,6 @@ class LoadIC: public IC {
// Update the inline cache and the global stub cache based on the // Update the inline cache and the global stub cache based on the
// lookup result. // lookup result.
void UpdateCaches(LookupResult* lookup, void UpdateCaches(LookupResult* lookup,
State state,
Handle<Object> object, Handle<Object> object,
Handle<String> name); Handle<String> name);
...@@ -430,8 +426,7 @@ class KeyedLoadIC: public LoadIC { ...@@ -430,8 +426,7 @@ class KeyedLoadIC: public LoadIC {
ASSERT(target()->is_keyed_load_stub()); ASSERT(target()->is_keyed_load_stub());
} }
MUST_USE_RESULT MaybeObject* Load(State state, MUST_USE_RESULT MaybeObject* Load(Handle<Object> object,
Handle<Object> object,
Handle<Object> key, Handle<Object> key,
ICMissMode force_generic); ICMissMode force_generic);
...@@ -528,7 +523,6 @@ class StoreIC: public IC { ...@@ -528,7 +523,6 @@ class StoreIC: public IC {
StrictModeFlag strict_mode); StrictModeFlag strict_mode);
MUST_USE_RESULT MaybeObject* Store( MUST_USE_RESULT MaybeObject* Store(
State state,
Handle<Object> object, Handle<Object> object,
Handle<String> name, Handle<String> name,
Handle<Object> value, Handle<Object> value,
...@@ -577,7 +571,6 @@ class StoreIC: public IC { ...@@ -577,7 +571,6 @@ class StoreIC: public IC {
// Update the inline cache and the global stub cache based on the // Update the inline cache and the global stub cache based on the
// lookup result. // lookup result.
void UpdateCaches(LookupResult* lookup, void UpdateCaches(LookupResult* lookup,
State state,
Handle<JSObject> receiver, Handle<JSObject> receiver,
Handle<String> name, Handle<String> name,
Handle<Object> value); Handle<Object> value);
...@@ -633,8 +626,7 @@ class KeyedStoreIC: public StoreIC { ...@@ -633,8 +626,7 @@ class KeyedStoreIC: public StoreIC {
ASSERT(target()->is_keyed_store_stub()); ASSERT(target()->is_keyed_store_stub());
} }
MUST_USE_RESULT MaybeObject* Store(State state, MUST_USE_RESULT MaybeObject* Store(Handle<Object> object,
Handle<Object> object,
Handle<Object> name, Handle<Object> name,
Handle<Object> value, Handle<Object> value,
ICMissMode force_generic); ICMissMode force_generic);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment