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

Side by Side Diff: src/prototype.h

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fix protoype walks with access checks 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 isolate_(receiver_map->GetIsolate()) {} 56 isolate_(receiver_map->GetIsolate()) {}
57 57
58 explicit PrototypeIterator(Handle<Map> receiver_map) 58 explicit PrototypeIterator(Handle<Map> receiver_map)
59 : did_jump_to_prototype_chain_(true), 59 : did_jump_to_prototype_chain_(true),
60 object_(NULL), 60 object_(NULL),
61 handle_(handle(receiver_map->prototype(), receiver_map->GetIsolate())), 61 handle_(handle(receiver_map->prototype(), receiver_map->GetIsolate())),
62 isolate_(receiver_map->GetIsolate()) {} 62 isolate_(receiver_map->GetIsolate()) {}
63 63
64 ~PrototypeIterator() {} 64 ~PrototypeIterator() {}
65 65
66 const bool HasAccess() {
67 Handle<JSObject> current;
68 if (handle_.is_null()) {
69 if (!object_->IsJSObject()) return true;
70 current = Handle<JSObject>(JSObject::cast(object_));
71 } else {
72 if (!handle_->IsJSObject()) return true;
73 current = Handle<JSObject>::cast(handle_);
74 }
75 if (current->IsJSGlobalProxy() || current->IsJSGlobalObject() ||
76 current->IsAccessCheckNeeded()) {
77 return isolate_->MayAccess(handle(isolate_->context()), current);
78 }
79 return true;
80 }
81
66 template <typename T = Object> 82 template <typename T = Object>
67 T* GetCurrent() const { 83 T* GetCurrent() const {
68 DCHECK(handle_.is_null()); 84 DCHECK(handle_.is_null());
69 return T::cast(object_); 85 return T::cast(object_);
70 } 86 }
71 87
72 template <typename T = Object> 88 template <typename T = Object>
73 static Handle<T> GetCurrent(const PrototypeIterator& iterator) { 89 static Handle<T> GetCurrent(const PrototypeIterator& iterator) {
74 DCHECK(!iterator.handle_.is_null()); 90 DCHECK(!iterator.handle_.is_null());
75 return Handle<T>::cast(iterator.handle_); 91 return Handle<T>::cast(iterator.handle_);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 168
153 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator); 169 DISALLOW_COPY_AND_ASSIGN(PrototypeIterator);
154 }; 170 };
155 171
156 172
157 } // namespace internal 173 } // namespace internal
158 174
159 } // namespace v8 175 } // namespace v8
160 176
161 #endif // V8_PROTOTYPE_H_ 177 #endif // V8_PROTOTYPE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698