Reviewers: Jakob,

Message:
ptal

Description:
Minor performance improvements to the LookupIterator

BUG=chromium:505998
LOG=n

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -13 lines):
  M src/lookup.h
  M src/lookup.cc
  M src/lookup-inl.h
  M test/cctest/test-api.cc
  M test/cctest/test-decls.cc


Index: src/lookup-inl.h
diff --git a/src/lookup-inl.h b/src/lookup-inl.h
index 98971390b60e1dd8674670ffa326f4546b978997..9b5927b53c3207ecf790e392f655835ed349fb81 100644
--- a/src/lookup-inl.h
+++ b/src/lookup-inl.h
@@ -15,7 +15,7 @@ namespace internal {

 JSReceiver* LookupIterator::NextHolder(Map* map) {
   DisallowHeapAllocation no_gc;
-  if (map->prototype()->IsNull()) return NULL;
+  if (!map->prototype()->IsJSReceiver()) return NULL;

   JSReceiver* next = JSReceiver::cast(map->prototype());
   DCHECK(!next->map()->IsGlobalObjectMap() ||
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 716622b475de66d098dfa587ad8b467f47d01f6d..53aa21dc490c58c10cc6767357be6eb8ee74ee5b 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -87,11 +87,6 @@ Handle<JSObject> LookupIterator::GetStoreTarget() const {
 }


-bool LookupIterator::IsBootstrapping() const {
-  return isolate_->bootstrapper()->IsActive();
-}
-
-
 bool LookupIterator::HasAccess() const {
   DCHECK_EQ(ACCESS_CHECK, state_);
   return isolate_->MayAccess(GetHolder<JSObject>());
Index: src/lookup.h
diff --git a/src/lookup.h b/src/lookup.h
index d0ee6cb54dfc589ff68eb6718677868f3bf939b6..9881659b26168b0dbbb1ef77fdecc0d4c9ee5920 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -259,11 +259,9 @@ class LookupIterator final BASE_EMBEDDED {
   bool InternalHolderIsReceiverOrHiddenPrototype() const;
   InterceptorInfo* GetInterceptor(JSObject* holder) const;

-  bool IsBootstrapping() const;
-
   bool check_hidden() const { return (configuration_ & kHidden) != 0; }
   bool check_interceptor() const {
-    return !IsBootstrapping() && (configuration_ & kInterceptor) != 0;
+    return (configuration_ & kInterceptor) != 0;
   }
   bool check_prototype_chain() const {
     return (configuration_ & kPrototypeChain) != 0;
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 1433b7bed6b86a6a1a664818e34bb47c786618de..00fd97baab77f34589e93b5a7b0923c41d1e761b 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -13273,18 +13273,19 @@ TEST(ForceSet) {


 TEST(ForceSetWithInterceptor) {
-  force_set_get_count = 0;
-  force_set_set_count = 0;
-  pass_on_get = false;
-
   v8::Isolate* isolate = CcTest::isolate();
   v8::HandleScope scope(isolate);
   v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate);
   templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
       ForceSetInterceptGetter, ForceSetInterceptSetter));
+  pass_on_get = true;
   LocalContext context(NULL, templ);
   v8::Handle<v8::Object> global = context->Global();

+  force_set_get_count = 0;
+  force_set_set_count = 0;
+  pass_on_get = false;
+
   v8::Handle<v8::String> some_property =
       v8::String::NewFromUtf8(isolate, "a");
   CHECK_EQ(0, force_set_set_count);
Index: test/cctest/test-decls.cc
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index 84b6ca6485db6aa28426df60d420be388992c582..347ca9a6bc89229302686e6ad923996c69057f06 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -130,6 +130,10 @@ void DeclarationContext::InitializeIfNeeded() {
   context_.Reset(isolate, context);
   context->Enter();
   is_initialized_ = true;
+  // Reset counts. Bootstrapping might have called into the interceptor.
+  get_count_ = 0;
+  set_count_ = 0;
+  query_count_ = 0;
   PostInitializeContext(context);
 }



--
--
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/d/optout.

Reply via email to