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

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

Issue 1532723005: [proxies] Fix Object.prototype.hasOwnProperty (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') | test/mjsunit/harmony/proxies.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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // Only JS objects can have properties. 698 // Only JS objects can have properties.
699 if (object->IsJSObject()) { 699 if (object->IsJSObject()) {
700 Handle<JSObject> js_obj = Handle<JSObject>::cast(object); 700 Handle<JSObject> js_obj = Handle<JSObject>::cast(object);
701 // Fast case: either the key is a real named property or it is not 701 // Fast case: either the key is a real named property or it is not
702 // an array index and there are no interceptors or hidden 702 // an array index and there are no interceptors or hidden
703 // prototypes. 703 // prototypes.
704 // TODO(jkummerow): Make JSReceiver::HasOwnProperty fast enough to 704 // TODO(jkummerow): Make JSReceiver::HasOwnProperty fast enough to
705 // handle all cases directly (without this custom fast path). 705 // handle all cases directly (without this custom fast path).
706 Maybe<bool> maybe = Nothing<bool>(); 706 Maybe<bool> maybe = Nothing<bool>();
707 if (key_is_array_index) { 707 if (key_is_array_index) {
708 maybe = JSObject::HasOwnElement(js_obj, index); 708 LookupIterator it(js_obj->GetIsolate(), js_obj, index,
709 LookupIterator::HIDDEN);
710 maybe = JSReceiver::HasProperty(&it);
709 } else { 711 } else {
710 maybe = JSObject::HasRealNamedProperty(js_obj, key); 712 maybe = JSObject::HasRealNamedProperty(js_obj, key);
711 } 713 }
712 if (!maybe.IsJust()) return isolate->heap()->exception(); 714 if (!maybe.IsJust()) return isolate->heap()->exception();
713 DCHECK(!isolate->has_pending_exception()); 715 DCHECK(!isolate->has_pending_exception());
714 if (maybe.FromJust()) { 716 if (maybe.FromJust()) {
715 return isolate->heap()->true_value(); 717 return isolate->heap()->true_value();
716 } 718 }
717 Map* map = js_obj->map(); 719 Map* map = js_obj->map();
718 if (!key_is_array_index && !map->has_named_interceptor() && 720 if (!key_is_array_index && !map->has_named_interceptor() &&
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 1414
1413 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { 1415 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) {
1414 HandleScope scope(isolate); 1416 HandleScope scope(isolate);
1415 DCHECK(args.length() == 2); 1417 DCHECK(args.length() == 2);
1416 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); 1418 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0);
1417 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); 1419 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1);
1418 return JSReceiver::DefineProperties(isolate, o, properties); 1420 return JSReceiver::DefineProperties(isolate, o, properties);
1419 } 1421 }
1420 } // namespace internal 1422 } // namespace internal
1421 } // namespace v8 1423 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698