Commit 13aa1d02 authored by ishell's avatar ishell Committed by Commit bot

[stubs] Call interface descriptors cleanup.

This is a first step towards a perfect world where a call interface descriptor is the only place that defines calling convention for a particular code stub.

Review-Url: https://codereview.chromium.org/2172223002
Cr-Commit-Position: refs/heads/master@{#38059}
parent ae752848
...@@ -28,9 +28,10 @@ void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler, ...@@ -28,9 +28,10 @@ void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler,
ToPrimitiveHint hint) { ToPrimitiveHint hint) {
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node; typedef compiler::Node Node;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0); Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(1); Node* context = assembler->Parameter(Descriptor::kContext);
// Lookup the @@toPrimitive property on the {input}. // Lookup the @@toPrimitive property on the {input}.
Callable callable = CodeFactory::GetProperty(assembler->isolate()); Callable callable = CodeFactory::GetProperty(assembler->isolate());
...@@ -113,9 +114,10 @@ void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) { ...@@ -113,9 +114,10 @@ void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) {
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node; typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable; typedef CodeStubAssembler::Variable Variable;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0); Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(1); Node* context = assembler->Parameter(Descriptor::kContext);
// We might need to loop once here due to ToPrimitive conversions. // We might need to loop once here due to ToPrimitive conversions.
Variable var_input(assembler, MachineRepresentation::kTagged); Variable var_input(assembler, MachineRepresentation::kTagged);
...@@ -224,9 +226,10 @@ void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler, ...@@ -224,9 +226,10 @@ void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler,
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node; typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable; typedef CodeStubAssembler::Variable Variable;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0); Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(1); Node* context = assembler->Parameter(Descriptor::kContext);
Variable var_result(assembler, MachineRepresentation::kTagged); Variable var_result(assembler, MachineRepresentation::kTagged);
Label return_result(assembler, &var_result); Label return_result(assembler, &var_result);
...@@ -304,8 +307,9 @@ void Builtins::Generate_OrdinaryToPrimitive_String( ...@@ -304,8 +307,9 @@ void Builtins::Generate_OrdinaryToPrimitive_String(
void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) { void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef TypeConversionDescriptor Descriptor;
Node* value = assembler->Parameter(0); Node* value = assembler->Parameter(Descriptor::kArgument);
Label return_true(assembler), return_false(assembler); Label return_true(assembler), return_false(assembler);
assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false); assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false);
......
...@@ -39,10 +39,11 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { ...@@ -39,10 +39,11 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* slot = assembler->Parameter(0); Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(1); Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(2); Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot,
vector); vector);
...@@ -51,10 +52,11 @@ void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) { ...@@ -51,10 +52,11 @@ void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) {
namespace { namespace {
void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) { void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* slot = assembler->Parameter(0); Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(1); Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(2); Node* context = assembler->Parameter(Descriptor::kContext);
Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode)); Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode));
assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector, assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector,
...@@ -78,12 +80,13 @@ void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { ...@@ -78,12 +80,13 @@ void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) { void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0); Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(1); Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(2); Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(3); Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(4); Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name, assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name,
slot, vector); slot, vector);
...@@ -95,25 +98,25 @@ void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) { ...@@ -95,25 +98,25 @@ void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) {
void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) { void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0); Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(1); Node* name = assembler->Parameter(Descriptor::kName);
// Node* slot = assembler->Parameter(2); Node* context = assembler->Parameter(Descriptor::kContext);
// Node* vector = assembler->Parameter(3);
Node* context = assembler->Parameter(4);
assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name); assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
} }
void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) { void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0); Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(1); Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(2); Node* value = assembler->Parameter(Descriptor::kValue);
Node* slot = assembler->Parameter(3); Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(4); Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(5); Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name, assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name,
value, slot, vector); value, slot, vector);
...@@ -131,13 +134,12 @@ namespace { ...@@ -131,13 +134,12 @@ namespace {
void Generate_StoreIC_Slow(CodeStubAssembler* assembler, void Generate_StoreIC_Slow(CodeStubAssembler* assembler,
LanguageMode language_mode) { LanguageMode language_mode) {
typedef compiler::Node Node; typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0); Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(1); Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(2); Node* value = assembler->Parameter(Descriptor::kValue);
// Node* slot = assembler->Parameter(3); Node* context = assembler->Parameter(Descriptor::kContext);
// Node* vector = assembler->Parameter(4);
Node* context = assembler->Parameter(5);
Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode)); Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode));
// The slow case calls into the runtime to complete the store without causing // The slow case calls into the runtime to complete the store without causing
......
...@@ -3045,9 +3045,12 @@ void CodeStubAssembler::LoadIC(const LoadICParameters* p) { ...@@ -3045,9 +3045,12 @@ void CodeStubAssembler::LoadIC(const LoadICParameters* p) {
// |handler| is a heap object. Must be code, call it. // |handler| is a heap object. Must be code, call it.
Bind(&call_handler); Bind(&call_handler);
LoadWithVectorDescriptor descriptor(isolate()); typedef LoadWithVectorDescriptor Descriptor;
TailCallStub(descriptor, handler, p->context, p->receiver, p->name, p->slot, TailCallStub(Descriptor(isolate()), var_handler.value(), p->context,
p->vector); Arg(Descriptor::kReceiver, p->receiver),
Arg(Descriptor::kName, p->name),
Arg(Descriptor::kSlot, p->slot),
Arg(Descriptor::kVector, p->vector));
} }
Bind(&try_polymorphic); Bind(&try_polymorphic);
......
This diff is collapsed.
This diff is collapsed.
...@@ -431,8 +431,9 @@ class CodeStub BASE_EMBEDDED { ...@@ -431,8 +431,9 @@ class CodeStub BASE_EMBEDDED {
#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \ #define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
public: \ public: \
typedef NAME##Descriptor Descriptor; \
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
return NAME##Descriptor(isolate()); \ return Descriptor(isolate()); \
} }
#define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \ #define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \
...@@ -1023,9 +1024,6 @@ class NumberToStringStub final : public HydrogenCodeStub { ...@@ -1023,9 +1024,6 @@ class NumberToStringStub final : public HydrogenCodeStub {
public: public:
explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kNumber = 0;
DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion); DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub); DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub);
}; };
...@@ -1035,9 +1033,6 @@ class TypeofStub final : public HydrogenCodeStub { ...@@ -1035,9 +1033,6 @@ class TypeofStub final : public HydrogenCodeStub {
public: public:
explicit TypeofStub(Isolate* isolate) : HydrogenCodeStub(isolate) {} explicit TypeofStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kObject = 0;
static void GenerateAheadOfTime(Isolate* isolate); static void GenerateAheadOfTime(Isolate* isolate);
DEFINE_CALL_INTERFACE_DESCRIPTOR(Typeof); DEFINE_CALL_INTERFACE_DESCRIPTOR(Typeof);
...@@ -1448,6 +1443,8 @@ class LoadFieldStub: public HandlerStub { ...@@ -1448,6 +1443,8 @@ class LoadFieldStub: public HandlerStub {
private: private:
class LoadFieldByIndexBits : public BitField<int, 0, 13> {}; class LoadFieldByIndexBits : public BitField<int, 0, 13> {};
// TODO(ishell): The stub uses only kReceiver parameter.
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub); DEFINE_HANDLER_CODE_STUB(LoadField, HandlerStub);
}; };
...@@ -1460,7 +1457,7 @@ class KeyedLoadSloppyArgumentsStub : public HandlerStub { ...@@ -1460,7 +1457,7 @@ class KeyedLoadSloppyArgumentsStub : public HandlerStub {
protected: protected:
Code::Kind kind() const override { return Code::KEYED_LOAD_IC; } Code::Kind kind() const override { return Code::KEYED_LOAD_IC; }
private: DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub); DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub);
}; };
...@@ -1478,7 +1475,7 @@ class KeyedStoreSloppyArgumentsStub : public HandlerStub { ...@@ -1478,7 +1475,7 @@ class KeyedStoreSloppyArgumentsStub : public HandlerStub {
protected: protected:
Code::Kind kind() const override { return Code::KEYED_STORE_IC; } Code::Kind kind() const override { return Code::KEYED_STORE_IC; }
private: DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub); DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub);
}; };
...@@ -1500,6 +1497,8 @@ class LoadConstantStub : public HandlerStub { ...@@ -1500,6 +1497,8 @@ class LoadConstantStub : public HandlerStub {
private: private:
class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {}; class ConstantIndexBits : public BitField<int, 0, kSubMinorKeyBits> {};
// TODO(ishell): The stub uses only kReceiver parameter.
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub); DEFINE_HANDLER_CODE_STUB(LoadConstant, HandlerStub);
}; };
...@@ -1558,6 +1557,8 @@ class StoreFieldStub : public HandlerStub { ...@@ -1558,6 +1557,8 @@ class StoreFieldStub : public HandlerStub {
class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
class RepresentationBits : public BitField<uint8_t, 13, 4> {}; class RepresentationBits : public BitField<uint8_t, 13, 4> {};
// TODO(ishell): The stub uses only kReceiver and kValue parameters.
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub); DEFINE_HANDLER_CODE_STUB(StoreField, HandlerStub);
}; };
...@@ -1591,25 +1592,23 @@ class StoreTransitionHelper { ...@@ -1591,25 +1592,23 @@ class StoreTransitionHelper {
return VectorStoreTransitionDescriptor::MapRegister(); return VectorStoreTransitionDescriptor::MapRegister();
} }
static int ReceiverIndex() { static int ReceiverIndex() { return StoreTransitionDescriptor::kReceiver; }
return StoreTransitionDescriptor::kReceiverIndex;
}
static int NameIndex() { return StoreTransitionDescriptor::kReceiverIndex; } static int NameIndex() { return StoreTransitionDescriptor::kReceiver; }
static int ValueIndex() { return StoreTransitionDescriptor::kValueIndex; } static int ValueIndex() { return StoreTransitionDescriptor::kValue; }
static int MapIndex() { static int MapIndex() {
DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMapIndex) == DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMap) ==
static_cast<int>(StoreTransitionDescriptor::kMapIndex)); static_cast<int>(StoreTransitionDescriptor::kMap));
return StoreTransitionDescriptor::kMapIndex; return StoreTransitionDescriptor::kMap;
} }
static int VectorIndex() { static int VectorIndex() {
if (HasVirtualSlotArg()) { if (HasVirtualSlotArg()) {
return VectorStoreTransitionDescriptor::kVirtualSlotVectorIndex; return VectorStoreTransitionDescriptor::kVirtualSlotVector;
} }
return VectorStoreTransitionDescriptor::kVectorIndex; return VectorStoreTransitionDescriptor::kVector;
} }
// Some platforms don't have a slot arg. // Some platforms don't have a slot arg.
...@@ -1658,16 +1657,16 @@ class StoreTransitionStub : public HandlerStub { ...@@ -1658,16 +1657,16 @@ class StoreTransitionStub : public HandlerStub {
return StoreModeBits::decode(sub_minor_key()); return StoreModeBits::decode(sub_minor_key());
} }
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
protected: protected:
Code::Kind kind() const override { return Code::STORE_IC; } Code::Kind kind() const override { return Code::STORE_IC; }
void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
private: private:
class StoreFieldByIndexBits : public BitField<int, 0, 13> {}; class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
class RepresentationBits : public BitField<uint8_t, 13, 4> {}; class RepresentationBits : public BitField<uint8_t, 13, 4> {};
class StoreModeBits : public BitField<StoreMode, 17, 2> {}; class StoreModeBits : public BitField<StoreMode, 17, 2> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub); DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub);
}; };
...@@ -1733,10 +1732,12 @@ class StoreGlobalStub : public HandlerStub { ...@@ -1733,10 +1732,12 @@ class StoreGlobalStub : public HandlerStub {
class RepresentationBits : public BitField<Representation::Kind, 4, 8> {}; class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
class CheckGlobalBits : public BitField<bool, 12, 1> {}; class CheckGlobalBits : public BitField<bool, 12, 1> {};
// TODO(ishell): The stub uses only kValue parameter.
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub); DEFINE_HANDLER_CODE_STUB(StoreGlobal, HandlerStub);
}; };
// TODO(ishell): remove, once StoreGlobalIC is implemented.
class StoreGlobalViaContextStub final : public PlatformCodeStub { class StoreGlobalViaContextStub final : public PlatformCodeStub {
public: public:
static const int kMaximumDepth = 15; static const int kMaximumDepth = 15;
...@@ -1847,10 +1848,6 @@ class BinaryOpICStub : public HydrogenCodeStub { ...@@ -1847,10 +1848,6 @@ class BinaryOpICStub : public HydrogenCodeStub {
void PrintState(std::ostream& os) const final; // NOLINT void PrintState(std::ostream& os) const final; // NOLINT
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
static const int kRight = 1;
private: private:
static void GenerateAheadOfTime(Isolate* isolate, static void GenerateAheadOfTime(Isolate* isolate,
const BinaryOpICState& state); const BinaryOpICState& state);
...@@ -1909,11 +1906,6 @@ class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { ...@@ -1909,11 +1906,6 @@ class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub {
Code::Kind GetCodeKind() const final { return Code::STUB; } Code::Kind GetCodeKind() const final { return Code::STUB; }
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kAllocationSite = 0;
static const int kLeft = 1;
static const int kRight = 2;
DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite); DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOpWithAllocationSite);
DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub); DEFINE_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub);
}; };
...@@ -1936,10 +1928,6 @@ class StringAddStub final : public HydrogenCodeStub { ...@@ -1936,10 +1928,6 @@ class StringAddStub final : public HydrogenCodeStub {
return PretenureFlagBits::decode(sub_minor_key()); return PretenureFlagBits::decode(sub_minor_key());
} }
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
static const int kRight = 1;
private: private:
class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {}; class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {};
class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {}; class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {};
...@@ -2103,11 +2091,6 @@ class RegExpConstructResultStub final : public HydrogenCodeStub { ...@@ -2103,11 +2091,6 @@ class RegExpConstructResultStub final : public HydrogenCodeStub {
explicit RegExpConstructResultStub(Isolate* isolate) explicit RegExpConstructResultStub(Isolate* isolate)
: HydrogenCodeStub(isolate) { } : HydrogenCodeStub(isolate) { }
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLength = 0;
static const int kIndex = 1;
static const int kInput = 2;
DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult);
DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub);
}; };
...@@ -2309,7 +2292,7 @@ class KeyedLoadGenericStub : public HydrogenCodeStub { ...@@ -2309,7 +2292,7 @@ class KeyedLoadGenericStub : public HydrogenCodeStub {
Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; } Code::Kind GetCodeKind() const override { return Code::KEYED_LOAD_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(Load); DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub); DEFINE_HYDROGEN_CODE_STUB(KeyedLoadGeneric, HydrogenCodeStub);
}; };
...@@ -2619,6 +2602,7 @@ class LoadScriptContextFieldStub : public ScriptContextFieldStub { ...@@ -2619,6 +2602,7 @@ class LoadScriptContextFieldStub : public ScriptContextFieldStub {
private: private:
Code::Kind kind() const override { return Code::LOAD_IC; } Code::Kind kind() const override { return Code::LOAD_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub); DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
}; };
...@@ -2632,6 +2616,7 @@ class StoreScriptContextFieldStub : public ScriptContextFieldStub { ...@@ -2632,6 +2616,7 @@ class StoreScriptContextFieldStub : public ScriptContextFieldStub {
private: private:
Code::Kind kind() const override { return Code::STORE_IC; } Code::Kind kind() const override { return Code::STORE_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub); DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
}; };
...@@ -2664,6 +2649,7 @@ class LoadFastElementStub : public HandlerStub { ...@@ -2664,6 +2649,7 @@ class LoadFastElementStub : public HandlerStub {
class IsJSArrayBits: public BitField<bool, 8, 1> {}; class IsJSArrayBits: public BitField<bool, 8, 1> {};
class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {}; class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub); DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub);
}; };
...@@ -2690,10 +2676,6 @@ class StoreFastElementStub : public HydrogenCodeStub { ...@@ -2690,10 +2676,6 @@ class StoreFastElementStub : public HydrogenCodeStub {
return CommonStoreModeBits::decode(sub_minor_key()); return CommonStoreModeBits::decode(sub_minor_key());
} }
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return StoreWithVectorDescriptor(isolate());
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; } Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
...@@ -2701,6 +2683,7 @@ class StoreFastElementStub : public HydrogenCodeStub { ...@@ -2701,6 +2683,7 @@ class StoreFastElementStub : public HydrogenCodeStub {
class ElementsKindBits : public BitField<ElementsKind, 3, 8> {}; class ElementsKindBits : public BitField<ElementsKind, 3, 8> {};
class IsJSArrayBits : public BitField<bool, 11, 1> {}; class IsJSArrayBits : public BitField<bool, 11, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub); DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub);
}; };
...@@ -2996,7 +2979,6 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub { ...@@ -2996,7 +2979,6 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
return CommonStoreModeBits::decode(sub_minor_key()); return CommonStoreModeBits::decode(sub_minor_key());
} }
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
Code::Kind GetCodeKind() const override { return Code::HANDLER; } Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; } ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
...@@ -3005,6 +2987,7 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub { ...@@ -3005,6 +2987,7 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
class ToBits : public BitField<ElementsKind, 11, 8> {}; class ToBits : public BitField<ElementsKind, 11, 8> {};
class IsJSArrayBits : public BitField<bool, 19, 1> {}; class IsJSArrayBits : public BitField<bool, 19, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub); DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
}; };
......
...@@ -536,6 +536,91 @@ Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor, ...@@ -536,6 +536,91 @@ Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
return CallN(call_descriptor, target, args); return CallN(call_descriptor, target, args);
} }
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 3;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 4;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3, const Arg& arg4,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 5;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3, const Arg& arg4,
const Arg& arg5, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 6;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[arg5.index] = arg5.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor, Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
Node* target, Node** args, size_t result_size) { Node* target, Node** args, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
...@@ -635,6 +720,52 @@ Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor, ...@@ -635,6 +720,52 @@ Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
return raw_assembler_->TailCallN(call_descriptor, target, args); return raw_assembler_->TailCallN(call_descriptor, target, args);
} }
Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
const Arg& arg4, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 5;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return raw_assembler_->TailCallN(call_descriptor, target, args);
}
Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
const Arg& arg4, const Arg& arg5,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 6;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[arg5.index] = arg5.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return raw_assembler_->TailCallN(call_descriptor, target, args);
}
Node* CodeAssembler::TailCallBytecodeDispatch( Node* CodeAssembler::TailCallBytecodeDispatch(
const CallInterfaceDescriptor& interface_descriptor, const CallInterfaceDescriptor& interface_descriptor,
Node* code_target_address, Node** args) { Node* code_target_address, Node** args) {
......
...@@ -326,6 +326,15 @@ class CodeAssembler { ...@@ -326,6 +326,15 @@ class CodeAssembler {
Node* arg1, Node* arg2, Node* arg3, Node* arg4, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
Node* arg5); Node* arg5);
// A pair of a zero-based argument index and a value.
// It helps writing arguments order independent code.
struct Arg {
Arg(int index, Node* value) : index(index), value(value) {}
int const index;
Node* const value;
};
Node* CallStub(Callable const& callable, Node* context, Node* arg1, Node* CallStub(Callable const& callable, Node* context, Node* arg1,
size_t result_size = 1); size_t result_size = 1);
Node* CallStub(Callable const& callable, Node* context, Node* arg1, Node* CallStub(Callable const& callable, Node* context, Node* arg1,
...@@ -350,6 +359,21 @@ class CodeAssembler { ...@@ -350,6 +359,21 @@ class CodeAssembler {
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target, Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4, Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
Node* arg5, size_t result_size = 1); Node* arg5, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, const Arg& arg5,
size_t result_size = 1);
Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target, Node* CallStubN(const CallInterfaceDescriptor& descriptor, Node* target,
Node** args, size_t result_size = 1); Node** args, size_t result_size = 1);
...@@ -371,6 +395,14 @@ class CodeAssembler { ...@@ -371,6 +395,14 @@ class CodeAssembler {
Node* context, Node* arg1, Node* arg2, Node* arg3, Node* context, Node* arg1, Node* arg2, Node* arg3,
Node* arg4, size_t result_size = 1); Node* arg4, size_t result_size = 1);
Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, size_t result_size = 1);
Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, const Arg& arg5,
size_t result_size = 1);
Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor, Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor,
Node* code_target_address, Node** args); Node* code_target_address, Node** args);
......
...@@ -224,6 +224,9 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) { ...@@ -224,6 +224,9 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
void JSGenericLowering::LowerJSStoreProperty(Node* node) { void JSGenericLowering::LowerJSStoreProperty(Node* node) {
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* key = NodeProperties::GetValueInput(node, 1);
Node* value = NodeProperties::GetValueInput(node, 2);
Node* closure = NodeProperties::GetValueInput(node, 3); Node* closure = NodeProperties::GetValueInput(node, 3);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node); Node* control = NodeProperties::GetControlInput(node);
...@@ -242,14 +245,22 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) { ...@@ -242,14 +245,22 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag), kHeapObjectTag),
effect, control); effect, control);
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); typedef StoreWithVectorDescriptor Descriptor;
node->ReplaceInput(4, vector); node->InsertInputs(zone(), 0, 1);
node->ReplaceInput(Descriptor::kReceiver, receiver);
node->ReplaceInput(Descriptor::kName, key);
node->ReplaceInput(Descriptor::kValue, value);
node->ReplaceInput(Descriptor::kSlot,
jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(7, effect); node->ReplaceInput(7, effect);
ReplaceWithStubCall(node, callable, flags); ReplaceWithStubCall(node, callable, flags);
} }
void JSGenericLowering::LowerJSStoreNamed(Node* node) { void JSGenericLowering::LowerJSStoreNamed(Node* node) {
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* value = NodeProperties::GetValueInput(node, 1);
Node* closure = NodeProperties::GetValueInput(node, 2); Node* closure = NodeProperties::GetValueInput(node, 2);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node); Node* control = NodeProperties::GetControlInput(node);
...@@ -267,15 +278,21 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) { ...@@ -267,15 +278,21 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag), kHeapObjectTag),
effect, control); effect, control);
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); typedef StoreWithVectorDescriptor Descriptor;
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); node->InsertInputs(zone(), 0, 2);
node->ReplaceInput(4, vector); node->ReplaceInput(Descriptor::kReceiver, receiver);
node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name()));
node->ReplaceInput(Descriptor::kValue, value);
node->ReplaceInput(Descriptor::kSlot,
jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(7, effect); node->ReplaceInput(7, effect);
ReplaceWithStubCall(node, callable, flags); ReplaceWithStubCall(node, callable, flags);
} }
void JSGenericLowering::LowerJSStoreGlobal(Node* node) { void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 0);
Node* closure = NodeProperties::GetValueInput(node, 1); Node* closure = NodeProperties::GetValueInput(node, 1);
Node* context = NodeProperties::GetContextInput(node); Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
...@@ -304,10 +321,14 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) { ...@@ -304,10 +321,14 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
machine()->Load(MachineType::AnyTagged()), native_context, machine()->Load(MachineType::AnyTagged()), native_context,
jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
effect, control); effect, control);
node->InsertInput(zone(), 0, global); typedef StoreWithVectorDescriptor Descriptor;
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); node->InsertInputs(zone(), 0, 3);
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); node->ReplaceInput(Descriptor::kReceiver, global);
node->ReplaceInput(4, vector); node->ReplaceInput(Descriptor::kName, jsgraph()->HeapConstant(p.name()));
node->ReplaceInput(Descriptor::kValue, value);
node->ReplaceInput(Descriptor::kSlot,
jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(Descriptor::kVector, vector);
node->ReplaceInput(7, effect); node->ReplaceInput(7, effect);
ReplaceWithStubCall(node, callable, flags); ReplaceWithStubCall(node, callable, flags);
} }
......
...@@ -193,6 +193,22 @@ void Node::InsertInput(Zone* zone, int index, Node* new_to) { ...@@ -193,6 +193,22 @@ void Node::InsertInput(Zone* zone, int index, Node* new_to) {
Verify(); Verify();
} }
void Node::InsertInputs(Zone* zone, int index, int count) {
DCHECK_NOT_NULL(zone);
DCHECK_LE(0, index);
DCHECK_LT(0, count);
DCHECK_LT(index, InputCount());
for (int i = 0; i < count; i++) {
AppendInput(zone, InputAt(Max(InputCount() - count, 0)));
}
for (int i = InputCount() - count - 1; i >= Max(index, count); --i) {
ReplaceInput(i, InputAt(i - count));
}
for (int i = 0; i < count; i++) {
ReplaceInput(index + i, nullptr);
}
Verify();
}
void Node::RemoveInput(int index) { void Node::RemoveInput(int index) {
DCHECK_LE(0, index); DCHECK_LE(0, index);
......
...@@ -100,6 +100,7 @@ class Node final { ...@@ -100,6 +100,7 @@ class Node final {
void AppendInput(Zone* zone, Node* new_to); void AppendInput(Zone* zone, Node* new_to);
void InsertInput(Zone* zone, int index, Node* new_to); void InsertInput(Zone* zone, int index, Node* new_to);
void InsertInputs(Zone* zone, int index, int count);
void RemoveInput(int index); void RemoveInput(int index);
void NullAllInputs(); void NullAllInputs();
void TrimInputCount(int new_input_count); void TrimInputCount(int new_input_count);
......
...@@ -2378,12 +2378,13 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) { ...@@ -2378,12 +2378,13 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate); TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0); DCHECK_EQ(4, args.length());
Handle<Object> key = args.at<Object>(1); typedef LoadWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
DCHECK(args.length() == 4); Handle<Object> key = args.at<Object>(Descriptor::kName);
Handle<Smi> slot = args.at<Smi>(2); Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
KeyedLoadICNexus nexus(vector, vector_slot); KeyedLoadICNexus nexus(vector, vector_slot);
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
...@@ -2422,6 +2423,35 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) { ...@@ -2422,6 +2423,35 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
DCHECK_EQ(5, args.length());
typedef StoreWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
Handle<Name> key = args.at<Name>(Descriptor::kName);
Handle<Object> value = args.at<Object>(Descriptor::kValue);
Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) {
StoreICNexus nexus(vector, vector_slot);
StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
} else {
DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC,
vector->GetKind(vector_slot));
KeyedStoreICNexus nexus(vector, vector_slot);
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
ic.UpdateState(receiver, key);
RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value));
}
}
RUNTIME_FUNCTION(Runtime_TransitionStoreIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate); TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
...@@ -2431,6 +2461,9 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { ...@@ -2431,6 +2461,9 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
int length = args.length(); int length = args.length();
DCHECK(length == 5 || length == 6); DCHECK(length == 5 || length == 6);
// TODO(ishell): use VectorStoreTransitionDescriptor indices here and update
// this comment:
//
// We might have slot and vector, for a normal miss (slot(3), vector(4)). // We might have slot and vector, for a normal miss (slot(3), vector(4)).
// Or, map and vector for a transitioning store miss (map(3), vector(4)). // Or, map and vector for a transitioning store miss (map(3), vector(4)).
// In this case, we need to recover the slot from a virtual register. // In this case, we need to recover the slot from a virtual register.
...@@ -2438,15 +2471,10 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { ...@@ -2438,15 +2471,10 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
Handle<Smi> slot; Handle<Smi> slot;
Handle<TypeFeedbackVector> vector; Handle<TypeFeedbackVector> vector;
if (length == 5) { if (length == 5) {
if (args.at<Object>(3)->IsMap()) { vector = args.at<TypeFeedbackVector>(4);
vector = args.at<TypeFeedbackVector>(4); slot = handle(
slot = handle( *reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()),
*reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()), isolate);
isolate);
} else {
vector = args.at<TypeFeedbackVector>(4);
slot = args.at<Smi>(3);
}
} else { } else {
vector = args.at<TypeFeedbackVector>(5); vector = args.at<TypeFeedbackVector>(5);
slot = args.at<Smi>(4); slot = args.at<Smi>(4);
...@@ -2468,17 +2496,15 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { ...@@ -2468,17 +2496,15 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
} }
} }
// Used from ic-<arch>.cc. // Used from ic-<arch>.cc.
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
TimerEventScope<TimerEventIcMiss> timer(isolate); TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(5, args.length());
Handle<Object> receiver = args.at<Object>(0); Handle<Object> receiver = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1); Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2); Handle<Object> value = args.at<Object>(2);
DCHECK(args.length() == 5);
Handle<Smi> slot = args.at<Smi>(3); Handle<Smi> slot = args.at<Smi>(3);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
...@@ -2493,13 +2519,14 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) { ...@@ -2493,13 +2519,14 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate); TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0); DCHECK_EQ(5, args.length());
Handle<Object> key = args.at<Object>(1); typedef StoreWithVectorDescriptor Descriptor;
Handle<Object> value = args.at<Object>(2); Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
Handle<Object> key = args.at<Object>(Descriptor::kName);
DCHECK(args.length() == 5); Handle<Object> value = args.at<Object>(Descriptor::kValue);
Handle<Smi> slot = args.at<Smi>(3); Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
KeyedStoreICNexus nexus(vector, vector_slot); KeyedStoreICNexus nexus(vector, vector_slot);
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
...@@ -2510,7 +2537,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) { ...@@ -2510,7 +2537,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 5); DCHECK_EQ(5, args.length());
Handle<Object> object = args.at<Object>(0); Handle<Object> object = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1); Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2); Handle<Object> value = args.at<Object>(2);
...@@ -2671,8 +2698,9 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) { ...@@ -2671,8 +2698,9 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft); typedef BinaryOpDescriptor Descriptor;
Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight); Handle<Object> left = args.at<Object>(Descriptor::kLeft);
Handle<Object> right = args.at<Object>(Descriptor::kRight);
BinaryOpIC ic(isolate); BinaryOpIC ic(isolate);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, ic.Transition(Handle<AllocationSite>::null(), left, right)); isolate, ic.Transition(Handle<AllocationSite>::null(), left, right));
...@@ -2684,11 +2712,11 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) { ...@@ -2684,11 +2712,11 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(3, args.length()); DCHECK_EQ(3, args.length());
typedef BinaryOpWithAllocationSiteDescriptor Descriptor;
Handle<AllocationSite> allocation_site = Handle<AllocationSite> allocation_site =
args.at<AllocationSite>(BinaryOpWithAllocationSiteStub::kAllocationSite); args.at<AllocationSite>(Descriptor::kAllocationSite);
Handle<Object> left = args.at<Object>(BinaryOpWithAllocationSiteStub::kLeft); Handle<Object> left = args.at<Object>(Descriptor::kLeft);
Handle<Object> right = Handle<Object> right = args.at<Object>(Descriptor::kRight);
args.at<Object>(BinaryOpWithAllocationSiteStub::kRight);
BinaryOpIC ic(isolate); BinaryOpIC ic(isolate);
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
ic.Transition(allocation_site, left, right)); ic.Transition(allocation_site, left, right));
...@@ -2993,12 +3021,13 @@ RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) { ...@@ -2993,12 +3021,13 @@ RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate); TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss"); TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate); HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0); DCHECK_EQ(4, args.length());
Handle<Name> key = args.at<Name>(1); typedef LoadWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
DCHECK(args.length() == 4); Handle<Name> key = args.at<Name>(Descriptor::kName);
Handle<Smi> slot = args.at<Smi>(2); Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
// A monomorphic or polymorphic KeyedLoadIC with a string key can call the // A monomorphic or polymorphic KeyedLoadIC with a string key can call the
// LoadIC miss handler if the handler misses. Since the vector Nexus is // LoadIC miss handler if the handler misses. Since the vector Nexus is
......
This diff is collapsed.
This diff is collapsed.
...@@ -38,10 +38,9 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, ...@@ -38,10 +38,9 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
made_call_(false), made_call_(false),
disable_stack_check_across_call_(false), disable_stack_check_across_call_(false),
stack_pointer_before_call_(nullptr) { stack_pointer_before_call_(nullptr) {
accumulator_.Bind( accumulator_.Bind(Parameter(InterpreterDispatchDescriptor::kAccumulator));
Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
bytecode_offset_.Bind( bytecode_offset_.Bind(
Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter)); Parameter(InterpreterDispatchDescriptor::kBytecodeOffset));
if (FLAG_trace_ignition) { if (FLAG_trace_ignition) {
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry); TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
} }
...@@ -95,12 +94,12 @@ Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { ...@@ -95,12 +94,12 @@ Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
// the debugger has swapped us to the patched debugger bytecode array. // the debugger has swapped us to the patched debugger bytecode array.
return LoadRegister(Register::bytecode_array()); return LoadRegister(Register::bytecode_array());
} else { } else {
return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter); return Parameter(InterpreterDispatchDescriptor::kBytecodeArray);
} }
} }
Node* InterpreterAssembler::DispatchTableRawPointer() { Node* InterpreterAssembler::DispatchTableRawPointer() {
return Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter); return Parameter(InterpreterDispatchDescriptor::kDispatchTable);
} }
Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
......
...@@ -26,6 +26,7 @@ namespace interpreter { ...@@ -26,6 +26,7 @@ namespace interpreter {
using compiler::Node; using compiler::Node;
typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable; typedef CodeStubAssembler::Variable Variable;
typedef InterpreterAssembler::Arg Arg;
#define __ assembler-> #define __ assembler->
...@@ -383,6 +384,7 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) { ...@@ -383,6 +384,7 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadGlobal(Callable ic, Node* Interpreter::BuildLoadGlobal(Callable ic,
InterpreterAssembler* assembler) { InterpreterAssembler* assembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
// Get the global object. // Get the global object.
Node* context = __ GetContext(); Node* context = __ GetContext();
...@@ -391,8 +393,9 @@ Node* Interpreter::BuildLoadGlobal(Callable ic, ...@@ -391,8 +393,9 @@ Node* Interpreter::BuildLoadGlobal(Callable ic,
Node* raw_slot = __ BytecodeOperandIdx(0); Node* raw_slot = __ BytecodeOperandIdx(0);
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
return __ CallStub(ic.descriptor(), code_target, context, smi_slot, return __ CallStub(ic.descriptor(), code_target, context,
type_feedback_vector); Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
} }
// LdaGlobal <slot> // LdaGlobal <slot>
...@@ -433,6 +436,7 @@ void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { ...@@ -433,6 +436,7 @@ void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
} }
void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
// Get the global object. // Get the global object.
Node* context = __ GetContext(); Node* context = __ GetContext();
Node* native_context = Node* native_context =
...@@ -447,8 +451,10 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { ...@@ -447,8 +451,10 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
Node* raw_slot = __ BytecodeOperandIdx(1); Node* raw_slot = __ BytecodeOperandIdx(1);
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
__ CallStub(ic.descriptor(), code_target, context, global, name, value, __ CallStub(ic.descriptor(), code_target, context,
smi_slot, type_feedback_vector); Arg(Descriptor::kReceiver, global), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch(); __ Dispatch();
} }
...@@ -567,6 +573,7 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { ...@@ -567,6 +573,7 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadNamedProperty(Callable ic, Node* Interpreter::BuildLoadNamedProperty(Callable ic,
InterpreterAssembler* assembler) { InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code()); Node* code_target = __ HeapConstant(ic.code());
Node* register_index = __ BytecodeOperandReg(0); Node* register_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(register_index); Node* object = __ LoadRegister(register_index);
...@@ -576,8 +583,10 @@ Node* Interpreter::BuildLoadNamedProperty(Callable ic, ...@@ -576,8 +583,10 @@ Node* Interpreter::BuildLoadNamedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext(); Node* context = __ GetContext();
return __ CallStub(ic.descriptor(), code_target, context, object, name, return __ CallStub(
smi_slot, type_feedback_vector); ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
} }
// LdaNamedProperty <object> <name_index> <slot> // LdaNamedProperty <object> <name_index> <slot>
...@@ -605,6 +614,7 @@ void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { ...@@ -605,6 +614,7 @@ void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadKeyedProperty(Callable ic, Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
InterpreterAssembler* assembler) { InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code()); Node* code_target = __ HeapConstant(ic.code());
Node* reg_index = __ BytecodeOperandReg(0); Node* reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(reg_index); Node* object = __ LoadRegister(reg_index);
...@@ -613,8 +623,10 @@ Node* Interpreter::BuildLoadKeyedProperty(Callable ic, ...@@ -613,8 +623,10 @@ Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext(); Node* context = __ GetContext();
return __ CallStub(ic.descriptor(), code_target, context, object, name, return __ CallStub(
smi_slot, type_feedback_vector); ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
} }
// KeyedLoadIC <object> <slot> // KeyedLoadIC <object> <slot>
...@@ -641,6 +653,7 @@ void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { ...@@ -641,6 +653,7 @@ void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
} }
void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code()); Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0); Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index); Node* object = __ LoadRegister(object_reg_index);
...@@ -651,8 +664,10 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { ...@@ -651,8 +664,10 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext(); Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context, object, name, value, __ CallStub(ic.descriptor(), code_target, context,
smi_slot, type_feedback_vector); Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch(); __ Dispatch();
} }
...@@ -677,6 +692,7 @@ void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) { ...@@ -677,6 +692,7 @@ void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) {
} }
void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code()); Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0); Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index); Node* object = __ LoadRegister(object_reg_index);
...@@ -687,8 +703,10 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { ...@@ -687,8 +703,10 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot); Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector(); Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext(); Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context, object, name, value, __ CallStub(ic.descriptor(), code_target, context,
smi_slot, type_feedback_vector); Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch(); __ Dispatch();
} }
......
...@@ -924,28 +924,29 @@ namespace internal { ...@@ -924,28 +924,29 @@ namespace internal {
// Most intrinsics are implemented in the runtime/ directory, but ICs are // Most intrinsics are implemented in the runtime/ directory, but ICs are
// implemented in ic.cc for now. // implemented in ic.cc for now.
#define FOR_EACH_INTRINSIC_IC(F) \ #define FOR_EACH_INTRINSIC_IC(F) \
F(BinaryOpIC_Miss, 2, 1) \ F(BinaryOpIC_Miss, 2, 1) \
F(BinaryOpIC_MissWithAllocationSite, 3, 1) \ F(BinaryOpIC_MissWithAllocationSite, 3, 1) \
F(CallIC_Miss, 3, 1) \ F(CallIC_Miss, 3, 1) \
F(CompareIC_Miss, 3, 1) \ F(CompareIC_Miss, 3, 1) \
F(ElementsTransitionAndStoreIC_Miss, 5, 1) \ F(ElementsTransitionAndStoreIC_Miss, 5, 1) \
F(KeyedLoadIC_Miss, 4, 1) \ F(KeyedLoadIC_Miss, 4, 1) \
F(KeyedLoadIC_MissFromStubFailure, 4, 1) \ F(KeyedLoadIC_MissFromStubFailure, 4, 1) \
F(KeyedStoreIC_Miss, 5, 1) \ F(KeyedStoreIC_Miss, 5, 1) \
F(KeyedStoreIC_MissFromStubFailure, 5, 1) \ F(KeyedStoreIC_MissFromStubFailure, 5, 1) \
F(KeyedStoreIC_Slow, 5, 1) \ F(KeyedStoreIC_Slow, 5, 1) \
F(LoadElementWithInterceptor, 2, 1) \ F(LoadElementWithInterceptor, 2, 1) \
F(LoadGlobalIC_Miss, 2, 1) \ F(LoadGlobalIC_Miss, 2, 1) \
F(LoadIC_Miss, 4, 1) \ F(LoadIC_Miss, 4, 1) \
F(LoadIC_MissFromStubFailure, 4, 1) \ F(LoadIC_MissFromStubFailure, 4, 1) \
F(LoadPropertyWithInterceptor, 3, 1) \ F(LoadPropertyWithInterceptor, 3, 1) \
F(LoadPropertyWithInterceptorOnly, 3, 1) \ F(LoadPropertyWithInterceptorOnly, 3, 1) \
F(StoreCallbackProperty, 6, 1) \ F(StoreCallbackProperty, 6, 1) \
F(StoreIC_Miss, 5, 1) \ F(StoreIC_Miss, 5, 1) \
F(StoreIC_MissFromStubFailure, 5, 1) \ F(StoreIC_MissFromStubFailure, 5, 1) \
F(StorePropertyWithInterceptor, 3, 1) \ F(TransitionStoreIC_MissFromStubFailure, 6, 1) \
F(ToBooleanIC_Miss, 1, 1) \ F(StorePropertyWithInterceptor, 3, 1) \
F(ToBooleanIC_Miss, 1, 1) \
F(Unreachable, 0, 1) F(Unreachable, 0, 1)
#define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \ #define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
......
...@@ -320,6 +320,80 @@ TEST(Inputs) { ...@@ -320,6 +320,80 @@ TEST(Inputs) {
CHECK_USES(n4, n3, n3, n5); CHECK_USES(n4, n3, n3, n5);
} }
TEST(InsertInputs) {
base::AccountingAllocator allocator;
Zone zone(&allocator);
Graph graph(&zone);
Node* n0 = graph.NewNode(&dummy_operator0);
Node* n1 = graph.NewNode(&dummy_operator1, n0);
Node* n2 = graph.NewNode(&dummy_operator1, n0);
{
Node* node = graph.NewNode(&dummy_operator1, n0);
node->InsertInputs(graph.zone(), 0, 1);
node->ReplaceInput(0, n1);
CHECK_INPUTS(node, n1, n0);
}
{
Node* node = graph.NewNode(&dummy_operator1, n0);
node->InsertInputs(graph.zone(), 0, 2);
node->ReplaceInput(0, node);
node->ReplaceInput(1, n2);
CHECK_INPUTS(node, node, n2, n0);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 0, 1);
node->ReplaceInput(0, node);
CHECK_INPUTS(node, node, n0, n1, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 1, 1);
node->ReplaceInput(1, node);
CHECK_INPUTS(node, n0, node, n1, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 2, 1);
node->ReplaceInput(2, node);
CHECK_INPUTS(node, n0, n1, node, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 2, 1);
node->ReplaceInput(2, node);
CHECK_INPUTS(node, n0, n1, node, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 0, 4);
node->ReplaceInput(0, node);
node->ReplaceInput(1, node);
node->ReplaceInput(2, node);
node->ReplaceInput(3, node);
CHECK_INPUTS(node, node, node, node, node, n0, n1, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 1, 4);
node->ReplaceInput(1, node);
node->ReplaceInput(2, node);
node->ReplaceInput(3, node);
node->ReplaceInput(4, node);
CHECK_INPUTS(node, n0, node, node, node, node, n1, n2);
}
{
Node* node = graph.NewNode(&dummy_operator3, n0, n1, n2);
node->InsertInputs(graph.zone(), 2, 4);
node->ReplaceInput(2, node);
node->ReplaceInput(3, node);
node->ReplaceInput(4, node);
node->ReplaceInput(5, node);
CHECK_INPUTS(node, n0, n1, node, node, node, node, n2);
}
}
TEST(RemoveInput) { TEST(RemoveInput) {
base::AccountingAllocator allocator; base::AccountingAllocator allocator;
......
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