Commit 2656c221 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[builtins] Interface descriptors usage cleanup.

This is a step towards the world where only leaf CSA classes have access
to parameters (via respective interface descriptor specified in builtin
definition macro).

BUG=v8:6116

Change-Id: I35dcd9a1c9d38ea394895ab339a07988a26070a0
Reviewed-on: https://chromium-review.googlesource.com/458198Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44021}
parent e6682554
...@@ -201,8 +201,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context, ...@@ -201,8 +201,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context,
} }
TF_BUILTIN(FastNewRestParameter, ArgumentsBuiltinsAssembler) { TF_BUILTIN(FastNewRestParameter, ArgumentsBuiltinsAssembler) {
Node* function = Parameter(FastNewArgumentsDescriptor::kFunction); Node* function = Parameter(Descriptor::kFunction);
Node* context = Parameter(FastNewArgumentsDescriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Return(EmitFastNewRestParameter(context, function)); Return(EmitFastNewRestParameter(context, function));
} }
......
...@@ -178,7 +178,6 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) { ...@@ -178,7 +178,6 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
} }
TF_BUILTIN(FastNewObject, ConstructorBuiltinsAssembler) { TF_BUILTIN(FastNewObject, ConstructorBuiltinsAssembler) {
typedef FastNewObjectDescriptor Descriptor;
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Node* target = Parameter(Descriptor::kTarget); Node* target = Parameter(Descriptor::kTarget);
Node* new_target = Parameter(Descriptor::kNewTarget); Node* new_target = Parameter(Descriptor::kNewTarget);
......
...@@ -17,17 +17,16 @@ class ConversionBuiltinsAssembler : public CodeStubAssembler { ...@@ -17,17 +17,16 @@ class ConversionBuiltinsAssembler : public CodeStubAssembler {
: CodeStubAssembler(state) {} : CodeStubAssembler(state) {}
protected: protected:
void Generate_NonPrimitiveToPrimitive(ToPrimitiveHint hint); void Generate_NonPrimitiveToPrimitive(Node* context, Node* input,
ToPrimitiveHint hint);
void Generate_OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); void Generate_OrdinaryToPrimitive(Node* context, Node* input,
OrdinaryToPrimitiveHint hint);
}; };
// ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] )
void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive( void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive(
ToPrimitiveHint hint) { Node* context, Node* input, ToPrimitiveHint hint) {
Node* input = Parameter(TypeConversionDescriptor::kArgument);
Node* context = Parameter(TypeConversionDescriptor::kContext);
// Lookup the @@toPrimitive property on the {input}. // Lookup the @@toPrimitive property on the {input}.
Node* exotic_to_prim = Node* exotic_to_prim =
GetProperty(context, input, factory()->to_primitive_symbol()); GetProperty(context, input, factory()->to_primitive_symbol());
...@@ -81,49 +80,58 @@ void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive( ...@@ -81,49 +80,58 @@ void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive(
} }
TF_BUILTIN(NonPrimitiveToPrimitive_Default, ConversionBuiltinsAssembler) { TF_BUILTIN(NonPrimitiveToPrimitive_Default, ConversionBuiltinsAssembler) {
Generate_NonPrimitiveToPrimitive(ToPrimitiveHint::kDefault); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Generate_NonPrimitiveToPrimitive(context, input, ToPrimitiveHint::kDefault);
} }
TF_BUILTIN(NonPrimitiveToPrimitive_Number, ConversionBuiltinsAssembler) { TF_BUILTIN(NonPrimitiveToPrimitive_Number, ConversionBuiltinsAssembler) {
Generate_NonPrimitiveToPrimitive(ToPrimitiveHint::kNumber); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Generate_NonPrimitiveToPrimitive(context, input, ToPrimitiveHint::kNumber);
} }
TF_BUILTIN(NonPrimitiveToPrimitive_String, ConversionBuiltinsAssembler) { TF_BUILTIN(NonPrimitiveToPrimitive_String, ConversionBuiltinsAssembler) {
Generate_NonPrimitiveToPrimitive(ToPrimitiveHint::kString); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Generate_NonPrimitiveToPrimitive(context, input, ToPrimitiveHint::kString);
} }
TF_BUILTIN(StringToNumber, CodeStubAssembler) { TF_BUILTIN(StringToNumber, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Return(StringToNumber(context, input)); Return(StringToNumber(context, input));
} }
TF_BUILTIN(ToName, CodeStubAssembler) { TF_BUILTIN(ToName, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Return(ToName(context, input)); Return(ToName(context, input));
} }
TF_BUILTIN(NonNumberToNumber, CodeStubAssembler) { TF_BUILTIN(NonNumberToNumber, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Return(NonNumberToNumber(context, input)); Return(NonNumberToNumber(context, input));
} }
// ES6 section 7.1.3 ToNumber ( argument ) // ES6 section 7.1.3 ToNumber ( argument )
TF_BUILTIN(ToNumber, CodeStubAssembler) { TF_BUILTIN(ToNumber, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Return(ToNumber(context, input)); Return(ToNumber(context, input));
} }
TF_BUILTIN(ToString, CodeStubAssembler) { TF_BUILTIN(ToString, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Label is_number(this); Label is_number(this);
Label runtime(this); Label runtime(this);
...@@ -158,10 +166,7 @@ TF_BUILTIN(ToString, CodeStubAssembler) { ...@@ -158,10 +166,7 @@ TF_BUILTIN(ToString, CodeStubAssembler) {
// 7.1.1.1 OrdinaryToPrimitive ( O, hint ) // 7.1.1.1 OrdinaryToPrimitive ( O, hint )
void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive( void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive(
OrdinaryToPrimitiveHint hint) { Node* context, Node* input, OrdinaryToPrimitiveHint hint) {
Node* input = Parameter(TypeConversionDescriptor::kArgument);
Node* context = Parameter(TypeConversionDescriptor::kContext);
Variable var_result(this, MachineRepresentation::kTagged); Variable var_result(this, MachineRepresentation::kTagged);
Label return_result(this, &var_result); Label return_result(this, &var_result);
...@@ -217,16 +222,22 @@ void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive( ...@@ -217,16 +222,22 @@ void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive(
} }
TF_BUILTIN(OrdinaryToPrimitive_Number, ConversionBuiltinsAssembler) { TF_BUILTIN(OrdinaryToPrimitive_Number, ConversionBuiltinsAssembler) {
Generate_OrdinaryToPrimitive(OrdinaryToPrimitiveHint::kNumber); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Generate_OrdinaryToPrimitive(context, input,
OrdinaryToPrimitiveHint::kNumber);
} }
TF_BUILTIN(OrdinaryToPrimitive_String, ConversionBuiltinsAssembler) { TF_BUILTIN(OrdinaryToPrimitive_String, ConversionBuiltinsAssembler) {
Generate_OrdinaryToPrimitive(OrdinaryToPrimitiveHint::kString); Node* context = Parameter(Descriptor::kContext);
Node* input = Parameter(Descriptor::kArgument);
Generate_OrdinaryToPrimitive(context, input,
OrdinaryToPrimitiveHint::kString);
} }
// ES6 section 7.1.2 ToBoolean ( argument ) // ES6 section 7.1.2 ToBoolean ( argument )
TF_BUILTIN(ToBoolean, CodeStubAssembler) { TF_BUILTIN(ToBoolean, CodeStubAssembler) {
Node* value = Parameter(TypeConversionDescriptor::kArgument); Node* value = Parameter(Descriptor::kArgument);
Label return_true(this), return_false(this); Label return_true(this), return_false(this);
BranchIfToBooleanIsTrue(value, &return_true, &return_false); BranchIfToBooleanIsTrue(value, &return_true, &return_false);
...@@ -307,8 +318,8 @@ TF_BUILTIN(ToLength, CodeStubAssembler) { ...@@ -307,8 +318,8 @@ TF_BUILTIN(ToLength, CodeStubAssembler) {
} }
TF_BUILTIN(ToInteger, CodeStubAssembler) { TF_BUILTIN(ToInteger, CodeStubAssembler) {
Node* input = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* input = Parameter(Descriptor::kArgument);
Return(ToInteger(context, input)); Return(ToInteger(context, input));
} }
...@@ -318,8 +329,8 @@ TF_BUILTIN(ToObject, CodeStubAssembler) { ...@@ -318,8 +329,8 @@ TF_BUILTIN(ToObject, CodeStubAssembler) {
Label if_number(this, Label::kDeferred), if_notsmi(this), if_jsreceiver(this), Label if_number(this, Label::kDeferred), if_notsmi(this), if_jsreceiver(this),
if_noconstructor(this, Label::kDeferred), if_wrapjsvalue(this); if_noconstructor(this, Label::kDeferred), if_wrapjsvalue(this);
Node* object = Parameter(TypeConversionDescriptor::kArgument); Node* context = Parameter(Descriptor::kContext);
Node* context = Parameter(TypeConversionDescriptor::kContext); Node* object = Parameter(Descriptor::kArgument);
Variable constructor_function_index_var(this, Variable constructor_function_index_var(this,
MachineType::PointerRepresentation()); MachineType::PointerRepresentation());
......
...@@ -167,8 +167,6 @@ void ForInBuiltinsAssembler::CheckEnumCache(Node* receiver, Label* use_cache, ...@@ -167,8 +167,6 @@ void ForInBuiltinsAssembler::CheckEnumCache(Node* receiver, Label* use_cache,
} }
TF_BUILTIN(ForInFilter, ForInBuiltinsAssembler) { TF_BUILTIN(ForInFilter, ForInBuiltinsAssembler) {
typedef ForInFilterDescriptor Descriptor;
Node* key = Parameter(Descriptor::kKey); Node* key = Parameter(Descriptor::kKey);
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -177,8 +175,6 @@ TF_BUILTIN(ForInFilter, ForInBuiltinsAssembler) { ...@@ -177,8 +175,6 @@ TF_BUILTIN(ForInFilter, ForInBuiltinsAssembler) {
} }
TF_BUILTIN(ForInNext, ForInBuiltinsAssembler) { TF_BUILTIN(ForInNext, ForInBuiltinsAssembler) {
typedef ForInNextDescriptor Descriptor;
Label filter(this); Label filter(this);
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* cache_array = Parameter(Descriptor::kCacheArray); Node* cache_array = Parameter(Descriptor::kCacheArray);
...@@ -195,8 +191,6 @@ TF_BUILTIN(ForInNext, ForInBuiltinsAssembler) { ...@@ -195,8 +191,6 @@ TF_BUILTIN(ForInNext, ForInBuiltinsAssembler) {
} }
TF_BUILTIN(ForInPrepare, ForInBuiltinsAssembler) { TF_BUILTIN(ForInPrepare, ForInBuiltinsAssembler) {
typedef ForInPrepareDescriptor Descriptor;
Label call_runtime(this), nothing_to_iterate(this); Label call_runtime(this), nothing_to_iterate(this);
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
......
...@@ -14,8 +14,6 @@ namespace v8 { ...@@ -14,8 +14,6 @@ namespace v8 {
namespace internal { namespace internal {
TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) { TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* index = Parameter(Descriptor::kName); Node* index = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
...@@ -38,8 +36,6 @@ TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) { ...@@ -38,8 +36,6 @@ TF_BUILTIN(KeyedLoadIC_IndexedString, CodeStubAssembler) {
} }
TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) { TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
...@@ -51,8 +47,6 @@ TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) { ...@@ -51,8 +47,6 @@ TF_BUILTIN(KeyedLoadIC_Miss, CodeStubAssembler) {
} }
TF_BUILTIN(KeyedLoadIC_Slow, CodeStubAssembler) { TF_BUILTIN(KeyedLoadIC_Slow, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -81,8 +75,6 @@ void Builtins::Generate_StoreICStrict_Uninitialized( ...@@ -81,8 +75,6 @@ void Builtins::Generate_StoreICStrict_Uninitialized(
} }
TF_BUILTIN(KeyedStoreIC_Miss, CodeStubAssembler) { TF_BUILTIN(KeyedStoreIC_Miss, CodeStubAssembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue); Node* value = Parameter(Descriptor::kValue);
...@@ -95,8 +87,6 @@ TF_BUILTIN(KeyedStoreIC_Miss, CodeStubAssembler) { ...@@ -95,8 +87,6 @@ TF_BUILTIN(KeyedStoreIC_Miss, CodeStubAssembler) {
} }
TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) { TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue); Node* value = Parameter(Descriptor::kValue);
...@@ -111,8 +101,6 @@ TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) { ...@@ -111,8 +101,6 @@ TF_BUILTIN(KeyedStoreIC_Slow, CodeStubAssembler) {
} }
TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) { TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
...@@ -122,8 +110,6 @@ TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) { ...@@ -122,8 +110,6 @@ TF_BUILTIN(LoadGlobalIC_Miss, CodeStubAssembler) {
} }
TF_BUILTIN(LoadGlobalIC_Slow, CodeStubAssembler) { TF_BUILTIN(LoadGlobalIC_Slow, CodeStubAssembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
Node* vector = Parameter(Descriptor::kVector); Node* vector = Parameter(Descriptor::kVector);
...@@ -137,8 +123,6 @@ void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) { ...@@ -137,8 +123,6 @@ void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
} }
TF_BUILTIN(LoadIC_FunctionPrototype, CodeStubAssembler) { TF_BUILTIN(LoadIC_FunctionPrototype, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
...@@ -166,8 +150,6 @@ TF_BUILTIN(LoadIC_FunctionPrototype, CodeStubAssembler) { ...@@ -166,8 +150,6 @@ TF_BUILTIN(LoadIC_FunctionPrototype, CodeStubAssembler) {
} }
TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) { TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* slot = Parameter(Descriptor::kSlot); Node* slot = Parameter(Descriptor::kSlot);
...@@ -178,8 +160,6 @@ TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) { ...@@ -178,8 +160,6 @@ TF_BUILTIN(LoadIC_Miss, CodeStubAssembler) {
} }
TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) { TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) {
typedef LoadWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -188,8 +168,6 @@ TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) { ...@@ -188,8 +168,6 @@ TF_BUILTIN(LoadIC_Slow, CodeStubAssembler) {
} }
TF_BUILTIN(StoreIC_Miss, CodeStubAssembler) { TF_BUILTIN(StoreIC_Miss, CodeStubAssembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = Parameter(Descriptor::kReceiver); Node* receiver = Parameter(Descriptor::kReceiver);
Node* name = Parameter(Descriptor::kName); Node* name = Parameter(Descriptor::kName);
Node* value = Parameter(Descriptor::kValue); Node* value = Parameter(Descriptor::kValue);
......
...@@ -26,8 +26,6 @@ void Builtins::Generate_StackCheck(MacroAssembler* masm) { ...@@ -26,8 +26,6 @@ void Builtins::Generate_StackCheck(MacroAssembler* masm) {
// TurboFan support builtins. // TurboFan support builtins.
TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) { TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) {
typedef CopyFastSmiOrObjectElementsDescriptor Descriptor;
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
// Load the {object}s elements. // Load the {object}s elements.
...@@ -64,8 +62,6 @@ TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) { ...@@ -64,8 +62,6 @@ TF_BUILTIN(CopyFastSmiOrObjectElements, CodeStubAssembler) {
} }
TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) { TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
typedef GrowArrayElementsDescriptor Descriptor;
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey); Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -81,8 +77,6 @@ TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) { ...@@ -81,8 +77,6 @@ TF_BUILTIN(GrowFastDoubleElements, CodeStubAssembler) {
} }
TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) { TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
typedef GrowArrayElementsDescriptor Descriptor;
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* key = Parameter(Descriptor::kKey); Node* key = Parameter(Descriptor::kKey);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -98,8 +92,6 @@ TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) { ...@@ -98,8 +92,6 @@ TF_BUILTIN(GrowFastSmiOrObjectElements, CodeStubAssembler) {
} }
TF_BUILTIN(NewUnmappedArgumentsElements, CodeStubAssembler) { TF_BUILTIN(NewUnmappedArgumentsElements, CodeStubAssembler) {
typedef NewArgumentsElementsDescriptor Descriptor;
Node* frame = Parameter(Descriptor::kFrame); Node* frame = Parameter(Descriptor::kFrame);
Node* length = SmiToWord(Parameter(Descriptor::kLength)); Node* length = SmiToWord(Parameter(Descriptor::kLength));
......
...@@ -23,7 +23,8 @@ class MathBuiltinsAssembler : public CodeStubAssembler { ...@@ -23,7 +23,8 @@ class MathBuiltinsAssembler : public CodeStubAssembler {
Node* (CodeStubAssembler::*float64op)(Node*)); Node* (CodeStubAssembler::*float64op)(Node*));
void MathUnaryOperation(Node* context, Node* x, void MathUnaryOperation(Node* context, Node* x,
Node* (CodeStubAssembler::*float64op)(Node*)); Node* (CodeStubAssembler::*float64op)(Node*));
void MathMaxMin(Node* (CodeStubAssembler::*float64op)(Node*, Node*), void MathMaxMin(Node* context, Node* argc,
Node* (CodeStubAssembler::*float64op)(Node*, Node*),
double default_val); double default_val);
}; };
...@@ -161,12 +162,8 @@ void MathBuiltinsAssembler::MathUnaryOperation( ...@@ -161,12 +162,8 @@ void MathBuiltinsAssembler::MathUnaryOperation(
} }
void MathBuiltinsAssembler::MathMaxMin( void MathBuiltinsAssembler::MathMaxMin(
Node* context, Node* argc,
Node* (CodeStubAssembler::*float64op)(Node*, Node*), double default_val) { Node* (CodeStubAssembler::*float64op)(Node*, Node*), double default_val) {
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
Node* context = Parameter(BuiltinDescriptor::kContext);
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
argc = arguments.GetLength(); argc = arguments.GetLength();
...@@ -512,12 +509,20 @@ TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) { ...@@ -512,12 +509,20 @@ TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) {
// ES6 #sec-math.max // ES6 #sec-math.max
TF_BUILTIN(MathMax, MathBuiltinsAssembler) { TF_BUILTIN(MathMax, MathBuiltinsAssembler) {
MathMaxMin(&CodeStubAssembler::Float64Max, -1.0 * V8_INFINITY); // TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
Node* context = Parameter(BuiltinDescriptor::kContext);
Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
MathMaxMin(context, argc, &CodeStubAssembler::Float64Max, -1.0 * V8_INFINITY);
} }
// ES6 #sec-math.min // ES6 #sec-math.min
TF_BUILTIN(MathMin, MathBuiltinsAssembler) { TF_BUILTIN(MathMin, MathBuiltinsAssembler) {
MathMaxMin(&CodeStubAssembler::Float64Min, V8_INFINITY); // TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
Node* context = Parameter(BuiltinDescriptor::kContext);
Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
MathMaxMin(context, argc, &CodeStubAssembler::Float64Min, V8_INFINITY);
} }
} // namespace internal } // namespace internal
......
...@@ -352,8 +352,6 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) { ...@@ -352,8 +352,6 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
} }
TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) { TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) {
typedef CreateIterResultObjectDescriptor Descriptor;
Node* const value = Parameter(Descriptor::kValue); Node* const value = Parameter(Descriptor::kValue);
Node* const done = Parameter(Descriptor::kDone); Node* const done = Parameter(Descriptor::kDone);
Node* const context = Parameter(Descriptor::kContext); Node* const context = Parameter(Descriptor::kContext);
...@@ -371,8 +369,6 @@ TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) { ...@@ -371,8 +369,6 @@ TF_BUILTIN(CreateIterResultObject, ObjectBuiltinsAssembler) {
} }
TF_BUILTIN(HasProperty, ObjectBuiltinsAssembler) { TF_BUILTIN(HasProperty, ObjectBuiltinsAssembler) {
typedef HasPropertyDescriptor Descriptor;
Node* key = Parameter(Descriptor::kKey); Node* key = Parameter(Descriptor::kKey);
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -381,8 +377,6 @@ TF_BUILTIN(HasProperty, ObjectBuiltinsAssembler) { ...@@ -381,8 +377,6 @@ TF_BUILTIN(HasProperty, ObjectBuiltinsAssembler) {
} }
TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) { TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) {
typedef CompareDescriptor Descriptor;
Node* object = Parameter(Descriptor::kLeft); Node* object = Parameter(Descriptor::kLeft);
Node* callable = Parameter(Descriptor::kRight); Node* callable = Parameter(Descriptor::kRight);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -392,8 +386,6 @@ TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) { ...@@ -392,8 +386,6 @@ TF_BUILTIN(InstanceOf, ObjectBuiltinsAssembler) {
// ES6 section 7.3.19 OrdinaryHasInstance ( C, O ) // ES6 section 7.3.19 OrdinaryHasInstance ( C, O )
TF_BUILTIN(OrdinaryHasInstance, ObjectBuiltinsAssembler) { TF_BUILTIN(OrdinaryHasInstance, ObjectBuiltinsAssembler) {
typedef CompareDescriptor Descriptor;
Node* constructor = Parameter(Descriptor::kLeft); Node* constructor = Parameter(Descriptor::kLeft);
Node* object = Parameter(Descriptor::kRight); Node* object = Parameter(Descriptor::kRight);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
...@@ -402,8 +394,6 @@ TF_BUILTIN(OrdinaryHasInstance, ObjectBuiltinsAssembler) { ...@@ -402,8 +394,6 @@ TF_BUILTIN(OrdinaryHasInstance, ObjectBuiltinsAssembler) {
} }
TF_BUILTIN(GetSuperConstructor, ObjectBuiltinsAssembler) { TF_BUILTIN(GetSuperConstructor, ObjectBuiltinsAssembler) {
typedef TypeofDescriptor Descriptor;
Node* object = Parameter(Descriptor::kObject); Node* object = Parameter(Descriptor::kObject);
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
......
...@@ -1206,8 +1206,6 @@ TF_BUILTIN(ResolvePromise, PromiseBuiltinsAssembler) { ...@@ -1206,8 +1206,6 @@ TF_BUILTIN(ResolvePromise, PromiseBuiltinsAssembler) {
} }
TF_BUILTIN(PromiseHandleReject, PromiseBuiltinsAssembler) { TF_BUILTIN(PromiseHandleReject, PromiseBuiltinsAssembler) {
typedef PromiseHandleRejectDescriptor Descriptor;
Node* const promise = Parameter(Descriptor::kPromise); Node* const promise = Parameter(Descriptor::kPromise);
Node* const on_reject = Parameter(Descriptor::kOnReject); Node* const on_reject = Parameter(Descriptor::kOnReject);
Node* const exception = Parameter(Descriptor::kException); Node* const exception = Parameter(Descriptor::kException);
......
...@@ -730,8 +730,6 @@ void RegExpBuiltinsAssembler::BranchIfFastRegExpResult(Node* context, Node* map, ...@@ -730,8 +730,6 @@ void RegExpBuiltinsAssembler::BranchIfFastRegExpResult(Node* context, Node* map,
// Slow path stub for RegExpPrototypeExec to decrease code size. // Slow path stub for RegExpPrototypeExec to decrease code size.
TF_BUILTIN(RegExpPrototypeExecSlow, RegExpBuiltinsAssembler) { TF_BUILTIN(RegExpPrototypeExecSlow, RegExpBuiltinsAssembler) {
typedef RegExpPrototypeExecSlowDescriptor Descriptor;
Node* const regexp = Parameter(Descriptor::kReceiver); Node* const regexp = Parameter(Descriptor::kReceiver);
Node* const string = Parameter(Descriptor::kString); Node* const string = Parameter(Descriptor::kString);
Node* const context = Parameter(Descriptor::kContext); Node* const context = Parameter(Descriptor::kContext);
...@@ -2172,8 +2170,6 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSplitBody(Node* const context, ...@@ -2172,8 +2170,6 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSplitBody(Node* const context,
// Helper that skips a few initial checks. // Helper that skips a few initial checks.
TF_BUILTIN(RegExpSplit, RegExpBuiltinsAssembler) { TF_BUILTIN(RegExpSplit, RegExpBuiltinsAssembler) {
typedef RegExpSplitDescriptor Descriptor;
Node* const regexp = Parameter(Descriptor::kReceiver); Node* const regexp = Parameter(Descriptor::kReceiver);
Node* const string = Parameter(Descriptor::kString); Node* const string = Parameter(Descriptor::kString);
Node* const maybe_limit = Parameter(Descriptor::kLimit); Node* const maybe_limit = Parameter(Descriptor::kLimit);
...@@ -2554,8 +2550,6 @@ Node* RegExpBuiltinsAssembler::ReplaceSimpleStringFastPath( ...@@ -2554,8 +2550,6 @@ Node* RegExpBuiltinsAssembler::ReplaceSimpleStringFastPath(
// Helper that skips a few initial checks. // Helper that skips a few initial checks.
TF_BUILTIN(RegExpReplace, RegExpBuiltinsAssembler) { TF_BUILTIN(RegExpReplace, RegExpBuiltinsAssembler) {
typedef RegExpReplaceDescriptor Descriptor;
Node* const regexp = Parameter(Descriptor::kReceiver); Node* const regexp = Parameter(Descriptor::kReceiver);
Node* const string = Parameter(Descriptor::kString); Node* const string = Parameter(Descriptor::kString);
Node* const replace_value = Parameter(Descriptor::kReplaceValue); Node* const replace_value = Parameter(Descriptor::kReplaceValue);
......
...@@ -26,19 +26,28 @@ class CodeAssemblerState; ...@@ -26,19 +26,28 @@ class CodeAssemblerState;
// //
// In the body of the builtin function the arguments can be accessed // In the body of the builtin function the arguments can be accessed
// as "Parameter(n)". // as "Parameter(n)".
#define TF_BUILTIN(Name, AssemblerBase) \ #define TF_BUILTIN(Name, AssemblerBase) \
class Name##Assembler : public AssemblerBase { \ class Name##Assembler : public AssemblerBase { \
public: \ public: \
typedef Builtin_##Name##_InterfaceDescriptor Descriptor; \ typedef Builtin_##Name##_InterfaceDescriptor Descriptor; \
\ \
explicit Name##Assembler(compiler::CodeAssemblerState* state) \ explicit Name##Assembler(compiler::CodeAssemblerState* state) \
: AssemblerBase(state) {} \ : AssemblerBase(state) {} \
void Generate##Name##Impl(); \ void Generate##Name##Impl(); \
}; \ \
void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \ Node* Parameter(Descriptor::ParameterIndices index) { \
Name##Assembler assembler(state); \ return CodeAssembler::Parameter(static_cast<int>(index)); \
assembler.Generate##Name##Impl(); \ } \
} \ /* TODO(ishell): Remove this way of accessing parameters once the */ \
/* JSFunction linkage arguments are reordered. */ \
Node* Parameter(BuiltinDescriptor::ParameterIndices index) { \
return CodeAssembler::Parameter(static_cast<int>(index)); \
} \
}; \
void Builtins::Generate_##Name(compiler::CodeAssemblerState* state) { \
Name##Assembler assembler(state); \
assembler.Generate##Name##Impl(); \
} \
void Name##Assembler::Generate##Name##Impl() void Name##Assembler::Generate##Name##Impl()
} // namespace internal } // namespace internal
......
...@@ -222,7 +222,7 @@ class Isolate; ...@@ -222,7 +222,7 @@ class Isolate;
TFS(ToLength, BUILTIN, kNoExtraICState, TypeConversion, 1) \ TFS(ToLength, BUILTIN, kNoExtraICState, TypeConversion, 1) \
TFS(ClassOf, BUILTIN, kNoExtraICState, Typeof, 1) \ TFS(ClassOf, BUILTIN, kNoExtraICState, Typeof, 1) \
TFS(Typeof, BUILTIN, kNoExtraICState, Typeof, 1) \ TFS(Typeof, BUILTIN, kNoExtraICState, Typeof, 1) \
TFS(GetSuperConstructor, BUILTIN, kNoExtraICState, TypeConversion, 1) \ TFS(GetSuperConstructor, BUILTIN, kNoExtraICState, Typeof, 1) \
\ \
/* Handlers */ \ /* Handlers */ \
TFS(LoadICProtoArray, BUILTIN, kNoExtraICState, LoadICProtoArray, 1) \ TFS(LoadICProtoArray, BUILTIN, kNoExtraICState, LoadICProtoArray, 1) \
......
...@@ -1447,15 +1447,13 @@ class ToDirectStringAssembler : public CodeStubAssembler { ...@@ -1447,15 +1447,13 @@ class ToDirectStringAssembler : public CodeStubAssembler {
#ifdef DEBUG #ifdef DEBUG
#define CSA_ASSERT(csa, x) \ #define CSA_ASSERT(csa, x) \
(csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__) (csa)->Assert([&] { return (x); }, #x, __FILE__, __LINE__)
#define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \ #define CSA_ASSERT_JS_ARGC_OP(csa, Op, op, expected) \
(csa)->Assert( \ (csa)->Assert( \
[&] { \ [&] { \
const CodeAssemblerState* state = (csa)->state(); \ compiler::Node* const argc = \
/* See Linkage::GetJSCallDescriptor(). */ \ (csa)->Parameter(Descriptor::kActualArgumentsCount); \
int argc_index = state->parameter_count() - 2; \ return (csa)->Op(argc, (csa)->Int32Constant(expected)); \
compiler::Node* const argc = (csa)->Parameter(argc_index); \ }, \
return (csa)->Op(argc, (csa)->Int32Constant(expected)); \
}, \
"argc " #op " " #expected, __FILE__, __LINE__) "argc " #op " " #expected, __FILE__, __LINE__)
#define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \ #define CSA_ASSERT_JS_ARGC_EQ(csa, expected) \
......
...@@ -502,7 +502,6 @@ void StringLengthStub::GenerateAssembly( ...@@ -502,7 +502,6 @@ void StringLengthStub::GenerateAssembly(
#define BINARY_OP_STUB(Name) \ #define BINARY_OP_STUB(Name) \
void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \ void Name::GenerateAssembly(compiler::CodeAssemblerState* state) const { \
typedef BinaryOpWithVectorDescriptor Descriptor; \
CodeStubAssembler assembler(state); \ CodeStubAssembler assembler(state); \
assembler.Return(Generate( \ assembler.Return(Generate( \
&assembler, assembler.Parameter(Descriptor::kLeft), \ &assembler, assembler.Parameter(Descriptor::kLeft), \
......
...@@ -280,6 +280,12 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor { ...@@ -280,6 +280,12 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
\ \
public: public:
#define DEFINE_EMPTY_PARAMETERS() \
enum ParameterIndices { \
kParameterCount, \
kContext = kParameterCount /* implicit parameter */ \
};
#define DEFINE_PARAMETERS(...) \ #define DEFINE_PARAMETERS(...) \
enum ParameterIndices { \ enum ParameterIndices { \
__VA_ARGS__, \ __VA_ARGS__, \
...@@ -978,6 +984,7 @@ class PromiseHandleRejectDescriptor final : public CallInterfaceDescriptor { ...@@ -978,6 +984,7 @@ class PromiseHandleRejectDescriptor final : public CallInterfaceDescriptor {
class WasmRuntimeCallDescriptor final : public CallInterfaceDescriptor { class WasmRuntimeCallDescriptor final : public CallInterfaceDescriptor {
public: public:
DEFINE_EMPTY_PARAMETERS()
DECLARE_DEFAULT_DESCRIPTOR(WasmRuntimeCallDescriptor, CallInterfaceDescriptor, DECLARE_DEFAULT_DESCRIPTOR(WasmRuntimeCallDescriptor, CallInterfaceDescriptor,
0) 0)
}; };
......
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