Reviewers: Jakob,

Message:
PTAL

Description:
Rename the configuration flags of the LookupIterator

BUG=

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

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

Affected files (+42, -38 lines):
  M src/api.cc
  M src/bootstrapper.cc
  M src/factory.cc
  M src/isolate.cc
  M src/json-stringifier.h
  M src/lookup.h
  M src/lookup.cc
  M src/objects.cc
  M src/runtime.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 4a6345910f978176c56c6476f232dd0e58e496c8..a287b4c9c9bdd08b81b370c2e04afe47cd180758 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3567,9 +3567,9 @@ static Local<Value> GetPropertyByLookup(i::Isolate* isolate,
   // If the property being looked up is a callback, it can throw
   // an exception.
   EXCEPTION_PREAMBLE(isolate);
-  i::LookupIterator it(
-      receiver, name, i::Handle<i::JSReceiver>(lookup->holder(), isolate),
-      i::LookupIterator::SKIP_INTERCEPTOR);
+  i::LookupIterator it(receiver, name,
+                       i::Handle<i::JSReceiver>(lookup->holder(), isolate),
+                       i::LookupIterator::CHECK_DERIVED_SKIP_INTERCEPTOR);
   i::Handle<i::Object> result;
   has_pending_exception = !i::Object::GetProperty(&it).ToHandle(&result);
   EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 240be719187df946dd347f6583c8f3e3868a4d2a..79aa5cea6dc512d0b0dc35c4b214cb85dbe55198 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -780,7 +780,7 @@ Handle<JSGlobalProxy> Genesis::CreateNewGlobals(
name, code, prototype, JS_GLOBAL_OBJECT_TYPE, JSGlobalObject::kSize);
 #ifdef DEBUG
     LookupIterator it(prototype, factory()->constructor_string(),
-                      LookupIterator::CHECK_OWN_REAL);
+                      LookupIterator::CHECK_PROPERTY);
     Handle<Object> value = JSReceiver::GetProperty(&it).ToHandleChecked();
     DCHECK(it.IsFound());
     DCHECK_EQ(*isolate()->object_function(), *value);
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 39e32806b7b90ec2909dcd891e4af7022df29cef..bb5e97a34e1f09c5260c47e64f73eba6badb1324 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -2169,8 +2169,7 @@ Handle<JSFunction> Factory::CreateApiFunction(
   if (prototype->IsTheHole()) {
 #ifdef DEBUG
     LookupIterator it(handle(JSObject::cast(result->prototype())),
-                      constructor_string(),
-                      LookupIterator::CHECK_OWN_REAL);
+ constructor_string(), LookupIterator::CHECK_PROPERTY);
     MaybeHandle<Object> maybe_prop = Object::GetProperty(&it);
     DCHECK(it.IsFound());
     DCHECK(maybe_prop.ToHandleChecked().is_identical_to(result));
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 215296d735cc5b8b9698cfc67d9dc0cfa3bd7208..4a9e0376e770be489fc6840bb28e30f17572afe2 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1049,8 +1049,8 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) { // Look up as own property. If the lookup fails, the exception is // probably not a valid Error object. In that case, we fall through
           // and capture the stack trace at this throw site.
-          LookupIterator lookup(
-              exception_handle, key, LookupIterator::CHECK_OWN_REAL);
+          LookupIterator lookup(exception_handle, key,
+                                LookupIterator::CHECK_PROPERTY);
           Handle<Object> stack_trace_property;
if (Object::GetProperty(&lookup).ToHandle(&stack_trace_property) &&
               stack_trace_property->IsJSArray()) {
Index: src/json-stringifier.h
diff --git a/src/json-stringifier.h b/src/json-stringifier.h
index 81249a7d4a8be9199ea1393170e401707f66a08b..1970c2debc5bee05c2a555ada95d6b519d052232 100644
--- a/src/json-stringifier.h
+++ b/src/json-stringifier.h
@@ -339,7 +339,8 @@ void BasicJsonStringifier::Append_(const Char* chars) {

 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction(
     Handle<Object> object, Handle<Object> key) {
- LookupIterator it(object, tojson_string_, LookupIterator::SKIP_INTERCEPTOR);
+  LookupIterator it(object, tojson_string_,
+                    LookupIterator::CHECK_DERIVED_SKIP_INTERCEPTOR);
   Handle<Object> fun;
ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object);
   if (!fun->IsJSFunction()) return object;
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 4f77364cd032e625a0d04ebda45d839394f0c225..c3e0fdb8a6845a15c61b4ad3cd2c2a86b722125e 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -174,7 +174,7 @@ void LookupIterator::TransitionToDataProperty(

   // Reload the information.
   state_ = NOT_FOUND;
-  configuration_ = CHECK_OWN_REAL;
+  configuration_ = CHECK_PROPERTY;
   state_ = LookupInHolder(*holder_map_);
   DCHECK(IsFound());
   HasProperty();
Index: src/lookup.h
diff --git a/src/lookup.h b/src/lookup.h
index 8705eea1d2766c910add5d0bfbd34300da651951..8444771ac69eef22279742cbc165884a48e21c88 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -15,15 +15,19 @@ namespace internal {
 class LookupIterator V8_FINAL BASE_EMBEDDED {
  public:
   enum Configuration {
-    CHECK_OWN_REAL = 0,
-    CHECK_HIDDEN = 1 << 0,
-    CHECK_DERIVED = 1 << 1,
+    // Configuration bits.
+    CHECK_HIDDEN_PROPERTY = 1 << 0,
+    CHECK_DERIVED_PROPERTY = 1 << 1,
     CHECK_INTERCEPTOR = 1 << 2,
     CHECK_ACCESS_CHECK = 1 << 3,
-    CHECK_HIDDEN_ACCESS = CHECK_HIDDEN | CHECK_ACCESS_CHECK,
-    SKIP_INTERCEPTOR = CHECK_HIDDEN_ACCESS | CHECK_DERIVED,
-    CHECK_ALL = SKIP_INTERCEPTOR | CHECK_INTERCEPTOR,
-    CHECK_OWN = CHECK_HIDDEN_ACCESS | CHECK_INTERCEPTOR
+
+    // Convience combinations of bits.
+    CHECK_PROPERTY = 0,
+ CHECK_HIDDEN_SKIP_INTERCEPTOR = CHECK_HIDDEN_PROPERTY | CHECK_ACCESS_CHECK,
+    CHECK_DERIVED_SKIP_INTERCEPTOR =
+        CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_DERIVED_PROPERTY,
+    CHECK_DERIVED = CHECK_DERIVED_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR,
+    CHECK_HIDDEN = CHECK_HIDDEN_SKIP_INTERCEPTOR | CHECK_INTERCEPTOR
   };

   enum State {
@@ -44,9 +48,8 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
     DESCRIPTOR
   };

-  LookupIterator(Handle<Object> receiver,
-                 Handle<Name> name,
-                 Configuration configuration = CHECK_ALL)
+  LookupIterator(Handle<Object> receiver, Handle<Name> name,
+                 Configuration configuration = CHECK_DERIVED)
       : configuration_(ComputeConfiguration(configuration, name)),
         state_(NOT_FOUND),
         property_kind_(DATA),
@@ -62,10 +65,9 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
     Next();
   }

-  LookupIterator(Handle<Object> receiver,
-                 Handle<Name> name,
+  LookupIterator(Handle<Object> receiver, Handle<Name> name,
                  Handle<JSReceiver> holder,
-                 Configuration configuration = CHECK_ALL)
+                 Configuration configuration = CHECK_DERIVED)
       : configuration_(ComputeConfiguration(configuration, name)),
         state_(NOT_FOUND),
         property_kind_(DATA),
@@ -161,10 +163,10 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
     return !IsBootstrapping() && (configuration_ & CHECK_INTERCEPTOR) != 0;
   }
   bool check_derived() const {
-    return (configuration_ & CHECK_DERIVED) != 0;
+    return (configuration_ & CHECK_DERIVED_PROPERTY) != 0;
   }
   bool check_hidden() const {
-    return (configuration_ & CHECK_HIDDEN) != 0;
+    return (configuration_ & CHECK_HIDDEN_PROPERTY) != 0;
   }
   bool check_access_check() const {
     return (configuration_ & CHECK_ACCESS_CHECK) != 0;
@@ -183,7 +185,7 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
   static Configuration ComputeConfiguration(
       Configuration configuration, Handle<Name> name) {
     if (name->IsOwn()) {
-      return static_cast<Configuration>(configuration & CHECK_OWN);
+      return static_cast<Configuration>(configuration & CHECK_HIDDEN);
     } else {
       return configuration;
     }
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 441c13907cb71d769607a3ac9372404810a69bdd..127be89bd279962f297fbf57318fa53ae0ae0e02 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -3871,7 +3871,7 @@ void JSObject::WriteToField(int descriptor, Object* value) {
 void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name,
                            Handle<Object> value,
                            PropertyAttributes attributes) {
-  LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL);
+  LookupIterator it(object, name, LookupIterator::CHECK_PROPERTY);
 #ifdef DEBUG
   uint32_t index;
   DCHECK(!object->IsJSProxy());
@@ -3896,7 +3896,8 @@ MaybeHandle<Object> JSObject::SetOwnPropertyIgnoreAttributes(
     PropertyAttributes attributes,
     ExecutableAccessorInfoHandling handling) {
   DCHECK(!value->IsTheHole());
-  LookupIterator it(object, name, LookupIterator::CHECK_HIDDEN_ACCESS);
+  LookupIterator it(object, name,
+                    LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR);
   bool is_observed = object->map()->is_observed() &&
                      *name != it.isolate()->heap()->hidden_string();
   for (; it.IsFound(); it.Next()) {
@@ -4066,7 +4067,7 @@ Maybe<PropertyAttributes> JSReceiver::GetOwnPropertyAttributes(
   if (object->IsJSObject() && name->AsArrayIndex(&index)) {
     return GetOwnElementAttribute(object, index);
   }
-  LookupIterator it(object, name, LookupIterator::CHECK_OWN);
+  LookupIterator it(object, name, LookupIterator::CHECK_HIDDEN);
   return GetPropertyAttributes(&it);
 }

@@ -4774,7 +4775,7 @@ void JSObject::DeleteHiddenProperty(Handle<JSObject> object, Handle<Name> key) {

 bool JSObject::HasHiddenProperties(Handle<JSObject> object) {
   Handle<Name> hidden = object->GetIsolate()->factory()->hidden_string();
-  LookupIterator it(object, hidden, LookupIterator::CHECK_OWN_REAL);
+  LookupIterator it(object, hidden, LookupIterator::CHECK_PROPERTY);
   Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it);
// Cannot get an exception since the hidden_string isn't accessible to JS.
   DCHECK(maybe.has_value);
@@ -5027,8 +5028,9 @@ MaybeHandle<Object> JSObject::DeleteProperty(Handle<JSObject> object,

   // Skip interceptors on FORCE_DELETION.
   LookupIterator::Configuration config =
-      delete_mode == FORCE_DELETION ? LookupIterator::CHECK_HIDDEN_ACCESS
-                                    : LookupIterator::CHECK_OWN;
+      delete_mode == FORCE_DELETION
+          ? LookupIterator::CHECK_HIDDEN_SKIP_INTERCEPTOR
+          : LookupIterator::CHECK_HIDDEN;

   LookupIterator it(object, name, config);

Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 4a753650cbd1ba3369047b2badb4f7f777ce429d..84eea4cb3b8a873f7cda18f5f6cfb455659a2164 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1980,7 +1980,7 @@ MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate,
     }
   } else {
     // Get attributes.
-    LookupIterator it(obj, name, LookupIterator::CHECK_OWN);
+    LookupIterator it(obj, name, LookupIterator::CHECK_HIDDEN);
     Maybe<PropertyAttributes> maybe = JSObject::GetPropertyAttributes(&it);
     if (!maybe.has_value) return MaybeHandle<Object>();
     attrs = maybe.value;
@@ -2159,7 +2159,7 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
                               PropertyAttributes attr, bool is_var,
                               bool is_const, bool is_function) {
   // Do the lookup own properties only, see ES5 erratum.
-  LookupIterator it(global, name, LookupIterator::CHECK_HIDDEN);
+  LookupIterator it(global, name, LookupIterator::CHECK_HIDDEN_PROPERTY);
   Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
   DCHECK(maybe.has_value);
   PropertyAttributes old_attributes = maybe.value;
@@ -2289,7 +2289,7 @@ RUNTIME_FUNCTION(Runtime_InitializeConstGlobal) {
   Handle<GlobalObject> global = isolate->global_object();

   // Lookup the property as own on the global object.
-  LookupIterator it(global, name, LookupIterator::CHECK_HIDDEN);
+  LookupIterator it(global, name, LookupIterator::CHECK_HIDDEN_PROPERTY);
   Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
   DCHECK(maybe.has_value);
   PropertyAttributes old_attributes = maybe.value;
@@ -2439,7 +2439,7 @@ RUNTIME_FUNCTION(Runtime_InitializeLegacyConstLookupSlot) {
     // code can run in between that modifies the declared property.
DCHECK(holder->IsJSGlobalObject() || holder->IsJSContextExtensionObject());

-    LookupIterator it(holder, name, LookupIterator::CHECK_HIDDEN);
+    LookupIterator it(holder, name, LookupIterator::CHECK_HIDDEN_PROPERTY);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
     if (!maybe.has_value) return isolate->heap()->exception();
     PropertyAttributes old_attributes = maybe.value;
@@ -5277,7 +5277,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
 #ifdef DEBUG
   uint32_t index = 0;
   DCHECK(!key->ToArrayIndex(&index));
-  LookupIterator it(object, key, LookupIterator::CHECK_OWN_REAL);
+  LookupIterator it(object, key, LookupIterator::CHECK_PROPERTY);
   Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
   DCHECK(maybe.has_value);
   RUNTIME_ASSERT(!it.IsFound());
@@ -5309,7 +5309,7 @@ RUNTIME_FUNCTION(Runtime_AddPropertyForTemplate) {
   bool duplicate;
   if (key->IsName()) {
     LookupIterator it(object, Handle<Name>::cast(key),
-                      LookupIterator::CHECK_OWN_REAL);
+                      LookupIterator::CHECK_PROPERTY);
Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it);
     DCHECK(maybe.has_value);
     duplicate = it.IsFound();


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