Commit 33da7197 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[nojit] Move several IC stubs to builtins

KeyedLoadSloppyArguments -> KeyedLoadIC_SloppyArguments
KeyedStoreSloppyArguments -> KeyedStoreIC_SloppyArguments
LoadIndexedIntercepter -> LoadIndexedInterceptorIC
StoreInArrayLiteralSlowStub -> StoreInArrayLiteralIC_Slow
StoreInterceptor -> StoreInterceptorIC
StoreSlowElementStub -> KeyedStoreIC_Slow

A few Store stubs were parameterized for the sole purpose of
determining the KeyedAccessStoreMode later on. These are now
implemented as a dedicated builtin for each store mode.

Bug: v8:7777
Change-Id: I743474b0e6c5d6ec2513bb9f8f3a93c5c0535927
Reviewed-on: https://chromium-review.googlesource.com/c/1339859Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57592}
parent c18dc785
......@@ -214,6 +214,21 @@ namespace internal {
TFH(StoreGlobalIC_Slow, StoreWithVector) \
TFH(StoreIC_Uninitialized, StoreWithVector) \
TFH(StoreInArrayLiteralIC_Slow, StoreWithVector) \
TFH(KeyedLoadIC_SloppyArguments, LoadWithVector) \
TFH(LoadIndexedInterceptorIC, LoadWithVector) \
TFH(StoreInterceptorIC, StoreWithVector) \
TFH(KeyedStoreIC_SloppyArguments_Standard, StoreWithVector) \
TFH(KeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW, StoreWithVector) \
TFH(KeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB, StoreWithVector) \
TFH(KeyedStoreIC_SloppyArguments_NoTransitionHandleCOW, StoreWithVector) \
TFH(StoreInArrayLiteralIC_Slow_Standard, StoreWithVector) \
TFH(StoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW, StoreWithVector) \
TFH(StoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB, StoreWithVector) \
TFH(StoreInArrayLiteralIC_Slow_NoTransitionHandleCOW, StoreWithVector) \
TFH(KeyedStoreIC_Slow_Standard, StoreWithVector) \
TFH(KeyedStoreIC_Slow_GrowNoTransitionHandleCOW, StoreWithVector) \
TFH(KeyedStoreIC_Slow_NoTransitionIgnoreOOB, StoreWithVector) \
TFH(KeyedStoreIC_Slow_NoTransitionHandleCOW, StoreWithVector) \
\
/* Microtask helpers */ \
TFS(EnqueueMicrotask, kMicrotask) \
......
......@@ -12,6 +12,17 @@
namespace v8 {
namespace internal {
class HandlerBuiltinsAssembler : public CodeStubAssembler {
public:
explicit HandlerBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
protected:
void Generate_KeyedStoreIC_SloppyArguments();
void Generate_KeyedStoreIC_Slow();
void Generate_StoreInArrayLiteralIC_Slow();
};
TF_BUILTIN(LoadIC_StringLength, CodeStubAssembler) {
Node* string = Parameter(Descriptor::kReceiver);
Return(LoadStringLengthAsSmi(string));
......@@ -41,7 +52,8 @@ void Builtins::Generate_StoreIC_Uninitialized(
StoreICUninitializedGenerator::Generate(state);
}
TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) {
void HandlerBuiltinsAssembler::Generate_KeyedStoreIC_Slow() {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
......@@ -55,7 +67,29 @@ TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) {
receiver, name);
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow, CodeStubAssembler) {
TF_BUILTIN(KeyedStoreIC_Slow, HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_Slow();
}
TF_BUILTIN(KeyedStoreIC_Slow_Standard, HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_Slow();
}
TF_BUILTIN(KeyedStoreIC_Slow_GrowNoTransitionHandleCOW,
HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_Slow();
}
TF_BUILTIN(KeyedStoreIC_Slow_NoTransitionIgnoreOOB, HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_Slow();
}
TF_BUILTIN(KeyedStoreIC_Slow_NoTransitionHandleCOW, HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_Slow();
}
void HandlerBuiltinsAssembler::Generate_StoreInArrayLiteralIC_Slow() {
typedef StoreWithVectorDescriptor Descriptor;
Node* array = Parameter(Descriptor::kReceiver);
Node* index = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
......@@ -64,6 +98,29 @@ TF_BUILTIN(StoreInArrayLiteralIC_Slow, CodeStubAssembler) {
index);
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow, HandlerBuiltinsAssembler) {
Generate_StoreInArrayLiteralIC_Slow();
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow_Standard, HandlerBuiltinsAssembler) {
Generate_StoreInArrayLiteralIC_Slow();
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW,
HandlerBuiltinsAssembler) {
Generate_StoreInArrayLiteralIC_Slow();
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB,
HandlerBuiltinsAssembler) {
Generate_StoreInArrayLiteralIC_Slow();
}
TF_BUILTIN(StoreInArrayLiteralIC_Slow_NoTransitionHandleCOW,
HandlerBuiltinsAssembler) {
Generate_StoreInArrayLiteralIC_Slow();
}
TF_BUILTIN(LoadGlobalIC_Slow, CodeStubAssembler) {
Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
......@@ -109,5 +166,91 @@ TF_BUILTIN(StoreGlobalIC_Slow, CodeStubAssembler) {
receiver, name);
}
TF_BUILTIN(KeyedLoadIC_SloppyArguments, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label miss(this);
Node* result = LoadKeyedSloppyArguments(receiver, key, &miss);
Return(result);
BIND(&miss);
{
Comment("Miss");
TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, slot,
vector);
}
}
void HandlerBuiltinsAssembler::Generate_KeyedStoreIC_SloppyArguments() {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label miss(this);
StoreKeyedSloppyArguments(receiver, key, value, &miss);
Return(value);
BIND(&miss);
TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, vector,
receiver, key);
}
TF_BUILTIN(KeyedStoreIC_SloppyArguments_Standard, HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_SloppyArguments();
}
TF_BUILTIN(KeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW,
HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_SloppyArguments();
}
TF_BUILTIN(KeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB,
HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_SloppyArguments();
}
TF_BUILTIN(KeyedStoreIC_SloppyArguments_NoTransitionHandleCOW,
HandlerBuiltinsAssembler) {
Generate_KeyedStoreIC_SloppyArguments();
}
TF_BUILTIN(StoreInterceptorIC, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, value, slot,
vector, receiver, name);
}
TF_BUILTIN(LoadIndexedInterceptorIC, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label if_keyispositivesmi(this), if_keyisinvalid(this);
Branch(TaggedIsPositiveSmi(key), &if_keyispositivesmi, &if_keyisinvalid);
BIND(&if_keyispositivesmi);
TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, receiver, key);
BIND(&if_keyisinvalid);
TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, slot,
vector);
}
} // namespace internal
} // namespace v8
......@@ -120,6 +120,78 @@ Callable CodeFactory::StoreOwnICInOptimizedCode(Isolate* isolate) {
return Callable(BUILTIN_CODE(isolate, StoreIC), StoreWithVectorDescriptor{});
}
Callable CodeFactory::KeyedStoreIC_SloppyArguments(Isolate* isolate,
KeyedAccessStoreMode mode) {
Builtins::Name builtin_index;
switch (mode) {
case STANDARD_STORE:
builtin_index = Builtins::kKeyedStoreIC_SloppyArguments_Standard;
break;
case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
builtin_index =
Builtins::kKeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW;
break;
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
builtin_index =
Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB;
break;
case STORE_NO_TRANSITION_HANDLE_COW:
builtin_index =
Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionHandleCOW;
break;
default:
UNREACHABLE();
}
return isolate->builtins()->CallableFor(isolate, builtin_index);
}
Callable CodeFactory::KeyedStoreIC_Slow(Isolate* isolate,
KeyedAccessStoreMode mode) {
Builtins::Name builtin_index;
switch (mode) {
case STANDARD_STORE:
builtin_index = Builtins::kKeyedStoreIC_Slow_Standard;
break;
case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
builtin_index = Builtins::kKeyedStoreIC_Slow_GrowNoTransitionHandleCOW;
break;
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
builtin_index = Builtins::kKeyedStoreIC_Slow_NoTransitionIgnoreOOB;
break;
case STORE_NO_TRANSITION_HANDLE_COW:
builtin_index = Builtins::kKeyedStoreIC_Slow_NoTransitionHandleCOW;
break;
default:
UNREACHABLE();
}
return isolate->builtins()->CallableFor(isolate, builtin_index);
}
Callable CodeFactory::StoreInArrayLiteralIC_Slow(Isolate* isolate,
KeyedAccessStoreMode mode) {
Builtins::Name builtin_index;
switch (mode) {
case STANDARD_STORE:
builtin_index = Builtins::kStoreInArrayLiteralIC_Slow_Standard;
break;
case STORE_AND_GROW_NO_TRANSITION_HANDLE_COW:
builtin_index =
Builtins::kStoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW;
break;
case STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS:
builtin_index =
Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB;
break;
case STORE_NO_TRANSITION_HANDLE_COW:
builtin_index =
Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionHandleCOW;
break;
default:
UNREACHABLE();
}
return isolate->builtins()->CallableFor(isolate, builtin_index);
}
// static
Callable CodeFactory::BinaryOperation(Isolate* isolate, Operation op) {
switch (op) {
......
......@@ -40,6 +40,13 @@ class V8_EXPORT_PRIVATE CodeFactory final {
static Callable StoreOwnIC(Isolate* isolate);
static Callable StoreOwnICInOptimizedCode(Isolate* isolate);
static Callable KeyedStoreIC_SloppyArguments(Isolate* isolate,
KeyedAccessStoreMode mode);
static Callable KeyedStoreIC_Slow(Isolate* isolate,
KeyedAccessStoreMode mode);
static Callable StoreInArrayLiteralIC_Slow(Isolate* isolate,
KeyedAccessStoreMode mode);
static Callable ResumeGenerator(Isolate* isolate);
static Callable FrameDropperTrampoline(Isolate* isolate);
......
......@@ -303,107 +303,12 @@ TF_STUB(ElementsTransitionAndStoreStub, CodeStubAssembler) {
}
}
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(KeyedLoadSloppyArgumentsStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label miss(this);
Node* result = LoadKeyedSloppyArguments(receiver, key, &miss);
Return(result);
BIND(&miss);
{
Comment("Miss");
TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, slot,
vector);
}
}
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(KeyedStoreSloppyArgumentsStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label miss(this);
StoreKeyedSloppyArguments(receiver, key, value, &miss);
Return(value);
BIND(&miss);
{
Comment("Miss");
TailCallRuntime(Runtime::kKeyedStoreIC_Miss, context, value, slot, vector,
receiver, key);
}
}
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(StoreInterceptorStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, value, slot,
vector, receiver, name);
}
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(LoadIndexedInterceptorStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* key = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
Label if_keyispositivesmi(this), if_keyisinvalid(this);
Branch(TaggedIsPositiveSmi(key), &if_keyispositivesmi, &if_keyisinvalid);
BIND(&if_keyispositivesmi);
TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, receiver, key);
BIND(&if_keyisinvalid);
TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, slot,
vector);
}
int JSEntryStub::GenerateHandlerTable(MacroAssembler* masm) {
int handler_table_offset = HandlerTable::EmitReturnTableStart(masm, 1);
HandlerTable::EmitReturnEntry(masm, 0, handler_offset_);
return handler_table_offset;
}
// TODO(ishell): move to builtins-handler-gen.
TF_STUB(StoreSlowElementStub, CodeStubAssembler) {
Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector);
Node* context = Parameter(Descriptor::kContext);
TailCallRuntime(Runtime::kKeyedStoreIC_Slow, context, value, slot, vector,
receiver, name);
}
TF_STUB(StoreInArrayLiteralSlowStub, CodeStubAssembler) {
Node* array = Parameter(Descriptor::kReceiver);
Node* index = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue);
Node* context = Parameter(Descriptor::kContext);
TailCallRuntime(Runtime::kStoreInArrayLiteralIC_Slow, context, value, array,
index);
}
TF_STUB(StoreFastElementStub, CodeStubAssembler) {
Comment("StoreFastElementStub: js_array=%d, elements_kind=%s, store_mode=%d",
stub->is_js_array(), ElementsKindToString(stub->elements_kind()),
......
......@@ -26,14 +26,8 @@ class CodeAssemblerState;
V(JSEntry) \
V(ProfileEntryHook) \
/* --- TurboFanCodeStubs --- */ \
V(StoreSlowElement) \
V(StoreInArrayLiteralSlow) \
V(ElementsTransitionAndStore) \
V(KeyedLoadSloppyArguments) \
V(KeyedStoreSloppyArguments) \
V(StoreFastElement) \
V(StoreInterceptor) \
V(LoadIndexedInterceptor)
V(StoreFastElement)
// List of code stubs only used on ARM 32 bits platforms.
#if V8_TARGET_ARCH_ARM
......@@ -411,52 +405,8 @@ class TurboFanCodeStub : public CodeStub {
namespace v8 {
namespace internal {
// TODO(jgruber): Convert this stub into a builtin.
class StoreInterceptorStub : public TurboFanCodeStub {
public:
explicit StoreInterceptorStub(Isolate* isolate) : TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(StoreInterceptor, TurboFanCodeStub);
};
// TODO(jgruber): Convert this stub into a builtin.
class LoadIndexedInterceptorStub : public TurboFanCodeStub {
public:
explicit LoadIndexedInterceptorStub(Isolate* isolate)
: TurboFanCodeStub(isolate) {}
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_TURBOFAN_CODE_STUB(LoadIndexedInterceptor, TurboFanCodeStub);
};
// TODO(jgruber): Convert this stub into a builtin.
class KeyedLoadSloppyArgumentsStub : public TurboFanCodeStub {
public:
explicit KeyedLoadSloppyArgumentsStub(Isolate* isolate)
: TurboFanCodeStub(isolate) {}
protected:
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_TURBOFAN_CODE_STUB(KeyedLoadSloppyArguments, TurboFanCodeStub);
};
class CommonStoreModeBits : public BitField<KeyedAccessStoreMode, 0, 3> {};
class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub {
public:
explicit KeyedStoreSloppyArgumentsStub(Isolate* isolate,
KeyedAccessStoreMode mode)
: TurboFanCodeStub(isolate) {
minor_key_ = CommonStoreModeBits::encode(mode);
}
protected:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(KeyedStoreSloppyArguments, TurboFanCodeStub);
};
class CallApiCallbackStub : public PlatformCodeStub {
public:
static const int kArgBits = 7;
......@@ -579,30 +529,6 @@ class StoreFastElementStub : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(StoreFastElement, TurboFanCodeStub);
};
class StoreSlowElementStub : public TurboFanCodeStub {
public:
StoreSlowElementStub(Isolate* isolate, KeyedAccessStoreMode mode)
: TurboFanCodeStub(isolate) {
minor_key_ = CommonStoreModeBits::encode(mode);
}
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(StoreSlowElement, TurboFanCodeStub);
};
class StoreInArrayLiteralSlowStub : public TurboFanCodeStub {
public:
StoreInArrayLiteralSlowStub(Isolate* isolate, KeyedAccessStoreMode mode)
: TurboFanCodeStub(isolate) {
minor_key_ = CommonStoreModeBits::encode(mode);
}
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_TURBOFAN_CODE_STUB(StoreInArrayLiteralSlow, TurboFanCodeStub);
};
class ElementsTransitionAndStoreStub : public TurboFanCodeStub {
public:
ElementsTransitionAndStoreStub(Isolate* isolate, ElementsKind from_kind,
......
......@@ -1075,6 +1075,56 @@ KeyedAccessLoadMode FeedbackNexus::GetKeyedAccessLoadMode() const {
return STANDARD_LOAD;
}
namespace {
bool BuiltinHasKeyedAccessStoreMode(int builtin_index) {
DCHECK(Builtins::IsBuiltinId(builtin_index));
switch (builtin_index) {
case Builtins::kKeyedStoreIC_SloppyArguments_Standard:
case Builtins::kKeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW:
case Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB:
case Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionHandleCOW:
case Builtins::kStoreInArrayLiteralIC_Slow_Standard:
case Builtins::kStoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW:
case Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB:
case Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionHandleCOW:
case Builtins::kKeyedStoreIC_Slow_Standard:
case Builtins::kKeyedStoreIC_Slow_GrowNoTransitionHandleCOW:
case Builtins::kKeyedStoreIC_Slow_NoTransitionIgnoreOOB:
case Builtins::kKeyedStoreIC_Slow_NoTransitionHandleCOW:
return true;
default:
return false;
}
UNREACHABLE();
}
KeyedAccessStoreMode KeyedAccessStoreModeForBuiltin(int builtin_index) {
DCHECK(BuiltinHasKeyedAccessStoreMode(builtin_index));
switch (builtin_index) {
case Builtins::kKeyedStoreIC_SloppyArguments_Standard:
case Builtins::kStoreInArrayLiteralIC_Slow_Standard:
case Builtins::kKeyedStoreIC_Slow_Standard:
return STANDARD_STORE;
case Builtins::kKeyedStoreIC_SloppyArguments_GrowNoTransitionHandleCOW:
case Builtins::kStoreInArrayLiteralIC_Slow_GrowNoTransitionHandleCOW:
case Builtins::kKeyedStoreIC_Slow_GrowNoTransitionHandleCOW:
return STORE_AND_GROW_NO_TRANSITION_HANDLE_COW;
case Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionIgnoreOOB:
case Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionIgnoreOOB:
case Builtins::kKeyedStoreIC_Slow_NoTransitionIgnoreOOB:
return STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS;
case Builtins::kKeyedStoreIC_SloppyArguments_NoTransitionHandleCOW:
case Builtins::kStoreInArrayLiteralIC_Slow_NoTransitionHandleCOW:
case Builtins::kKeyedStoreIC_Slow_NoTransitionHandleCOW:
return STORE_NO_TRANSITION_HANDLE_COW;
default:
UNREACHABLE();
}
}
} // namespace
KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
DCHECK(IsKeyedStoreICKind(kind()) || IsStoreInArrayLiteralICKind(kind()));
KeyedAccessStoreMode mode = STANDARD_STORE;
......@@ -1101,14 +1151,19 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
} else {
// Element store without prototype chain check.
handler = Handle<Code>::cast(maybe_code_handler.object());
if (handler->is_builtin()) continue;
}
CodeStub::Major major_key = CodeStub::MajorKeyFromKey(handler->stub_key());
if (handler->is_builtin()) {
const int builtin_index = handler->builtin_index();
if (!BuiltinHasKeyedAccessStoreMode(builtin_index)) continue;
mode = KeyedAccessStoreModeForBuiltin(builtin_index);
break;
} else {
CodeStub::Major major_key =
CodeStub::MajorKeyFromKey(handler->stub_key());
uint32_t minor_key = CodeStub::MinorKeyFromKey(handler->stub_key());
CHECK(major_key == CodeStub::KeyedStoreSloppyArguments ||
major_key == CodeStub::StoreFastElement ||
major_key == CodeStub::StoreSlowElement ||
major_key == CodeStub::StoreInArrayLiteralSlow ||
CHECK(major_key == CodeStub::StoreFastElement ||
major_key == CodeStub::ElementsTransitionAndStore ||
major_key == CodeStub::NoCache);
if (major_key != CodeStub::NoCache) {
......@@ -1116,6 +1171,7 @@ KeyedAccessStoreMode FeedbackNexus::GetKeyedAccessStoreMode() const {
break;
}
}
}
return mode;
}
......
......@@ -10,6 +10,7 @@
#include "src/arguments-inl.h"
#include "src/ast/ast.h"
#include "src/base/bits.h"
#include "src/code-factory.h"
#include "src/conversions.h"
#include "src/execution.h"
#include "src/field-type.h"
......@@ -1072,8 +1073,9 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map,
!receiver_map->GetIndexedInterceptor()->getter()->IsUndefined(
isolate()) &&
!receiver_map->GetIndexedInterceptor()->non_masking()) {
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_LoadIndexedInterceptorStub);
return LoadIndexedInterceptorStub(isolate()).GetCode();
return BUILTIN_CODE(isolate(), LoadIndexedInterceptorIC);
}
InstanceType instance_type = receiver_map->instance_type();
if (instance_type < FIRST_NONSTRING_TYPE) {
......@@ -1090,8 +1092,9 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map,
ElementsKind elements_kind = receiver_map->elements_kind();
if (IsSloppyArgumentsElementsKind(elements_kind)) {
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedLoadIC_KeyedLoadSloppyArgumentsStub);
return KeyedLoadSloppyArgumentsStub(isolate()).GetCode();
return BUILTIN_CODE(isolate(), KeyedLoadIC_SloppyArguments);
}
bool is_js_array = instance_type == JS_ARRAY_TYPE;
if (elements_kind == DICTIONARY_ELEMENTS) {
......@@ -1499,9 +1502,9 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
USE(holder);
DCHECK(!holder->GetNamedInterceptor()->setter()->IsUndefined(isolate()));
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), StoreIC_StoreInterceptorStub);
StoreInterceptorStub stub(isolate());
return MaybeObjectHandle(stub.GetCode());
return MaybeObjectHandle(BUILTIN_CODE(isolate(), StoreInterceptorIC));
}
case LookupIterator::ACCESSOR: {
......@@ -1842,8 +1845,10 @@ Handle<Object> KeyedStoreIC::StoreElementHandler(
bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
Handle<Code> stub;
if (receiver_map->has_sloppy_arguments_elements()) {
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_KeyedStoreSloppyArgumentsStub);
stub = KeyedStoreSloppyArgumentsStub(isolate(), store_mode).GetCode();
stub =
CodeFactory::KeyedStoreIC_SloppyArguments(isolate(), store_mode).code();
} else if (receiver_map->has_fast_elements() ||
receiver_map->has_fixed_typed_array_elements()) {
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreFastElementStub);
......@@ -1852,12 +1857,15 @@ Handle<Object> KeyedStoreIC::StoreElementHandler(
.GetCode();
if (receiver_map->has_fixed_typed_array_elements()) return stub;
} else if (IsStoreInArrayLiteralICKind(kind())) {
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), StoreInArrayLiteralIC_SlowStub);
stub = StoreInArrayLiteralSlowStub(isolate(), store_mode).GetCode();
stub =
CodeFactory::StoreInArrayLiteralIC_Slow(isolate(), store_mode).code();
} else {
// TODO(jgruber): Update counter name.
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub);
DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind);
stub = StoreSlowElementStub(isolate(), store_mode).GetCode();
stub = CodeFactory::KeyedStoreIC_Slow(isolate(), store_mode).code();
}
if (IsStoreInArrayLiteralICKind(kind())) return stub;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment