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

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

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Extend DefineProperty API Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/keys.h" 10 #include "src/keys.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 desc.set_enumerable(true); 108 desc.set_enumerable(true);
109 desc.set_configurable(true); 109 desc.set_configurable(true);
110 // 4. Let key be ? ToPropertyKey(P). 110 // 4. Let key be ? ToPropertyKey(P).
111 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, 111 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
112 Object::ToPropertyKey(isolate, name)); 112 Object::ToPropertyKey(isolate, name));
113 // 5. Perform ? DefinePropertyOrThrow(O, key, desc). 113 // 5. Perform ? DefinePropertyOrThrow(O, key, desc).
114 // To preserve legacy behavior, we ignore errors silently rather than 114 // To preserve legacy behavior, we ignore errors silently rather than
115 // throwing an exception. 115 // throwing an exception.
116 Maybe<bool> success = JSReceiver::DefineOwnProperty( 116 Maybe<bool> success = JSReceiver::DefineOwnProperty(
117 isolate, receiver, name, &desc, Object::DONT_THROW); 117 isolate, receiver, name, &desc, Object::DONT_THROW, false);
Franzi 2017/05/10 09:17:52 I'd prefer an enum instead of a bool. "false" is j
118 MAYBE_RETURN(success, isolate->heap()->exception()); 118 MAYBE_RETURN(success, isolate->heap()->exception());
119 if (!success.FromJust()) { 119 if (!success.FromJust()) {
120 isolate->CountUsage(v8::Isolate::kDefineGetterOrSetterWouldThrow); 120 isolate->CountUsage(v8::Isolate::kDefineGetterOrSetterWouldThrow);
121 } 121 }
122 // 6. Return undefined. 122 // 6. Return undefined.
123 return isolate->heap()->undefined_value(); 123 return isolate->heap()->undefined_value();
124 } 124 }
125 125
126 Object* ObjectLookupAccessor(Isolate* isolate, Handle<Object> object, 126 Object* ObjectLookupAccessor(Isolate* isolate, Handle<Object> object,
127 Handle<Object> key, AccessorComponent component) { 127 Handle<Object> key, AccessorComponent component) {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 if (object->IsJSReceiver()) { 545 if (object->IsJSReceiver()) {
546 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), 546 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object),
547 SEALED, Object::THROW_ON_ERROR), 547 SEALED, Object::THROW_ON_ERROR),
548 isolate->heap()->exception()); 548 isolate->heap()->exception());
549 } 549 }
550 return *object; 550 return *object;
551 } 551 }
552 552
553 } // namespace internal 553 } // namespace internal
554 } // namespace v8 554 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698