Commit 54b37455 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Encapsulate extra_ic_state in CallICs.

R=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17046 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d4cbf02a
......@@ -102,9 +102,8 @@ void IC::SetTargetAtAddress(Address address, Code* target) {
InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object,
JSObject* holder) {
if (object->IsJSObject()) {
return GetCodeCacheForObject(JSObject::cast(object), holder);
}
if (object->IsJSObject()) return OWN_MAP;
// If the object is a value, we use the prototype map for the cache.
ASSERT(object->IsString() || object->IsSymbol() ||
object->IsNumber() || object->IsBoolean());
......@@ -112,23 +111,6 @@ InlineCacheHolderFlag IC::GetCodeCacheForObject(Object* object,
}
InlineCacheHolderFlag IC::GetCodeCacheForObject(JSObject* object,
JSObject* holder) {
// Fast-properties and global objects store stubs in their own maps.
// Slow properties objects use prototype's map (unless the property is its own
// when holder == object). It works because slow properties objects having
// the same prototype (or a prototype with the same map) and not having
// the property are interchangeable for such a stub.
if (holder != object &&
!object->HasFastProperties() &&
!object->IsJSGlobalProxy() &&
!object->IsJSGlobalObject()) {
return PROTOTYPE_MAP;
}
return OWN_MAP;
}
JSObject* IC::GetCodeCacheHolder(Isolate* isolate,
Object* object,
InlineCacheHolderFlag holder) {
......
This diff is collapsed.
......@@ -134,8 +134,6 @@ class IC {
// These methods should not be called with undefined or null.
static inline InlineCacheHolderFlag GetCodeCacheForObject(Object* object,
JSObject* holder);
static inline InlineCacheHolderFlag GetCodeCacheForObject(JSObject* object,
JSObject* holder);
static inline JSObject* GetCodeCacheHolder(Isolate* isolate,
Object* object,
InlineCacheHolderFlag holder);
......@@ -244,17 +242,14 @@ class CallICBase: public IC {
class StringStubState: public BitField<StringStubFeedback, 1, 1> {};
// Returns a JSFunction or a Failure.
MUST_USE_RESULT MaybeObject* LoadFunction(Code::ExtraICState extra_ic_state,
Handle<Object> object,
MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object,
Handle<String> name);
protected:
CallICBase(Code::Kind kind, Isolate* isolate)
: IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {}
bool TryUpdateExtraICState(LookupResult* lookup,
Handle<Object> object,
Code::ExtraICState* extra_ic_state);
virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; }
// Compute a monomorphic stub if possible, otherwise return a null handle.
Handle<Code> ComputeMonomorphicStub(LookupResult* lookup,
......@@ -265,7 +260,6 @@ class CallICBase: public IC {
// Update the inline cache and the global stub cache based on the lookup
// result.
void UpdateCaches(LookupResult* lookup,
Code::ExtraICState extra_ic_state,
Handle<Object> object,
Handle<String> name);
......@@ -300,7 +294,9 @@ class CallICBase: public IC {
class CallIC: public CallICBase {
public:
explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) {
explicit CallIC(Isolate* isolate)
: CallICBase(Code::CALL_IC, isolate),
extra_ic_state_(target()->extra_ic_state()) {
ASSERT(target()->is_call_stub());
}
......@@ -325,6 +321,13 @@ class CallIC: public CallICBase {
CallICBase::GenerateNormal(masm, argc);
GenerateMiss(masm, argc, Code::kNoExtraICState);
}
bool TryUpdateExtraICState(LookupResult* lookup, Handle<Object> object);
protected:
virtual Code::ExtraICState extra_ic_state() { return extra_ic_state_; }
private:
Code::ExtraICState extra_ic_state_;
};
......@@ -578,10 +581,10 @@ class StoreIC: public IC {
// Compute the code stub for this store; used for rewriting to
// monomorphic state and making sure that the code stub is in the
// stub cache.
virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
private:
void set_target(Code* code) {
......@@ -649,10 +652,10 @@ class KeyedStoreIC: public StoreIC {
protected:
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
virtual Handle<Code> ComputeStoreMonomorphic(LookupResult* lookup,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
virtual Handle<Code> ComputeStoreHandler(LookupResult* lookup,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { }
virtual Handle<Code> pre_monomorphic_stub() {
......
This diff is collapsed.
......@@ -94,7 +94,6 @@ class StubCache {
Handle<Code> FindLoadHandler(Handle<Name> name,
Handle<JSObject> receiver,
Handle<JSObject> stub_holder,
Code::Kind kind,
Code::StubType type);
......@@ -1047,7 +1046,7 @@ class CallStubCompiler: public StubCompiler {
int argc,
Code::Kind kind,
Code::ExtraICState extra_state,
InlineCacheHolderFlag cache_holder);
InlineCacheHolderFlag cache_holder = OWN_MAP);
Handle<Code> CompileCallField(Handle<JSObject> object,
Handle<JSObject> holder,
......
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