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

Side by Side Diff: src/api.cc

Issue 2085223002: Add HasOwnProperty with array indexes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('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 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 4167 matching lines...) Expand 10 before | Expand all | Expand 10 after
4178 Local<Name> key) { 4178 Local<Name> key) {
4179 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, HasOwnProperty, bool); 4179 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, HasOwnProperty, bool);
4180 auto self = Utils::OpenHandle(this); 4180 auto self = Utils::OpenHandle(this);
4181 auto key_val = Utils::OpenHandle(*key); 4181 auto key_val = Utils::OpenHandle(*key);
4182 auto result = i::JSReceiver::HasOwnProperty(self, key_val); 4182 auto result = i::JSReceiver::HasOwnProperty(self, key_val);
4183 has_pending_exception = result.IsNothing(); 4183 has_pending_exception = result.IsNothing();
4184 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool); 4184 RETURN_ON_FAILED_EXECUTION_PRIMITIVE(bool);
4185 return result; 4185 return result;
4186 } 4186 }
4187 4187
4188 Maybe<bool> v8::Object::HasOwnProperty(Local<Context> context, uint32_t index) {
4189 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
4190 return HasOwnProperty(
4191 context, Utils::ToLocal(isolate->factory()->Uint32ToString(index)));
Toon Verwaest 2016/06/22 09:41:31 You'll want to add a JSReceiver::HasOwnProperty wi
4192 }
4188 4193
4189 bool v8::Object::HasOwnProperty(Local<String> key) { 4194 bool v8::Object::HasOwnProperty(Local<String> key) {
4190 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 4195 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
4191 return HasOwnProperty(context, key).FromMaybe(false); 4196 return HasOwnProperty(context, key).FromMaybe(false);
4192 } 4197 }
4193 4198
4194 4199
4195 Maybe<bool> v8::Object::HasRealNamedProperty(Local<Context> context, 4200 Maybe<bool> v8::Object::HasRealNamedProperty(Local<Context> context,
4196 Local<Name> key) { 4201 Local<Name> key) {
4197 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, HasRealNamedProperty, bool); 4202 PREPARE_FOR_EXECUTION_PRIMITIVE(context, Object, HasRealNamedProperty, bool);
(...skipping 4680 matching lines...) Expand 10 before | Expand all | Expand 10 after
8878 Address callback_address = 8883 Address callback_address =
8879 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8884 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8880 VMState<EXTERNAL> state(isolate); 8885 VMState<EXTERNAL> state(isolate);
8881 ExternalCallbackScope call_scope(isolate, callback_address); 8886 ExternalCallbackScope call_scope(isolate, callback_address);
8882 callback(info); 8887 callback(info);
8883 } 8888 }
8884 8889
8885 8890
8886 } // namespace internal 8891 } // namespace internal
8887 } // namespace v8 8892 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698