| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 MUST_USE_RESULT bool AdvanceFollowingProxiesIgnoringAccessChecks() { | 140 MUST_USE_RESULT bool AdvanceFollowingProxiesIgnoringAccessChecks() { |
| 141 if (handle_.is_null() || !handle_->IsJSProxy()) { | 141 if (handle_.is_null() || !handle_->IsJSProxy()) { |
| 142 AdvanceIgnoringProxies(); | 142 AdvanceIgnoringProxies(); |
| 143 return true; | 143 return true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 // Due to possible __proto__ recursion limit the number of Proxies | 146 // Due to possible __proto__ recursion limit the number of Proxies |
| 147 // we visit to an arbitrarily chosen large number. | 147 // we visit to an arbitrarily chosen large number. |
| 148 seen_proxies_++; | 148 seen_proxies_++; |
| 149 if (seen_proxies_ > kProxyPrototypeLimit) { | 149 if (seen_proxies_ > kProxyPrototypeLimit) { |
| 150 isolate_->Throw( | 150 isolate_->StackOverflow(); |
| 151 *isolate_->factory()->NewRangeError(MessageTemplate::kStackOverflow)); | |
| 152 return false; | 151 return false; |
| 153 } | 152 } |
| 154 MaybeHandle<Object> proto = | 153 MaybeHandle<Object> proto = |
| 155 JSProxy::GetPrototype(Handle<JSProxy>::cast(handle_)); | 154 JSProxy::GetPrototype(Handle<JSProxy>::cast(handle_)); |
| 156 if (!proto.ToHandle(&handle_)) return false; | 155 if (!proto.ToHandle(&handle_)) return false; |
| 157 is_at_end_ = | 156 is_at_end_ = |
| 158 where_to_end_ == END_AT_NON_HIDDEN || handle_->IsNull(isolate_); | 157 where_to_end_ == END_AT_NON_HIDDEN || handle_->IsNull(isolate_); |
| 159 return true; | 158 return true; |
| 160 } | 159 } |
| 161 | 160 |
| 162 bool IsAtEnd() const { return is_at_end_; } | 161 bool IsAtEnd() const { return is_at_end_; } |
| 163 | 162 |
| 164 private: | 163 private: |
| 165 Isolate* isolate_; | 164 Isolate* isolate_; |
| 166 Object* object_; | 165 Object* object_; |
| 167 Handle<Object> handle_; | 166 Handle<Object> handle_; |
| 168 WhereToEnd where_to_end_; | 167 WhereToEnd where_to_end_; |
| 169 bool is_at_end_; | 168 bool is_at_end_; |
| 170 int seen_proxies_; | 169 int seen_proxies_; |
| 171 | 170 |
| 172 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); | 171 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); |
| 173 }; | 172 }; |
| 174 | 173 |
| 175 | 174 |
| 176 } // namespace internal | 175 } // namespace internal |
| 177 | 176 |
| 178 } // namespace v8 | 177 } // namespace v8 |
| 179 | 178 |
| 180 #endif // V8_PROTOTYPE_H_ | 179 #endif // V8_PROTOTYPE_H_ |
| OLD | NEW |