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

Side by Side Diff: src/api.cc

Issue 1479543002: [proxies] Implement [[Delete]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo 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 | src/bootstrapper.cc » ('j') | test/mjsunit/harmony/proxies-delete-property.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3861 matching lines...) Expand 10 before | Expand all | Expand 10 after
3872 auto self = Utils::OpenHandle(this); 3872 auto self = Utils::OpenHandle(this);
3873 i::Handle<i::String> name(self->constructor_name()); 3873 i::Handle<i::String> name(self->constructor_name());
3874 return Utils::ToLocal(name); 3874 return Utils::ToLocal(name);
3875 } 3875 }
3876 3876
3877 3877
3878 Maybe<bool> v8::Object::Delete(Local<Context> context, Local<Value> key) { 3878 Maybe<bool> v8::Object::Delete(Local<Context> context, Local<Value> key) {
3879 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Delete()", bool); 3879 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::Delete()", bool);
3880 auto self = Utils::OpenHandle(this); 3880 auto self = Utils::OpenHandle(this);
3881 auto key_obj = Utils::OpenHandle(*key); 3881 auto key_obj = Utils::OpenHandle(*key);
3882 i::Handle<i::Object> obj; 3882 Maybe<bool> result =
3883 has_pending_exception = 3883 i::Runtime::DeleteObjectProperty(isolate, self, key_obj, i::SLOPPY);
3884 !i::Runtime::DeleteObjectProperty(isolate, self, key_obj, i::SLOPPY) 3884 has_pending_exception = result.IsNothing();
3885 .ToHandle(&obj);
3886 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 3885 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
3887 return Just(obj->IsTrue()); 3886 return result;
3888 } 3887 }
3889 3888
3890 3889
3891 bool v8::Object::Delete(v8::Local<Value> key) { 3890 bool v8::Object::Delete(v8::Local<Value> key) {
3892 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 3891 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
3893 return Delete(context, key).FromMaybe(false); 3892 return Delete(context, key).FromMaybe(false);
3894 } 3893 }
3895 3894
3896 3895
3897 Maybe<bool> v8::Object::DeletePrivate(Local<Context> context, 3896 Maybe<bool> v8::Object::DeletePrivate(Local<Context> context,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3930 3929
3931 Maybe<bool> v8::Object::HasPrivate(Local<Context> context, Local<Private> key) { 3930 Maybe<bool> v8::Object::HasPrivate(Local<Context> context, Local<Private> key) {
3932 return HasOwnProperty(context, Local<Name>(reinterpret_cast<Name*>(*key))); 3931 return HasOwnProperty(context, Local<Name>(reinterpret_cast<Name*>(*key)));
3933 } 3932 }
3934 3933
3935 3934
3936 Maybe<bool> v8::Object::Delete(Local<Context> context, uint32_t index) { 3935 Maybe<bool> v8::Object::Delete(Local<Context> context, uint32_t index) {
3937 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DeleteProperty()", 3936 PREPARE_FOR_EXECUTION_PRIMITIVE(context, "v8::Object::DeleteProperty()",
3938 bool); 3937 bool);
3939 auto self = Utils::OpenHandle(this); 3938 auto self = Utils::OpenHandle(this);
3940 i::Handle<i::Object> obj; 3939 Maybe<bool> result = i::JSReceiver::DeleteElement(self, index);
3941 has_pending_exception = 3940 has_pending_exception = result.IsNothing();
3942 !i::JSReceiver::DeleteElement(self, index).ToHandle(&obj);
3943 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 3941 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
3944 return Just(obj->IsTrue()); 3942 return result;
3945 } 3943 }
3946 3944
3947 3945
3948 bool v8::Object::Delete(uint32_t index) { 3946 bool v8::Object::Delete(uint32_t index) {
3949 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 3947 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
3950 return Delete(context, index).FromMaybe(false); 3948 return Delete(context, index).FromMaybe(false);
3951 } 3949 }
3952 3950
3953 3951
3954 Maybe<bool> v8::Object::Has(Local<Context> context, uint32_t index) { 3952 Maybe<bool> v8::Object::Has(Local<Context> context, uint32_t index) {
(...skipping 4564 matching lines...) Expand 10 before | Expand all | Expand 10 after
8519 Address callback_address = 8517 Address callback_address =
8520 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8518 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8521 VMState<EXTERNAL> state(isolate); 8519 VMState<EXTERNAL> state(isolate);
8522 ExternalCallbackScope call_scope(isolate, callback_address); 8520 ExternalCallbackScope call_scope(isolate, callback_address);
8523 callback(info); 8521 callback(info);
8524 } 8522 }
8525 8523
8526 8524
8527 } // namespace internal 8525 } // namespace internal
8528 } // namespace v8 8526 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/bootstrapper.cc » ('j') | test/mjsunit/harmony/proxies-delete-property.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698