Commit bb276334 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use ComputeHandlerFlags to find handlers, rather than manually encoding.

BUG=
R=ishell@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19510 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 0a01afda
......@@ -839,8 +839,17 @@ Handle<Code> IC::ComputeHandler(LookupResult* lookup,
isolate(), *object, cache_holder));
Handle<Code> code = isolate()->stub_cache()->FindHandler(
name, handle(stub_holder->map()), kind(), cache_holder);
if (!code.is_null()) return code;
name, handle(stub_holder->map()), kind(), cache_holder,
lookup->IsNormal() ? Code::NORMAL : Code::FAST);
if (!code.is_null()) {
#ifdef DEBUG
Handle<Code> compiled = CompileHandler(
lookup, object, name, value, cache_holder);
ASSERT(compiled->major_key() == code->major_key());
ASSERT(compiled->flags() == code->flags());
#endif
return code;
}
code = CompileHandler(lookup, object, name, value, cache_holder);
ASSERT(code->is_handler());
......
......@@ -7511,9 +7511,11 @@ MaybeObject* CodeCache::UpdateNormalTypeCache(Name* name, Code* code) {
Object* CodeCache::Lookup(Name* name, Code::Flags flags) {
flags = Code::RemoveTypeFromFlags(flags);
Object* result = LookupDefaultCache(name, flags);
if (result->IsCode()) return result;
Object* result = LookupDefaultCache(name, Code::RemoveTypeFromFlags(flags));
if (result->IsCode()) {
if (Code::cast(result)->flags() == flags) return result;
return GetHeap()->undefined_value();
}
return LookupNormalTypeCache(name, flags);
}
......
......@@ -116,9 +116,9 @@ Handle<Code> StubCache::FindIC(Handle<Name> name,
Handle<Code> StubCache::FindHandler(Handle<Name> name,
Handle<Map> stub_holder,
Code::Kind kind,
InlineCacheHolderFlag cache_holder) {
Code::Flags flags = Code::ComputeMonomorphicFlags(
Code::HANDLER, kNoExtraICState, cache_holder, Code::NORMAL);
InlineCacheHolderFlag cache_holder,
Code::StubType type) {
Code::Flags flags = Code::ComputeHandlerFlags(kind, type, cache_holder);
Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_);
if (probe->IsCode()) return Handle<Code>::cast(probe);
......@@ -192,8 +192,17 @@ Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
// Compile the stub that is either shared for all names or
// name specific if there are global objects involved.
Handle<Code> handler = FindHandler(
cache_name, stub_holder, Code::LOAD_IC, flag);
if (!handler.is_null()) return handler;
cache_name, stub_holder, Code::LOAD_IC, flag, Code::FAST);
if (!handler.is_null()) {
#ifdef DEBUG
LoadStubCompiler compiler(isolate_, kNoExtraICState, flag);
Handle<Code> compiled = compiler.CompileLoadNonexistent(
type, last, cache_name);
ASSERT(compiled->major_key() == handler->major_key());
ASSERT(compiled->flags() == handler->flags());
#endif
return handler;
}
LoadStubCompiler compiler(isolate_, kNoExtraICState, flag);
handler = compiler.CompileLoadNonexistent(type, last, cache_name);
......
......@@ -89,7 +89,8 @@ class StubCache {
Handle<Code> FindHandler(Handle<Name> name,
Handle<Map> map,
Code::Kind kind,
InlineCacheHolderFlag cache_holder = OWN_MAP);
InlineCacheHolderFlag cache_holder,
Code::StubType type);
Handle<Code> ComputeMonomorphicIC(Code::Kind kind,
Handle<Name> name,
......
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