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

Side by Side Diff: src/api.cc

Issue 1766293002: [runtime] JSObject::GetKeys never returns the EnumCache, so we don't need to copy in GetPropertyNam… (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 3765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3776 3776
3777 3777
3778 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) { 3778 MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) {
3779 PREPARE_FOR_EXECUTION(context, "v8::Object::GetPropertyNames()", Array); 3779 PREPARE_FOR_EXECUTION(context, "v8::Object::GetPropertyNames()", Array);
3780 auto self = Utils::OpenHandle(this); 3780 auto self = Utils::OpenHandle(this);
3781 i::Handle<i::FixedArray> value; 3781 i::Handle<i::FixedArray> value;
3782 has_pending_exception = 3782 has_pending_exception =
3783 !i::JSReceiver::GetKeys(self, i::INCLUDE_PROTOS, i::ENUMERABLE_STRINGS) 3783 !i::JSReceiver::GetKeys(self, i::INCLUDE_PROTOS, i::ENUMERABLE_STRINGS)
3784 .ToHandle(&value); 3784 .ToHandle(&value);
3785 RETURN_ON_FAILED_EXECUTION(Array); 3785 RETURN_ON_FAILED_EXECUTION(Array);
3786 // Because we use caching to speed up enumeration it is important 3786 DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel ||
3787 // to never change the result of the basic enumeration function so 3787 self->map()->EnumLength() == 0 ||
3788 // we clone the result. 3788 self->map()->instance_descriptors()->GetEnumCache() != *value);
3789 auto elms = isolate->factory()->CopyFixedArray(value); 3789 auto result = isolate->factory()->NewJSArrayWithElements(value);
3790 auto result = isolate->factory()->NewJSArrayWithElements(elms);
3791 RETURN_ESCAPED(Utils::ToLocal(result)); 3790 RETURN_ESCAPED(Utils::ToLocal(result));
3792 } 3791 }
3793 3792
3794 3793
3795 Local<Array> v8::Object::GetPropertyNames() { 3794 Local<Array> v8::Object::GetPropertyNames() {
3796 auto context = ContextFromHeapObject(Utils::OpenHandle(this)); 3795 auto context = ContextFromHeapObject(Utils::OpenHandle(this));
3797 RETURN_TO_LOCAL_UNCHECKED(GetPropertyNames(context), Array); 3796 RETURN_TO_LOCAL_UNCHECKED(GetPropertyNames(context), Array);
3798 } 3797 }
3799 3798
3800 3799
(...skipping 4894 matching lines...) Expand 10 before | Expand all | Expand 10 after
8695 Address callback_address = 8694 Address callback_address =
8696 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8695 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8697 VMState<EXTERNAL> state(isolate); 8696 VMState<EXTERNAL> state(isolate);
8698 ExternalCallbackScope call_scope(isolate, callback_address); 8697 ExternalCallbackScope call_scope(isolate, callback_address);
8699 callback(info); 8698 callback(info);
8700 } 8699 }
8701 8700
8702 8701
8703 } // namespace internal 8702 } // namespace internal
8704 } // namespace v8 8703 } // 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