Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: src/prototype.h

Issue 1748923003: [proxies] use [[GetPrototypeOf]] trap in for-in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge with master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-forin.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-forin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698