Commit 29817ae0 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[csa] Remove ParameterMode from CSA::CodeStubArguments

Bug: v8:9708
Change-Id: I91e429e478ad70dc2212f9f78830d10941fa47e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1800581Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63740}
parent 0a3e812a
...@@ -81,8 +81,10 @@ ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map, ...@@ -81,8 +81,10 @@ ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map,
} }
Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs( Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs(
Node* map, Node* frame_ptr, Node* arg_count, Node* first_arg, TNode<Map> map, TNode<RawPtrT> frame_ptr, TNode<BInt> arg_count,
Node* rest_count, ParameterMode param_mode, int base_size) { TNode<BInt> first_arg, TNode<BInt> rest_count, ParameterMode param_mode,
int base_size) {
DCHECK_EQ(param_mode, OptimalParameterMode());
// Allocate the parameter object (either a Rest parameter object, a strict // Allocate the parameter object (either a Rest parameter object, a strict
// argument object or a sloppy arguments object) and the elements together and // argument object or a sloppy arguments object) and the elements together and
// fill in the contents with the arguments above |formal_parameter_count|. // fill in the contents with the arguments above |formal_parameter_count|.
...@@ -92,18 +94,18 @@ Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs( ...@@ -92,18 +94,18 @@ Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs(
std::tie(result, elements, unused) = std::tie(result, elements, unused) =
AllocateArgumentsObject(map, rest_count, nullptr, param_mode, base_size); AllocateArgumentsObject(map, rest_count, nullptr, param_mode, base_size);
DCHECK_NULL(unused); DCHECK_NULL(unused);
CodeStubArguments arguments(this, arg_count, frame_ptr, param_mode); CodeStubArguments arguments(this, arg_count, frame_ptr);
TVARIABLE(IntPtrT, offset, TVARIABLE(IntPtrT, offset,
IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag)); IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag));
VariableList list({&offset}, zone()); VariableList list({&offset}, zone());
arguments.ForEach( arguments.ForEach(
list, list,
[&](Node* arg) { [&](TNode<Object> arg) {
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, StoreNoWriteBarrier(MachineRepresentation::kTagged, elements,
offset.value(), arg); offset.value(), arg);
Increment(&offset, kTaggedSize); Increment(&offset, kTaggedSize);
}, },
first_arg, nullptr, param_mode); first_arg);
return result; return result;
} }
...@@ -119,8 +121,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context, ...@@ -119,8 +121,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context,
Label no_rest_parameters(this), runtime(this, Label::kDeferred), Label no_rest_parameters(this), runtime(this, Label::kDeferred),
done(this, &result); done(this, &result);
Node* rest_count = TNode<BInt> rest_count =
IntPtrOrSmiSub(info.argument_count, info.formal_parameter_count, mode); IntPtrOrSmiSub(info.argument_count, info.formal_parameter_count);
TNode<NativeContext> const native_context = LoadNativeContext(context); TNode<NativeContext> const native_context = LoadNativeContext(context);
TNode<Map> const array_map = TNode<Map> const array_map =
LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context); LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
...@@ -174,8 +176,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewStrictArguments(Node* context, ...@@ -174,8 +176,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewStrictArguments(Node* context,
JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize, mode); JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize, mode);
TNode<NativeContext> const native_context = LoadNativeContext(context); TNode<NativeContext> const native_context = LoadNativeContext(context);
TNode<Object> const map = TNode<Map> map = CAST(
LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX); LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX));
GotoIf(BIntEqual(info.argument_count, zero), &empty); GotoIf(BIntEqual(info.argument_count, zero), &empty);
result.Bind(ConstructParametersObjectFromArgs( result.Bind(ConstructParametersObjectFromArgs(
...@@ -253,14 +255,14 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -253,14 +255,14 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
Comment("Fill in non-mapped parameters"); Comment("Fill in non-mapped parameters");
TNode<IntPtrT> argument_offset = TNode<IntPtrT> argument_offset =
ElementOffsetFromIndex(info.argument_count, PACKED_ELEMENTS, mode, ElementOffsetFromIndex(info.argument_count, PACKED_ELEMENTS,
FixedArray::kHeaderSize - kHeapObjectTag); FixedArray::kHeaderSize - kHeapObjectTag);
TNode<IntPtrT> mapped_offset = TNode<IntPtrT> mapped_offset =
ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS, mode, ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS,
FixedArray::kHeaderSize - kHeapObjectTag); FixedArray::kHeaderSize - kHeapObjectTag);
CodeStubArguments arguments(this, info.argument_count, info.frame, mode); CodeStubArguments arguments(this, info.argument_count, info.frame);
TVARIABLE(IntPtrT, current_argument, TVARIABLE(RawPtrT, current_argument,
Signed(arguments.AtIndexPtr(info.argument_count, mode))); arguments.AtIndexPtr(info.argument_count));
VariableList var_list1({&current_argument}, zone()); VariableList var_list1({&current_argument}, zone());
mapped_offset = BuildFastLoop<IntPtrT>( mapped_offset = BuildFastLoop<IntPtrT>(
var_list1, argument_offset, mapped_offset, var_list1, argument_offset, mapped_offset,
...@@ -319,8 +321,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -319,8 +321,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
info.argument_count, &runtime, info.argument_count, &runtime,
JSSloppyArgumentsObject::kSize + FixedArray::kHeaderSize, mode); JSSloppyArgumentsObject::kSize + FixedArray::kHeaderSize, mode);
TNode<NativeContext> const native_context = LoadNativeContext(context); TNode<NativeContext> const native_context = LoadNativeContext(context);
TNode<Object> const map = TNode<Map> map = CAST(LoadContextElement(
LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX); native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX));
result.Bind(ConstructParametersObjectFromArgs( result.Bind(ConstructParametersObjectFromArgs(
map, info.frame, info.argument_count, zero, info.argument_count, mode, map, info.frame, info.argument_count, zero, info.argument_count, mode,
JSSloppyArgumentsObject::kSize)); JSSloppyArgumentsObject::kSize));
......
...@@ -40,10 +40,9 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler { ...@@ -40,10 +40,9 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler {
// and then copies |rest_count| arguments from the stack frame pointed to by // and then copies |rest_count| arguments from the stack frame pointed to by
// |frame_ptr| starting from |first_arg|. |arg_count| == |first_arg| + // |frame_ptr| starting from |first_arg|. |arg_count| == |first_arg| +
// |rest_count|. // |rest_count|.
Node* ConstructParametersObjectFromArgs(Node* map, Node* frame_ptr, Node* ConstructParametersObjectFromArgs(
Node* arg_count, Node* first_arg, TNode<Map> map, TNode<RawPtrT> frame_ptr, TNode<BInt> arg_count,
Node* rest_count, TNode<BInt> first_arg, TNode<BInt> rest_count, ParameterMode param_mode,
ParameterMode param_mode,
int base_size); int base_size);
}; };
......
...@@ -298,7 +298,7 @@ TF_BUILTIN(ArrayPrototypePop, CodeStubAssembler) { ...@@ -298,7 +298,7 @@ TF_BUILTIN(ArrayPrototypePop, CodeStubAssembler) {
TNode<Context> context = CAST(Parameter(Descriptor::kContext)); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget))); CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget)));
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
Label runtime(this, Label::kDeferred); Label runtime(this, Label::kDeferred);
...@@ -395,14 +395,12 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) { ...@@ -395,14 +395,12 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
Label double_transition(this); Label double_transition(this);
Label runtime(this, Label::kDeferred); Label runtime(this, Label::kDeferred);
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
TNode<Int32T> argc = TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext)); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget))); CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget)));
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
TNode<JSArray> array_receiver; TNode<JSArray> array_receiver;
TNode<Int32T> kind; TNode<Int32T> kind;
...@@ -494,9 +492,9 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) { ...@@ -494,9 +492,9 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
BIND(&default_label); BIND(&default_label);
{ {
args.ForEach( args.ForEach(
[this, array_receiver, context](Node* arg) { [=](TNode<Object> arg) {
TNode<Number> length = LoadJSArrayLength(array_receiver); TNode<Number> length = LoadJSArrayLength(array_receiver);
SetPropertyStrict(context, array_receiver, length, CAST(arg)); SetPropertyStrict(context, array_receiver, length, arg);
}, },
arg_index.value()); arg_index.value());
args.PopAndReturn(LoadJSArrayLength(array_receiver)); args.PopAndReturn(LoadJSArrayLength(array_receiver));
...@@ -626,7 +624,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -626,7 +624,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
TNode<Int32T> argc = TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> items = args.GetOptionalArgumentValue(0); TNode<Object> items = args.GetOptionalArgumentValue(0);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
...@@ -1031,8 +1029,7 @@ void ArrayIncludesIndexofAssembler::Generate(SearchVariant variant, ...@@ -1031,8 +1029,7 @@ void ArrayIncludesIndexofAssembler::Generate(SearchVariant variant,
BIND(&call_runtime); BIND(&call_runtime);
{ {
TNode<Object> start_from = TNode<Object> start_from = args.GetOptionalArgumentValue(kFromIndexArg);
args.GetOptionalArgumentValue(kFromIndexArg, UndefinedConstant());
Runtime::FunctionId function = variant == kIncludes Runtime::FunctionId function = variant == kIncludes
? Runtime::kArrayIncludes_Slow ? Runtime::kArrayIncludes_Slow
: Runtime::kArrayIndexOf; : Runtime::kArrayIndexOf;
...@@ -2221,7 +2218,7 @@ void ArrayBuiltinsAssembler::GenerateArrayNArgumentsConstructor( ...@@ -2221,7 +2218,7 @@ void ArrayBuiltinsAssembler::GenerateArrayNArgumentsConstructor(
// Replace incoming JS receiver argument with the target. // Replace incoming JS receiver argument with the target.
// TODO(ishell): Avoid replacing the target on the stack and just add it // TODO(ishell): Avoid replacing the target on the stack and just add it
// as another additional parameter for Runtime::kNewArray. // as another additional parameter for Runtime::kNewArray.
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
args.SetReceiver(target); args.SetReceiver(target);
// Adjust arguments count for the runtime call: +1 for implicit receiver // Adjust arguments count for the runtime call: +1 for implicit receiver
......
...@@ -1002,7 +1002,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList( ...@@ -1002,7 +1002,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList(
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag; const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
TNode<IntPtrT> first_to_element_offset = TNode<IntPtrT> first_to_element_offset =
ElementOffsetFromIndex(IntPtrConstant(0), kind, INTPTR_PARAMETERS, 0); ElementOffsetFromIndex(IntPtrConstant(0), kind, 0);
VARIABLE( VARIABLE(
var_offset, MachineType::PointerRepresentation(), var_offset, MachineType::PointerRepresentation(),
IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset))); IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset)));
...@@ -1115,7 +1115,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList( ...@@ -1115,7 +1115,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList(
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag; const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
TNode<IntPtrT> first_to_element_offset = TNode<IntPtrT> first_to_element_offset =
ElementOffsetFromIndex(IntPtrConstant(0), kind, INTPTR_PARAMETERS, 0); ElementOffsetFromIndex(IntPtrConstant(0), kind, 0);
VARIABLE( VARIABLE(
var_offset, MachineType::PointerRepresentation(), var_offset, MachineType::PointerRepresentation(),
IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset))); IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset)));
...@@ -1887,9 +1887,10 @@ TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) { ...@@ -1887,9 +1887,10 @@ TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) {
TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) { TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) {
const char* const kMethodName = "Map.prototype.forEach"; const char* const kMethodName = "Map.prototype.forEach";
Node* const argc = Parameter(Descriptor::kJSActualArgumentsCount); TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* const context = Parameter(Descriptor::kContext); Node* const context = Parameter(Descriptor::kContext);
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> const receiver = args.GetReceiver(); TNode<Object> const receiver = args.GetReceiver();
TNode<Object> const callback = args.GetOptionalArgumentValue(0); TNode<Object> const callback = args.GetOptionalArgumentValue(0);
TNode<Object> const this_arg = args.GetOptionalArgumentValue(1); TNode<Object> const this_arg = args.GetOptionalArgumentValue(1);
...@@ -2119,9 +2120,10 @@ TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) { ...@@ -2119,9 +2120,10 @@ TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) {
TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) { TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) {
const char* const kMethodName = "Set.prototype.forEach"; const char* const kMethodName = "Set.prototype.forEach";
Node* const argc = Parameter(Descriptor::kJSActualArgumentsCount); TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* const context = Parameter(Descriptor::kContext); Node* const context = Parameter(Descriptor::kContext);
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> const receiver = args.GetReceiver(); TNode<Object> const receiver = args.GetReceiver();
TNode<Object> const callback = args.GetOptionalArgumentValue(0); TNode<Object> const callback = args.GetOptionalArgumentValue(0);
TNode<Object> const this_arg = args.GetOptionalArgumentValue(1); TNode<Object> const this_arg = args.GetOptionalArgumentValue(1);
......
...@@ -15,15 +15,13 @@ TF_BUILTIN(FastConsoleAssert, CodeStubAssembler) { ...@@ -15,15 +15,13 @@ TF_BUILTIN(FastConsoleAssert, CodeStubAssembler) {
Label runtime(this); Label runtime(this);
Label out(this); Label out(this);
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
TNode<Int32T> argc = TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Node* new_target = Parameter(Descriptor::kJSNewTarget); Node* new_target = Parameter(Descriptor::kJSNewTarget);
GotoIf(Word32Equal(argc, Int32Constant(0)), &runtime); GotoIf(Word32Equal(argc, Int32Constant(0)), &runtime);
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
BranchIfToBooleanIsTrue(args.AtIndex(0), &out, &runtime); BranchIfToBooleanIsTrue(args.AtIndex(0), &out, &runtime);
BIND(&out); BIND(&out);
args.PopAndReturn(UndefinedConstant()); args.PopAndReturn(UndefinedConstant());
......
...@@ -223,8 +223,7 @@ TNode<Context> ConstructorBuiltinsAssembler::EmitFastNewFunctionContext( ...@@ -223,8 +223,7 @@ TNode<Context> ConstructorBuiltinsAssembler::EmitFastNewFunctionContext(
TNode<ScopeInfo> scope_info, TNode<Uint32T> slots, TNode<Context> context, TNode<ScopeInfo> scope_info, TNode<Uint32T> slots, TNode<Context> context,
ScopeType scope_type) { ScopeType scope_type) {
TNode<IntPtrT> slots_intptr = Signed(ChangeUint32ToWord(slots)); TNode<IntPtrT> slots_intptr = Signed(ChangeUint32ToWord(slots));
TNode<IntPtrT> size = TNode<IntPtrT> size = ElementOffsetFromIndex(slots_intptr, PACKED_ELEMENTS,
ElementOffsetFromIndex(slots_intptr, PACKED_ELEMENTS, INTPTR_PARAMETERS,
Context::kTodoHeaderSize); Context::kTodoHeaderSize);
// Create a new closure from the given function info in new space // Create a new closure from the given function info in new space
......
...@@ -15,14 +15,12 @@ namespace internal { ...@@ -15,14 +15,12 @@ namespace internal {
TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) { TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
Label slow(this); Label slow(this);
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
// arguments are reordered.
TNode<Int32T> argc = TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
Node* new_target = Parameter(Descriptor::kJSNewTarget); Node* new_target = Parameter(Descriptor::kJSNewTarget);
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
// Check that receiver has instance type of JS_FUNCTION_TYPE // Check that receiver has instance type of JS_FUNCTION_TYPE
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
...@@ -128,7 +126,7 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) { ...@@ -128,7 +126,7 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
VariableList foreach_vars({&index}, zone()); VariableList foreach_vars({&index}, zone());
args.ForEach( args.ForEach(
foreach_vars, foreach_vars,
[&](Node* arg) { [&](TNode<Object> arg) {
StoreFixedArrayElement(elements, index.value(), arg); StoreFixedArrayElement(elements, index.value(), arg);
Increment(&index); Increment(&index);
}, },
......
...@@ -115,13 +115,13 @@ void GeneratorBuiltinsAssembler::GeneratorPrototypeResume( ...@@ -115,13 +115,13 @@ void GeneratorBuiltinsAssembler::GeneratorPrototypeResume(
TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) { TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) {
const int kValueArg = 0; const int kValueArg = 0;
TNode<IntPtrT> argc = TNode<Int32T> argc =
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
CodeStubArguments args(this, argc); CodeStubArguments args(this, argc);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
TNode<Object> value = args.GetOptionalArgumentValue(kValueArg); TNode<Object> value = args.GetOptionalArgumentValue(kValueArg);
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
GeneratorPrototypeResume(&args, receiver, value, context, GeneratorPrototypeResume(&args, receiver, value, context,
JSGeneratorObject::kNext, JSGeneratorObject::kNext,
...@@ -132,13 +132,13 @@ TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) { ...@@ -132,13 +132,13 @@ TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) {
TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) { TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) {
const int kValueArg = 0; const int kValueArg = 0;
TNode<IntPtrT> argc = TNode<Int32T> argc =
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
CodeStubArguments args(this, argc); CodeStubArguments args(this, argc);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
TNode<Object> value = args.GetOptionalArgumentValue(kValueArg); TNode<Object> value = args.GetOptionalArgumentValue(kValueArg);
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
GeneratorPrototypeResume(&args, receiver, value, context, GeneratorPrototypeResume(&args, receiver, value, context,
JSGeneratorObject::kReturn, JSGeneratorObject::kReturn,
...@@ -149,13 +149,13 @@ TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) { ...@@ -149,13 +149,13 @@ TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) {
TF_BUILTIN(GeneratorPrototypeThrow, GeneratorBuiltinsAssembler) { TF_BUILTIN(GeneratorPrototypeThrow, GeneratorBuiltinsAssembler) {
const int kExceptionArg = 0; const int kExceptionArg = 0;
TNode<IntPtrT> argc = TNode<Int32T> argc =
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
CodeStubArguments args(this, argc); CodeStubArguments args(this, argc);
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
TNode<Object> exception = args.GetOptionalArgumentValue(kExceptionArg); TNode<Object> exception = args.GetOptionalArgumentValue(kExceptionArg);
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
GeneratorPrototypeResume(&args, receiver, exception, context, GeneratorPrototypeResume(&args, receiver, exception, context,
JSGeneratorObject::kThrow, JSGeneratorObject::kThrow,
......
...@@ -139,7 +139,7 @@ void IntlBuiltinsAssembler::ListFormatCommon(TNode<Context> context, ...@@ -139,7 +139,7 @@ void IntlBuiltinsAssembler::ListFormatCommon(TNode<Context> context,
TNode<Int32T> argc, TNode<Int32T> argc,
Runtime::FunctionId format_func_id, Runtime::FunctionId format_func_id,
const char* method_name) { const char* method_name) {
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
// Label has_list(this); // Label has_list(this);
// 1. Let lf be this value. // 1. Let lf be this value.
......
...@@ -143,20 +143,18 @@ void MathBuiltinsAssembler::MathRoundingOperation( ...@@ -143,20 +143,18 @@ void MathBuiltinsAssembler::MathRoundingOperation(
} }
void MathBuiltinsAssembler::MathMaxMin( void MathBuiltinsAssembler::MathMaxMin(
Node* context, Node* argc, TNode<Context> context, TNode<Int32T> argc,
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>, TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>,
SloppyTNode<Float64T>), SloppyTNode<Float64T>),
double default_val) { double default_val) {
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments arguments(this, argc);
argc = arguments.GetLength(INTPTR_PARAMETERS);
VARIABLE(result, MachineRepresentation::kFloat64); TVARIABLE(Float64T, result, Float64Constant(default_val));
result.Bind(Float64Constant(default_val));
CodeStubAssembler::VariableList vars({&result}, zone()); CodeStubAssembler::VariableList vars({&result}, zone());
arguments.ForEach(vars, [=, &result](Node* arg) { arguments.ForEach(vars, [&](TNode<Object> arg) {
Node* float_value = TruncateTaggedToFloat64(context, arg); TNode<Float64T> float_value = TruncateTaggedToFloat64(context, arg);
result.Bind((this->*float64op)(result.value(), float_value)); result = (this->*float64op)(result.value(), float_value);
}); });
arguments.PopAndReturn(ChangeFloat64ToTagged(result.value())); arguments.PopAndReturn(ChangeFloat64ToTagged(result.value()));
...@@ -260,19 +258,17 @@ TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) { ...@@ -260,19 +258,17 @@ TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) {
// ES6 #sec-math.max // ES6 #sec-math.max
TF_BUILTIN(MathMax, MathBuiltinsAssembler) { TF_BUILTIN(MathMax, MathBuiltinsAssembler) {
// TODO(ishell): use constants from Descriptor once the JSFunction linkage TNode<Context> context = CAST(Parameter(Descriptor::kContext));
// arguments are reordered. TNode<Int32T> argc =
Node* context = Parameter(Descriptor::kContext); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
MathMaxMin(context, argc, &CodeStubAssembler::Float64Max, -1.0 * V8_INFINITY); 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) {
// TODO(ishell): use constants from Descriptor once the JSFunction linkage TNode<Context> context = CAST(Parameter(Descriptor::kContext));
// arguments are reordered. TNode<Int32T> argc =
Node* context = Parameter(Descriptor::kContext); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
MathMaxMin(context, argc, &CodeStubAssembler::Float64Min, V8_INFINITY); MathMaxMin(context, argc, &CodeStubAssembler::Float64Min, V8_INFINITY);
} }
......
...@@ -21,7 +21,7 @@ class MathBuiltinsAssembler : public CodeStubAssembler { ...@@ -21,7 +21,7 @@ class MathBuiltinsAssembler : public CodeStubAssembler {
void MathRoundingOperation( void MathRoundingOperation(
Node* context, Node* x, Node* context, Node* x,
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>)); TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>));
void MathMaxMin(Node* context, Node* argc, void MathMaxMin(TNode<Context> context, TNode<Int32T> argc,
TNode<Float64T> (CodeStubAssembler::*float64op)( TNode<Float64T> (CodeStubAssembler::*float64op)(
SloppyTNode<Float64T>, SloppyTNode<Float64T>), SloppyTNode<Float64T>, SloppyTNode<Float64T>),
double default_val); double default_val);
......
...@@ -451,7 +451,7 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) { ...@@ -451,7 +451,7 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) {
// second argument. // second argument.
// 4. For each element nextSource of sources, in ascending index order, // 4. For each element nextSource of sources, in ascending index order,
args.ForEach( args.ForEach(
[=](Node* next_source) { [=](TNode<Object> next_source) {
CallBuiltin(Builtins::kSetDataProperties, context, to, next_source); CallBuiltin(Builtins::kSetDataProperties, context, to, next_source);
}, },
IntPtrConstant(1)); IntPtrConstant(1));
...@@ -1334,11 +1334,12 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) { ...@@ -1334,11 +1334,12 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
// ES6 section 19.1.2.7 Object.getOwnPropertyDescriptor ( O, P ) // ES6 section 19.1.2.7 Object.getOwnPropertyDescriptor ( O, P )
TF_BUILTIN(ObjectGetOwnPropertyDescriptor, ObjectBuiltinsAssembler) { TF_BUILTIN(ObjectGetOwnPropertyDescriptor, ObjectBuiltinsAssembler) {
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount); TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget))); CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget)));
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, argc);
TNode<Object> object_input = args.GetOptionalArgumentValue(0); TNode<Object> object_input = args.GetOptionalArgumentValue(0);
TNode<Object> key = args.GetOptionalArgumentValue(1); TNode<Object> key = args.GetOptionalArgumentValue(1);
......
...@@ -80,7 +80,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments( ...@@ -80,7 +80,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
GotoIf(SmiGreaterThan(length, SmiConstant(FixedArray::kMaxRegularLength)), GotoIf(SmiGreaterThan(length, SmiConstant(FixedArray::kMaxRegularLength)),
&if_large_object); &if_large_object);
args.ForEach(list, [=, &offset](Node* arg) { args.ForEach(list, [&](TNode<Object> arg) {
StoreNoWriteBarrier(MachineRepresentation::kTagged, allocated_elements, StoreNoWriteBarrier(MachineRepresentation::kTagged, allocated_elements,
offset.value(), arg); offset.value(), arg);
Increment(&offset, kTaggedSize); Increment(&offset, kTaggedSize);
...@@ -89,7 +89,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments( ...@@ -89,7 +89,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
BIND(&if_large_object); BIND(&if_large_object);
{ {
args.ForEach(list, [=, &offset](Node* arg) { args.ForEach(list, [&](TNode<Object> arg) {
Store(allocated_elements, offset.value(), arg); Store(allocated_elements, offset.value(), arg);
Increment(&offset, kTaggedSize); Increment(&offset, kTaggedSize);
}); });
......
...@@ -670,12 +670,12 @@ TNode<HeapObject> RegExpBuiltinsAssembler::RegExpExecInternal( ...@@ -670,12 +670,12 @@ TNode<HeapObject> RegExpBuiltinsAssembler::RegExpExecInternal(
// Fill match and capture offsets in match_info. // Fill match and capture offsets in match_info.
{ {
TNode<IntPtrT> limit_offset = ElementOffsetFromIndex( TNode<IntPtrT> limit_offset =
register_count, INT32_ELEMENTS, SMI_PARAMETERS, 0); ElementOffsetFromIndex(register_count, INT32_ELEMENTS, 0);
TNode<IntPtrT> to_offset = ElementOffsetFromIndex( TNode<IntPtrT> to_offset = ElementOffsetFromIndex(
IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), PACKED_ELEMENTS, IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), PACKED_ELEMENTS,
INTPTR_PARAMETERS, RegExpMatchInfo::kHeaderSize - kHeapObjectTag); RegExpMatchInfo::kHeaderSize - kHeapObjectTag);
TVARIABLE(IntPtrT, var_to_offset, to_offset); TVARIABLE(IntPtrT, var_to_offset, to_offset);
VariableList vars({&var_to_offset}, zone()); VariableList vars({&var_to_offset}, zone());
......
...@@ -118,14 +118,14 @@ Node* StringBuiltinsAssembler::CallSearchStringRaw(Node* const subject_ptr, ...@@ -118,14 +118,14 @@ Node* StringBuiltinsAssembler::CallSearchStringRaw(Node* const subject_ptr,
return result; return result;
} }
TNode<IntPtrT> StringBuiltinsAssembler::PointerToStringDataAtIndex( TNode<RawPtrT> StringBuiltinsAssembler::PointerToStringDataAtIndex(
Node* const string_data, Node* const index, String::Encoding encoding) { TNode<RawPtrT> string_data, TNode<IntPtrT> index,
String::Encoding encoding) {
const ElementsKind kind = (encoding == String::ONE_BYTE_ENCODING) const ElementsKind kind = (encoding == String::ONE_BYTE_ENCODING)
? UINT8_ELEMENTS ? UINT8_ELEMENTS
: UINT16_ELEMENTS; : UINT16_ELEMENTS;
TNode<IntPtrT> const offset_in_bytes = TNode<IntPtrT> offset_in_bytes = ElementOffsetFromIndex(index, kind);
ElementOffsetFromIndex(index, kind, INTPTR_PARAMETERS); return RawPtrAdd(string_data, offset_in_bytes);
return Signed(IntPtrAdd(string_data, offset_in_bytes));
} }
void StringBuiltinsAssembler::GenerateStringEqual(TNode<String> left, void StringBuiltinsAssembler::GenerateStringEqual(TNode<String> left,
...@@ -556,7 +556,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) { ...@@ -556,7 +556,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
Node* context = Parameter(Descriptor::kContext); Node* context = Parameter(Descriptor::kContext);
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments arguments(this, argc);
// Check if we have exactly one argument (plus the implicit receiver), i.e. // Check if we have exactly one argument (plus the implicit receiver), i.e.
// if the parent frame is not an arguments adaptor frame. // if the parent frame is not an arguments adaptor frame.
Label if_oneargument(this), if_notoneargument(this); Label if_oneargument(this), if_notoneargument(this);
...@@ -590,8 +590,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) { ...@@ -590,8 +590,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
// codes. Stop if any of the conversions generates a code that doesn't fit // codes. Stop if any of the conversions generates a code that doesn't fit
// in 8 bits. // in 8 bits.
CodeStubAssembler::VariableList vars({&var_max_index}, zone()); CodeStubAssembler::VariableList vars({&var_max_index}, zone());
arguments.ForEach(vars, [this, context, &two_byte, &var_max_index, &code16, arguments.ForEach(vars, [&](TNode<Object> arg) {
one_byte_result](Node* arg) {
Node* code32 = TruncateTaggedToWord32(context, arg); Node* code32 = TruncateTaggedToWord32(context, arg);
code16 = Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit)); code16 = Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit));
...@@ -638,14 +637,13 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) { ...@@ -638,14 +637,13 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
// using a 16-bit representation. // using a 16-bit representation.
arguments.ForEach( arguments.ForEach(
vars, vars,
[this, context, two_byte_result, &var_max_index](Node* arg) { [&](TNode<Object> arg) {
Node* code32 = TruncateTaggedToWord32(context, arg); TNode<Word32T> code32 = TruncateTaggedToWord32(context, arg);
TNode<Word32T> code16 = TNode<Word32T> code16 =
Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit)); Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit));
TNode<IntPtrT> offset = ElementOffsetFromIndex( TNode<IntPtrT> offset = ElementOffsetFromIndex(
var_max_index.value(), UINT16_ELEMENTS, var_max_index.value(), UINT16_ELEMENTS,
CodeStubAssembler::INTPTR_PARAMETERS,
SeqTwoByteString::kHeaderSize - kHeapObjectTag); SeqTwoByteString::kHeaderSize - kHeapObjectTag);
StoreNoWriteBarrier(MachineRepresentation::kWord16, two_byte_result, StoreNoWriteBarrier(MachineRepresentation::kWord16, two_byte_result,
offset, code16); offset, code16);
...@@ -721,9 +719,9 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -721,9 +719,9 @@ void StringBuiltinsAssembler::StringIndexOf(
BIND(&one_one); BIND(&one_one);
{ {
TNode<IntPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex(
subject_ptr, subject_offset, String::ONE_BYTE_ENCODING); subject_ptr, subject_offset, String::ONE_BYTE_ENCODING);
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
search_ptr, search_offset, String::ONE_BYTE_ENCODING); search_ptr, search_offset, String::ONE_BYTE_ENCODING);
Label direct_memchr_call(this), generic_fast_path(this); Label direct_memchr_call(this), generic_fast_path(this);
...@@ -734,8 +732,8 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -734,8 +732,8 @@ void StringBuiltinsAssembler::StringIndexOf(
// search strings. // search strings.
BIND(&direct_memchr_call); BIND(&direct_memchr_call);
{ {
TNode<IntPtrT> const string_addr = TNode<RawPtrT> const string_addr =
IntPtrAdd(adjusted_subject_ptr, start_position); RawPtrAdd(adjusted_subject_ptr, start_position);
TNode<IntPtrT> const search_length = TNode<IntPtrT> const search_length =
IntPtrSub(subject_length, start_position); IntPtrSub(subject_length, start_position);
TNode<IntPtrT> const search_byte = TNode<IntPtrT> const search_byte =
...@@ -743,14 +741,14 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -743,14 +741,14 @@ void StringBuiltinsAssembler::StringIndexOf(
TNode<ExternalReference> const memchr = TNode<ExternalReference> const memchr =
ExternalConstant(ExternalReference::libc_memchr_function()); ExternalConstant(ExternalReference::libc_memchr_function());
TNode<IntPtrT> const result_address = UncheckedCast<IntPtrT>( TNode<RawPtrT> const result_address = UncheckedCast<RawPtrT>(
CallCFunction(memchr, MachineType::Pointer(), CallCFunction(memchr, MachineType::Pointer(),
std::make_pair(MachineType::Pointer(), string_addr), std::make_pair(MachineType::Pointer(), string_addr),
std::make_pair(MachineType::IntPtr(), search_byte), std::make_pair(MachineType::IntPtr(), search_byte),
std::make_pair(MachineType::UintPtr(), search_length))); std::make_pair(MachineType::UintPtr(), search_length)));
GotoIf(WordEqual(result_address, int_zero), &return_minus_1); GotoIf(WordEqual(result_address, int_zero), &return_minus_1);
TNode<IntPtrT> const result_index = TNode<IntPtrT> const result_index =
IntPtrAdd(IntPtrSub(result_address, string_addr), start_position); IntPtrAdd(RawPtrSub(result_address, string_addr), start_position);
f_return(SmiTag(result_index)); f_return(SmiTag(result_index));
} }
...@@ -765,9 +763,9 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -765,9 +763,9 @@ void StringBuiltinsAssembler::StringIndexOf(
BIND(&one_two); BIND(&one_two);
{ {
TNode<IntPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex(
subject_ptr, subject_offset, String::ONE_BYTE_ENCODING); subject_ptr, subject_offset, String::ONE_BYTE_ENCODING);
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
search_ptr, search_offset, String::TWO_BYTE_ENCODING); search_ptr, search_offset, String::TWO_BYTE_ENCODING);
Node* const result = CallSearchStringRaw<onebyte_t, twobyte_t>( Node* const result = CallSearchStringRaw<onebyte_t, twobyte_t>(
...@@ -778,9 +776,9 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -778,9 +776,9 @@ void StringBuiltinsAssembler::StringIndexOf(
BIND(&two_one); BIND(&two_one);
{ {
TNode<IntPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex(
subject_ptr, subject_offset, String::TWO_BYTE_ENCODING); subject_ptr, subject_offset, String::TWO_BYTE_ENCODING);
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
search_ptr, search_offset, String::ONE_BYTE_ENCODING); search_ptr, search_offset, String::ONE_BYTE_ENCODING);
Node* const result = CallSearchStringRaw<twobyte_t, onebyte_t>( Node* const result = CallSearchStringRaw<twobyte_t, onebyte_t>(
...@@ -791,9 +789,9 @@ void StringBuiltinsAssembler::StringIndexOf( ...@@ -791,9 +789,9 @@ void StringBuiltinsAssembler::StringIndexOf(
BIND(&two_two); BIND(&two_two);
{ {
TNode<IntPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_subject_ptr = PointerToStringDataAtIndex(
subject_ptr, subject_offset, String::TWO_BYTE_ENCODING); subject_ptr, subject_offset, String::TWO_BYTE_ENCODING);
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex( TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
search_ptr, search_offset, String::TWO_BYTE_ENCODING); search_ptr, search_offset, String::TWO_BYTE_ENCODING);
Node* const result = CallSearchStringRaw<twobyte_t, twobyte_t>( Node* const result = CallSearchStringRaw<twobyte_t, twobyte_t>(
......
...@@ -51,8 +51,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler { ...@@ -51,8 +51,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
Node* const search_ptr, Node* const search_length, Node* const search_ptr, Node* const search_length,
Node* const start_position); Node* const start_position);
TNode<IntPtrT> PointerToStringDataAtIndex(Node* const string_data, TNode<RawPtrT> PointerToStringDataAtIndex(TNode<RawPtrT> string_data,
Node* const index, TNode<IntPtrT> index,
String::Encoding encoding); String::Encoding encoding);
// substr and slice have a common way of handling the {start} argument. // substr and slice have a common way of handling the {start} argument.
......
...@@ -539,10 +539,10 @@ TNode<BoolT> TypedArrayBuiltinsAssembler::IsSharedArrayBuffer( ...@@ -539,10 +539,10 @@ TNode<BoolT> TypedArrayBuiltinsAssembler::IsSharedArrayBuffer(
// ES #sec-get-%typedarray%.prototype.set // ES #sec-get-%typedarray%.prototype.set
TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) { TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) {
const char* method_name = "%TypedArray%.prototype.set"; const char* method_name = "%TypedArray%.prototype.set";
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext)); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
CodeStubArguments args( CodeStubArguments args(this, argc);
this,
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)));
Label if_source_is_typed_array(this), if_source_is_fast_jsarray(this), Label if_source_is_typed_array(this), if_source_is_fast_jsarray(this),
if_offset_is_out_of_bounds(this, Label::kDeferred), if_offset_is_out_of_bounds(this, Label::kDeferred),
...@@ -708,8 +708,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) { ...@@ -708,8 +708,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
TNode<IntPtrT> length = ChangeInt32ToIntPtr( TNode<IntPtrT> length = ChangeInt32ToIntPtr(
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount))); UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)));
// 2. Let items be the List of arguments passed to this function. // 2. Let items be the List of arguments passed to this function.
CodeStubArguments args(this, length, nullptr, INTPTR_PARAMETERS, CodeStubArguments args(this, length);
CodeStubArguments::ReceiverMode::kHasReceiver);
Label if_not_constructor(this, Label::kDeferred), Label if_not_constructor(this, Label::kDeferred),
if_detached(this, Label::kDeferred); if_detached(this, Label::kDeferred);
...@@ -738,7 +737,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) { ...@@ -738,7 +737,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
BuildFastLoop<IntPtrT>( BuildFastLoop<IntPtrT>(
IntPtrConstant(0), length, IntPtrConstant(0), length,
[&](TNode<IntPtrT> index) { [&](TNode<IntPtrT> index) {
TNode<Object> item = args.AtIndex(index, INTPTR_PARAMETERS); TNode<Object> item = args.AtIndex(index);
Node* value = Node* value =
PrepareValueForWriteToTypedArray(item, kind, context); PrepareValueForWriteToTypedArray(item, kind, context);
...@@ -771,6 +770,8 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) { ...@@ -771,6 +770,8 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
// ES6 #sec-%typedarray%.from // ES6 #sec-%typedarray%.from
TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
TNode<Context> context = CAST(Parameter(Descriptor::kContext)); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Label check_iterator(this), from_array_like(this), fast_path(this), Label check_iterator(this), from_array_like(this), fast_path(this),
...@@ -780,9 +781,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { ...@@ -780,9 +781,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
if_iterator_fn_not_callable(this, Label::kDeferred), if_iterator_fn_not_callable(this, Label::kDeferred),
if_detached(this, Label::kDeferred); if_detached(this, Label::kDeferred);
CodeStubArguments args( CodeStubArguments args(this, argc);
this,
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)));
TNode<Object> source = args.GetOptionalArgumentValue(0); TNode<Object> source = args.GetOptionalArgumentValue(0);
// 5. If thisArg is present, let T be thisArg; else let T be undefined. // 5. If thisArg is present, let T be thisArg; else let T be undefined.
......
This diff is collapsed.
...@@ -299,11 +299,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -299,11 +299,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return ParameterRepresentation(OptimalParameterMode()); return ParameterRepresentation(OptimalParameterMode());
} }
TNode<IntPtrT> ParameterToIntPtr(TNode<Smi> value) { return SmiUntag(value); }
TNode<IntPtrT> ParameterToIntPtr(TNode<IntPtrT> value) { return value; }
// TODO(v8:9708): remove once all uses are ported.
TNode<IntPtrT> ParameterToIntPtr(Node* value, ParameterMode mode) { TNode<IntPtrT> ParameterToIntPtr(Node* value, ParameterMode mode) {
if (mode == SMI_PARAMETERS) value = SmiUntag(value); if (mode == SMI_PARAMETERS) value = SmiUntag(value);
return UncheckedCast<IntPtrT>(value); return UncheckedCast<IntPtrT>(value);
} }
template <typename TIndex>
TNode<TIndex> IntPtrToParameter(TNode<IntPtrT> value);
Node* IntPtrToParameter(SloppyTNode<IntPtrT> value, ParameterMode mode) { Node* IntPtrToParameter(SloppyTNode<IntPtrT> value, ParameterMode mode) {
if (mode == SMI_PARAMETERS) return SmiTag(value); if (mode == SMI_PARAMETERS) return SmiTag(value);
return value; return value;
...@@ -453,6 +459,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -453,6 +459,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<Smi> OpName(TNode<Smi> a, TNode<Smi> b) { return SmiOpName(a, b); } \ TNode<Smi> OpName(TNode<Smi> a, TNode<Smi> b) { return SmiOpName(a, b); } \
TNode<IntPtrT> OpName(TNode<IntPtrT> a, TNode<IntPtrT> b) { \ TNode<IntPtrT> OpName(TNode<IntPtrT> a, TNode<IntPtrT> b) { \
return IntPtrOpName(a, b); \ return IntPtrOpName(a, b); \
} \
TNode<RawPtrT> OpName(TNode<RawPtrT> a, TNode<RawPtrT> b) { \
return ReinterpretCast<RawPtrT>(IntPtrOpName( \
ReinterpretCast<IntPtrT>(a), ReinterpretCast<IntPtrT>(b))); \
} }
// TODO(v8:9708): Define BInt operations once all uses are ported. // TODO(v8:9708): Define BInt operations once all uses are ported.
PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin) PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin)
...@@ -474,9 +484,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -474,9 +484,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> OpName(TNode<Smi> a, TNode<Smi> b) { return SmiOpName(a, b); } \ TNode<BoolT> OpName(TNode<Smi> a, TNode<Smi> b) { return SmiOpName(a, b); } \
TNode<BoolT> OpName(TNode<IntPtrT> a, TNode<IntPtrT> b) { \ TNode<BoolT> OpName(TNode<IntPtrT> a, TNode<IntPtrT> b) { \
return IntPtrOpName(a, b); \ return IntPtrOpName(a, b); \
} \
TNode<BoolT> OpName(TNode<RawPtrT> a, TNode<RawPtrT> b) { \
return IntPtrOpName(a, b); \
} }
// TODO(v8:9708): Define BInt operations once all uses are ported. // TODO(v8:9708): Define BInt operations once all uses are ported.
PARAMETER_BINOP(IntPtrOrSmiEqual, IntPtrEqual, SmiEqual) PARAMETER_BINOP(IntPtrOrSmiEqual, WordEqual, SmiEqual)
PARAMETER_BINOP(IntPtrOrSmiNotEqual, WordNotEqual, SmiNotEqual) PARAMETER_BINOP(IntPtrOrSmiNotEqual, WordNotEqual, SmiNotEqual)
PARAMETER_BINOP(IntPtrOrSmiLessThan, IntPtrLessThan, SmiLessThan) PARAMETER_BINOP(IntPtrOrSmiLessThan, IntPtrLessThan, SmiLessThan)
PARAMETER_BINOP(IntPtrOrSmiLessThanOrEqual, IntPtrLessThanOrEqual, PARAMETER_BINOP(IntPtrOrSmiLessThanOrEqual, IntPtrLessThanOrEqual,
...@@ -3804,32 +3817,48 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -3804,32 +3817,48 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
} }
}; };
// template <typename TIndex>
class V8_EXPORT_PRIVATE CodeStubArguments { class V8_EXPORT_PRIVATE CodeStubArguments {
public: public:
using Node = compiler::Node; using Node = compiler::Node;
enum ReceiverMode { kHasReceiver, kNoReceiver }; enum ReceiverMode { kHasReceiver, kNoReceiver };
// |argc| is an intptr value which specifies the number of arguments passed // |argc| specifies the number of arguments passed to the builtin excluding
// to the builtin excluding the receiver. The arguments will include a // the receiver. The arguments will include a receiver iff |receiver_mode|
// receiver iff |receiver_mode| is kHasReceiver. // is kHasReceiver.
CodeStubArguments(CodeStubAssembler* assembler, Node* argc, CodeStubArguments(CodeStubAssembler* assembler, TNode<IntPtrT> argc,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver) ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
: CodeStubArguments(assembler, argc, nullptr, : CodeStubArguments(assembler, argc, TNode<RawPtrT>(), receiver_mode) {}
CodeStubAssembler::INTPTR_PARAMETERS, receiver_mode) {
} CodeStubArguments(CodeStubAssembler* assembler, TNode<Int32T> argc,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
: CodeStubArguments(assembler, assembler->ChangeInt32ToIntPtr(argc),
TNode<RawPtrT>(), receiver_mode) {}
// |argc| is either a smi or intptr depending on |param_mode|. The arguments // TODO(v8:9708): Consider removing this variant
// include a receiver iff |receiver_mode| is kHasReceiver. CodeStubArguments(CodeStubAssembler* assembler, TNode<Smi> argc,
CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp, ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
CodeStubAssembler::ParameterMode param_mode, : CodeStubArguments(assembler, assembler->ParameterToIntPtr(argc),
TNode<RawPtrT>(), receiver_mode) {}
// |argc| specifies the number of arguments passed to the builtin excluding
// the receiver. The arguments will include a receiver iff |receiver_mode|
// is kHasReceiver.
CodeStubArguments(CodeStubAssembler* assembler, TNode<IntPtrT> argc,
TNode<RawPtrT> fp,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver); ReceiverMode receiver_mode = ReceiverMode::kHasReceiver);
CodeStubArguments(CodeStubAssembler* assembler, TNode<Smi> argc,
TNode<RawPtrT> fp,
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
: CodeStubArguments(assembler, assembler->ParameterToIntPtr(argc), fp,
receiver_mode) {}
// Used by Torque to construct arguments based on a Torque-defined // Used by Torque to construct arguments based on a Torque-defined
// struct of values. // struct of values.
CodeStubArguments(CodeStubAssembler* assembler, CodeStubArguments(CodeStubAssembler* assembler,
TorqueStructArguments torque_arguments) TorqueStructArguments torque_arguments)
: assembler_(assembler), : assembler_(assembler),
argc_mode_(CodeStubAssembler::INTPTR_PARAMETERS),
receiver_mode_(ReceiverMode::kHasReceiver), receiver_mode_(ReceiverMode::kHasReceiver),
argc_(torque_arguments.length), argc_(torque_arguments.length),
base_(torque_arguments.base), base_(torque_arguments.base),
...@@ -3842,14 +3871,17 @@ class V8_EXPORT_PRIVATE CodeStubArguments { ...@@ -3842,14 +3871,17 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
void SetReceiver(TNode<Object> object) const; void SetReceiver(TNode<Object> object) const;
// Computes address of the index'th argument. // Computes address of the index'th argument.
TNode<WordT> AtIndexPtr(Node* index, TNode<RawPtrT> AtIndexPtr(TNode<IntPtrT> index) const;
CodeStubAssembler::ParameterMode mode = TNode<RawPtrT> AtIndexPtr(TNode<Smi> index) const {
CodeStubAssembler::INTPTR_PARAMETERS) const; return AtIndexPtr(assembler_->ParameterToIntPtr(index));
}
// |index| is zero-based and does not include the receiver // |index| is zero-based and does not include the receiver
TNode<Object> AtIndex(Node* index, TNode<Object> AtIndex(TNode<IntPtrT> index) const;
CodeStubAssembler::ParameterMode mode = // TODO(v8:9708): Consider removing this variant
CodeStubAssembler::INTPTR_PARAMETERS) const; TNode<Object> AtIndex(TNode<Smi> index) const {
return AtIndex(assembler_->ParameterToIntPtr(index));
}
TNode<Object> AtIndex(int index) const; TNode<Object> AtIndex(int index) const;
...@@ -3859,15 +3891,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments { ...@@ -3859,15 +3891,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
TNode<Object> GetOptionalArgumentValue(int index, TNode<Object> GetOptionalArgumentValue(int index,
TNode<Object> default_value); TNode<Object> default_value);
Node* GetLength(CodeStubAssembler::ParameterMode mode) const { TNode<IntPtrT> GetLength() const { return argc_; }
DCHECK_EQ(mode, argc_mode_);
return argc_;
}
TorqueStructArguments GetTorqueArguments() const { TorqueStructArguments GetTorqueArguments() const {
DCHECK_EQ(argc_mode_, CodeStubAssembler::INTPTR_PARAMETERS); return TorqueStructArguments{fp_, base_, argc_};
return TorqueStructArguments{assembler_->UncheckedCast<RawPtrT>(fp_), base_,
assembler_->UncheckedCast<IntPtrT>(argc_)};
} }
TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index) { TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index) {
...@@ -3875,28 +3902,34 @@ class V8_EXPORT_PRIVATE CodeStubArguments { ...@@ -3875,28 +3902,34 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
} }
TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index, TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index,
TNode<Object> default_value); TNode<Object> default_value);
TNode<IntPtrT> GetLength() const {
DCHECK_EQ(argc_mode_, CodeStubAssembler::INTPTR_PARAMETERS);
return assembler_->UncheckedCast<IntPtrT>(argc_);
}
using ForEachBodyFunction = std::function<void(Node* arg)>; using ForEachBodyFunction = std::function<void(TNode<Object> arg)>;
// Iteration doesn't include the receiver. |first| and |last| are zero-based. // Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, template <typename TIndex>
Node* last = nullptr, void ForEach(const ForEachBodyFunction& body,
CodeStubAssembler::ParameterMode mode = TNode<TIndex> first = TNode<TIndex>(),
CodeStubAssembler::INTPTR_PARAMETERS) { TNode<TIndex> last = TNode<TIndex>()) {
CodeStubAssembler::VariableList list(0, assembler_->zone()); CodeStubAssembler::VariableList list(0, assembler_->zone());
ForEach(list, body, first, last); ForEach(list, body, first, last);
} }
// Iteration doesn't include the receiver. |first| and |last| are zero-based. // Iteration doesn't include the receiver. |first| and |last| are zero-based.
void ForEach(const CodeStubAssembler::VariableList& vars, void ForEach(const CodeStubAssembler::VariableList& vars,
const ForEachBodyFunction& body, Node* first = nullptr, const ForEachBodyFunction& body,
Node* last = nullptr, TNode<IntPtrT> first = TNode<IntPtrT>(),
CodeStubAssembler::ParameterMode mode = TNode<IntPtrT> last = TNode<IntPtrT>());
CodeStubAssembler::INTPTR_PARAMETERS);
void ForEach(const CodeStubAssembler::VariableList& vars,
const ForEachBodyFunction& body, TNode<Smi> first,
TNode<Smi> last = TNode<Smi>()) {
TNode<IntPtrT> first_intptr = assembler_->ParameterToIntPtr(first);
TNode<IntPtrT> last_intptr;
if (last != nullptr) {
last_intptr = assembler_->ParameterToIntPtr(last);
}
return ForEach(vars, body, first_intptr, last_intptr);
}
void PopAndReturn(Node* value); void PopAndReturn(Node* value);
...@@ -3904,11 +3937,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments { ...@@ -3904,11 +3937,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
Node* GetArguments(); Node* GetArguments();
CodeStubAssembler* assembler_; CodeStubAssembler* assembler_;
CodeStubAssembler::ParameterMode argc_mode_;
ReceiverMode receiver_mode_; ReceiverMode receiver_mode_;
Node* argc_; TNode<IntPtrT> argc_;
TNode<RawPtrT> base_; TNode<RawPtrT> base_;
Node* fp_; TNode<RawPtrT> fp_;
}; };
class ToDirectStringAssembler : public CodeStubAssembler { class ToDirectStringAssembler : public CodeStubAssembler {
......
...@@ -847,8 +847,12 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -847,8 +847,12 @@ class V8_EXPORT_PRIVATE CodeAssembler {
TNode<RawPtrT> RawPtrAdd(TNode<RawPtrT> left, TNode<IntPtrT> right) { TNode<RawPtrT> RawPtrAdd(TNode<RawPtrT> left, TNode<IntPtrT> right) {
return ReinterpretCast<RawPtrT>(IntPtrAdd(left, right)); return ReinterpretCast<RawPtrT>(IntPtrAdd(left, right));
} }
TNode<RawPtrT> RawPtrAdd(TNode<IntPtrT> left, TNode<RawPtrT> right) { TNode<RawPtrT> RawPtrSub(TNode<RawPtrT> left, TNode<IntPtrT> right) {
return ReinterpretCast<RawPtrT>(IntPtrAdd(left, right)); return ReinterpretCast<RawPtrT>(IntPtrSub(left, right));
}
TNode<IntPtrT> RawPtrSub(TNode<RawPtrT> left, TNode<RawPtrT> right) {
return Signed(
IntPtrSub(static_cast<Node*>(left), static_cast<Node*>(right)));
} }
TNode<WordT> WordShl(SloppyTNode<WordT> value, int shift); TNode<WordT> WordShl(SloppyTNode<WordT> value, int shift);
......
...@@ -329,8 +329,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -329,8 +329,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
// FixedArray backing store -> Smi or object elements. // FixedArray backing store -> Smi or object elements.
{ {
TNode<IntPtrT> offset = ElementOffsetFromIndex( TNode<IntPtrT> offset =
index, PACKED_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize);
// Check if we're about to overwrite the hole. We can safely do that // Check if we're about to overwrite the hole. We can safely do that
// only if there can be no setters on the prototype chain. // only if there can be no setters on the prototype chain.
// If we know that we're storing beyond the previous array length, we // If we know that we're storing beyond the previous array length, we
...@@ -399,8 +399,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -399,8 +399,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
PACKED_SMI_ELEMENTS, target_kind, slow); PACKED_SMI_ELEMENTS, target_kind, slow);
// Reload migrated elements. // Reload migrated elements.
TNode<FixedArrayBase> double_elements = LoadElements(receiver); TNode<FixedArrayBase> double_elements = LoadElements(receiver);
TNode<IntPtrT> double_offset = ElementOffsetFromIndex( TNode<IntPtrT> double_offset =
index, PACKED_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize);
// Make sure we do not store signalling NaNs into double arrays. // Make sure we do not store signalling NaNs into double arrays.
TNode<Float64T> double_value = TNode<Float64T> double_value =
Float64SilenceNaN(LoadHeapNumberValue(CAST(value))); Float64SilenceNaN(LoadHeapNumberValue(CAST(value)));
...@@ -432,8 +432,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -432,8 +432,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
&check_cow_elements); &check_cow_elements);
// FixedDoubleArray backing store -> double elements. // FixedDoubleArray backing store -> double elements.
{ {
TNode<IntPtrT> offset = ElementOffsetFromIndex( TNode<IntPtrT> offset =
index, PACKED_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize);
// Check if we're about to overwrite the hole. We can safely do that // Check if we're about to overwrite the hole. We can safely do that
// only if there can be no setters on the prototype chain. // only if there can be no setters on the prototype chain.
{ {
...@@ -481,8 +481,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity( ...@@ -481,8 +481,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
PACKED_DOUBLE_ELEMENTS, target_kind, slow); PACKED_DOUBLE_ELEMENTS, target_kind, slow);
// Reload migrated elements. // Reload migrated elements.
TNode<FixedArrayBase> fast_elements = LoadElements(receiver); TNode<FixedArrayBase> fast_elements = LoadElements(receiver);
TNode<IntPtrT> fast_offset = ElementOffsetFromIndex( TNode<IntPtrT> fast_offset =
index, PACKED_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize); ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize);
Store(fast_elements, fast_offset, value); Store(fast_elements, fast_offset, value);
MaybeUpdateLengthAndReturn(receiver, index, value, update_length); MaybeUpdateLengthAndReturn(receiver, index, value, update_length);
} }
......
...@@ -1997,12 +1997,9 @@ TEST(Arguments) { ...@@ -1997,12 +1997,9 @@ TEST(Arguments) {
CodeStubArguments arguments(&m, m.IntPtrConstant(3)); CodeStubArguments arguments(&m, m.IntPtrConstant(3));
CSA_ASSERT( CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(12)));
&m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(13)));
CSA_ASSERT( CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(14)));
&m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(Smi::FromInt(13))));
CSA_ASSERT(
&m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14))));
arguments.PopAndReturn(arguments.GetReceiver()); arguments.PopAndReturn(arguments.GetReceiver());
...@@ -2022,21 +2019,14 @@ TEST(ArgumentsWithSmiConstantIndices) { ...@@ -2022,21 +2019,14 @@ TEST(ArgumentsWithSmiConstantIndices) {
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state()); CodeStubAssembler m(asm_tester.state());
CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, CodeStubArguments arguments(&m, m.SmiConstant(3));
CodeStubAssembler::SMI_PARAMETERS);
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0)),
CSA_ASSERT(&m, m.SmiConstant(12)));
m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0), CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(1)),
CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(13)));
m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(2)),
CSA_ASSERT(&m, m.SmiConstant(14)));
m.TaggedEqual(arguments.AtIndex(m.SmiConstant(1),
CodeStubAssembler::SMI_PARAMETERS),
m.SmiConstant(Smi::FromInt(13))));
CSA_ASSERT(&m,
m.TaggedEqual(arguments.AtIndex(m.SmiConstant(2),
CodeStubAssembler::SMI_PARAMETERS),
m.SmiConstant(Smi::FromInt(14))));
arguments.PopAndReturn(arguments.GetReceiver()); arguments.PopAndReturn(arguments.GetReceiver());
...@@ -2075,21 +2065,14 @@ TEST(ArgumentsWithSmiIndices) { ...@@ -2075,21 +2065,14 @@ TEST(ArgumentsWithSmiIndices) {
CodeAssemblerTester asm_tester(isolate, kNumParams); CodeAssemblerTester asm_tester(isolate, kNumParams);
CodeStubAssembler m(asm_tester.state()); CodeStubAssembler m(asm_tester.state());
CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr, CodeStubArguments arguments(&m, m.SmiConstant(3));
CodeStubAssembler::SMI_PARAMETERS);
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0)),
CSA_ASSERT(&m, m.SmiConstant(12)));
m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0), CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 1)),
CodeStubAssembler::SMI_PARAMETERS), m.SmiConstant(13)));
m.SmiConstant(Smi::FromInt(12)))); CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 2)),
CSA_ASSERT(&m, m.SmiConstant(14)));
m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 1),
CodeStubAssembler::SMI_PARAMETERS),
m.SmiConstant(Smi::FromInt(13))));
CSA_ASSERT(&m,
m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 2),
CodeStubAssembler::SMI_PARAMETERS),
m.SmiConstant(Smi::FromInt(14))));
arguments.PopAndReturn(arguments.GetReceiver()); arguments.PopAndReturn(arguments.GetReceiver());
...@@ -2116,7 +2099,7 @@ TEST(ArgumentsForEach) { ...@@ -2116,7 +2099,7 @@ TEST(ArgumentsForEach) {
sum = m.SmiConstant(0); sum = m.SmiConstant(0);
arguments.ForEach(list, [&m, &sum](Node* arg) { arguments.ForEach(list, [&](TNode<Object> arg) {
sum = m.SmiAdd(sum.value(), m.CAST(arg)); sum = m.SmiAdd(sum.value(), m.CAST(arg));
}); });
......
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