Add JSSpecialApiObjectType to fast path
HTMLCollection and NodeList have InstanceType JS_SPECIAL_API_OBJECT_TYPE, and therefore always run the slow case of GetAlignedPropertyFromInternalField. This slows down the performance of indexedPropertyGetter for both types, which are very commonly used in websites. Bug: Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng Change-Id: I36bd2cd7d9bbc19149e15174f6868b8a1f1658c8 Reviewed-on: https://chromium-review.googlesource.com/726529 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Adithya Srinivasan <adithyas@chromium.org> Cr-Commit-Position: refs/heads/master@{#48760}
This commit is contained in:
parent
789298d8ac
commit
f65251be3c
@ -9116,6 +9116,7 @@ class Internals {
|
||||
static const int kFirstNonstringType = 0x80;
|
||||
static const int kOddballType = 0x83;
|
||||
static const int kForeignType = 0x87;
|
||||
static const int kJSSpecialApiObjectType = 0xbb;
|
||||
static const int kJSApiObjectType = 0xbf;
|
||||
static const int kJSObjectType = 0xc0;
|
||||
|
||||
@ -9723,7 +9724,8 @@ Local<Value> Object::GetInternalField(int index) {
|
||||
// know where to find the internal fields and can return the value directly.
|
||||
auto instance_type = I::GetInstanceType(obj);
|
||||
if (instance_type == I::kJSObjectType ||
|
||||
instance_type == I::kJSApiObjectType) {
|
||||
instance_type == I::kJSApiObjectType ||
|
||||
instance_type == I::kJSSpecialApiObjectType) {
|
||||
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
||||
O* value = I::ReadField<O*>(obj, offset);
|
||||
O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
|
||||
@ -9743,7 +9745,8 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
|
||||
// know where to find the internal fields and can return the value directly.
|
||||
auto instance_type = I::GetInstanceType(obj);
|
||||
if (V8_LIKELY(instance_type == I::kJSObjectType ||
|
||||
instance_type == I::kJSApiObjectType)) {
|
||||
instance_type == I::kJSApiObjectType ||
|
||||
instance_type == I::kJSSpecialApiObjectType)) {
|
||||
int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
|
||||
return I::ReadField<void*>(obj, offset);
|
||||
}
|
||||
|
@ -837,6 +837,7 @@ enum InstanceType : uint8_t {
|
||||
|
||||
STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
||||
STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType);
|
||||
STATIC_ASSERT(JS_SPECIAL_API_OBJECT_TYPE == Internals::kJSSpecialApiObjectType);
|
||||
STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
||||
STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
|
||||
STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
|
||||
|
Loading…
Reference in New Issue
Block a user