Commit 97900904 authored by ishell's avatar ishell Committed by Commit bot

[stubs] Port KeyedStoreIC_Slow/Miss and StoreSlowElementStub to TF.

This CL also removes unused LoadApiGetterStub and renames StoreElementStub to StoreSlowElementStub.

BUG=v8:4587

Review-Url: https://codereview.chromium.org/2670863003
Cr-Commit-Position: refs/heads/master@{#42951}
parent 9576d08c
......@@ -45,12 +45,34 @@ void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(
KeyedStoreGenericGenerator::Generate(state, STRICT);
}
void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
KeyedStoreIC::GenerateMiss(masm);
TF_BUILTIN(KeyedStoreIC_Miss, CodeStubAssembler) {
typedef StoreWithVectorDescriptor Descriptor;
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_Miss, context, value, slot, vector,
receiver, name);
}
void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
KeyedStoreIC::GenerateSlow(masm);
TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) {
typedef StoreWithVectorDescriptor Descriptor;
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);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
TailCallRuntime(Runtime::kKeyedStoreIC_Slow, context, value, slot, vector,
receiver, name);
}
TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) {
......
......@@ -234,8 +234,8 @@ class Isolate;
StoreWithVector) \
TFS(KeyedStoreIC_Megamorphic_Strict, KEYED_STORE_IC, kNoExtraICState, \
StoreWithVector) \
ASM(KeyedStoreIC_Miss) \
ASH(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC) \
TFS(KeyedStoreIC_Miss, BUILTIN, kNoExtraICState, StoreWithVector) \
TFS(KeyedStoreIC_Slow, HANDLER, Code::KEYED_STORE_IC, StoreWithVector) \
TFS(LoadGlobalIC_Miss, BUILTIN, kNoExtraICState, LoadGlobalWithVector) \
TFS(LoadGlobalIC_Slow, HANDLER, Code::LOAD_GLOBAL_IC, LoadGlobalWithVector) \
TFS(LoadField, HANDLER, Code::LOAD_IC, LoadField) \
......
......@@ -1499,23 +1499,6 @@ void SubStringStub::GenerateAssembly(
assembler.Parameter(Descriptor::kContext)));
}
void LoadApiGetterStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* context = assembler.Parameter(Descriptor::kContext);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
// For now we only support receiver_is_holder.
DCHECK(receiver_is_holder());
Node* holder = receiver;
Node* map = assembler.LoadMap(receiver);
Node* descriptors = assembler.LoadMapDescriptors(map);
Node* callback = assembler.LoadFixedArrayElement(
descriptors, DescriptorArray::ToValueIndex(index()));
assembler.TailCallStub(CodeFactory::ApiGetter(isolate()), context, receiver,
holder, callback);
}
void StoreGlobalStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const {
typedef CodeStubAssembler::Label Label;
......@@ -2076,10 +2059,20 @@ void CreateWeakCellStub::GenerateAheadOfTime(Isolate* isolate) {
stub.GetCode();
}
void StoreSlowElementStub::GenerateAssembly(
compiler::CodeAssemblerState* state) const {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* value = assembler.Parameter(Descriptor::kValue);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
void StoreElementStub::Generate(MacroAssembler* masm) {
DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind());
KeyedStoreIC::GenerateSlow(masm);
assembler.TailCallRuntime(Runtime::kKeyedStoreIC_Slow, context, value, slot,
vector, receiver, name);
}
void StoreFastElementStub::GenerateAssembly(
......
......@@ -47,7 +47,7 @@ class Node;
V(RecordWrite) \
V(RegExpExec) \
V(StoreBufferOverflow) \
V(StoreElement) \
V(StoreSlowElement) \
V(SubString) \
V(FastNewRestParameter) \
V(FastNewSloppyArguments) \
......@@ -105,7 +105,6 @@ class Node;
V(StoreFastElement) \
V(StoreGlobal) \
V(StoreInterceptor) \
V(LoadApiGetter) \
V(LoadIndexedInterceptor) \
V(GrowArrayElements)
......@@ -1005,33 +1004,6 @@ class KeyedStoreSloppyArgumentsStub : public TurboFanCodeStub {
DEFINE_TURBOFAN_CODE_STUB(KeyedStoreSloppyArguments, TurboFanCodeStub);
};
class LoadApiGetterStub : public TurboFanCodeStub {
public:
LoadApiGetterStub(Isolate* isolate, bool receiver_is_holder, int index)
: TurboFanCodeStub(isolate) {
// If that's not true, we need to ensure that the receiver is actually a
// JSReceiver. http://crbug.com/609134
DCHECK(receiver_is_holder);
minor_key_ = IndexBits::encode(index) |
ReceiverIsHolderBits::encode(receiver_is_holder);
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::LOAD_IC; }
int index() const { return IndexBits::decode(minor_key_); }
bool receiver_is_holder() const {
return ReceiverIsHolderBits::decode(minor_key_);
}
private:
class ReceiverIsHolderBits : public BitField<bool, 0, 1> {};
class IndexBits : public BitField<int, 1, kDescriptorIndexBitCount> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load);
DEFINE_TURBOFAN_CODE_STUB(LoadApiGetter, TurboFanCodeStub);
};
class StoreGlobalStub : public TurboFanCodeStub {
public:
StoreGlobalStub(Isolate* isolate, PropertyCellType type,
......@@ -1928,31 +1900,19 @@ class ArrayNArgumentsConstructorStub : public PlatformCodeStub {
DEFINE_PLATFORM_CODE_STUB(ArrayNArgumentsConstructor, PlatformCodeStub);
};
class StoreElementStub : public PlatformCodeStub {
class StoreSlowElementStub : public TurboFanCodeStub {
public:
StoreElementStub(Isolate* isolate, ElementsKind elements_kind,
KeyedAccessStoreMode mode)
: PlatformCodeStub(isolate) {
// TODO(jkummerow): Rename this stub to StoreSlowElementStub,
// drop elements_kind parameter.
DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind);
minor_key_ = ElementsKindBits::encode(elements_kind) |
CommonStoreModeBits::encode(mode);
StoreSlowElementStub(Isolate* isolate, KeyedAccessStoreMode mode)
: TurboFanCodeStub(isolate) {
minor_key_ = CommonStoreModeBits::encode(mode);
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
private:
ElementsKind elements_kind() const {
return ElementsKindBits::decode(minor_key_);
}
class ElementsKindBits
: public BitField<ElementsKind, CommonStoreModeBits::kNext, 8> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_PLATFORM_CODE_STUB(StoreElement, PlatformCodeStub);
DEFINE_TURBOFAN_CODE_STUB(StoreSlowElement, TurboFanCodeStub);
};
class ToBooleanICStub : public HydrogenCodeStub {
......
......@@ -13,38 +13,6 @@ namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -13,32 +13,6 @@ namespace v8 {
namespace internal {
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
ASM_LOCATION("KeyedStoreIC::GenerateMiss");
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
ASM_LOCATION("KeyedStoreIC::GenerateSlow");
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -12,48 +12,6 @@
namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
Register receiver = StoreWithVectorDescriptor::ReceiverRegister();
Register name = StoreWithVectorDescriptor::NameRegister();
STATIC_ASSERT(StoreWithVectorDescriptor::kStackArgumentsCount == 3);
// Current stack layout:
// - esp[12] -- value
// - esp[8] -- slot
// - esp[4] -- vector
// - esp[0] -- return address
Register return_address = StoreWithVectorDescriptor::SlotRegister();
__ pop(return_address);
__ push(receiver);
__ push(name);
__ push(return_address);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
......
......@@ -105,7 +105,8 @@ Handle<Object> PropertyICCompiler::CompileKeyedStoreMonomorphicHandler(
store_mode).GetCode();
} else {
TRACE_HANDLER_STATS(isolate(), KeyedStoreIC_StoreElementStub);
stub = StoreElementStub(isolate(), elements_kind, store_mode).GetCode();
DCHECK_EQ(DICTIONARY_ELEMENTS, elements_kind);
stub = StoreSlowElementStub(isolate(), store_mode).GetCode();
}
Handle<Object> validity_cell =
Map::GetOrCreatePrototypeChainValidityCell(receiver_map, isolate());
......
......@@ -432,12 +432,6 @@ class KeyedStoreIC : public StoreIC {
Handle<Object> name,
Handle<Object> value);
// Code generators for stub routines. Only called once at startup.
static void GenerateMiss(MacroAssembler* masm);
static void GenerateSlow(MacroAssembler* masm);
static void GenerateMegamorphic(MacroAssembler* masm,
LanguageMode language_mode);
static void Clear(Isolate* isolate, Code* host, KeyedStoreICNexus* nexus);
protected:
......
......@@ -13,38 +13,6 @@ namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -13,38 +13,6 @@ namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -13,38 +13,6 @@ namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
case Token::EQ_STRICT:
......
......@@ -12,35 +12,6 @@
namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
__ Push(StoreWithVectorDescriptor::ValueRegister(),
StoreWithVectorDescriptor::SlotRegister(),
StoreWithVectorDescriptor::VectorRegister(),
StoreWithVectorDescriptor::ReceiverRegister(),
StoreWithVectorDescriptor::NameRegister());
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
StoreIC_PushArgs(masm);
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
......
......@@ -12,48 +12,6 @@
namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
Register receiver = StoreWithVectorDescriptor::ReceiverRegister();
Register name = StoreWithVectorDescriptor::NameRegister();
Register value = StoreWithVectorDescriptor::ValueRegister();
Register slot = StoreWithVectorDescriptor::SlotRegister();
Register vector = StoreWithVectorDescriptor::VectorRegister();
Register temp = r11;
DCHECK(!AreAliased(receiver, name, value, slot, vector, temp));
__ PopReturnAddressTo(temp);
__ Push(value);
__ Push(slot);
__ Push(vector);
__ Push(receiver);
__ Push(name);
__ PushReturnAddressFrom(temp);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
......
......@@ -12,48 +12,6 @@
namespace v8 {
namespace internal {
// ----------------------------------------------------------------------------
// Static IC stub generators.
//
#define __ ACCESS_MASM(masm)
static void StoreIC_PushArgs(MacroAssembler* masm) {
Register receiver = StoreWithVectorDescriptor::ReceiverRegister();
Register name = StoreWithVectorDescriptor::NameRegister();
STATIC_ASSERT(StoreWithVectorDescriptor::kStackArgumentsCount == 3);
// Current stack layout:
// - esp[12] -- value
// - esp[8] -- slot
// - esp[4] -- vector
// - esp[0] -- return address
Register return_address = StoreWithVectorDescriptor::SlotRegister();
__ pop(return_address);
__ push(receiver);
__ push(name);
__ push(return_address);
}
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Miss);
}
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
// Return address is on the stack.
StoreIC_PushArgs(masm);
// Do tail-call to runtime routine.
__ TailCallRuntime(Runtime::kKeyedStoreIC_Slow);
}
#undef __
Condition CompareIC::ComputeCondition(Token::Value op) {
switch (op) {
......
......@@ -973,7 +973,7 @@ KeyedAccessStoreMode KeyedStoreICNexus::GetKeyedAccessStoreMode() const {
uint32_t minor_key = CodeStub::MinorKeyFromKey(handler->stub_key());
CHECK(major_key == CodeStub::KeyedStoreSloppyArguments ||
major_key == CodeStub::StoreFastElement ||
major_key == CodeStub::StoreElement ||
major_key == CodeStub::StoreSlowElement ||
major_key == CodeStub::ElementsTransitionAndStore ||
major_key == CodeStub::NoCache);
if (major_key != CodeStub::NoCache) {
......
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