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

Side by Side Diff: src/api.cc

Issue 1768443003: [runtime] JSObject::GetKeys never returns the EnumCache, so we don't need to copy (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | 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 3773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3784 3784
3785 3785
3786 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context) { 3786 MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context) {
3787 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyNames()", Array); 3787 PREPARE_FOR_EXECUTION(context, "v8::Object::GetOwnPropertyNames()", Array);
3788 auto self = Utils::OpenHandle(this); 3788 auto self = Utils::OpenHandle(this);
3789 i::Handle<i::FixedArray> value; 3789 i::Handle<i::FixedArray> value;
3790 has_pending_exception = 3790 has_pending_exception =
3791 !i::JSReceiver::GetKeys(self, i::OWN_ONLY, i::ENUMERABLE_STRINGS) 3791 !i::JSReceiver::GetKeys(self, i::OWN_ONLY, i::ENUMERABLE_STRINGS)
3792 .ToHandle(&value); 3792 .ToHandle(&value);
3793 RETURN_ON_FAILED_EXECUTION(Array); 3793 RETURN_ON_FAILED_EXECUTION(Array);
3794 // Because we use caching to speed up enumeration it is important 3794 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel ||
3795 // to never change the result of the basic enumeration function so 3795 self->map()->EnumLength() == 0 ||
3796 // we clone the result. 3796 self->map()->instance_descriptors()->GetEnumCache() != *value);
3797 auto elms = isolate->factory()->CopyFixedArray(value); 3797 auto result = isolate->factory()->NewJSArrayWithElements(value);
3798 auto result = isolate->factory()->NewJSArrayWithElements(elms);
3799 RETURN_ESCAPED(Utils::ToLocal(result)); 3798 RETURN_ESCAPED(Utils::ToLocal(result));
3800 } 3799 }
3801 3800
3802 3801
3803 Local<Array> v8::Object::GetOwnPropertyNames() { 3802 Local<Array> v8::Object::GetOwnPropertyNames() {
3804 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 3803 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
3805 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyNames(context), Array); 3804 RETURN_TO_LOCAL_UNCHECKED(GetOwnPropertyNames(context), Array);
3806 } 3805 }
3807 3806
3808 3807
(...skipping 4812 matching lines...) Expand 10 before | Expand all | Expand 10 after
8621 Address callback_address = 8620 Address callback_address =
8622 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8621 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8623 VMState<EXTERNAL> state(isolate); 8622 VMState<EXTERNAL> state(isolate);
8624 ExternalCallbackScope call_scope(isolate, callback_address); 8623 ExternalCallbackScope call_scope(isolate, callback_address);
8625 callback(info); 8624 callback(info);
8626 } 8625 }
8627 8626
8628 8627
8629 } // namespace internal 8628 } // namespace internal
8630 } // namespace v8 8629 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698