Revision: 19510
Author:   [email protected]
Date:     Thu Feb 20 12:40:34 2014 UTC
Log: Use ComputeHandlerFlags to find handlers, rather than manually encoding.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/170203003
http://code.google.com/p/v8/source/detail?r=19510

Modified:
 /branches/bleeding_edge/src/ic.cc
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/stub-cache.cc
 /branches/bleeding_edge/src/stub-cache.h

=======================================
--- /branches/bleeding_edge/src/ic.cc   Tue Feb 18 15:12:58 2014 UTC
+++ /branches/bleeding_edge/src/ic.cc   Thu Feb 20 12:40:34 2014 UTC
@@ -839,8 +839,17 @@
       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());
=======================================
--- /branches/bleeding_edge/src/objects.cc      Wed Feb 19 14:19:42 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Thu Feb 20 12:40:34 2014 UTC
@@ -7511,9 +7511,11 @@


 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);
 }

=======================================
--- /branches/bleeding_edge/src/stub-cache.cc   Mon Feb 17 12:36:44 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc   Thu Feb 20 12:40:34 2014 UTC
@@ -116,9 +116,9 @@
 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 @@
   // 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);
=======================================
--- /branches/bleeding_edge/src/stub-cache.h    Mon Feb 17 12:36:44 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.h    Thu Feb 20 12:40:34 2014 UTC
@@ -89,7 +89,8 @@
   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,

--
--
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