| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 if (handle_.is_null()) { | 119 if (handle_.is_null()) { |
| 120 object_ = prototype; | 120 object_ = prototype; |
| 121 } else { | 121 } else { |
| 122 handle_ = handle(prototype, isolate_); | 122 handle_ = handle(prototype, isolate_); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Returns false iff a call to JSProxy::GetPrototype throws. | 126 // Returns false iff a call to JSProxy::GetPrototype throws. |
| 127 // TODO(neis): This should probably replace Advance(). | 127 // TODO(neis): This should probably replace Advance(). |
| 128 bool AdvanceFollowingProxies() { | 128 MUST_USE_RESULT bool AdvanceFollowingProxies() { |
| 129 DCHECK(!(handle_.is_null() && object_->IsJSProxy())); | 129 DCHECK(!(handle_.is_null() && object_->IsJSProxy())); |
| 130 if (!HasAccess()) { | 130 if (!HasAccess()) { |
| 131 // Abort the lookup if we do not have access to the current object. | 131 // Abort the lookup if we do not have access to the current object. |
| 132 handle_ = isolate_->factory()->null_value(); | 132 handle_ = isolate_->factory()->null_value(); |
| 133 is_at_end_ = true; | 133 is_at_end_ = true; |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 return AdvanceFollowingProxiesIgnoringAccessChecks(); |
| 137 } |
| 138 |
| 139 MUST_USE_RESULT bool AdvanceFollowingProxiesIgnoringAccessChecks() { |
| 136 if (handle_.is_null() || !handle_->IsJSProxy()) { | 140 if (handle_.is_null() || !handle_->IsJSProxy()) { |
| 137 AdvanceIgnoringProxies(); | 141 AdvanceIgnoringProxies(); |
| 138 return true; | 142 return true; |
| 139 } | 143 } |
| 144 |
| 140 // Due to possible __proto__ recursion limit the number of Proxies | 145 // Due to possible __proto__ recursion limit the number of Proxies |
| 141 // we visit to an arbitrarily chosen large number. | 146 // we visit to an arbitrarily chosen large number. |
| 142 seen_proxies_++; | 147 seen_proxies_++; |
| 143 if (seen_proxies_ > kProxyPrototypeLimit) { | 148 if (seen_proxies_ > kProxyPrototypeLimit) { |
| 144 isolate_->Throw( | 149 isolate_->Throw( |
| 145 *isolate_->factory()->NewRangeError(MessageTemplate::kStackOverflow)); | 150 *isolate_->factory()->NewRangeError(MessageTemplate::kStackOverflow)); |
| 146 return false; | 151 return false; |
| 147 } | 152 } |
| 148 MaybeHandle<Object> proto = | 153 MaybeHandle<Object> proto = |
| 149 JSProxy::GetPrototype(Handle<JSProxy>::cast(handle_)); | 154 JSProxy::GetPrototype(Handle<JSProxy>::cast(handle_)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 164 | 169 |
| 165 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); | 170 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); |
| 166 }; | 171 }; |
| 167 | 172 |
| 168 | 173 |
| 169 } // namespace internal | 174 } // namespace internal |
| 170 | 175 |
| 171 } // namespace v8 | 176 } // namespace v8 |
| 172 | 177 |
| 173 #endif // V8_PROTOTYPE_H_ | 178 #endif // V8_PROTOTYPE_H_ |
| OLD | NEW |