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

Side by Side Diff: src/lookup.cc

Issue 1330153003: Adding template parameter to PrototypeIterator GetCurrent for casting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplifications Created 5 years, 3 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/isolate.cc ('k') | src/objects.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 #include "src/lookup.h" 5 #include "src/lookup.h"
6 6
7 #include "src/bootstrapper.h" 7 #include "src/bootstrapper.h"
8 #include "src/deoptimizer.h" 8 #include "src/deoptimizer.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/lookup-inl.h" 10 #include "src/lookup-inl.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 Handle<Map> LookupIterator::GetReceiverMap() const { 87 Handle<Map> LookupIterator::GetReceiverMap() const {
88 if (receiver_->IsNumber()) return factory()->heap_number_map(); 88 if (receiver_->IsNumber()) return factory()->heap_number_map();
89 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_); 89 return handle(Handle<HeapObject>::cast(receiver_)->map(), isolate_);
90 } 90 }
91 91
92 92
93 Handle<JSObject> LookupIterator::GetStoreTarget() const { 93 Handle<JSObject> LookupIterator::GetStoreTarget() const {
94 if (receiver_->IsJSGlobalProxy()) { 94 if (receiver_->IsJSGlobalProxy()) {
95 PrototypeIterator iter(isolate(), receiver_); 95 PrototypeIterator iter(isolate(), receiver_);
96 if (iter.IsAtEnd()) return Handle<JSGlobalProxy>::cast(receiver_); 96 if (iter.IsAtEnd()) return Handle<JSGlobalProxy>::cast(receiver_);
97 return Handle<JSGlobalObject>::cast(PrototypeIterator::GetCurrent(iter)); 97 return PrototypeIterator::GetCurrent<JSGlobalObject>(iter);
98 } 98 }
99 return Handle<JSObject>::cast(receiver_); 99 return Handle<JSObject>::cast(receiver_);
100 } 100 }
101 101
102 102
103 bool LookupIterator::HasAccess() const { 103 bool LookupIterator::HasAccess() const {
104 DCHECK_EQ(ACCESS_CHECK, state_); 104 DCHECK_EQ(ACCESS_CHECK, state_);
105 return isolate_->MayAccess(GetHolder<JSObject>()); 105 return isolate_->MayAccess(GetHolder<JSObject>());
106 } 106 }
107 107
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (!receiver_->IsJSReceiver()) return false; 352 if (!receiver_->IsJSReceiver()) return false;
353 Object* current = *receiver_; 353 Object* current = *receiver_;
354 JSReceiver* holder = *holder_; 354 JSReceiver* holder = *holder_;
355 // JSProxy do not occur as hidden prototypes. 355 // JSProxy do not occur as hidden prototypes.
356 if (current->IsJSProxy()) { 356 if (current->IsJSProxy()) {
357 return JSReceiver::cast(current) == holder; 357 return JSReceiver::cast(current) == holder;
358 } 358 }
359 PrototypeIterator iter(isolate(), current, 359 PrototypeIterator iter(isolate(), current,
360 PrototypeIterator::START_AT_RECEIVER); 360 PrototypeIterator::START_AT_RECEIVER);
361 do { 361 do {
362 if (JSReceiver::cast(iter.GetCurrent()) == holder) return true; 362 if (iter.GetCurrent<JSReceiver>() == holder) return true;
363 DCHECK(!current->IsJSProxy()); 363 DCHECK(!current->IsJSProxy());
364 iter.Advance(); 364 iter.Advance();
365 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); 365 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
366 return false; 366 return false;
367 } 367 }
368 368
369 369
370 Handle<Object> LookupIterator::FetchValue() const { 370 Handle<Object> LookupIterator::FetchValue() const {
371 Object* result = NULL; 371 Object* result = NULL;
372 Handle<JSObject> holder = GetHolder<JSObject>(); 372 Handle<JSObject> holder = GetHolder<JSObject>();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 case InterceptorState::kSkipNonMasking: 543 case InterceptorState::kSkipNonMasking:
544 return true; 544 return true;
545 case InterceptorState::kProcessNonMasking: 545 case InterceptorState::kProcessNonMasking:
546 return false; 546 return false;
547 } 547 }
548 } 548 }
549 return interceptor_state_ == InterceptorState::kProcessNonMasking; 549 return interceptor_state_ == InterceptorState::kProcessNonMasking;
550 } 550 }
551 } // namespace internal 551 } // namespace internal
552 } // namespace v8 552 } // namespace v8
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698