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

Side by Side Diff: src/prototype.h

Issue 1492863002: [proxies] Make Object.prototype.isPrototypeOf work with proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years 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-debug.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
109 bool IsAtEnd(WhereToEnd where_to_end = END_AT_NULL) const { 123 bool IsAtEnd(WhereToEnd where_to_end = END_AT_NULL) const {
110 if (handle_.is_null()) { 124 if (handle_.is_null()) {
111 return object_->IsNull() || 125 return object_->IsNull() ||
112 (did_jump_to_prototype_chain_ && 126 (did_jump_to_prototype_chain_ &&
113 where_to_end == END_AT_NON_HIDDEN && 127 where_to_end == END_AT_NON_HIDDEN &&
114 !HeapObject::cast(object_)->map()->is_hidden_prototype()); 128 !HeapObject::cast(object_)->map()->is_hidden_prototype());
115 } else { 129 } else {
116 return handle_->IsNull() || 130 return handle_->IsNull() ||
117 (did_jump_to_prototype_chain_ && 131 (did_jump_to_prototype_chain_ &&
118 where_to_end == END_AT_NON_HIDDEN && 132 where_to_end == END_AT_NON_HIDDEN &&
(...skipping 19 matching lines...) Expand all
138 152
139 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); 153 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator);
140 }; 154 };
141 155
142 156
143 } // namespace internal 157 } // namespace internal
144 158
145 } // namespace v8 159 } // namespace v8
146 160
147 #endif // V8_PROTOTYPE_H_ 161 #endif // V8_PROTOTYPE_H_
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698