Reviewers: mvstanton,

Message:
PTAL

Description:
Minor LookupIterator cleanups

BUG=

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

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

Affected files (+21, -42 lines):
  M src/ic/ic.cc
  M src/lookup.h
  M src/lookup.cc
  M src/objects.h
  M src/objects.cc
  M src/runtime.cc


Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 4c297ee8ff826be2a1f2ed35a91b2fabab1ae96e..2bd40de8ca09f7867e32bc61461e8ab1daa28b1b 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -970,7 +970,7 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
                                       cache_holder);
// Perform a lookup behind the interceptor. Copy the LookupIterator since
     // the original iterator will be used to fetch the value.
-    LookupIterator it(lookup);
+    LookupIterator it = *lookup;
     it.Next();
     LookupForRead(&it);
     return compiler.CompileLoadInterceptor(&it);
Index: src/lookup.cc
diff --git a/src/lookup.cc b/src/lookup.cc
index 56001c3e171ceb8366ff7c3631473bbd01e2d218..58e3032e502d2e2fbfed4d7ac855dff500b86e28 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -35,8 +35,8 @@ void LookupIterator::Next() {
   // Either was found in the receiver, or the receiver has no prototype.
   if (holder == NULL) return;

-  maybe_holder_ = handle(holder);
-  holder_map_ = handle(map);
+  maybe_holder_ = handle(holder, isolate_);
+  holder_map_ = handle(map, isolate_);
 }


@@ -53,7 +53,7 @@ Handle<JSReceiver> LookupIterator::GetRoot() const {
 Handle<Map> LookupIterator::GetReceiverMap() const {
   Handle<Object> receiver = GetReceiver();
   if (receiver->IsNumber()) return isolate_->factory()->heap_number_map();
-  return handle(Handle<HeapObject>::cast(receiver)->map());
+  return handle(Handle<HeapObject>::cast(receiver)->map(), isolate_);
 }


@@ -184,7 +184,7 @@ void LookupIterator::PrepareTransitionToDataProperty(
   }

   transition_map_ = Map::TransitionToDataProperty(
-      handle(receiver->map()), name_, value, attributes, store_mode);
+ handle(receiver->map(), isolate_), name_, value, attributes, store_mode);
   state_ = TRANSITION;
 }

@@ -209,8 +209,9 @@ void LookupIterator::TransitionToAccessorProperty(
   // observable.
   Handle<JSObject> receiver = GetStoreTarget();
   maybe_holder_ = receiver;
-  holder_map_ = Map::TransitionToAccessorProperty(
-      handle(receiver->map()), name_, component, accessor, attributes);
+  holder_map_ =
+      Map::TransitionToAccessorProperty(handle(receiver->map(), isolate_),
+ name_, component, accessor, attributes);
   JSObject::MigrateToMap(receiver, holder_map_);

   ReloadPropertyInformation();
@@ -243,7 +244,7 @@ void LookupIterator::TransitionToAccessorProperty(
   JSObject::SetNormalizedProperty(receiver, name_, pair, details);

   JSObject::ReoptimizeIfPrototype(receiver);
-  holder_map_ = handle(receiver->map());
+  holder_map_ = handle(receiver->map(), isolate_);
   ReloadPropertyInformation();
 }

Index: src/lookup.h
diff --git a/src/lookup.h b/src/lookup.h
index d6fa35b265861db90861415c992c5721aa8a31d1..1e5ab0772dc0e6b48560a0487506daec1fd1bd20 100644
--- a/src/lookup.h
+++ b/src/lookup.h
@@ -53,18 +53,6 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
     DESCRIPTOR
   };

-  explicit LookupIterator(const LookupIterator* other)
-      : configuration_(other->configuration_),
-        state_(other->state_),
-        property_kind_(other->property_kind_),
-        property_encoding_(other->property_encoding_),
-        property_details_(other->property_details_),
-        isolate_(other->isolate_),
-        name_(other->name_),
-        holder_map_(other->holder_map_),
-        maybe_receiver_(other->maybe_receiver_),
-        maybe_holder_(other->maybe_holder_) {}
-
   LookupIterator(Handle<Object> receiver, Handle<Name> name,
                  Configuration configuration = CHECK_DERIVED)
       : configuration_(ComputeConfiguration(configuration, name)),
@@ -77,7 +65,7 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
         maybe_receiver_(receiver),
         number_(DescriptorArray::kNotFound) {
     Handle<JSReceiver> root = GetRoot();
-    holder_map_ = handle(root->map());
+    holder_map_ = handle(root->map(), isolate_);
     maybe_holder_ = root;
     Next();
   }
@@ -92,7 +80,7 @@ class LookupIterator V8_FINAL BASE_EMBEDDED {
         property_details_(NONE, NORMAL, Representation::None()),
         isolate_(name->GetIsolate()),
         name_(name),
-        holder_map_(holder->map()),
+        holder_map_(holder->map(), isolate_),
         maybe_receiver_(receiver),
         maybe_holder_(holder),
         number_(DescriptorArray::kNotFound) {
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index b6e0eaca94a8871cc780adea4225941fb672709c..ad31f91f1f893c27d500e2b7379ca2b0aa1f7536 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -12844,12 +12844,12 @@ void JSArray::JSArrayUpdateLengthFromIndex(Handle<JSArray> array,


 bool JSArray::IsReadOnlyLengthDescriptor(Handle<Map> jsarray_map) {
-    Isolate* isolate = jsarray_map->GetIsolate();
-    DCHECK(!jsarray_map->is_dictionary_map());
-    LookupResult lookup(isolate);
-    Handle<Name> length_string = isolate->factory()->length_string();
-    jsarray_map->LookupDescriptor(NULL, *length_string, &lookup);
-    return lookup.IsReadOnly();
+  Isolate* isolate = jsarray_map->GetIsolate();
+  DCHECK(!jsarray_map->is_dictionary_map());
+  LookupResult lookup(isolate);
+  Handle<Name> length_string = isolate->factory()->length_string();
+  jsarray_map->LookupDescriptor(NULL, *length_string, &lookup);
+  return lookup.IsReadOnly();
 }


@@ -14615,13 +14615,6 @@ Handle<Object> ExternalFloat64Array::SetValue(
 }


-PropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) {
-  DCHECK(!HasFastProperties());
- Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry());
-  return PropertyCell::cast(value);
-}
-
-
 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell(
     Handle<JSGlobalObject> global,
     Handle<Name> name) {
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index a804dc62a6d41dd0fb0abdcf146a16db03981d5f..1c2f4e9e0cd6549aec8aec51a870c28ebd3fe5ff 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -7797,9 +7797,6 @@ class GlobalObject: public JSObject {
   // [global proxy]: the global proxy object of the context
   DECL_ACCESSORS(global_proxy, JSObject)

-  // Retrieve the property cell used to store a property.
-  PropertyCell* GetPropertyCell(LookupResult* result);
-
   DECLARE_CAST(GlobalObject)

   // Layout description.
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 32ecf52e879b9421e36c32a06f9da4dea4c45a88..5db5e4d4f7170a03ca9e9dee39fab075ea0b2a44 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -10895,8 +10895,8 @@ RUNTIME_FUNCTION(Runtime_Break) {
 }


-static Handle<Object> DebugLookupResultValue(LookupIterator* it,
-                                             bool* has_caught = NULL) {
+static Handle<Object> DebugGetProperty(LookupIterator* it,
+                                       bool* has_caught = NULL) {
   for (; it->IsFound(); it->Next()) {
     switch (it->state()) {
       case LookupIterator::NOT_FOUND:
@@ -10982,7 +10982,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetPropertyDetails) {

   LookupIterator it(obj, name, LookupIterator::CHECK_HIDDEN);
   bool has_caught = false;
-  Handle<Object> value = DebugLookupResultValue(&it, &has_caught);
+  Handle<Object> value = DebugGetProperty(&it, &has_caught);
   if (!it.IsFound()) return isolate->heap()->undefined_value();

   Handle<Object> maybe_pair;
@@ -11022,7 +11022,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetProperty) {
   CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);

   LookupIterator it(obj, name, LookupIterator::CHECK_DERIVED);
-  return *DebugLookupResultValue(&it);
+  return *DebugGetProperty(&it);
 }




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