Index: src/prototype.h |
diff --git a/src/prototype.h b/src/prototype.h |
index 6e9015da63f1d8029592c9632d2b02ae45cc5bc3..d052510b497480292e4c837977c514db89cd6089 100644 |
--- a/src/prototype.h |
+++ b/src/prototype.h |
@@ -53,21 +53,35 @@ class PrototypeIterator { |
if (where_to_start == kStartAtPrototype) Advance(); |
} |
- explicit PrototypeIterator(Map* receiver_map) |
+ explicit PrototypeIterator(Map* receiver_map, |
+ WhereToEnd where_to_end = END_AT_NULL) |
: isolate_(receiver_map->GetIsolate()), |
object_(receiver_map->GetPrototypeChainRootMap(isolate_)->prototype()), |
- where_to_end_(END_AT_NULL), |
+ where_to_end_(where_to_end), |
is_at_end_(object_->IsNull(isolate_)), |
- seen_proxies_(0) {} |
+ seen_proxies_(0) { |
+ if (!is_at_end_ && where_to_end_ == END_AT_NON_HIDDEN) { |
+ DCHECK(object_->IsJSReceiver()); |
+ Map* map = JSReceiver::cast(object_)->map(); |
+ is_at_end_ = !map->has_hidden_prototype(); |
+ } |
+ } |
- explicit PrototypeIterator(Handle<Map> receiver_map) |
+ explicit PrototypeIterator(Handle<Map> receiver_map, |
+ WhereToEnd where_to_end = END_AT_NULL) |
: isolate_(receiver_map->GetIsolate()), |
object_(NULL), |
handle_(receiver_map->GetPrototypeChainRootMap(isolate_)->prototype(), |
isolate_), |
- where_to_end_(END_AT_NULL), |
+ where_to_end_(where_to_end), |
is_at_end_(handle_->IsNull(isolate_)), |
- seen_proxies_(0) {} |
+ seen_proxies_(0) { |
+ if (!is_at_end_ && where_to_end_ == END_AT_NON_HIDDEN) { |
+ DCHECK(handle_->IsJSReceiver()); |
+ Map* map = JSReceiver::cast(*handle_)->map(); |
+ is_at_end_ = !map->has_hidden_prototype(); |
+ } |
+ } |
~PrototypeIterator() {} |