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

Side by Side Diff: src/api.cc

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Created 3 years, 8 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 4270 matching lines...) Expand 10 before | Expand all | Expand 10 after
4281 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this); 4281 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
4282 i::Handle<i::Name> key_obj = Utils::OpenHandle(*key); 4282 i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
4283 4283
4284 Maybe<bool> success = i::JSReceiver::DefineOwnProperty( 4284 Maybe<bool> success = i::JSReceiver::DefineOwnProperty(
4285 isolate, self, key_obj, &descriptor.get_private()->desc, 4285 isolate, self, key_obj, &descriptor.get_private()->desc,
4286 i::Object::DONT_THROW); 4286 i::Object::DONT_THROW);
4287 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 4287 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
4288 return success; 4288 return success;
4289 } 4289 }
4290 4290
4291 Maybe<bool> v8::Object::DefinePropertyWithoutInterceptors(
4292 v8::Local<v8::Context> context, v8::Local<Name> key,
4293 PropertyDescriptor& descriptor) {
4294 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object,
4295 DefinePropertyWithoutInterceptors, bool);
4296 i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
4297 i::Handle<i::Name> key_obj = Utils::OpenHandle(*key);
4298
4299 Maybe<bool> success = i::JSReceiver::DefineOwnPropertyWithoutIntercept(
4300 isolate, self, key_obj, &descriptor.get_private()->desc,
4301 i::Object::DONT_THROW);
4302
4303 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
4304 return success;
4305 }
4306
4291 MUST_USE_RESULT 4307 MUST_USE_RESULT
4292 static i::MaybeHandle<i::Object> DefineObjectProperty( 4308 static i::MaybeHandle<i::Object> DefineObjectProperty(
4293 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key, 4309 i::Handle<i::JSObject> js_object, i::Handle<i::Object> key,
4294 i::Handle<i::Object> value, i::PropertyAttributes attrs) { 4310 i::Handle<i::Object> value, i::PropertyAttributes attrs) {
4295 i::Isolate* isolate = js_object->GetIsolate(); 4311 i::Isolate* isolate = js_object->GetIsolate();
4296 bool success = false; 4312 bool success = false;
4297 i::LookupIterator it = i::LookupIterator::PropertyOrElement( 4313 i::LookupIterator it = i::LookupIterator::PropertyOrElement(
4298 isolate, js_object, key, &success, i::LookupIterator::OWN); 4314 isolate, js_object, key, &success, i::LookupIterator::OWN);
4299 if (!success) return i::MaybeHandle<i::Object>(); 4315 if (!success) return i::MaybeHandle<i::Object>();
4300 4316
(...skipping 6023 matching lines...) Expand 10 before | Expand all | Expand 10 after
10324 Address callback_address = 10340 Address callback_address =
10325 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10341 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10326 VMState<EXTERNAL> state(isolate); 10342 VMState<EXTERNAL> state(isolate);
10327 ExternalCallbackScope call_scope(isolate, callback_address); 10343 ExternalCallbackScope call_scope(isolate, callback_address);
10328 callback(info); 10344 callback(info);
10329 } 10345 }
10330 10346
10331 10347
10332 } // namespace internal 10348 } // namespace internal
10333 } // namespace v8 10349 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698