| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PROTOTYPE_H_ | 5 #ifndef V8_PROTOTYPE_H_ |
| 6 #define V8_PROTOTYPE_H_ | 6 #define V8_PROTOTYPE_H_ |
| 7 | 7 |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } else { | 99 } else { |
| 100 if (handle_.is_null()) { | 100 if (handle_.is_null()) { |
| 101 object_ = HeapObject::cast(object_)->map()->prototype(); | 101 object_ = HeapObject::cast(object_)->map()->prototype(); |
| 102 } else { | 102 } else { |
| 103 handle_ = | 103 handle_ = |
| 104 handle(HeapObject::cast(*handle_)->map()->prototype(), isolate_); | 104 handle(HeapObject::cast(*handle_)->map()->prototype(), isolate_); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Returns false iff a call to JSProxy::GetPrototype throws. | |
| 110 // TODO(neis): This should probably replace Advance(). | |
| 111 bool AdvanceFollowingProxies() { | |
| 112 DCHECK(!(handle_.is_null() && object_->IsJSProxy())); | |
| 113 if (!handle_.is_null() && handle_->IsJSProxy()) { | |
| 114 did_jump_to_prototype_chain_ = true; | |
| 115 MaybeHandle<Object> proto = | |
| 116 JSProxy::GetPrototype(Handle<JSProxy>::cast(handle_)); | |
| 117 return proto.ToHandle(&handle_); | |
| 118 } | |
| 119 AdvanceIgnoringProxies(); | |
| 120 return true; | |
| 121 } | |
| 122 | |
| 123 bool IsAtEnd(WhereToEnd where_to_end = END_AT_NULL) const { | 109 bool IsAtEnd(WhereToEnd where_to_end = END_AT_NULL) const { |
| 124 if (handle_.is_null()) { | 110 if (handle_.is_null()) { |
| 125 return object_->IsNull() || | 111 return object_->IsNull() || |
| 126 (did_jump_to_prototype_chain_ && | 112 (did_jump_to_prototype_chain_ && |
| 127 where_to_end == END_AT_NON_HIDDEN && | 113 where_to_end == END_AT_NON_HIDDEN && |
| 128 !HeapObject::cast(object_)->map()->is_hidden_prototype()); | 114 !HeapObject::cast(object_)->map()->is_hidden_prototype()); |
| 129 } else { | 115 } else { |
| 130 return handle_->IsNull() || | 116 return handle_->IsNull() || |
| 131 (did_jump_to_prototype_chain_ && | 117 (did_jump_to_prototype_chain_ && |
| 132 where_to_end == END_AT_NON_HIDDEN && | 118 where_to_end == END_AT_NON_HIDDEN && |
| (...skipping 19 matching lines...) Expand all Loading... |
| 152 | 138 |
| 153 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); | 139 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); |
| 154 }; | 140 }; |
| 155 | 141 |
| 156 | 142 |
| 157 } // namespace internal | 143 } // namespace internal |
| 158 | 144 |
| 159 } // namespace v8 | 145 } // namespace v8 |
| 160 | 146 |
| 161 #endif // V8_PROTOTYPE_H_ | 147 #endif // V8_PROTOTYPE_H_ |
| OLD | NEW |