Reviewers: Igor Sheludko,

Message:
PTAL

Description:
Use ComputeHandlerFlags to find handlers, rather than manually encoding.

BUG=

Please review this at https://codereview.chromium.org/170203003/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+21, -4 lines):
  M src/ic.cc
  M src/stub-cache.cc


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index bd06cb6f9617d5bcf435673cbf507ae91eeedc97..51820759422ad052d0c46ee50b1b652867205b8d 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -840,7 +840,15 @@ Handle<Code> IC::ComputeHandler(LookupResult* lookup,

   Handle<Code> code = isolate()->stub_cache()->FindHandler(
       name, handle(stub_holder->map()), kind(), cache_holder);
-  if (!code.is_null()) return code;
+  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());
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 132ed711aa27f920a89af918ff748f54b4818b56..fac556c85bc9c5db02519193e5e37ea055625433 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -117,8 +117,8 @@ 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);
+  Code::Flags flags = Code::ComputeHandlerFlags(
+      kind, Code::NORMAL, cache_holder);

Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_);
   if (probe->IsCode()) return Handle<Code>::cast(probe);
@@ -193,7 +193,16 @@ Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
   // 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;
+  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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to