Commit 6a3d1868 authored by ager@chromium.org's avatar ager@chromium.org

Revert revision 331. The propagation of monomorphic prototype failure

information does not work.  In certains situations, it will keep
alternating between unrelated monomorphic states instead of going
megamorphic.
Review URL: http://codereview.chromium.org/2959

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@338 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d6ae7d4d
This diff is collapsed.
......@@ -81,12 +81,8 @@ class IC {
Code* target() { return GetTargetAtAddress(address()); }
inline Address address();
// Compute the state of the current inline cache. If the current
// inline cache is monomorphic, this might change the code cache in
// the receiver map and it might return a code object from the code
// cache in the receiver map that should be used as the new target.
static State ComputeCacheState(Code* target, Object* receiver,
Object* name, Object** new_target);
// Compute the current IC state based on the target stub and the receiver.
static State StateFrom(Code* target, Object* receiver);
// Clear the inline cache to initial state.
static void Clear(Address address);
......@@ -165,7 +161,7 @@ class CallIC: public IC {
public:
CallIC() : IC(EXTRA_CALL_FRAME) { ASSERT(target()->is_call_stub()); }
Object* LoadFunction(Handle<Object> object, Handle<String> name);
Object* LoadFunction(State state, Handle<Object> object, Handle<String> name);
// Code generator routines.
......@@ -183,6 +179,7 @@ class CallIC: public IC {
// Update the inline cache and the global stub cache based on the
// lookup result.
void UpdateCaches(LookupResult* lookup,
State state,
Handle<Object> object,
Handle<String> name);
......@@ -200,7 +197,7 @@ class LoadIC: public IC {
public:
LoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_load_stub()); }
Object* Load(Handle<Object> object, Handle<String> name);
Object* Load(State state, Handle<Object> object, Handle<String> name);
// Code generator routines.
static void GenerateInitialize(MacroAssembler* masm);
......@@ -222,6 +219,7 @@ class LoadIC: public IC {
// Update the inline cache and the global stub cache based on the
// lookup result.
void UpdateCaches(LookupResult* lookup,
State state,
Handle<Object> object,
Handle<String> name);
......@@ -245,7 +243,7 @@ class KeyedLoadIC: public IC {
public:
KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); }
Object* Load(Handle<Object> object, Handle<Object> key);
Object* Load(State state, Handle<Object> object, Handle<Object> key);
// Code generator routines.
static void GenerateMiss(MacroAssembler* masm);
......@@ -258,6 +256,7 @@ class KeyedLoadIC: public IC {
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
Handle<Object> object,
Handle<String> name);
......@@ -284,7 +283,8 @@ class StoreIC: public IC {
public:
StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); }
Object* Store(Handle<Object> object,
Object* Store(State state,
Handle<Object> object,
Handle<String> name,
Handle<Object> value);
......@@ -299,7 +299,7 @@ class StoreIC: public IC {
// Update the inline cache and the global stub cache based on the
// lookup result.
void UpdateCaches(LookupResult* lookup,
Handle<JSObject> receiver,
State state, Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
......@@ -320,7 +320,8 @@ class KeyedStoreIC: public IC {
public:
KeyedStoreIC() : IC(NO_EXTRA_FRAME) { }
Object* Store(Handle<Object> object,
Object* Store(State state,
Handle<Object> object,
Handle<Object> name,
Handle<Object> value);
......@@ -334,6 +335,7 @@ class KeyedStoreIC: public IC {
// Update the inline cache.
void UpdateCaches(LookupResult* lookup,
State state,
Handle<JSObject> receiver,
Handle<String> name,
Handle<Object> value);
......
......@@ -2109,20 +2109,6 @@ void Map::ClearCodeCache() {
}
Object* Map::FindInCodeCache(String* name, Code::Flags flags) {
int index;
return FindIndexInCodeCache(name, flags, &index);
}
void Map::RemoveFromCodeCache(int index) {
FixedArray* array = code_cache();
ASSERT(array->length() >= index && array->get(index)->IsCode());
array->set_undefined(index - 1); // key
array->set_undefined(index); // code
}
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef SMI_ACCESSORS
......
......@@ -2410,27 +2410,41 @@ Object* Map::UpdateCodeCache(String* name, Code* code) {
}
Object* Map::FindIndexInCodeCache(String* name, Code::Flags flags, int* index) {
Object* Map::FindInCodeCache(String* name, Code::Flags flags) {
FixedArray* cache = code_cache();
int length = cache->length();
for (int i = 0; i < length; i += 2) {
Object* key = cache->get(i);
if (key->IsUndefined()) {
continue;
return key;
}
if (name->Equals(String::cast(key))) {
Code* code = Code::cast(cache->get(i + 1));
if (code->flags() == flags) {
*index = i + 1;
return code;
}
if (code->flags() == flags) return code;
}
}
*index = -1;
return Heap::undefined_value();
}
int Map::IndexInCodeCache(Code* code) {
FixedArray* array = code_cache();
int len = array->length();
for (int i = 0; i < len; i += 2) {
if (array->get(i + 1) == code) return i + 1;
}
return -1;
}
void Map::RemoveFromCodeCache(int index) {
FixedArray* array = code_cache();
ASSERT(array->length() >= index && array->get(index)->IsCode());
array->set_undefined(index - 1); // key
array->set_undefined(index); // code
}
void FixedArray::FixedArrayIterateBody(ObjectVisitor* v) {
IteratePointers(v, kHeaderSize, kHeaderSize + length() * kPointerSize);
}
......
......@@ -2342,14 +2342,14 @@ class Map: public HeapObject {
Object* UpdateCodeCache(String* name, Code* code);
// Returns the found code or undefined if absent.
inline Object* FindInCodeCache(String* name, Code::Flags flags);
Object* FindInCodeCache(String* name, Code::Flags flags);
// Returns the found code or undefined if absent. Also returns the
// index at which the code was found or -1 if absent.
Object* FindIndexInCodeCache(String* name, Code::Flags flags, int* index);
// Returns the non-negative index of the code object if it is in the
// cache and -1 otherwise.
int IndexInCodeCache(Code* code);
// Removes a code object from the code cache at the given index.
inline void RemoveFromCodeCache(int index);
void RemoveFromCodeCache(int index);
// Dispatched behavior.
void MapIterateBody(ObjectVisitor* v);
......
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