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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 1530873002: [proxies] Fix bogus cast in HasOwnPropertyImplementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | test/mjsunit/harmony/proxies-has.js » ('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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 Handle<JSObject> object, 664 Handle<JSObject> object,
665 Handle<Name> key) { 665 Handle<Name> key) {
666 Maybe<bool> maybe = JSReceiver::HasOwnProperty(object, key); 666 Maybe<bool> maybe = JSReceiver::HasOwnProperty(object, key);
667 if (!maybe.IsJust()) return isolate->heap()->exception(); 667 if (!maybe.IsJust()) return isolate->heap()->exception();
668 if (maybe.FromJust()) return isolate->heap()->true_value(); 668 if (maybe.FromJust()) return isolate->heap()->true_value();
669 // Handle hidden prototypes. If there's a hidden prototype above this thing 669 // Handle hidden prototypes. If there's a hidden prototype above this thing
670 // then we have to check it for properties, because they are supposed to 670 // then we have to check it for properties, because they are supposed to
671 // look like they are on this object. 671 // look like they are on this object.
672 PrototypeIterator iter(isolate, object); 672 PrototypeIterator iter(isolate, object);
673 if (!iter.IsAtEnd() && 673 if (!iter.IsAtEnd() &&
674 Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)) 674 PrototypeIterator::GetCurrent<HeapObject>(iter)
675 ->map() 675 ->map()
676 ->is_hidden_prototype()) { 676 ->is_hidden_prototype()) {
677 // TODO(verwaest): The recursion is not necessary for keys that are array 677 // TODO(verwaest): The recursion is not necessary for keys that are array
678 // indices. Removing this. 678 // indices. Removing this.
679 // Casting to JSObject is fine because JSProxies are never used as 679 // Casting to JSObject is fine because JSProxies are never used as
680 // hidden prototypes. 680 // hidden prototypes.
681 return HasOwnPropertyImplementation( 681 return HasOwnPropertyImplementation(
682 isolate, Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), 682 isolate, PrototypeIterator::GetCurrent<JSObject>(iter), key);
683 key);
684 } 683 }
685 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); 684 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
686 return isolate->heap()->false_value(); 685 return isolate->heap()->false_value();
687 } 686 }
688 687
689 688
690 RUNTIME_FUNCTION(Runtime_HasOwnProperty) { 689 RUNTIME_FUNCTION(Runtime_HasOwnProperty) {
691 HandleScope scope(isolate); 690 HandleScope scope(isolate);
692 DCHECK(args.length() == 2); 691 DCHECK(args.length() == 2);
693 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0) 692 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0)
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 1412
1414 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1413 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1415 HandleScope scope(isolate); 1414 HandleScope scope(isolate);
1416 DCHECK(args.length() == 2); 1415 DCHECK(args.length() == 2);
1417 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1416 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1418 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1417 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1419 return JSReceiver::DefineProperties(isolate, o, properties); 1418 return JSReceiver::DefineProperties(isolate, o, properties);
1420 } 1419 }
1421 } // namespace internal 1420 } // namespace internal
1422 } // namespace v8 1421 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/harmony/proxies-has.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698