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,
ToPrimitiveHint hint) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0);
Node* context = assembler->Parameter(1);
Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(Descriptor::kContext);
// Lookup the @@toPrimitive property on the {input}.
Callable callable = CodeFactory::GetProperty(assembler->isolate());
......@@ -113,9 +114,10 @@ void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0);
Node* context = assembler->Parameter(1);
Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(Descriptor::kContext);
// We might need to loop once here due to ToPrimitive conversions.
Variable var_input(assembler, MachineRepresentation::kTagged);
......@@ -224,9 +226,10 @@ void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler,
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
typedef TypeConversionDescriptor Descriptor;
Node* input = assembler->Parameter(0);
Node* context = assembler->Parameter(1);
Node* input = assembler->Parameter(Descriptor::kArgument);
Node* context = assembler->Parameter(Descriptor::kContext);
Variable var_result(assembler, MachineRepresentation::kTagged);
Label return_result(assembler, &var_result);
......@@ -304,8 +307,9 @@ void Builtins::Generate_OrdinaryToPrimitive_String(
void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) {
typedef compiler::Node Node;
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);
assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false);
......
......@@ -39,10 +39,11 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* slot = assembler->Parameter(0);
Node* vector = assembler->Parameter(1);
Node* context = assembler->Parameter(2);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot,
vector);
......@@ -51,10 +52,11 @@ void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) {
namespace {
void Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler, TypeofMode mode) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* slot = assembler->Parameter(0);
Node* vector = assembler->Parameter(1);
Node* context = assembler->Parameter(2);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* typeof_mode = assembler->SmiConstant(Smi::FromInt(mode));
assembler->TailCallRuntime(Runtime::kGetGlobal, context, slot, vector,
......@@ -78,12 +80,13 @@ void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* slot = assembler->Parameter(2);
Node* vector = assembler->Parameter(3);
Node* context = assembler->Parameter(4);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name,
slot, vector);
......@@ -95,25 +98,25 @@ void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) {
void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
// Node* slot = assembler->Parameter(2);
// Node* vector = assembler->Parameter(3);
Node* context = assembler->Parameter(4);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
}
void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* value = assembler->Parameter(2);
Node* slot = assembler->Parameter(3);
Node* vector = assembler->Parameter(4);
Node* context = assembler->Parameter(5);
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);
assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, receiver, name,
value, slot, vector);
......@@ -131,13 +134,12 @@ namespace {
void Generate_StoreIC_Slow(CodeStubAssembler* assembler,
LanguageMode language_mode) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* value = assembler->Parameter(2);
// Node* slot = assembler->Parameter(3);
// Node* vector = assembler->Parameter(4);
Node* context = assembler->Parameter(5);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(Descriptor::kValue);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode));
// The slow case calls into the runtime to complete the store without causing
......
......@@ -3045,9 +3045,12 @@ void CodeStubAssembler::LoadIC(const LoadICParameters* p) {
// |handler| is a heap object. Must be code, call it.
Bind(&call_handler);
LoadWithVectorDescriptor descriptor(isolate());
TailCallStub(descriptor, handler, p->context, p->receiver, p->name, p->slot,
p->vector);
typedef LoadWithVectorDescriptor Descriptor;
TailCallStub(Descriptor(isolate()), var_handler.value(), p->context,
Arg(Descriptor::kReceiver, p->receiver),
Arg(Descriptor::kName, p->name),
Arg(Descriptor::kSlot, p->slot),
Arg(Descriptor::kVector, p->vector));
}
Bind(&try_polymorphic);
......
......@@ -189,6 +189,8 @@ class CodeStubGraphBuilder: public CodeStubGraphBuilderBase {
explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub)
: CodeStubGraphBuilderBase(info, stub) {}
typedef typename Stub::Descriptor Descriptor;
protected:
virtual HValue* BuildCodeStub() {
if (casted_stub()->IsUninitialized()) {
......@@ -287,7 +289,7 @@ static Handle<Code> DoGenerateCode(Stub* stub) {
template <>
HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
info()->MarkAsSavesCallerDoubles();
HValue* number = GetParameter(NumberToStringStub::kNumber);
HValue* number = GetParameter(Descriptor::kArgument);
return BuildNumberToString(number, Type::Number());
}
......@@ -302,7 +304,7 @@ template <>
HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
Factory* factory = isolate()->factory();
HConstant* number_string = Add<HConstant>(factory->number_string());
HValue* object = GetParameter(TypeofStub::kObject);
HValue* object = GetParameter(Descriptor::kObject);
IfBuilder is_smi(this);
HValue* smi_check = is_smi.If<HIsSmiAndBranch>(object);
......@@ -407,8 +409,8 @@ Handle<Code> TypeofStub::GenerateCode() { return DoGenerateCode(this); }
template <>
HValue* CodeStubGraphBuilder<FastCloneRegExpStub>::BuildCodeStub() {
HValue* closure = GetParameter(0);
HValue* literal_index = GetParameter(1);
HValue* closure = GetParameter(Descriptor::kClosure);
HValue* literal_index = GetParameter(Descriptor::kLiteralIndex);
// This stub is very performance sensitive, the generated code must be tuned
// so that it doesn't build and eager frame.
......@@ -467,8 +469,8 @@ HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() {
Factory* factory = isolate()->factory();
HValue* undefined = graph()->GetConstantUndefined();
AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode();
HValue* closure = GetParameter(0);
HValue* literal_index = GetParameter(1);
HValue* closure = GetParameter(Descriptor::kClosure);
HValue* literal_index = GetParameter(Descriptor::kLiteralIndex);
// TODO(turbofan): This codestub has regressed to need a frame on ia32 at some
// point and wasn't caught since it wasn't built in the snapshot. We should
......@@ -607,8 +609,8 @@ HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(),
object);
HInstruction* feedback_vector = GetParameter(0);
HInstruction* slot = GetParameter(1);
HInstruction* feedback_vector = GetParameter(Descriptor::kVector);
HInstruction* slot = GetParameter(Descriptor::kSlot);
Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS,
INITIALIZING_STORE);
return feedback_vector;
......@@ -634,14 +636,13 @@ HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() {
Handle<Map> weak_cell_map = isolate()->factory()->weak_cell_map();
AddStoreMapConstant(object, weak_cell_map);
HInstruction* value = GetParameter(CreateWeakCellDescriptor::kValueIndex);
HInstruction* value = GetParameter(Descriptor::kValue);
Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellValue(), value);
Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellNext(),
graph()->GetConstantHole());
HInstruction* feedback_vector =
GetParameter(CreateWeakCellDescriptor::kVectorIndex);
HInstruction* slot = GetParameter(CreateWeakCellDescriptor::kSlotIndex);
HInstruction* feedback_vector = GetParameter(Descriptor::kVector);
HInstruction* slot = GetParameter(Descriptor::kSlot);
Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS,
INITIALIZING_STORE);
return graph()->GetConstant0();
......@@ -676,6 +677,7 @@ HValue* CodeStubGraphBuilder<StoreScriptContextFieldStub>::BuildCodeStub() {
Add<HStoreNamedField>(script_context,
HObjectAccess::ForContextSlot(slot_index),
GetParameter(2), STORE_TO_INITIALIZED_ENTRY);
// TODO(ishell): Remove this unused stub.
return GetParameter(2);
}
......@@ -1073,8 +1075,8 @@ HValue* CodeStubGraphBuilder<GrowArrayElementsStub>::BuildCodeStub() {
info()->MarkAsSavesCallerDoubles();
}
HValue* object = GetParameter(GrowArrayElementsDescriptor::kObjectIndex);
HValue* key = GetParameter(GrowArrayElementsDescriptor::kKeyIndex);
HValue* object = GetParameter(Descriptor::kObject);
HValue* key = GetParameter(Descriptor::kKey);
HValue* elements = AddLoadElements(object);
HValue* current_capacity = Add<HLoadNamedField>(
......@@ -1103,9 +1105,8 @@ HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() {
: NEVER_RETURN_HOLE;
HInstruction* load = BuildUncheckedMonomorphicElementAccess(
GetParameter(LoadDescriptor::kReceiverIndex),
GetParameter(LoadDescriptor::kNameIndex), NULL,
casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD,
GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName),
NULL, casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD,
hole_mode, STANDARD_STORE);
return load;
}
......@@ -1139,7 +1140,8 @@ HLoadNamedField* CodeStubGraphBuilderBase::BuildLoadNamedField(
template<>
HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() {
return BuildLoadNamedField(GetParameter(0), casted_stub()->index());
return BuildLoadNamedField(GetParameter(Descriptor::kReceiver),
casted_stub()->index());
}
......@@ -1150,7 +1152,7 @@ Handle<Code> LoadFieldStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() {
HValue* map = AddLoadMap(GetParameter(0), NULL);
HValue* map = AddLoadMap(GetParameter(Descriptor::kReceiver), NULL);
HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset(
Map::kDescriptorsOffset, Representation::Tagged());
HValue* descriptors = Add<HLoadNamedField>(map, nullptr, descriptors_access);
......@@ -1285,8 +1287,8 @@ HValue* CodeStubGraphBuilderBase::EmitKeyedSloppyArguments(HValue* receiver,
template <>
HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() {
HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
HValue* key = GetParameter(LoadDescriptor::kNameIndex);
HValue* receiver = GetParameter(Descriptor::kReceiver);
HValue* key = GetParameter(Descriptor::kName);
return EmitKeyedSloppyArguments(receiver, key, NULL);
}
......@@ -1299,9 +1301,9 @@ Handle<Code> KeyedLoadSloppyArgumentsStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<KeyedStoreSloppyArgumentsStub>::BuildCodeStub() {
HValue* receiver = GetParameter(StoreDescriptor::kReceiverIndex);
HValue* key = GetParameter(StoreDescriptor::kNameIndex);
HValue* value = GetParameter(StoreDescriptor::kValueIndex);
HValue* receiver = GetParameter(Descriptor::kReceiver);
HValue* key = GetParameter(Descriptor::kName);
HValue* value = GetParameter(Descriptor::kValue);
return EmitKeyedSloppyArguments(receiver, key, value);
}
......@@ -1359,9 +1361,10 @@ void CodeStubGraphBuilderBase::BuildStoreNamedField(
template <>
HValue* CodeStubGraphBuilder<StoreFieldStub>::BuildCodeStub() {
BuildStoreNamedField(GetParameter(0), GetParameter(2), casted_stub()->index(),
BuildStoreNamedField(GetParameter(Descriptor::kReceiver),
GetParameter(Descriptor::kValue), casted_stub()->index(),
casted_stub()->representation(), false);
return GetParameter(2);
return GetParameter(Descriptor::kValue);
}
......@@ -1435,13 +1438,12 @@ Handle<Code> StoreTransitionStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<StoreFastElementStub>::BuildCodeStub() {
BuildUncheckedMonomorphicElementAccess(
GetParameter(StoreDescriptor::kReceiverIndex),
GetParameter(StoreDescriptor::kNameIndex),
GetParameter(StoreDescriptor::kValueIndex), casted_stub()->is_js_array(),
GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName),
GetParameter(Descriptor::kValue), casted_stub()->is_js_array(),
casted_stub()->elements_kind(), STORE, NEVER_RETURN_HOLE,
casted_stub()->store_mode());
return GetParameter(2);
return GetParameter(Descriptor::kValue);
}
......@@ -1454,8 +1456,8 @@ template <>
HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() {
ElementsKind const from_kind = casted_stub()->from_kind();
ElementsKind const to_kind = casted_stub()->to_kind();
HValue* const object = GetParameter(0);
HValue* const map = GetParameter(1);
HValue* const object = GetParameter(Descriptor::kObject);
HValue* const map = GetParameter(Descriptor::kMap);
// The {object} is known to be a JSObject (otherwise it wouldn't have elements
// anyways).
......@@ -1518,8 +1520,8 @@ template <>
HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
BinaryOpICState state = casted_stub()->state();
HValue* left = GetParameter(BinaryOpICStub::kLeft);
HValue* right = GetParameter(BinaryOpICStub::kRight);
HValue* left = GetParameter(Descriptor::kLeft);
HValue* right = GetParameter(Descriptor::kRight);
Type* left_type = state.GetLeftType();
Type* right_type = state.GetRightType();
......@@ -1595,10 +1597,9 @@ template <>
HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() {
BinaryOpICState state = casted_stub()->state();
HValue* allocation_site = GetParameter(
BinaryOpWithAllocationSiteStub::kAllocationSite);
HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft);
HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight);
HValue* allocation_site = GetParameter(Descriptor::kAllocationSite);
HValue* left = GetParameter(Descriptor::kLeft);
HValue* right = GetParameter(Descriptor::kRight);
Type* left_type = state.GetLeftType();
Type* right_type = state.GetRightType();
......@@ -1755,8 +1756,8 @@ HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() {
StringAddFlags flags = stub->flags();
PretenureFlag pretenure_flag = stub->pretenure_flag();
HValue* left = GetParameter(StringAddStub::kLeft);
HValue* right = GetParameter(StringAddStub::kRight);
HValue* left = GetParameter(Descriptor::kLeft);
HValue* right = GetParameter(Descriptor::kRight);
// Make sure that both arguments are strings if not known in advance.
if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) {
......@@ -1780,7 +1781,7 @@ template <>
HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() {
ToBooleanICStub* stub = casted_stub();
IfBuilder if_true(this);
if_true.If<HBranch>(GetParameter(0), stub->types());
if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->types());
if_true.Then();
if_true.Return(graph()->GetConstantTrue());
if_true.Else();
......@@ -1793,11 +1794,11 @@ Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); }
template <>
HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() {
StoreGlobalStub* stub = casted_stub();
HParameter* value = GetParameter(StoreDescriptor::kValueIndex);
HParameter* value = GetParameter(Descriptor::kValue);
if (stub->check_global()) {
// Check that the map of the global has not changed: use a placeholder map
// that will be replaced later with the global object's map.
HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex);
HParameter* proxy = GetParameter(Descriptor::kReceiver);
HValue* proxy_map =
Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap());
HValue* global =
......@@ -1920,7 +1921,7 @@ Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() {
template <>
HValue* CodeStubGraphBuilder<ToObjectStub>::BuildCodeStub() {
HValue* receiver = GetParameter(TypeConversionDescriptor::kArgumentIndex);
HValue* receiver = GetParameter(Descriptor::kArgument);
return BuildToObject(receiver);
}
......@@ -1929,8 +1930,8 @@ Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); }
template <>
HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() {
HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
HValue* key = GetParameter(LoadDescriptor::kNameIndex);
HValue* receiver = GetParameter(Descriptor::kReceiver);
HValue* key = GetParameter(Descriptor::kName);
Add<HCheckSmi>(key);
......@@ -1950,9 +1951,9 @@ Handle<Code> LoadDictionaryElementStub::GenerateCode() {
template<>
HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() {
// Determine the parameters.
HValue* length = GetParameter(RegExpConstructResultStub::kLength);
HValue* index = GetParameter(RegExpConstructResultStub::kIndex);
HValue* input = GetParameter(RegExpConstructResultStub::kInput);
HValue* length = GetParameter(Descriptor::kLength);
HValue* index = GetParameter(Descriptor::kIndex);
HValue* input = GetParameter(Descriptor::kInput);
// TODO(turbofan): This codestub has regressed to need a frame on ia32 at some
// point and wasn't caught since it wasn't built in the snapshot. We should
......@@ -1977,6 +1978,8 @@ class CodeStubGraphBuilder<KeyedLoadGenericStub>
explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub)
: CodeStubGraphBuilderBase(info, stub) {}
typedef KeyedLoadGenericStub::Descriptor Descriptor;
protected:
virtual HValue* BuildCodeStub();
......@@ -2032,8 +2035,8 @@ void CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildFastElementLoad(
HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() {
HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
HValue* key = GetParameter(LoadDescriptor::kNameIndex);
HValue* receiver = GetParameter(Descriptor::kReceiver);
HValue* key = GetParameter(Descriptor::kName);
// Split into a smi/integer case and unique string case.
HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(),
graph()->CreateBasicBlock());
......
......@@ -421,10 +421,10 @@ void LoadICTrampolineTFStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* slot = assembler->Parameter(2);
Node* context = assembler->Parameter(3);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* vector = assembler->LoadTypeFeedbackVectorForStub();
CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
......@@ -434,11 +434,11 @@ void LoadICTrampolineTFStub::GenerateAssembly(
void LoadICTFStub::GenerateAssembly(CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* slot = assembler->Parameter(2);
Node* vector = assembler->Parameter(3);
Node* context = assembler->Parameter(4);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
assembler->LoadIC(&p);
......@@ -448,8 +448,8 @@ void LoadGlobalICTrampolineStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* slot = assembler->Parameter(0);
Node* context = assembler->Parameter(1);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* vector = assembler->LoadTypeFeedbackVectorForStub();
CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
......@@ -460,9 +460,9 @@ void LoadGlobalICTrampolineStub::GenerateAssembly(
void LoadGlobalICStub::GenerateAssembly(CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* slot = assembler->Parameter(0);
Node* vector = assembler->Parameter(1);
Node* context = assembler->Parameter(2);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
CodeStubAssembler::LoadICParameters p(context, nullptr, nullptr, slot,
vector);
......@@ -3559,8 +3559,8 @@ void GenerateStringEqual(CodeStubAssembler* assembler, ResultMode mode) {
void LoadApiGetterStub::GenerateAssembly(CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* context = assembler->Parameter(3);
Node* receiver = assembler->Parameter(0);
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;
......@@ -3805,12 +3805,11 @@ void ToIntegerStub::GenerateAssembly(CodeStubAssembler* assembler) const {
void StoreInterceptorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* receiver = assembler->Parameter(0);
Node* name = assembler->Parameter(1);
Node* value = assembler->Parameter(2);
// Node* slot = assembler->Parameter(3);
// Node* vector = assembler->Parameter(4);
Node* context = assembler->Parameter(5);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(Descriptor::kValue);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context,
receiver, name, value);
}
......@@ -3819,11 +3818,12 @@ void LoadIndexedInterceptorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
typedef CodeStubAssembler::Label Label;
Node* receiver = assembler->Parameter(0);
Node* key = assembler->Parameter(1);
Node* slot = assembler->Parameter(2);
Node* vector = assembler->Parameter(3);
Node* context = assembler->Parameter(4);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* key = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler);
assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi,
......@@ -4065,16 +4065,9 @@ void ToObjectStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
descriptor->Initialize(Runtime::FunctionForId(Runtime::kToObject)->entry);
}
CallInterfaceDescriptor StoreTransitionStub::GetCallInterfaceDescriptor()
const {
return VectorStoreTransitionDescriptor(isolate());
}
CallInterfaceDescriptor
ElementsTransitionAndStoreStub::GetCallInterfaceDescriptor() const {
return VectorStoreTransitionDescriptor(isolate());
void StoreTransitionStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
descriptor->Initialize(
FUNCTION_ADDR(Runtime_TransitionStoreIC_MissFromStubFailure));
}
void TypeofStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {}
......@@ -4499,10 +4492,8 @@ void FastNewFunctionContextStub::GenerateAssembly(
int size = length * kPointerSize + FixedArray::kHeaderSize;
// Get the function
Node* function =
assembler->Parameter(FastNewFunctionContextDescriptor::kFunctionIndex);
Node* context =
assembler->Parameter(FastNewFunctionContextDescriptor::kContextIndex);
Node* function = assembler->Parameter(Descriptor::kFunction);
Node* context = assembler->Parameter(Descriptor::kContext);
// Create a new closure from the given function info in new space
Node* function_context = assembler->Allocate(size);
......@@ -4692,17 +4683,13 @@ void ArrayNoArgumentConstructorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* native_context = assembler->LoadObjectField(
assembler->Parameter(
ArrayNoArgumentConstructorDescriptor::kFunctionIndex),
JSFunction::kContextOffset);
assembler->Parameter(Descriptor::kFunction), JSFunction::kContextOffset);
bool track_allocation_site =
AllocationSite::GetMode(elements_kind()) == TRACK_ALLOCATION_SITE &&
override_mode() != DISABLE_ALLOCATION_SITES;
Node* allocation_site =
track_allocation_site
? assembler->Parameter(
ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex)
: nullptr;
track_allocation_site ? assembler->Parameter(Descriptor::kAllocationSite)
: nullptr;
Node* array_map =
assembler->LoadJSArrayElementsMap(elements_kind(), native_context);
Node* array = assembler->AllocateJSArray(
......@@ -4715,10 +4702,9 @@ void ArrayNoArgumentConstructorStub::GenerateAssembly(
void InternalArrayNoArgumentConstructorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* array_map = assembler->LoadObjectField(
assembler->Parameter(
ArrayNoArgumentConstructorDescriptor::kFunctionIndex),
JSFunction::kPrototypeOrInitialMapOffset);
Node* array_map =
assembler->LoadObjectField(assembler->Parameter(Descriptor::kFunction),
JSFunction::kPrototypeOrInitialMapOffset);
Node* array = assembler->AllocateJSArray(
elements_kind(), array_map,
assembler->IntPtrConstant(JSArray::kPreallocatedArrayElements),
......@@ -4728,6 +4714,7 @@ void InternalArrayNoArgumentConstructorStub::GenerateAssembly(
namespace {
template <typename Descriptor>
void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
ElementsKind elements_kind,
compiler::Node* array_map,
......@@ -4741,8 +4728,7 @@ void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
Label small_smi_size(assembler);
Label call_runtime(assembler, Label::kDeferred);
Node* size = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kArraySizeSmiParameterIndex);
Node* size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
assembler->Branch(assembler->WordIsSmi(size), &smi_size, &call_runtime);
assembler->Bind(&smi_size);
......@@ -4756,8 +4742,7 @@ void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
assembler->Bind(&abort);
Node* reason =
assembler->SmiConstant(Smi::FromInt(kAllocatingNonEmptyPackedArray));
Node* context = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kContextIndex);
Node* context = assembler->Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kAbort, context, reason);
} else {
int element_size =
......@@ -4783,14 +4768,10 @@ void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
assembler->Bind(&call_runtime);
{
Node* context = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kContextIndex);
Node* function = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
Node* array_size = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kArraySizeSmiParameterIndex);
Node* allocation_site = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kAllocationSiteIndex);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* function = assembler->Parameter(Descriptor::kFunction);
Node* array_size = assembler->Parameter(Descriptor::kArraySizeSmiParameter);
Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
assembler->TailCallRuntime(Runtime::kNewArray, context, function,
array_size, function, allocation_site);
}
......@@ -4800,8 +4781,7 @@ void SingleArgumentConstructorCommon(CodeStubAssembler* assembler,
void ArraySingleArgumentConstructorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* function = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
Node* function = assembler->Parameter(Descriptor::kFunction);
Node* native_context =
assembler->LoadObjectField(function, JSFunction::kContextOffset);
Node* array_map =
......@@ -4809,22 +4789,20 @@ void ArraySingleArgumentConstructorStub::GenerateAssembly(
AllocationSiteMode mode = override_mode() == DISABLE_ALLOCATION_SITES
? DONT_TRACK_ALLOCATION_SITE
: AllocationSite::GetMode(elements_kind());
Node* allocation_site = assembler->Parameter(
ArrayNoArgumentConstructorDescriptor::kAllocationSiteIndex);
SingleArgumentConstructorCommon(assembler, elements_kind(), array_map,
allocation_site, mode);
Node* allocation_site = assembler->Parameter(Descriptor::kAllocationSite);
SingleArgumentConstructorCommon<Descriptor>(assembler, elements_kind(),
array_map, allocation_site, mode);
}
void InternalArraySingleArgumentConstructorStub::GenerateAssembly(
CodeStubAssembler* assembler) const {
typedef compiler::Node Node;
Node* function = assembler->Parameter(
ArraySingleArgumentConstructorDescriptor::kFunctionIndex);
Node* function = assembler->Parameter(Descriptor::kFunction);
Node* array_map = assembler->LoadObjectField(
function, JSFunction::kPrototypeOrInitialMapOffset);
SingleArgumentConstructorCommon(assembler, elements_kind(), array_map,
assembler->UndefinedConstant(),
DONT_TRACK_ALLOCATION_SITE);
SingleArgumentConstructorCommon<Descriptor>(
assembler, elements_kind(), array_map, assembler->UndefinedConstant(),
DONT_TRACK_ALLOCATION_SITE);
}
ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
......
......@@ -431,8 +431,9 @@ class CodeStub BASE_EMBEDDED {
#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
public: \
typedef NAME##Descriptor Descriptor; \
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
return NAME##Descriptor(isolate()); \
return Descriptor(isolate()); \
}
#define DEFINE_ON_STACK_CALL_INTERFACE_DESCRIPTOR(PARAMETER_COUNT) \
......@@ -1023,9 +1024,6 @@ class NumberToStringStub final : public HydrogenCodeStub {
public:
explicit NumberToStringStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kNumber = 0;
DEFINE_CALL_INTERFACE_DESCRIPTOR(TypeConversion);
DEFINE_HYDROGEN_CODE_STUB(NumberToString, HydrogenCodeStub);
};
......@@ -1035,9 +1033,6 @@ class TypeofStub final : public HydrogenCodeStub {
public:
explicit TypeofStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kObject = 0;
static void GenerateAheadOfTime(Isolate* isolate);
DEFINE_CALL_INTERFACE_DESCRIPTOR(Typeof);
......@@ -1448,6 +1443,8 @@ class LoadFieldStub: public HandlerStub {
private:
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);
};
......@@ -1460,7 +1457,7 @@ class KeyedLoadSloppyArgumentsStub : public HandlerStub {
protected:
Code::Kind kind() const override { return Code::KEYED_LOAD_IC; }
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(KeyedLoadSloppyArguments, HandlerStub);
};
......@@ -1478,7 +1475,7 @@ class KeyedStoreSloppyArgumentsStub : public HandlerStub {
protected:
Code::Kind kind() const override { return Code::KEYED_STORE_IC; }
private:
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(KeyedStoreSloppyArguments, HandlerStub);
};
......@@ -1500,6 +1497,8 @@ class LoadConstantStub : public HandlerStub {
private:
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);
};
......@@ -1558,6 +1557,8 @@ class StoreFieldStub : public HandlerStub {
class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
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);
};
......@@ -1591,25 +1592,23 @@ class StoreTransitionHelper {
return VectorStoreTransitionDescriptor::MapRegister();
}
static int ReceiverIndex() {
return StoreTransitionDescriptor::kReceiverIndex;
}
static int ReceiverIndex() { return StoreTransitionDescriptor::kReceiver; }
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() {
DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMapIndex) ==
static_cast<int>(StoreTransitionDescriptor::kMapIndex));
return StoreTransitionDescriptor::kMapIndex;
DCHECK(static_cast<int>(VectorStoreTransitionDescriptor::kMap) ==
static_cast<int>(StoreTransitionDescriptor::kMap));
return StoreTransitionDescriptor::kMap;
}
static int VectorIndex() {
if (HasVirtualSlotArg()) {
return VectorStoreTransitionDescriptor::kVirtualSlotVectorIndex;
return VectorStoreTransitionDescriptor::kVirtualSlotVector;
}
return VectorStoreTransitionDescriptor::kVectorIndex;
return VectorStoreTransitionDescriptor::kVector;
}
// Some platforms don't have a slot arg.
......@@ -1658,16 +1657,16 @@ class StoreTransitionStub : public HandlerStub {
return StoreModeBits::decode(sub_minor_key());
}
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
protected:
Code::Kind kind() const override { return Code::STORE_IC; }
void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
private:
class StoreFieldByIndexBits : public BitField<int, 0, 13> {};
class RepresentationBits : public BitField<uint8_t, 13, 4> {};
class StoreModeBits : public BitField<StoreMode, 17, 2> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
DEFINE_HANDLER_CODE_STUB(StoreTransition, HandlerStub);
};
......@@ -1733,10 +1732,12 @@ class StoreGlobalStub : public HandlerStub {
class RepresentationBits : public BitField<Representation::Kind, 4, 8> {};
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);
};
// TODO(ishell): remove, once StoreGlobalIC is implemented.
class StoreGlobalViaContextStub final : public PlatformCodeStub {
public:
static const int kMaximumDepth = 15;
......@@ -1847,10 +1848,6 @@ class BinaryOpICStub : public HydrogenCodeStub {
void PrintState(std::ostream& os) const final; // NOLINT
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
static const int kRight = 1;
private:
static void GenerateAheadOfTime(Isolate* isolate,
const BinaryOpICState& state);
......@@ -1909,11 +1906,6 @@ class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub {
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_HYDROGEN_CODE_STUB(BinaryOpWithAllocationSite, BinaryOpICStub);
};
......@@ -1936,10 +1928,6 @@ class StringAddStub final : public HydrogenCodeStub {
return PretenureFlagBits::decode(sub_minor_key());
}
// Parameters accessed via CodeStubGraphBuilder::GetParameter()
static const int kLeft = 0;
static const int kRight = 1;
private:
class StringAddFlagsBits : public BitField<StringAddFlags, 0, 3> {};
class PretenureFlagBits : public BitField<PretenureFlag, 3, 1> {};
......@@ -2103,11 +2091,6 @@ class RegExpConstructResultStub final : public HydrogenCodeStub {
explicit RegExpConstructResultStub(Isolate* 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_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub);
};
......@@ -2309,7 +2292,7 @@ class KeyedLoadGenericStub : public HydrogenCodeStub {
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);
};
......@@ -2619,6 +2602,7 @@ class LoadScriptContextFieldStub : public ScriptContextFieldStub {
private:
Code::Kind kind() const override { return Code::LOAD_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
};
......@@ -2632,6 +2616,7 @@ class StoreScriptContextFieldStub : public ScriptContextFieldStub {
private:
Code::Kind kind() const override { return Code::STORE_IC; }
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
};
......@@ -2664,6 +2649,7 @@ class LoadFastElementStub : public HandlerStub {
class IsJSArrayBits: public BitField<bool, 8, 1> {};
class CanConvertHoleToUndefined : public BitField<bool, 9, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(LoadWithVector);
DEFINE_HANDLER_CODE_STUB(LoadFastElement, HandlerStub);
};
......@@ -2690,10 +2676,6 @@ class StoreFastElementStub : public HydrogenCodeStub {
return CommonStoreModeBits::decode(sub_minor_key());
}
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return StoreWithVectorDescriptor(isolate());
}
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
......@@ -2701,6 +2683,7 @@ class StoreFastElementStub : public HydrogenCodeStub {
class ElementsKindBits : public BitField<ElementsKind, 3, 8> {};
class IsJSArrayBits : public BitField<bool, 11, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(StoreWithVector);
DEFINE_HYDROGEN_CODE_STUB(StoreFastElement, HydrogenCodeStub);
};
......@@ -2996,7 +2979,6 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
return CommonStoreModeBits::decode(sub_minor_key());
}
CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
Code::Kind GetCodeKind() const override { return Code::HANDLER; }
ExtraICState GetExtraICState() const override { return Code::KEYED_STORE_IC; }
......@@ -3005,6 +2987,7 @@ class ElementsTransitionAndStoreStub : public HydrogenCodeStub {
class ToBits : public BitField<ElementsKind, 11, 8> {};
class IsJSArrayBits : public BitField<bool, 19, 1> {};
DEFINE_CALL_INTERFACE_DESCRIPTOR(VectorStoreTransition);
DEFINE_HYDROGEN_CODE_STUB(ElementsTransitionAndStore, HydrogenCodeStub);
};
......
......@@ -536,6 +536,91 @@ Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
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* target, Node** args, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
......@@ -635,6 +720,52 @@ Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
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(
const CallInterfaceDescriptor& interface_descriptor,
Node* code_target_address, Node** args) {
......
......@@ -326,6 +326,15 @@ class CodeAssembler {
Node* arg1, Node* arg2, Node* arg3, Node* arg4,
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,
size_t result_size = 1);
Node* CallStub(Callable const& callable, Node* context, Node* arg1,
......@@ -350,6 +359,21 @@ class CodeAssembler {
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, Node* arg1, Node* arg2, Node* arg3, Node* arg4,
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** args, size_t result_size = 1);
......@@ -371,6 +395,14 @@ class CodeAssembler {
Node* context, Node* arg1, Node* arg2, Node* arg3,
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* code_target_address, Node** args);
......
......@@ -224,6 +224,9 @@ void JSGenericLowering::LowerJSLoadGlobal(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* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -242,14 +245,22 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(4, vector);
typedef StoreWithVectorDescriptor Descriptor;
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);
ReplaceWithStubCall(node, callable, flags);
}
void JSGenericLowering::LowerJSStoreNamed(Node* node) {
Node* receiver = NodeProperties::GetValueInput(node, 0);
Node* value = NodeProperties::GetValueInput(node, 1);
Node* closure = NodeProperties::GetValueInput(node, 2);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
......@@ -267,15 +278,21 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset -
kHeapObjectTag),
effect, control);
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(4, vector);
typedef StoreWithVectorDescriptor Descriptor;
node->InsertInputs(zone(), 0, 2);
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);
ReplaceWithStubCall(node, callable, flags);
}
void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 0);
Node* closure = NodeProperties::GetValueInput(node, 1);
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
......@@ -304,10 +321,14 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
machine()->Load(MachineType::AnyTagged()), native_context,
jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)),
effect, control);
node->InsertInput(zone(), 0, global);
node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name()));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
node->ReplaceInput(4, vector);
typedef StoreWithVectorDescriptor Descriptor;
node->InsertInputs(zone(), 0, 3);
node->ReplaceInput(Descriptor::kReceiver, global);
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);
ReplaceWithStubCall(node, callable, flags);
}
......
......@@ -193,6 +193,22 @@ void Node::InsertInput(Zone* zone, int index, Node* new_to) {
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) {
DCHECK_LE(0, index);
......
......@@ -100,6 +100,7 @@ class Node final {
void AppendInput(Zone* zone, 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 NullAllInputs();
void TrimInputCount(int new_input_count);
......
......@@ -2378,12 +2378,13 @@ RUNTIME_FUNCTION(Runtime_KeyedLoadIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
DCHECK(args.length() == 4);
Handle<Smi> slot = args.at<Smi>(2);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
DCHECK_EQ(4, args.length());
typedef LoadWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
Handle<Object> key = args.at<Object>(Descriptor::kName);
Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
KeyedLoadICNexus nexus(vector, vector_slot);
KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
......@@ -2422,6 +2423,35 @@ RUNTIME_FUNCTION(Runtime_StoreIC_Miss) {
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);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
......@@ -2431,6 +2461,9 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
int length = args.length();
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)).
// 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.
......@@ -2438,15 +2471,10 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
Handle<Smi> slot;
Handle<TypeFeedbackVector> vector;
if (length == 5) {
if (args.at<Object>(3)->IsMap()) {
vector = args.at<TypeFeedbackVector>(4);
slot = handle(
*reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()),
isolate);
} else {
vector = args.at<TypeFeedbackVector>(4);
slot = args.at<Smi>(3);
}
vector = args.at<TypeFeedbackVector>(4);
slot = handle(
*reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()),
isolate);
} else {
vector = args.at<TypeFeedbackVector>(5);
slot = args.at<Smi>(4);
......@@ -2468,17 +2496,15 @@ RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) {
}
}
// Used from ic-<arch>.cc.
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
DCHECK_EQ(5, args.length());
Handle<Object> receiver = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
DCHECK(args.length() == 5);
Handle<Smi> slot = args.at<Smi>(3);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
......@@ -2493,13 +2519,14 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
DCHECK(args.length() == 5);
Handle<Smi> slot = args.at<Smi>(3);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4);
DCHECK_EQ(5, args.length());
typedef StoreWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
Handle<Object> key = args.at<Object>(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());
KeyedStoreICNexus nexus(vector, vector_slot);
KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus);
......@@ -2510,7 +2537,7 @@ RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) {
RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) {
HandleScope scope(isolate);
DCHECK(args.length() == 5);
DCHECK_EQ(5, args.length());
Handle<Object> object = args.at<Object>(0);
Handle<Object> key = args.at<Object>(1);
Handle<Object> value = args.at<Object>(2);
......@@ -2671,8 +2698,9 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_Miss) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
Handle<Object> left = args.at<Object>(BinaryOpICStub::kLeft);
Handle<Object> right = args.at<Object>(BinaryOpICStub::kRight);
typedef BinaryOpDescriptor Descriptor;
Handle<Object> left = args.at<Object>(Descriptor::kLeft);
Handle<Object> right = args.at<Object>(Descriptor::kRight);
BinaryOpIC ic(isolate);
RETURN_RESULT_OR_FAILURE(
isolate, ic.Transition(Handle<AllocationSite>::null(), left, right));
......@@ -2684,11 +2712,11 @@ RUNTIME_FUNCTION(Runtime_BinaryOpIC_MissWithAllocationSite) {
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
typedef BinaryOpWithAllocationSiteDescriptor Descriptor;
Handle<AllocationSite> allocation_site =
args.at<AllocationSite>(BinaryOpWithAllocationSiteStub::kAllocationSite);
Handle<Object> left = args.at<Object>(BinaryOpWithAllocationSiteStub::kLeft);
Handle<Object> right =
args.at<Object>(BinaryOpWithAllocationSiteStub::kRight);
args.at<AllocationSite>(Descriptor::kAllocationSite);
Handle<Object> left = args.at<Object>(Descriptor::kLeft);
Handle<Object> right = args.at<Object>(Descriptor::kRight);
BinaryOpIC ic(isolate);
RETURN_RESULT_OR_FAILURE(isolate,
ic.Transition(allocation_site, left, right));
......@@ -2993,12 +3021,13 @@ RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) {
TimerEventScope<TimerEventIcMiss> timer(isolate);
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8"), "V8.IcMiss");
HandleScope scope(isolate);
Handle<Object> receiver = args.at<Object>(0);
Handle<Name> key = args.at<Name>(1);
DCHECK(args.length() == 4);
Handle<Smi> slot = args.at<Smi>(2);
Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3);
DCHECK_EQ(4, args.length());
typedef LoadWithVectorDescriptor Descriptor;
Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver);
Handle<Name> key = args.at<Name>(Descriptor::kName);
Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot);
Handle<TypeFeedbackVector> vector =
args.at<TypeFeedbackVector>(Descriptor::kVector);
FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value());
// A monomorphic or polymorphic KeyedLoadIC with a string key can call the
// LoadIC miss handler if the handler misses. Since the vector Nexus is
......
......@@ -83,10 +83,11 @@ FunctionType* LoadDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, SmiType(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kReceiver, AnyTagged(zone));
function->InitParameter(kName, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
return function;
}
......@@ -101,8 +102,9 @@ FunctionType* LoadGlobalDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 1, zone)->AsFunction();
function->InitParameter(0, SmiType(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kSlot, SmiType(zone));
return function;
}
......@@ -117,9 +119,10 @@ LoadGlobalWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
function->InitParameter(0, SmiType(zone));
function->InitParameter(1, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kSlot, SmiType(zone));
function->InitParameter(kVector, AnyTagged(zone));
return function;
}
......@@ -134,11 +137,12 @@ FunctionType* StoreDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, AnyTagged(zone));
function->InitParameter(3, SmiType(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kReceiver, AnyTagged(zone));
function->InitParameter(kName, AnyTagged(zone));
function->InitParameter(kValue, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
return function;
}
......@@ -178,11 +182,12 @@ StoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // Receiver
function->InitParameter(1, AnyTagged(zone)); // Name
function->InitParameter(2, AnyTagged(zone)); // Value
function->InitParameter(3, AnyTagged(zone)); // Map
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kReceiver, AnyTagged(zone));
function->InitParameter(kName, AnyTagged(zone));
function->InitParameter(kValue, AnyTagged(zone));
function->InitParameter(kMap, AnyTagged(zone));
return function;
}
......@@ -191,9 +196,10 @@ StoreGlobalViaContextDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
function->InitParameter(0, UntaggedIntegral32(zone));
function->InitParameter(1, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kSlot, UntaggedIntegral32(zone));
function->InitParameter(kValue, AnyTagged(zone));
return function;
}
......@@ -234,11 +240,12 @@ LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, SmiType(zone));
function->InitParameter(3, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kReceiver, AnyTagged(zone));
function->InitParameter(kName, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
function->InitParameter(kVector, AnyTagged(zone));
return function;
}
......@@ -260,6 +267,7 @@ VectorStoreTransitionDescriptor::BuildCallInterfaceDescriptorFunctionType(
Type::Function(AnyTagged(zone), Type::Undefined(), arg_count, zone)
->AsFunction();
int index = 0;
// TODO(ishell): use ParameterIndices here
function->InitParameter(index++, AnyTagged(zone)); // receiver
function->InitParameter(index++, AnyTagged(zone)); // name
function->InitParameter(index++, AnyTagged(zone)); // value
......@@ -276,12 +284,13 @@ StoreWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, AnyTagged(zone));
function->InitParameter(3, SmiType(zone));
function->InitParameter(4, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kReceiver, AnyTagged(zone));
function->InitParameter(kName, AnyTagged(zone));
function->InitParameter(kValue, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
function->InitParameter(kVector, AnyTagged(zone));
return function;
}
......@@ -362,8 +371,9 @@ VarArgFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), AnyTagged(zone), 1, zone)->AsFunction();
function->InitParameter(0, UntaggedIntegral32(zone)); // actual #arguments
Type::Function(AnyTagged(zone), AnyTagged(zone), kParameterCount, zone)
->AsFunction();
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
return function;
}
......@@ -372,11 +382,12 @@ FastCloneRegExpDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // closure
function->InitParameter(1, SmiType(zone)); // literal_index
function->InitParameter(2, AnyTagged(zone)); // pattern
function->InitParameter(3, AnyTagged(zone)); // flags
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kClosure, AnyTagged(zone));
function->InitParameter(kLiteralIndex, SmiType(zone));
function->InitParameter(kPattern, AnyTagged(zone));
function->InitParameter(kFlags, AnyTagged(zone));
return function;
}
......@@ -385,10 +396,11 @@ FastCloneShallowArrayDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, SmiType(zone));
function->InitParameter(2, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kClosure, AnyTagged(zone));
function->InitParameter(kLiteralIndex, SmiType(zone));
function->InitParameter(kConstantElements, AnyTagged(zone));
return function;
}
......@@ -397,9 +409,10 @@ CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, SmiType(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kVector, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
return function;
}
......@@ -408,10 +421,11 @@ CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone));
function->InitParameter(1, SmiType(zone));
function->InitParameter(2, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kVector, AnyTagged(zone));
function->InitParameter(kSlot, SmiType(zone));
function->InitParameter(kValue, AnyTagged(zone));
return function;
}
......@@ -420,9 +434,10 @@ CallTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // target
function->InitParameter(1, UntaggedIntegral32(zone)); // actual #arguments
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
return function;
}
......@@ -430,11 +445,12 @@ FunctionType* ConstructStubDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // target
function->InitParameter(1, AnyTagged(zone)); // new.target
function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments
function->InitParameter(3, AnyTagged(zone)); // opt. allocation site
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, AnyTagged(zone));
function->InitParameter(kNewTarget, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
function->InitParameter(kAllocationSite, AnyTagged(zone));
return function;
}
......@@ -443,10 +459,11 @@ ConstructTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // target
function->InitParameter(1, AnyTagged(zone)); // new.target
function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, AnyTagged(zone));
function->InitParameter(kNewTarget, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
return function;
}
......@@ -455,9 +472,10 @@ CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 2, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, SmiType(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kSlot, SmiType(zone));
return function;
}
......@@ -466,10 +484,11 @@ FunctionType* CallFunctionWithFeedbackAndVectorDescriptor::
int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, SmiType(zone));
function->InitParameter(2, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kSlot, SmiType(zone));
function->InitParameter(kVector, AnyTagged(zone));
return function;
}
......@@ -478,11 +497,12 @@ ArrayNoArgumentConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, UntaggedIntegral32(zone));
function->InitParameter(3, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kAllocationSite, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
function->InitParameter(kFunctionParameter, AnyTagged(zone));
return function;
}
......@@ -491,12 +511,13 @@ FunctionType* ArraySingleArgumentConstructorDescriptor::
int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 5, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, AnyTagged(zone));
function->InitParameter(2, UntaggedIntegral32(zone));
function->InitParameter(3, AnyTagged(zone));
function->InitParameter(4, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kAllocationSite, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
function->InitParameter(kFunctionParameter, AnyTagged(zone));
function->InitParameter(kArraySizeSmiParameter, AnyTagged(zone));
return function;
}
......@@ -505,10 +526,11 @@ ArrayNArgumentsConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 3, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, AnyTagged(zone)); // Allocation site or undefined
function->InitParameter(2, UntaggedIntegral32(zone)); // Arg count
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kAllocationSite, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
return function;
}
......@@ -517,11 +539,12 @@ ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(0, Type::Receiver()); // JSFunction
function->InitParameter(1, AnyTagged(zone)); // the new target
function->InitParameter(2, UntaggedIntegral32(zone)); // actual #arguments
function->InitParameter(3, UntaggedIntegral32(zone)); // expected #arguments
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kFunction, Type::Receiver());
function->InitParameter(kNewTarget, AnyTagged(zone));
function->InitParameter(kActualArgumentsCount, UntaggedIntegral32(zone));
function->InitParameter(kExpectedArgumentsCount, UntaggedIntegral32(zone));
return function;
}
......@@ -554,13 +577,13 @@ FunctionType*
ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionTypeWithArg(
Isolate* isolate, int parameter_count, int argc) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4 + argc, zone)
->AsFunction();
function->InitParameter(0, AnyTagged(zone)); // callee
function->InitParameter(1, AnyTagged(zone)); // call_data
function->InitParameter(2, AnyTagged(zone)); // holder
function->InitParameter(3, ExternalPointer(zone)); // api_function_address
FunctionType* function = Type::Function(AnyTagged(zone), Type::Undefined(),
kParameterCount + argc, zone)
->AsFunction();
function->InitParameter(kFunction, AnyTagged(zone));
function->InitParameter(kCallData, AnyTagged(zone));
function->InitParameter(kHolder, AnyTagged(zone));
function->InitParameter(kApiFunctionAddress, ExternalPointer(zone));
for (int i = 0; i < argc; i++) {
function->InitParameter(i, AnyTagged(zone));
}
......@@ -572,11 +595,12 @@ InterpreterDispatchDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int parameter_count) {
Zone* zone = isolate->interface_descriptor_zone();
FunctionType* function =
Type::Function(AnyTagged(zone), Type::Undefined(), 4, zone)->AsFunction();
function->InitParameter(kAccumulatorParameter, AnyTagged(zone));
function->InitParameter(kBytecodeOffsetParameter, UntaggedIntegral32(zone));
function->InitParameter(kBytecodeArrayParameter, AnyTagged(zone));
function->InitParameter(kDispatchTableParameter, AnyTagged(zone));
Type::Function(AnyTagged(zone), Type::Undefined(), kParameterCount, zone)
->AsFunction();
function->InitParameter(kAccumulator, AnyTagged(zone));
function->InitParameter(kBytecodeOffset, UntaggedIntegral32(zone));
function->InitParameter(kBytecodeArray, AnyTagged(zone));
function->InitParameter(kDispatchTable, AnyTagged(zone));
return function;
}
......
......@@ -285,6 +285,14 @@ class CallInterfaceDescriptor {
\
public:
#define DEFINE_PARAMETERS(...) \
enum ParameterIndices { \
__VA_ARGS__, \
\
kParameterCount, \
kContext = kParameterCount /* implicit parameter */ \
};
class VoidDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor)
......@@ -365,10 +373,10 @@ class OnStackWith7ArgsDescriptor : public OnStackArgsDescriptorBase {
// LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
class LoadDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kName, kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor,
CallInterfaceDescriptor)
enum ParameterIndices { kReceiverIndex, kNameIndex, kSlotIndex };
static const Register ReceiverRegister();
static const Register NameRegister();
static const Register SlotRegister();
......@@ -376,11 +384,10 @@ class LoadDescriptor : public CallInterfaceDescriptor {
class LoadGlobalDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalDescriptor,
CallInterfaceDescriptor)
enum ParameterIndices { kSlotIndex };
static const Register SlotRegister() {
return LoadDescriptor::SlotRegister();
}
......@@ -388,11 +395,10 @@ class LoadGlobalDescriptor : public CallInterfaceDescriptor {
class StoreDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kName, kValue, kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreDescriptor,
CallInterfaceDescriptor)
enum ParameterIndices { kReceiverIndex, kNameIndex, kValueIndex, kSlotIndex };
static const Register ReceiverRegister();
static const Register NameRegister();
static const Register ValueRegister();
......@@ -402,18 +408,10 @@ class StoreDescriptor : public CallInterfaceDescriptor {
class StoreTransitionDescriptor : public StoreDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kName, kValue, kMap)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreTransitionDescriptor,
StoreDescriptor)
// Extends StoreDescriptor with Map parameter.
enum ParameterIndices {
kReceiverIndex,
kNameIndex,
kValueIndex,
kMapIndex,
kParameterCount
};
static const Register MapRegister();
};
......@@ -423,18 +421,19 @@ class VectorStoreTransitionDescriptor : public StoreDescriptor {
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(VectorStoreTransitionDescriptor,
StoreDescriptor)
// TODO(ishell): use DEFINE_PARAMETERS macro here
// Extends StoreDescriptor with Map parameter.
enum ParameterIndices {
kReceiverIndex = 0,
kNameIndex = 1,
kValueIndex = 2,
kReceiver = 0,
kName = 1,
kValue = 2,
kMapIndex = 3,
kMap = 3,
kSlotIndex = 4, // not present on ia32.
kVirtualSlotVectorIndex = 4,
kSlot = 4, // not present on ia32.
kVirtualSlotVector = 4,
kVectorIndex = 5
kVector = 5
};
static const Register MapRegister();
......@@ -444,43 +443,28 @@ class VectorStoreTransitionDescriptor : public StoreDescriptor {
class StoreWithVectorDescriptor : public StoreDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kName, kValue, kSlot, kVector)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreWithVectorDescriptor,
StoreDescriptor)
enum ParameterIndices {
kReceiverIndex,
kNameIndex,
kValueIndex,
kSlotIndex,
kVectorIndex
};
static const Register VectorRegister();
};
class LoadWithVectorDescriptor : public LoadDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kName, kSlot, kVector)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadWithVectorDescriptor,
LoadDescriptor)
enum ParameterIndices {
kReceiverIndex,
kNameIndex,
kSlotIndex,
kVectorIndex
};
static const Register VectorRegister();
};
class LoadGlobalWithVectorDescriptor : public LoadGlobalDescriptor {
public:
DEFINE_PARAMETERS(kSlot, kVector)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadGlobalWithVectorDescriptor,
LoadGlobalDescriptor)
enum ParameterIndices { kSlotIndex, kVectorIndex };
static const Register VectorRegister() {
return LoadWithVectorDescriptor::VectorRegister();
}
......@@ -493,8 +477,8 @@ class FastNewClosureDescriptor : public CallInterfaceDescriptor {
class FastNewFunctionContextDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction)
DECLARE_DESCRIPTOR(FastNewFunctionContextDescriptor, CallInterfaceDescriptor)
enum ParameterIndices { kFunctionIndex, kContextIndex };
};
class FastNewObjectDescriptor : public CallInterfaceDescriptor {
......@@ -521,8 +505,7 @@ class FastNewStrictArgumentsDescriptor : public CallInterfaceDescriptor {
class TypeConversionDescriptor final : public CallInterfaceDescriptor {
public:
enum ParameterIndices { kArgumentIndex };
DEFINE_PARAMETERS(kArgument)
DECLARE_DESCRIPTOR(TypeConversionDescriptor, CallInterfaceDescriptor)
static const Register ArgumentRegister();
......@@ -530,33 +513,35 @@ class TypeConversionDescriptor final : public CallInterfaceDescriptor {
class HasPropertyDescriptor final : public CallInterfaceDescriptor {
public:
enum ParameterIndices { kKeyIndex, kObjectIndex };
DECLARE_DEFAULT_DESCRIPTOR(HasPropertyDescriptor, CallInterfaceDescriptor, 2)
DEFINE_PARAMETERS(kKey, kObject)
DECLARE_DEFAULT_DESCRIPTOR(HasPropertyDescriptor, CallInterfaceDescriptor,
kParameterCount)
};
class ForInFilterDescriptor final : public CallInterfaceDescriptor {
public:
enum ParameterIndices { kKeyIndex, kObjectIndex };
DECLARE_DEFAULT_DESCRIPTOR(ForInFilterDescriptor, CallInterfaceDescriptor, 2)
DEFINE_PARAMETERS(kKey, kObject)
DECLARE_DEFAULT_DESCRIPTOR(ForInFilterDescriptor, CallInterfaceDescriptor,
kParameterCount)
};
class GetPropertyDescriptor final : public CallInterfaceDescriptor {
public:
enum ParameterIndices { kObjectIndex, kKeyIndex };
DECLARE_DEFAULT_DESCRIPTOR(GetPropertyDescriptor, CallInterfaceDescriptor, 2)
DEFINE_PARAMETERS(kObject, kKey)
DECLARE_DEFAULT_DESCRIPTOR(GetPropertyDescriptor, CallInterfaceDescriptor,
kParameterCount)
};
class TypeofDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kObject)
DECLARE_DESCRIPTOR(TypeofDescriptor, CallInterfaceDescriptor)
};
class FastCloneRegExpDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kClosure, kLiteralIndex, kPattern, kFlags)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneRegExpDescriptor,
CallInterfaceDescriptor)
};
......@@ -564,6 +549,7 @@ class FastCloneRegExpDescriptor : public CallInterfaceDescriptor {
class FastCloneShallowArrayDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kClosure, kLiteralIndex, kConstantElements)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneShallowArrayDescriptor,
CallInterfaceDescriptor)
};
......@@ -577,6 +563,7 @@ class FastCloneShallowObjectDescriptor : public CallInterfaceDescriptor {
class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kVector, kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateAllocationSiteDescriptor,
CallInterfaceDescriptor)
};
......@@ -584,13 +571,7 @@ class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor {
class CreateWeakCellDescriptor : public CallInterfaceDescriptor {
public:
enum ParameterIndices {
kVectorIndex,
kSlotIndex,
kValueIndex,
kParameterCount
};
DEFINE_PARAMETERS(kVector, kSlot, kValue)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateWeakCellDescriptor,
CallInterfaceDescriptor)
};
......@@ -598,6 +579,7 @@ class CreateWeakCellDescriptor : public CallInterfaceDescriptor {
class CallTrampolineDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kActualArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CallTrampolineDescriptor,
CallInterfaceDescriptor)
};
......@@ -605,6 +587,8 @@ class CallTrampolineDescriptor : public CallInterfaceDescriptor {
class ConstructStubDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kNewTarget, kActualArgumentsCount,
kAllocationSite)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructStubDescriptor,
CallInterfaceDescriptor)
};
......@@ -612,6 +596,7 @@ class ConstructStubDescriptor : public CallInterfaceDescriptor {
class ConstructTrampolineDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kNewTarget, kActualArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ConstructTrampolineDescriptor,
CallInterfaceDescriptor)
};
......@@ -625,6 +610,7 @@ class CallFunctionDescriptor : public CallInterfaceDescriptor {
class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kSlot)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
CallFunctionWithFeedbackDescriptor, CallInterfaceDescriptor)
};
......@@ -633,6 +619,7 @@ class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor {
class CallFunctionWithFeedbackAndVectorDescriptor
: public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kSlot, kVector)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor)
};
......@@ -646,12 +633,14 @@ class CallConstructDescriptor : public CallInterfaceDescriptor {
class RegExpConstructResultDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kLength, kIndex, kInput)
DECLARE_DESCRIPTOR(RegExpConstructResultDescriptor, CallInterfaceDescriptor)
};
class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kSlot, kValue)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(StoreGlobalViaContextDescriptor,
CallInterfaceDescriptor)
......@@ -662,6 +651,7 @@ class StoreGlobalViaContextDescriptor : public CallInterfaceDescriptor {
class TransitionElementsKindDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kObject, kMap)
DECLARE_DESCRIPTOR(TransitionElementsKindDescriptor, CallInterfaceDescriptor)
};
......@@ -681,59 +671,46 @@ SIMD128_TYPES(SIMD128_ALLOC_DESC)
class ArrayNoArgumentConstructorDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kAllocationSite, kActualArgumentsCount,
kFunctionParameter)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
ArrayNoArgumentConstructorDescriptor, CallInterfaceDescriptor)
enum ParameterIndices {
kFunctionIndex,
kAllocationSiteIndex,
kArgumentCountIndex,
kFunctionParameterIndex,
kContextIndex
};
};
class ArraySingleArgumentConstructorDescriptor
: public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kAllocationSite, kActualArgumentsCount,
kFunctionParameter, kArraySizeSmiParameter)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
ArraySingleArgumentConstructorDescriptor, CallInterfaceDescriptor)
enum ParameterIndices {
kFunctionIndex,
kAllocationSiteIndex,
kArgumentCountIndex,
kFunctionParameterIndex,
kArraySizeSmiParameterIndex,
kContextIndex
};
};
class ArrayNArgumentsConstructorDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kAllocationSite, kActualArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
ArrayNArgumentsConstructorDescriptor, CallInterfaceDescriptor)
enum ParameterIndices {
kFunctionIndex,
kAllocationSiteIndex,
kArgumentCountIndex,
kContextIndex
};
};
class CompareDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kLeft, kRight)
DECLARE_DESCRIPTOR(CompareDescriptor, CallInterfaceDescriptor)
};
class BinaryOpDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kLeft, kRight)
DECLARE_DESCRIPTOR(BinaryOpDescriptor, CallInterfaceDescriptor)
};
class BinaryOpWithAllocationSiteDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kAllocationSite, kLeft, kRight)
DECLARE_DESCRIPTOR(BinaryOpWithAllocationSiteDescriptor,
CallInterfaceDescriptor)
};
......@@ -745,32 +722,33 @@ class CountOpDescriptor final : public CallInterfaceDescriptor {
class StringAddDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kLeft, kRight)
DECLARE_DESCRIPTOR(StringAddDescriptor, CallInterfaceDescriptor)
};
class StringCompareDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kLeft, kRight)
DECLARE_DESCRIPTOR(StringCompareDescriptor, CallInterfaceDescriptor)
enum ParameterIndices { kLeftIndex, kRightIndex, kParameterCount };
static const Register LeftRegister();
static const Register RightRegister();
};
// TODO(ishell): not used, remove.
class KeyedDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(KeyedDescriptor, CallInterfaceDescriptor)
};
// TODO(ishell): not used, remove
class NamedDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(NamedDescriptor, CallInterfaceDescriptor)
};
// TODO(ishell): not used, remove.
class CallHandlerDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(CallHandlerDescriptor, CallInterfaceDescriptor)
......@@ -779,6 +757,8 @@ class CallHandlerDescriptor : public CallInterfaceDescriptor {
class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kNewTarget, kActualArgumentsCount,
kExpectedArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
CallInterfaceDescriptor)
};
......@@ -796,6 +776,7 @@ class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
//
class ApiCallbackDescriptorBase : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kFunction, kCallData, kHolder, kApiFunctionAddress)
static CallInterfaceDescriptor ForArgs(Isolate* isolate, int argc);
protected:
......@@ -857,6 +838,7 @@ class ApiCallbackWith7ArgsDescriptor : public ApiCallbackDescriptorBase {
class ApiGetterDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kHolder, kCallback)
DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor)
static const Register ReceiverRegister();
......@@ -866,6 +848,7 @@ class ApiGetterDescriptor : public CallInterfaceDescriptor {
class MathPowTaggedDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kExponent)
DECLARE_DESCRIPTOR(MathPowTaggedDescriptor, CallInterfaceDescriptor)
static const Register exponent();
......@@ -873,6 +856,7 @@ class MathPowTaggedDescriptor : public CallInterfaceDescriptor {
class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kExponent)
DECLARE_DESCRIPTOR(MathPowIntegerDescriptor, CallInterfaceDescriptor)
static const Register exponent();
......@@ -880,28 +864,26 @@ class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
class VarArgFunctionDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kActualArgumentsCount)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(VarArgFunctionDescriptor,
CallInterfaceDescriptor)
};
class GrowArrayElementsDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kObject, kKey)
DECLARE_DESCRIPTOR(GrowArrayElementsDescriptor, CallInterfaceDescriptor)
enum RegisterInfo { kObjectIndex, kKeyIndex };
static const Register ObjectRegister();
static const Register KeyRegister();
};
class InterpreterDispatchDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kAccumulator, kBytecodeOffset, kBytecodeArray,
kDispatchTable)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(InterpreterDispatchDescriptor,
CallInterfaceDescriptor)
static const int kAccumulatorParameter = 0;
static const int kBytecodeOffsetParameter = 1;
static const int kBytecodeArrayParameter = 2;
static const int kDispatchTableParameter = 3;
};
class InterpreterPushArgsAndCallDescriptor : public CallInterfaceDescriptor {
......@@ -933,6 +915,7 @@ class ResumeGeneratorDescriptor final : public CallInterfaceDescriptor {
#undef DECLARE_DESCRIPTOR
#undef DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE
#undef DECLARE_DESCRIPTOR_WITH_BASE_AND_FUNCTION_TYPE_ARG
#undef DEFINE_PARAMETERS
// We define the association between CallDescriptors::Key and the specialized
// descriptor here to reduce boilerplate and mistakes.
......
......@@ -38,10 +38,9 @@ InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone,
made_call_(false),
disable_stack_check_across_call_(false),
stack_pointer_before_call_(nullptr) {
accumulator_.Bind(
Parameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
accumulator_.Bind(Parameter(InterpreterDispatchDescriptor::kAccumulator));
bytecode_offset_.Bind(
Parameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter));
Parameter(InterpreterDispatchDescriptor::kBytecodeOffset));
if (FLAG_trace_ignition) {
TraceBytecode(Runtime::kInterpreterTraceBytecodeEntry);
}
......@@ -95,12 +94,12 @@ Node* InterpreterAssembler::BytecodeArrayTaggedPointer() {
// the debugger has swapped us to the patched debugger bytecode array.
return LoadRegister(Register::bytecode_array());
} else {
return Parameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter);
return Parameter(InterpreterDispatchDescriptor::kBytecodeArray);
}
}
Node* InterpreterAssembler::DispatchTableRawPointer() {
return Parameter(InterpreterDispatchDescriptor::kDispatchTableParameter);
return Parameter(InterpreterDispatchDescriptor::kDispatchTable);
}
Node* InterpreterAssembler::RegisterLocation(Node* reg_index) {
......
......@@ -26,6 +26,7 @@ namespace interpreter {
using compiler::Node;
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
typedef InterpreterAssembler::Arg Arg;
#define __ assembler->
......@@ -383,6 +384,7 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadGlobal(Callable ic,
InterpreterAssembler* assembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
// Get the global object.
Node* context = __ GetContext();
......@@ -391,8 +393,9 @@ Node* Interpreter::BuildLoadGlobal(Callable ic,
Node* raw_slot = __ BytecodeOperandIdx(0);
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
return __ CallStub(ic.descriptor(), code_target, context, smi_slot,
type_feedback_vector);
return __ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
}
// LdaGlobal <slot>
......@@ -433,6 +436,7 @@ void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
}
void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
// Get the global object.
Node* context = __ GetContext();
Node* native_context =
......@@ -447,8 +451,10 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
Node* raw_slot = __ BytecodeOperandIdx(1);
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
__ CallStub(ic.descriptor(), code_target, context, global, name, value,
smi_slot, type_feedback_vector);
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, global), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch();
}
......@@ -567,6 +573,7 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadNamedProperty(Callable ic,
InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* register_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(register_index);
......@@ -576,8 +583,10 @@ Node* Interpreter::BuildLoadNamedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
return __ CallStub(ic.descriptor(), code_target, context, object, name,
smi_slot, type_feedback_vector);
return __ CallStub(
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>
......@@ -605,6 +614,7 @@ void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(reg_index);
......@@ -613,8 +623,10 @@ Node* Interpreter::BuildLoadKeyedProperty(Callable ic,
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
return __ CallStub(ic.descriptor(), code_target, context, object, name,
smi_slot, type_feedback_vector);
return __ CallStub(
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>
......@@ -641,6 +653,7 @@ void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) {
}
void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index);
......@@ -651,8 +664,10 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context, object, name, value,
smi_slot, type_feedback_vector);
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch();
}
......@@ -677,6 +692,7 @@ void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) {
}
void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index);
......@@ -687,8 +703,10 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context, object, name, value,
smi_slot, type_feedback_vector);
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ Dispatch();
}
......
......@@ -924,28 +924,29 @@ namespace internal {
// Most intrinsics are implemented in the runtime/ directory, but ICs are
// implemented in ic.cc for now.
#define FOR_EACH_INTRINSIC_IC(F) \
F(BinaryOpIC_Miss, 2, 1) \
F(BinaryOpIC_MissWithAllocationSite, 3, 1) \
F(CallIC_Miss, 3, 1) \
F(CompareIC_Miss, 3, 1) \
F(ElementsTransitionAndStoreIC_Miss, 5, 1) \
F(KeyedLoadIC_Miss, 4, 1) \
F(KeyedLoadIC_MissFromStubFailure, 4, 1) \
F(KeyedStoreIC_Miss, 5, 1) \
F(KeyedStoreIC_MissFromStubFailure, 5, 1) \
F(KeyedStoreIC_Slow, 5, 1) \
F(LoadElementWithInterceptor, 2, 1) \
F(LoadGlobalIC_Miss, 2, 1) \
F(LoadIC_Miss, 4, 1) \
F(LoadIC_MissFromStubFailure, 4, 1) \
F(LoadPropertyWithInterceptor, 3, 1) \
F(LoadPropertyWithInterceptorOnly, 3, 1) \
F(StoreCallbackProperty, 6, 1) \
F(StoreIC_Miss, 5, 1) \
F(StoreIC_MissFromStubFailure, 5, 1) \
F(StorePropertyWithInterceptor, 3, 1) \
F(ToBooleanIC_Miss, 1, 1) \
#define FOR_EACH_INTRINSIC_IC(F) \
F(BinaryOpIC_Miss, 2, 1) \
F(BinaryOpIC_MissWithAllocationSite, 3, 1) \
F(CallIC_Miss, 3, 1) \
F(CompareIC_Miss, 3, 1) \
F(ElementsTransitionAndStoreIC_Miss, 5, 1) \
F(KeyedLoadIC_Miss, 4, 1) \
F(KeyedLoadIC_MissFromStubFailure, 4, 1) \
F(KeyedStoreIC_Miss, 5, 1) \
F(KeyedStoreIC_MissFromStubFailure, 5, 1) \
F(KeyedStoreIC_Slow, 5, 1) \
F(LoadElementWithInterceptor, 2, 1) \
F(LoadGlobalIC_Miss, 2, 1) \
F(LoadIC_Miss, 4, 1) \
F(LoadIC_MissFromStubFailure, 4, 1) \
F(LoadPropertyWithInterceptor, 3, 1) \
F(LoadPropertyWithInterceptorOnly, 3, 1) \
F(StoreCallbackProperty, 6, 1) \
F(StoreIC_Miss, 5, 1) \
F(StoreIC_MissFromStubFailure, 5, 1) \
F(TransitionStoreIC_MissFromStubFailure, 6, 1) \
F(StorePropertyWithInterceptor, 3, 1) \
F(ToBooleanIC_Miss, 1, 1) \
F(Unreachable, 0, 1)
#define FOR_EACH_INTRINSIC_RETURN_OBJECT(F) \
......
......@@ -320,6 +320,80 @@ TEST(Inputs) {
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) {
base::AccountingAllocator allocator;
......
......@@ -93,10 +93,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsUnsignedByteOperand(
int offset) {
return IsLoad(
MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
}
Matcher<Node*>
......@@ -104,10 +103,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsSignedByteOperand(
int offset) {
Matcher<Node*> load_matcher = IsLoad(
MachineType::Int8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
if (kPointerSize == 8) {
load_matcher = IsChangeInt32ToInt64(load_matcher);
}
......@@ -120,11 +118,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsUnsignedShortOperand(
if (TargetSupportsUnalignedAccess()) {
return IsLoad(
MachineType::Uint16(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
} else {
#if V8_TARGET_LITTLE_ENDIAN
const int kStep = -1;
......@@ -139,10 +135,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsUnsignedShortOperand(
for (int i = 0; i < static_cast<int>(arraysize(bytes)); i++) {
bytes[i] = IsLoad(
MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset + kMsbOffset + kStep * i)));
}
return IsWord32Or(IsWord32Shl(bytes[0], IsInt32Constant(kBitsPerByte)),
......@@ -157,11 +152,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsSignedShortOperand(
if (TargetSupportsUnalignedAccess()) {
load_matcher = IsLoad(
MachineType::Int16(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
} else {
#if V8_TARGET_LITTLE_ENDIAN
const int kStep = -1;
......@@ -176,10 +169,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsSignedShortOperand(
for (int i = 0; i < static_cast<int>(arraysize(bytes)); i++) {
bytes[i] = IsLoad(
(i == 0) ? MachineType::Int8() : MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset + kMsbOffset + kStep * i)));
}
load_matcher = IsWord32Or(
......@@ -198,11 +190,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsUnsignedQuadOperand(
if (TargetSupportsUnalignedAccess()) {
return IsLoad(
MachineType::Uint32(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
} else {
#if V8_TARGET_LITTLE_ENDIAN
const int kStep = -1;
......@@ -217,10 +207,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsUnsignedQuadOperand(
for (int i = 0; i < static_cast<int>(arraysize(bytes)); i++) {
bytes[i] = IsLoad(
MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset + kMsbOffset + kStep * i)));
}
return IsWord32Or(
......@@ -239,11 +228,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsSignedQuadOperand(
if (TargetSupportsUnalignedAccess()) {
load_matcher = IsLoad(
MachineType::Int32(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(offset)));
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset)));
} else {
#if V8_TARGET_LITTLE_ENDIAN
const int kStep = -1;
......@@ -258,10 +245,9 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsSignedQuadOperand(
for (int i = 0; i < static_cast<int>(arraysize(bytes)); i++) {
bytes[i] = IsLoad(
(i == 0) ? MachineType::Int8() : MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrAdd(
IsParameter(
InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(offset + kMsbOffset + kStep * i)));
}
load_matcher = IsWord32Or(
......@@ -316,20 +302,20 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
Node* tail_call_node = m.Dispatch();
OperandScale operand_scale = OperandScale::kSingle;
Matcher<Node*> next_bytecode_offset_matcher = IsIntPtrAdd(
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsIntPtrConstant(
interpreter::Bytecodes::Size(bytecode, operand_scale)));
Matcher<Node*> target_bytecode_matcher = m.IsLoad(
MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
next_bytecode_offset_matcher);
Matcher<Node*> next_bytecode_offset_matcher =
IsIntPtrAdd(IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(
interpreter::Bytecodes::Size(bytecode, operand_scale)));
Matcher<Node*> target_bytecode_matcher =
m.IsLoad(MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
next_bytecode_offset_matcher);
if (kPointerSize == 8) {
target_bytecode_matcher = IsChangeUint32ToUint64(target_bytecode_matcher);
}
Matcher<Node*> code_target_matcher = m.IsLoad(
MachineType::Pointer(),
IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter),
IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
IsWordShl(target_bytecode_matcher, IsIntPtrConstant(kPointerSizeLog2)));
if (interpreter::Bytecodes::IsStarLookahead(bytecode, operand_scale)) {
......@@ -340,10 +326,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
next_bytecode_offset_matcher =
IsPhi(MachineType::PointerRepresentation(),
next_bytecode_offset_matcher, after_lookahead_offset, _);
Matcher<Node*> after_lookahead_bytecode = m.IsLoad(
MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
after_lookahead_offset);
Matcher<Node*> after_lookahead_bytecode =
m.IsLoad(MachineType::Uint8(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
after_lookahead_offset);
if (kPointerSize == 8) {
after_lookahead_bytecode =
IsChangeUint32ToUint64(after_lookahead_bytecode);
......@@ -351,22 +337,21 @@ TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
target_bytecode_matcher =
IsPhi(MachineRepresentation::kWord8, target_bytecode_matcher,
after_lookahead_bytecode, _);
code_target_matcher = m.IsLoad(
MachineType::Pointer(),
IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter),
IsWordShl(target_bytecode_matcher,
IsIntPtrConstant(kPointerSizeLog2)));
code_target_matcher =
m.IsLoad(MachineType::Pointer(),
IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
IsWordShl(target_bytecode_matcher,
IsIntPtrConstant(kPointerSizeLog2)));
}
EXPECT_THAT(
tail_call_node,
IsTailCall(
_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
next_bytecode_offset_matcher,
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter),
_, _));
IsTailCall(_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulator),
next_bytecode_offset_matcher,
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
_, _));
}
}
......@@ -383,7 +368,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
Node* tail_call_node = m.Jump(m.IntPtrConstant(jump_offset));
Matcher<Node*> next_bytecode_offset_matcher = IsIntPtrAdd(
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffsetParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeOffset),
IsIntPtrConstant(jump_offset));
Matcher<Node*> target_bytecode_matcher =
m.IsLoad(MachineType::Uint8(), _, next_bytecode_offset_matcher);
......@@ -391,21 +376,19 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
target_bytecode_matcher =
IsChangeUint32ToUint64(target_bytecode_matcher);
}
Matcher<Node*> code_target_matcher = m.IsLoad(
MachineType::Pointer(),
IsParameter(InterpreterDispatchDescriptor::kDispatchTableParameter),
IsWordShl(target_bytecode_matcher,
IsIntPtrConstant(kPointerSizeLog2)));
Matcher<Node*> code_target_matcher =
m.IsLoad(MachineType::Pointer(),
IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
IsWordShl(target_bytecode_matcher,
IsIntPtrConstant(kPointerSizeLog2)));
EXPECT_THAT(
tail_call_node,
IsTailCall(
_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter),
next_bytecode_offset_matcher, _,
IsParameter(
InterpreterDispatchDescriptor::kDispatchTableParameter),
_, _));
IsTailCall(_, code_target_matcher,
IsParameter(InterpreterDispatchDescriptor::kAccumulator),
next_bytecode_offset_matcher, _,
IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
_, _));
}
}
}
......@@ -478,9 +461,8 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetSetAccumulator) {
InterpreterAssemblerForTest m(this, bytecode);
// Should be incoming accumulator if not set.
EXPECT_THAT(
m.GetAccumulator(),
IsParameter(InterpreterDispatchDescriptor::kAccumulatorParameter));
EXPECT_THAT(m.GetAccumulator(),
IsParameter(InterpreterDispatchDescriptor::kAccumulator));
// Should be set by SetAccumulator.
Node* accumulator_value_1 = m.Int32Constant(0xdeadbeef);
m.SetAccumulator(accumulator_value_1);
......@@ -597,7 +579,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadConstantPoolEntry) {
Node* load_constant = m.LoadConstantPoolEntry(index);
Matcher<Node*> constant_pool_matcher = m.IsLoad(
MachineType::AnyTagged(),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArrayParameter),
IsParameter(InterpreterDispatchDescriptor::kBytecodeArray),
IsIntPtrConstant(BytecodeArray::kConstantPoolOffset - kHeapObjectTag));
EXPECT_THAT(
load_constant,
......
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