[csa] Remove ParameterMode from CSA::CodeStubArguments
Bug: v8:9708 Change-Id: I91e429e478ad70dc2212f9f78830d10941fa47e6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1800581 Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#63740}
This commit is contained in:
parent
0a3e812a23
commit
29817ae091
@ -81,8 +81,10 @@ ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map,
|
||||
}
|
||||
|
||||
Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs(
|
||||
Node* map, Node* frame_ptr, Node* arg_count, Node* first_arg,
|
||||
Node* rest_count, ParameterMode param_mode, int base_size) {
|
||||
TNode<Map> map, TNode<RawPtrT> frame_ptr, TNode<BInt> arg_count,
|
||||
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
|
||||
// argument object or a sloppy arguments object) and the elements together and
|
||||
// fill in the contents with the arguments above |formal_parameter_count|.
|
||||
@ -92,18 +94,18 @@ Node* ArgumentsBuiltinsAssembler::ConstructParametersObjectFromArgs(
|
||||
std::tie(result, elements, unused) =
|
||||
AllocateArgumentsObject(map, rest_count, nullptr, param_mode, base_size);
|
||||
DCHECK_NULL(unused);
|
||||
CodeStubArguments arguments(this, arg_count, frame_ptr, param_mode);
|
||||
CodeStubArguments arguments(this, arg_count, frame_ptr);
|
||||
TVARIABLE(IntPtrT, offset,
|
||||
IntPtrConstant(FixedArrayBase::kHeaderSize - kHeapObjectTag));
|
||||
VariableList list({&offset}, zone());
|
||||
arguments.ForEach(
|
||||
list,
|
||||
[&](Node* arg) {
|
||||
[&](TNode<Object> arg) {
|
||||
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements,
|
||||
offset.value(), arg);
|
||||
Increment(&offset, kTaggedSize);
|
||||
},
|
||||
first_arg, nullptr, param_mode);
|
||||
first_arg);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -119,8 +121,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewRestParameter(Node* context,
|
||||
Label no_rest_parameters(this), runtime(this, Label::kDeferred),
|
||||
done(this, &result);
|
||||
|
||||
Node* rest_count =
|
||||
IntPtrOrSmiSub(info.argument_count, info.formal_parameter_count, mode);
|
||||
TNode<BInt> rest_count =
|
||||
IntPtrOrSmiSub(info.argument_count, info.formal_parameter_count);
|
||||
TNode<NativeContext> const native_context = LoadNativeContext(context);
|
||||
TNode<Map> const array_map =
|
||||
LoadJSArrayElementsMap(PACKED_ELEMENTS, native_context);
|
||||
@ -174,8 +176,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewStrictArguments(Node* context,
|
||||
JSStrictArgumentsObject::kSize + FixedArray::kHeaderSize, mode);
|
||||
|
||||
TNode<NativeContext> const native_context = LoadNativeContext(context);
|
||||
TNode<Object> const map =
|
||||
LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX);
|
||||
TNode<Map> map = CAST(
|
||||
LoadContextElement(native_context, Context::STRICT_ARGUMENTS_MAP_INDEX));
|
||||
GotoIf(BIntEqual(info.argument_count, zero), &empty);
|
||||
|
||||
result.Bind(ConstructParametersObjectFromArgs(
|
||||
@ -253,14 +255,14 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
|
||||
|
||||
Comment("Fill in non-mapped parameters");
|
||||
TNode<IntPtrT> argument_offset =
|
||||
ElementOffsetFromIndex(info.argument_count, PACKED_ELEMENTS, mode,
|
||||
ElementOffsetFromIndex(info.argument_count, PACKED_ELEMENTS,
|
||||
FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
TNode<IntPtrT> mapped_offset =
|
||||
ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS, mode,
|
||||
ElementOffsetFromIndex(mapped_count, PACKED_ELEMENTS,
|
||||
FixedArray::kHeaderSize - kHeapObjectTag);
|
||||
CodeStubArguments arguments(this, info.argument_count, info.frame, mode);
|
||||
TVARIABLE(IntPtrT, current_argument,
|
||||
Signed(arguments.AtIndexPtr(info.argument_count, mode)));
|
||||
CodeStubArguments arguments(this, info.argument_count, info.frame);
|
||||
TVARIABLE(RawPtrT, current_argument,
|
||||
arguments.AtIndexPtr(info.argument_count));
|
||||
VariableList var_list1({¤t_argument}, zone());
|
||||
mapped_offset = BuildFastLoop<IntPtrT>(
|
||||
var_list1, argument_offset, mapped_offset,
|
||||
@ -319,8 +321,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
|
||||
info.argument_count, &runtime,
|
||||
JSSloppyArgumentsObject::kSize + FixedArray::kHeaderSize, mode);
|
||||
TNode<NativeContext> const native_context = LoadNativeContext(context);
|
||||
TNode<Object> const map =
|
||||
LoadContextElement(native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX);
|
||||
TNode<Map> map = CAST(LoadContextElement(
|
||||
native_context, Context::SLOPPY_ARGUMENTS_MAP_INDEX));
|
||||
result.Bind(ConstructParametersObjectFromArgs(
|
||||
map, info.frame, info.argument_count, zero, info.argument_count, mode,
|
||||
JSSloppyArgumentsObject::kSize));
|
||||
|
@ -40,11 +40,10 @@ class ArgumentsBuiltinsAssembler : public CodeStubAssembler {
|
||||
// and then copies |rest_count| arguments from the stack frame pointed to by
|
||||
// |frame_ptr| starting from |first_arg|. |arg_count| == |first_arg| +
|
||||
// |rest_count|.
|
||||
Node* ConstructParametersObjectFromArgs(Node* map, Node* frame_ptr,
|
||||
Node* arg_count, Node* first_arg,
|
||||
Node* rest_count,
|
||||
ParameterMode param_mode,
|
||||
int base_size);
|
||||
Node* ConstructParametersObjectFromArgs(
|
||||
TNode<Map> map, TNode<RawPtrT> frame_ptr, TNode<BInt> arg_count,
|
||||
TNode<BInt> first_arg, TNode<BInt> rest_count, ParameterMode param_mode,
|
||||
int base_size);
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
@ -298,7 +298,7 @@ TF_BUILTIN(ArrayPrototypePop, CodeStubAssembler) {
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget)));
|
||||
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
|
||||
Label runtime(this, Label::kDeferred);
|
||||
@ -395,14 +395,12 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
|
||||
Label double_transition(this);
|
||||
Label runtime(this, Label::kDeferred);
|
||||
|
||||
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
|
||||
// arguments are reordered.
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
CSA_ASSERT(this, IsUndefined(Parameter(Descriptor::kJSNewTarget)));
|
||||
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
TNode<JSArray> array_receiver;
|
||||
TNode<Int32T> kind;
|
||||
@ -494,9 +492,9 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
|
||||
BIND(&default_label);
|
||||
{
|
||||
args.ForEach(
|
||||
[this, array_receiver, context](Node* arg) {
|
||||
[=](TNode<Object> arg) {
|
||||
TNode<Number> length = LoadJSArrayLength(array_receiver);
|
||||
SetPropertyStrict(context, array_receiver, length, CAST(arg));
|
||||
SetPropertyStrict(context, array_receiver, length, arg);
|
||||
},
|
||||
arg_index.value());
|
||||
args.PopAndReturn(LoadJSArrayLength(array_receiver));
|
||||
@ -626,7 +624,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> items = args.GetOptionalArgumentValue(0);
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
|
||||
@ -1031,8 +1029,7 @@ void ArrayIncludesIndexofAssembler::Generate(SearchVariant variant,
|
||||
|
||||
BIND(&call_runtime);
|
||||
{
|
||||
TNode<Object> start_from =
|
||||
args.GetOptionalArgumentValue(kFromIndexArg, UndefinedConstant());
|
||||
TNode<Object> start_from = args.GetOptionalArgumentValue(kFromIndexArg);
|
||||
Runtime::FunctionId function = variant == kIncludes
|
||||
? Runtime::kArrayIncludes_Slow
|
||||
: Runtime::kArrayIndexOf;
|
||||
@ -2221,7 +2218,7 @@ void ArrayBuiltinsAssembler::GenerateArrayNArgumentsConstructor(
|
||||
// Replace incoming JS receiver argument with the target.
|
||||
// TODO(ishell): Avoid replacing the target on the stack and just add it
|
||||
// as another additional parameter for Runtime::kNewArray.
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
args.SetReceiver(target);
|
||||
|
||||
// Adjust arguments count for the runtime call: +1 for implicit receiver
|
||||
|
@ -1002,7 +1002,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::MapIteratorToList(
|
||||
|
||||
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
|
||||
TNode<IntPtrT> first_to_element_offset =
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), kind, INTPTR_PARAMETERS, 0);
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), kind, 0);
|
||||
VARIABLE(
|
||||
var_offset, MachineType::PointerRepresentation(),
|
||||
IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset)));
|
||||
@ -1115,7 +1115,7 @@ TNode<JSArray> CollectionsBuiltinsAssembler::SetOrSetIteratorToList(
|
||||
|
||||
const int first_element_offset = FixedArray::kHeaderSize - kHeapObjectTag;
|
||||
TNode<IntPtrT> first_to_element_offset =
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), kind, INTPTR_PARAMETERS, 0);
|
||||
ElementOffsetFromIndex(IntPtrConstant(0), kind, 0);
|
||||
VARIABLE(
|
||||
var_offset, MachineType::PointerRepresentation(),
|
||||
IntPtrAdd(first_to_element_offset, IntPtrConstant(first_element_offset)));
|
||||
@ -1887,9 +1887,10 @@ TF_BUILTIN(MapPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
||||
|
||||
TF_BUILTIN(MapPrototypeForEach, CollectionsBuiltinsAssembler) {
|
||||
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);
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> const receiver = args.GetReceiver();
|
||||
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
||||
TNode<Object> const this_arg = args.GetOptionalArgumentValue(1);
|
||||
@ -2119,9 +2120,10 @@ TF_BUILTIN(SetPrototypeGetSize, CollectionsBuiltinsAssembler) {
|
||||
|
||||
TF_BUILTIN(SetPrototypeForEach, CollectionsBuiltinsAssembler) {
|
||||
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);
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> const receiver = args.GetReceiver();
|
||||
TNode<Object> const callback = args.GetOptionalArgumentValue(0);
|
||||
TNode<Object> const this_arg = args.GetOptionalArgumentValue(1);
|
||||
|
@ -15,15 +15,13 @@ TF_BUILTIN(FastConsoleAssert, CodeStubAssembler) {
|
||||
Label runtime(this);
|
||||
Label out(this);
|
||||
|
||||
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
|
||||
// arguments are reordered.
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* new_target = Parameter(Descriptor::kJSNewTarget);
|
||||
GotoIf(Word32Equal(argc, Int32Constant(0)), &runtime);
|
||||
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
BranchIfToBooleanIsTrue(args.AtIndex(0), &out, &runtime);
|
||||
BIND(&out);
|
||||
args.PopAndReturn(UndefinedConstant());
|
||||
|
@ -223,9 +223,8 @@ TNode<Context> ConstructorBuiltinsAssembler::EmitFastNewFunctionContext(
|
||||
TNode<ScopeInfo> scope_info, TNode<Uint32T> slots, TNode<Context> context,
|
||||
ScopeType scope_type) {
|
||||
TNode<IntPtrT> slots_intptr = Signed(ChangeUint32ToWord(slots));
|
||||
TNode<IntPtrT> size =
|
||||
ElementOffsetFromIndex(slots_intptr, PACKED_ELEMENTS, INTPTR_PARAMETERS,
|
||||
Context::kTodoHeaderSize);
|
||||
TNode<IntPtrT> size = ElementOffsetFromIndex(slots_intptr, PACKED_ELEMENTS,
|
||||
Context::kTodoHeaderSize);
|
||||
|
||||
// Create a new closure from the given function info in new space
|
||||
TNode<Context> function_context =
|
||||
|
@ -15,14 +15,12 @@ namespace internal {
|
||||
TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
|
||||
Label slow(this);
|
||||
|
||||
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
|
||||
// arguments are reordered.
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
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
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
@ -128,7 +126,7 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
|
||||
VariableList foreach_vars({&index}, zone());
|
||||
args.ForEach(
|
||||
foreach_vars,
|
||||
[&](Node* arg) {
|
||||
[&](TNode<Object> arg) {
|
||||
StoreFixedArrayElement(elements, index.value(), arg);
|
||||
Increment(&index);
|
||||
},
|
||||
|
@ -115,13 +115,13 @@ void GeneratorBuiltinsAssembler::GeneratorPrototypeResume(
|
||||
TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) {
|
||||
const int kValueArg = 0;
|
||||
|
||||
TNode<IntPtrT> argc =
|
||||
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
CodeStubArguments args(this, argc);
|
||||
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
TNode<Object> value = args.GetOptionalArgumentValue(kValueArg);
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
|
||||
GeneratorPrototypeResume(&args, receiver, value, context,
|
||||
JSGeneratorObject::kNext,
|
||||
@ -132,13 +132,13 @@ TF_BUILTIN(GeneratorPrototypeNext, GeneratorBuiltinsAssembler) {
|
||||
TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) {
|
||||
const int kValueArg = 0;
|
||||
|
||||
TNode<IntPtrT> argc =
|
||||
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
CodeStubArguments args(this, argc);
|
||||
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
TNode<Object> value = args.GetOptionalArgumentValue(kValueArg);
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
|
||||
GeneratorPrototypeResume(&args, receiver, value, context,
|
||||
JSGeneratorObject::kReturn,
|
||||
@ -149,13 +149,13 @@ TF_BUILTIN(GeneratorPrototypeReturn, GeneratorBuiltinsAssembler) {
|
||||
TF_BUILTIN(GeneratorPrototypeThrow, GeneratorBuiltinsAssembler) {
|
||||
const int kExceptionArg = 0;
|
||||
|
||||
TNode<IntPtrT> argc =
|
||||
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
CodeStubArguments args(this, argc);
|
||||
|
||||
TNode<Object> receiver = args.GetReceiver();
|
||||
TNode<Object> exception = args.GetOptionalArgumentValue(kExceptionArg);
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
|
||||
GeneratorPrototypeResume(&args, receiver, exception, context,
|
||||
JSGeneratorObject::kThrow,
|
||||
|
@ -139,7 +139,7 @@ void IntlBuiltinsAssembler::ListFormatCommon(TNode<Context> context,
|
||||
TNode<Int32T> argc,
|
||||
Runtime::FunctionId format_func_id,
|
||||
const char* method_name) {
|
||||
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
|
||||
CodeStubArguments args(this, argc);
|
||||
|
||||
// Label has_list(this);
|
||||
// 1. Let lf be this value.
|
||||
|
@ -143,20 +143,18 @@ void MathBuiltinsAssembler::MathRoundingOperation(
|
||||
}
|
||||
|
||||
void MathBuiltinsAssembler::MathMaxMin(
|
||||
Node* context, Node* argc,
|
||||
TNode<Context> context, TNode<Int32T> argc,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>,
|
||||
SloppyTNode<Float64T>),
|
||||
double default_val) {
|
||||
CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc));
|
||||
argc = arguments.GetLength(INTPTR_PARAMETERS);
|
||||
CodeStubArguments arguments(this, argc);
|
||||
|
||||
VARIABLE(result, MachineRepresentation::kFloat64);
|
||||
result.Bind(Float64Constant(default_val));
|
||||
TVARIABLE(Float64T, result, Float64Constant(default_val));
|
||||
|
||||
CodeStubAssembler::VariableList vars({&result}, zone());
|
||||
arguments.ForEach(vars, [=, &result](Node* arg) {
|
||||
Node* float_value = TruncateTaggedToFloat64(context, arg);
|
||||
result.Bind((this->*float64op)(result.value(), float_value));
|
||||
arguments.ForEach(vars, [&](TNode<Object> arg) {
|
||||
TNode<Float64T> float_value = TruncateTaggedToFloat64(context, arg);
|
||||
result = (this->*float64op)(result.value(), float_value);
|
||||
});
|
||||
|
||||
arguments.PopAndReturn(ChangeFloat64ToTagged(result.value()));
|
||||
@ -260,19 +258,17 @@ TF_BUILTIN(MathTrunc, MathBuiltinsAssembler) {
|
||||
|
||||
// ES6 #sec-math.max
|
||||
TF_BUILTIN(MathMax, MathBuiltinsAssembler) {
|
||||
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
|
||||
// arguments are reordered.
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
MathMaxMin(context, argc, &CodeStubAssembler::Float64Max, -1.0 * V8_INFINITY);
|
||||
}
|
||||
|
||||
// ES6 #sec-math.min
|
||||
TF_BUILTIN(MathMin, MathBuiltinsAssembler) {
|
||||
// TODO(ishell): use constants from Descriptor once the JSFunction linkage
|
||||
// arguments are reordered.
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
MathMaxMin(context, argc, &CodeStubAssembler::Float64Min, V8_INFINITY);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ class MathBuiltinsAssembler : public CodeStubAssembler {
|
||||
void MathRoundingOperation(
|
||||
Node* context, Node* x,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(SloppyTNode<Float64T>));
|
||||
void MathMaxMin(Node* context, Node* argc,
|
||||
void MathMaxMin(TNode<Context> context, TNode<Int32T> argc,
|
||||
TNode<Float64T> (CodeStubAssembler::*float64op)(
|
||||
SloppyTNode<Float64T>, SloppyTNode<Float64T>),
|
||||
double default_val);
|
||||
|
@ -451,7 +451,7 @@ TF_BUILTIN(ObjectAssign, ObjectBuiltinsAssembler) {
|
||||
// second argument.
|
||||
// 4. For each element nextSource of sources, in ascending index order,
|
||||
args.ForEach(
|
||||
[=](Node* next_source) {
|
||||
[=](TNode<Object> next_source) {
|
||||
CallBuiltin(Builtins::kSetDataProperties, context, to, next_source);
|
||||
},
|
||||
IntPtrConstant(1));
|
||||
@ -1334,11 +1334,12 @@ TF_BUILTIN(CreateGeneratorObject, ObjectBuiltinsAssembler) {
|
||||
|
||||
// ES6 section 19.1.2.7 Object.getOwnPropertyDescriptor ( O, P )
|
||||
TF_BUILTIN(ObjectGetOwnPropertyDescriptor, ObjectBuiltinsAssembler) {
|
||||
Node* argc = Parameter(Descriptor::kJSActualArgumentsCount);
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
Node* context = Parameter(Descriptor::kContext);
|
||||
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> key = args.GetOptionalArgumentValue(1);
|
||||
|
||||
|
@ -80,7 +80,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
|
||||
|
||||
GotoIf(SmiGreaterThan(length, SmiConstant(FixedArray::kMaxRegularLength)),
|
||||
&if_large_object);
|
||||
args.ForEach(list, [=, &offset](Node* arg) {
|
||||
args.ForEach(list, [&](TNode<Object> arg) {
|
||||
StoreNoWriteBarrier(MachineRepresentation::kTagged, allocated_elements,
|
||||
offset.value(), arg);
|
||||
Increment(&offset, kTaggedSize);
|
||||
@ -89,7 +89,7 @@ Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
|
||||
|
||||
BIND(&if_large_object);
|
||||
{
|
||||
args.ForEach(list, [=, &offset](Node* arg) {
|
||||
args.ForEach(list, [&](TNode<Object> arg) {
|
||||
Store(allocated_elements, offset.value(), arg);
|
||||
Increment(&offset, kTaggedSize);
|
||||
});
|
||||
|
@ -670,12 +670,12 @@ TNode<HeapObject> RegExpBuiltinsAssembler::RegExpExecInternal(
|
||||
|
||||
// Fill match and capture offsets in match_info.
|
||||
{
|
||||
TNode<IntPtrT> limit_offset = ElementOffsetFromIndex(
|
||||
register_count, INT32_ELEMENTS, SMI_PARAMETERS, 0);
|
||||
TNode<IntPtrT> limit_offset =
|
||||
ElementOffsetFromIndex(register_count, INT32_ELEMENTS, 0);
|
||||
|
||||
TNode<IntPtrT> to_offset = ElementOffsetFromIndex(
|
||||
IntPtrConstant(RegExpMatchInfo::kFirstCaptureIndex), PACKED_ELEMENTS,
|
||||
INTPTR_PARAMETERS, RegExpMatchInfo::kHeaderSize - kHeapObjectTag);
|
||||
RegExpMatchInfo::kHeaderSize - kHeapObjectTag);
|
||||
TVARIABLE(IntPtrT, var_to_offset, to_offset);
|
||||
|
||||
VariableList vars({&var_to_offset}, zone());
|
||||
|
@ -118,14 +118,14 @@ Node* StringBuiltinsAssembler::CallSearchStringRaw(Node* const subject_ptr,
|
||||
return result;
|
||||
}
|
||||
|
||||
TNode<IntPtrT> StringBuiltinsAssembler::PointerToStringDataAtIndex(
|
||||
Node* const string_data, Node* const index, String::Encoding encoding) {
|
||||
TNode<RawPtrT> StringBuiltinsAssembler::PointerToStringDataAtIndex(
|
||||
TNode<RawPtrT> string_data, TNode<IntPtrT> index,
|
||||
String::Encoding encoding) {
|
||||
const ElementsKind kind = (encoding == String::ONE_BYTE_ENCODING)
|
||||
? UINT8_ELEMENTS
|
||||
: UINT16_ELEMENTS;
|
||||
TNode<IntPtrT> const offset_in_bytes =
|
||||
ElementOffsetFromIndex(index, kind, INTPTR_PARAMETERS);
|
||||
return Signed(IntPtrAdd(string_data, offset_in_bytes));
|
||||
TNode<IntPtrT> offset_in_bytes = ElementOffsetFromIndex(index, kind);
|
||||
return RawPtrAdd(string_data, offset_in_bytes);
|
||||
}
|
||||
|
||||
void StringBuiltinsAssembler::GenerateStringEqual(TNode<String> left,
|
||||
@ -556,7 +556,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
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.
|
||||
// if the parent frame is not an arguments adaptor frame.
|
||||
Label if_oneargument(this), if_notoneargument(this);
|
||||
@ -590,8 +590,7 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
|
||||
// codes. Stop if any of the conversions generates a code that doesn't fit
|
||||
// in 8 bits.
|
||||
CodeStubAssembler::VariableList vars({&var_max_index}, zone());
|
||||
arguments.ForEach(vars, [this, context, &two_byte, &var_max_index, &code16,
|
||||
one_byte_result](Node* arg) {
|
||||
arguments.ForEach(vars, [&](TNode<Object> arg) {
|
||||
Node* code32 = TruncateTaggedToWord32(context, arg);
|
||||
code16 = Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit));
|
||||
|
||||
@ -638,14 +637,13 @@ TF_BUILTIN(StringFromCharCode, CodeStubAssembler) {
|
||||
// using a 16-bit representation.
|
||||
arguments.ForEach(
|
||||
vars,
|
||||
[this, context, two_byte_result, &var_max_index](Node* arg) {
|
||||
Node* code32 = TruncateTaggedToWord32(context, arg);
|
||||
[&](TNode<Object> arg) {
|
||||
TNode<Word32T> code32 = TruncateTaggedToWord32(context, arg);
|
||||
TNode<Word32T> code16 =
|
||||
Word32And(code32, Int32Constant(String::kMaxUtf16CodeUnit));
|
||||
|
||||
TNode<IntPtrT> offset = ElementOffsetFromIndex(
|
||||
var_max_index.value(), UINT16_ELEMENTS,
|
||||
CodeStubAssembler::INTPTR_PARAMETERS,
|
||||
SeqTwoByteString::kHeaderSize - kHeapObjectTag);
|
||||
StoreNoWriteBarrier(MachineRepresentation::kWord16, two_byte_result,
|
||||
offset, code16);
|
||||
@ -721,9 +719,9 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
|
||||
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);
|
||||
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
search_ptr, search_offset, String::ONE_BYTE_ENCODING);
|
||||
|
||||
Label direct_memchr_call(this), generic_fast_path(this);
|
||||
@ -734,8 +732,8 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
// search strings.
|
||||
BIND(&direct_memchr_call);
|
||||
{
|
||||
TNode<IntPtrT> const string_addr =
|
||||
IntPtrAdd(adjusted_subject_ptr, start_position);
|
||||
TNode<RawPtrT> const string_addr =
|
||||
RawPtrAdd(adjusted_subject_ptr, start_position);
|
||||
TNode<IntPtrT> const search_length =
|
||||
IntPtrSub(subject_length, start_position);
|
||||
TNode<IntPtrT> const search_byte =
|
||||
@ -743,14 +741,14 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
|
||||
TNode<ExternalReference> const memchr =
|
||||
ExternalConstant(ExternalReference::libc_memchr_function());
|
||||
TNode<IntPtrT> const result_address = UncheckedCast<IntPtrT>(
|
||||
TNode<RawPtrT> const result_address = UncheckedCast<RawPtrT>(
|
||||
CallCFunction(memchr, MachineType::Pointer(),
|
||||
std::make_pair(MachineType::Pointer(), string_addr),
|
||||
std::make_pair(MachineType::IntPtr(), search_byte),
|
||||
std::make_pair(MachineType::UintPtr(), search_length)));
|
||||
GotoIf(WordEqual(result_address, int_zero), &return_minus_1);
|
||||
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));
|
||||
}
|
||||
|
||||
@ -765,9 +763,9 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
|
||||
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);
|
||||
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
search_ptr, search_offset, String::TWO_BYTE_ENCODING);
|
||||
|
||||
Node* const result = CallSearchStringRaw<onebyte_t, twobyte_t>(
|
||||
@ -778,9 +776,9 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
|
||||
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);
|
||||
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
search_ptr, search_offset, String::ONE_BYTE_ENCODING);
|
||||
|
||||
Node* const result = CallSearchStringRaw<twobyte_t, onebyte_t>(
|
||||
@ -791,9 +789,9 @@ void StringBuiltinsAssembler::StringIndexOf(
|
||||
|
||||
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);
|
||||
TNode<IntPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
TNode<RawPtrT> const adjusted_search_ptr = PointerToStringDataAtIndex(
|
||||
search_ptr, search_offset, String::TWO_BYTE_ENCODING);
|
||||
|
||||
Node* const result = CallSearchStringRaw<twobyte_t, twobyte_t>(
|
||||
|
@ -51,8 +51,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler {
|
||||
Node* const search_ptr, Node* const search_length,
|
||||
Node* const start_position);
|
||||
|
||||
TNode<IntPtrT> PointerToStringDataAtIndex(Node* const string_data,
|
||||
Node* const index,
|
||||
TNode<RawPtrT> PointerToStringDataAtIndex(TNode<RawPtrT> string_data,
|
||||
TNode<IntPtrT> index,
|
||||
String::Encoding encoding);
|
||||
|
||||
// substr and slice have a common way of handling the {start} argument.
|
||||
|
@ -539,10 +539,10 @@ TNode<BoolT> TypedArrayBuiltinsAssembler::IsSharedArrayBuffer(
|
||||
// ES #sec-get-%typedarray%.prototype.set
|
||||
TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) {
|
||||
const char* method_name = "%TypedArray%.prototype.set";
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
CodeStubArguments args(
|
||||
this,
|
||||
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)));
|
||||
CodeStubArguments args(this, argc);
|
||||
|
||||
Label if_source_is_typed_array(this), if_source_is_fast_jsarray(this),
|
||||
if_offset_is_out_of_bounds(this, Label::kDeferred),
|
||||
@ -708,8 +708,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
|
||||
TNode<IntPtrT> length = ChangeInt32ToIntPtr(
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount)));
|
||||
// 2. Let items be the List of arguments passed to this function.
|
||||
CodeStubArguments args(this, length, nullptr, INTPTR_PARAMETERS,
|
||||
CodeStubArguments::ReceiverMode::kHasReceiver);
|
||||
CodeStubArguments args(this, length);
|
||||
|
||||
Label if_not_constructor(this, Label::kDeferred),
|
||||
if_detached(this, Label::kDeferred);
|
||||
@ -738,7 +737,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
|
||||
BuildFastLoop<IntPtrT>(
|
||||
IntPtrConstant(0), length,
|
||||
[&](TNode<IntPtrT> index) {
|
||||
TNode<Object> item = args.AtIndex(index, INTPTR_PARAMETERS);
|
||||
TNode<Object> item = args.AtIndex(index);
|
||||
Node* value =
|
||||
PrepareValueForWriteToTypedArray(item, kind, context);
|
||||
|
||||
@ -771,6 +770,8 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
|
||||
|
||||
// ES6 #sec-%typedarray%.from
|
||||
TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
|
||||
TNode<Int32T> argc =
|
||||
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
|
||||
TNode<Context> context = CAST(Parameter(Descriptor::kContext));
|
||||
|
||||
Label check_iterator(this), from_array_like(this), fast_path(this),
|
||||
@ -780,9 +781,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
|
||||
if_iterator_fn_not_callable(this, Label::kDeferred),
|
||||
if_detached(this, Label::kDeferred);
|
||||
|
||||
CodeStubArguments args(
|
||||
this,
|
||||
ChangeInt32ToIntPtr(Parameter(Descriptor::kJSActualArgumentsCount)));
|
||||
CodeStubArguments args(this, argc);
|
||||
TNode<Object> source = args.GetOptionalArgumentValue(0);
|
||||
|
||||
// 5. If thisArg is present, let T be thisArg; else let T be undefined.
|
||||
|
@ -131,6 +131,16 @@ void CodeStubAssembler::Check(SloppyTNode<Word32T> condition_node,
|
||||
Check(branch, message, file, line, extra_nodes);
|
||||
}
|
||||
|
||||
template <>
|
||||
TNode<Smi> CodeStubAssembler::IntPtrToParameter<Smi>(TNode<IntPtrT> value) {
|
||||
return SmiTag(value);
|
||||
}
|
||||
template <>
|
||||
TNode<IntPtrT> CodeStubAssembler::IntPtrToParameter<IntPtrT>(
|
||||
TNode<IntPtrT> value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
void CodeStubAssembler::CollectCallableFeedback(
|
||||
TNode<Object> target, TNode<Context> context,
|
||||
TNode<FeedbackVector> feedback_vector, TNode<UintPtrT> slot_id) {
|
||||
@ -400,6 +410,11 @@ TNode<IntPtrT> CodeStubAssembler::IntPtrOrSmiConstant<IntPtrT>(int value) {
|
||||
return IntPtrConstant(value);
|
||||
}
|
||||
|
||||
template <>
|
||||
TNode<RawPtrT> CodeStubAssembler::IntPtrOrSmiConstant<RawPtrT>(int value) {
|
||||
return ReinterpretCast<RawPtrT>(IntPtrConstant(value));
|
||||
}
|
||||
|
||||
Node* CodeStubAssembler::IntPtrOrSmiConstant(int value, ParameterMode mode) {
|
||||
if (mode == SMI_PARAMETERS) {
|
||||
return SmiConstant(value);
|
||||
@ -3148,29 +3163,26 @@ TNode<Smi> CodeStubAssembler::BuildAppendJSArray(ElementsKind kind,
|
||||
TVARIABLE(Smi, var_tagged_length);
|
||||
ParameterMode mode = OptimalParameterMode();
|
||||
TVARIABLE(BInt, var_length, SmiToBInt(LoadFastJSArrayLength(array)));
|
||||
VARIABLE(var_elements, MachineRepresentation::kTagged, LoadElements(array));
|
||||
TVARIABLE(FixedArrayBase, var_elements, LoadElements(array));
|
||||
|
||||
// Resize the capacity of the fixed array if it doesn't fit.
|
||||
TNode<IntPtrT> first = arg_index->value();
|
||||
Node* growth = IntPtrToParameter(
|
||||
IntPtrSub(UncheckedCast<IntPtrT>(args->GetLength(INTPTR_PARAMETERS)),
|
||||
first),
|
||||
mode);
|
||||
TNode<BInt> growth = IntPtrToBInt(IntPtrSub(args->GetLength(), first));
|
||||
PossiblyGrowElementsCapacity(mode, kind, array, var_length.value(),
|
||||
&var_elements, growth, &pre_bailout);
|
||||
|
||||
// Push each argument onto the end of the array now that there is enough
|
||||
// capacity.
|
||||
CodeStubAssembler::VariableList push_vars({&var_length}, zone());
|
||||
Node* elements = var_elements.value();
|
||||
TNode<FixedArrayBase> elements = var_elements.value();
|
||||
args->ForEach(
|
||||
push_vars,
|
||||
[=, &var_length, &pre_bailout](Node* arg) {
|
||||
[&](TNode<Object> arg) {
|
||||
TryStoreArrayElement(kind, mode, &pre_bailout, elements,
|
||||
var_length.value(), arg);
|
||||
Increment(&var_length);
|
||||
},
|
||||
first, nullptr);
|
||||
first);
|
||||
{
|
||||
TNode<Smi> length = BIntToSmi(var_length.value());
|
||||
var_tagged_length = length;
|
||||
@ -5098,10 +5110,10 @@ void CodeStubAssembler::CopyElements(ElementsKind kind,
|
||||
IntPtrMul(length, IntPtrConstant(ElementsKindToByteSize(kind)));
|
||||
static const int32_t fa_base_data_offset =
|
||||
FixedArrayBase::kHeaderSize - kHeapObjectTag;
|
||||
TNode<IntPtrT> src_offset_start = ElementOffsetFromIndex(
|
||||
src_index, kind, INTPTR_PARAMETERS, fa_base_data_offset);
|
||||
TNode<IntPtrT> dst_offset_start = ElementOffsetFromIndex(
|
||||
dst_index, kind, INTPTR_PARAMETERS, fa_base_data_offset);
|
||||
TNode<IntPtrT> src_offset_start =
|
||||
ElementOffsetFromIndex(src_index, kind, fa_base_data_offset);
|
||||
TNode<IntPtrT> dst_offset_start =
|
||||
ElementOffsetFromIndex(dst_index, kind, fa_base_data_offset);
|
||||
TNode<IntPtrT> src_elements_intptr = BitcastTaggedToWord(src_elements);
|
||||
TNode<IntPtrT> source_data_ptr =
|
||||
IntPtrAdd(src_elements_intptr, src_offset_start);
|
||||
@ -8384,10 +8396,13 @@ void CodeStubAssembler::Increment(TVariable<TIndex>* variable, int value) {
|
||||
}
|
||||
|
||||
// Instantiate Increment for Smi and IntPtrT.
|
||||
// TODO(v8:9708): Consider renaming to [Smi|IntPtrT|RawPtrT]Increment.
|
||||
template void CodeStubAssembler::Increment<Smi>(TVariable<Smi>* variable,
|
||||
int value);
|
||||
template void CodeStubAssembler::Increment<IntPtrT>(
|
||||
TVariable<IntPtrT>* variable, int value);
|
||||
template void CodeStubAssembler::Increment<RawPtrT>(
|
||||
TVariable<RawPtrT>* variable, int value);
|
||||
|
||||
void CodeStubAssembler::Use(Label* label) {
|
||||
GotoIf(Word32Equal(Int32Constant(0), Int32Constant(1)), label);
|
||||
@ -10262,8 +10277,7 @@ TNode<BoolT> CodeStubAssembler::IsOffsetInBounds(SloppyTNode<IntPtrT> offset,
|
||||
// Make sure we point to the last field.
|
||||
int element_size = 1 << ElementsKindToShiftSize(kind);
|
||||
int correction = header_size - kHeapObjectTag - element_size;
|
||||
TNode<IntPtrT> last_offset =
|
||||
ElementOffsetFromIndex(length, kind, INTPTR_PARAMETERS, correction);
|
||||
TNode<IntPtrT> last_offset = ElementOffsetFromIndex(length, kind, correction);
|
||||
return IntPtrLessThanOrEqual(offset, last_offset);
|
||||
}
|
||||
|
||||
@ -13513,21 +13527,19 @@ TNode<UintPtrT> CodeStubAssembler::LoadJSTypedArrayLength(
|
||||
return LoadObjectField<UintPtrT>(typed_array, JSTypedArray::kLengthOffset);
|
||||
}
|
||||
|
||||
CodeStubArguments::CodeStubArguments(
|
||||
CodeStubAssembler* assembler, Node* argc, Node* fp,
|
||||
CodeStubAssembler::ParameterMode param_mode, ReceiverMode receiver_mode)
|
||||
CodeStubArguments::CodeStubArguments(CodeStubAssembler* assembler,
|
||||
TNode<IntPtrT> argc, TNode<RawPtrT> fp,
|
||||
ReceiverMode receiver_mode)
|
||||
: assembler_(assembler),
|
||||
argc_mode_(param_mode),
|
||||
receiver_mode_(receiver_mode),
|
||||
argc_(argc),
|
||||
base_(),
|
||||
fp_(fp != nullptr ? fp : assembler_->LoadFramePointer()) {
|
||||
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
||||
argc_, SYSTEM_POINTER_ELEMENTS, param_mode,
|
||||
argc_, SYSTEM_POINTER_ELEMENTS,
|
||||
(StandardFrameConstants::kFixedSlotCountAboveFp - 1) *
|
||||
kSystemPointerSize);
|
||||
base_ =
|
||||
assembler_->UncheckedCast<RawPtrT>(assembler_->IntPtrAdd(fp_, offset));
|
||||
base_ = assembler_->RawPtrAdd(fp_, offset);
|
||||
}
|
||||
|
||||
TNode<Object> CodeStubArguments::GetReceiver() const {
|
||||
@ -13542,24 +13554,18 @@ void CodeStubArguments::SetReceiver(TNode<Object> object) const {
|
||||
base_, assembler_->IntPtrConstant(kSystemPointerSize), object);
|
||||
}
|
||||
|
||||
TNode<WordT> CodeStubArguments::AtIndexPtr(
|
||||
Node* index, CodeStubAssembler::ParameterMode mode) const {
|
||||
using Node = compiler::Node;
|
||||
Node* negated_index = assembler_->IntPtrOrSmiSub(
|
||||
assembler_->IntPtrOrSmiConstant(0, mode), index, mode);
|
||||
TNode<RawPtrT> CodeStubArguments::AtIndexPtr(TNode<IntPtrT> index) const {
|
||||
TNode<IntPtrT> negated_index =
|
||||
assembler_->IntPtrOrSmiSub(assembler_->IntPtrConstant(0), index);
|
||||
TNode<IntPtrT> offset = assembler_->ElementOffsetFromIndex(
|
||||
negated_index, SYSTEM_POINTER_ELEMENTS, mode, 0);
|
||||
return assembler_->IntPtrAdd(assembler_->UncheckedCast<IntPtrT>(base_),
|
||||
offset);
|
||||
negated_index, SYSTEM_POINTER_ELEMENTS, 0);
|
||||
return assembler_->RawPtrAdd(base_, offset);
|
||||
}
|
||||
|
||||
TNode<Object> CodeStubArguments::AtIndex(
|
||||
Node* index, CodeStubAssembler::ParameterMode mode) const {
|
||||
DCHECK_EQ(argc_mode_, mode);
|
||||
CSA_ASSERT(assembler_,
|
||||
assembler_->UintPtrOrSmiLessThan(index, GetLength(mode), mode));
|
||||
TNode<Object> CodeStubArguments::AtIndex(TNode<IntPtrT> index) const {
|
||||
CSA_ASSERT(assembler_, assembler_->UintPtrOrSmiLessThan(index, GetLength()));
|
||||
return assembler_->UncheckedCast<Object>(
|
||||
assembler_->LoadFullTagged(AtIndexPtr(index, mode)));
|
||||
assembler_->LoadFullTagged(AtIndexPtr(index)));
|
||||
}
|
||||
|
||||
TNode<Object> CodeStubArguments::AtIndex(int index) const {
|
||||
@ -13572,9 +13578,8 @@ TNode<Object> CodeStubArguments::GetOptionalArgumentValue(
|
||||
CodeStubAssembler::Label argument_missing(assembler_),
|
||||
argument_done(assembler_, &result);
|
||||
|
||||
assembler_->GotoIf(assembler_->UintPtrOrSmiGreaterThanOrEqual(
|
||||
assembler_->IntPtrOrSmiConstant(index, argc_mode_),
|
||||
argc_, argc_mode_),
|
||||
assembler_->GotoIf(assembler_->UintPtrGreaterThanOrEqual(
|
||||
assembler_->IntPtrConstant(index), argc_),
|
||||
&argument_missing);
|
||||
result = AtIndex(index);
|
||||
assembler_->Goto(&argument_done);
|
||||
@ -13593,10 +13598,8 @@ TNode<Object> CodeStubArguments::GetOptionalArgumentValue(
|
||||
CodeStubAssembler::Label argument_missing(assembler_),
|
||||
argument_done(assembler_, &result);
|
||||
|
||||
assembler_->GotoIf(
|
||||
assembler_->UintPtrOrSmiGreaterThanOrEqual(
|
||||
assembler_->IntPtrToParameter(index, argc_mode_), argc_, argc_mode_),
|
||||
&argument_missing);
|
||||
assembler_->GotoIf(assembler_->UintPtrGreaterThanOrEqual(index, argc_),
|
||||
&argument_missing);
|
||||
result = AtIndex(index);
|
||||
assembler_->Goto(&argument_done);
|
||||
|
||||
@ -13610,42 +13613,38 @@ TNode<Object> CodeStubArguments::GetOptionalArgumentValue(
|
||||
|
||||
void CodeStubArguments::ForEach(
|
||||
const CodeStubAssembler::VariableList& vars,
|
||||
const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last,
|
||||
CodeStubAssembler::ParameterMode mode) {
|
||||
const CodeStubArguments::ForEachBodyFunction& body, TNode<IntPtrT> first,
|
||||
TNode<IntPtrT> last) {
|
||||
assembler_->Comment("CodeStubArguments::ForEach");
|
||||
if (first == nullptr) {
|
||||
first = assembler_->IntPtrOrSmiConstant(0, mode);
|
||||
first = assembler_->IntPtrConstant(0);
|
||||
}
|
||||
if (last == nullptr) {
|
||||
DCHECK_EQ(mode, argc_mode_);
|
||||
last = argc_;
|
||||
}
|
||||
TNode<IntPtrT> start = assembler_->IntPtrSub(
|
||||
assembler_->UncheckedCast<IntPtrT>(base_),
|
||||
assembler_->ElementOffsetFromIndex(first, SYSTEM_POINTER_ELEMENTS, mode));
|
||||
TNode<IntPtrT> end = assembler_->IntPtrSub(
|
||||
assembler_->UncheckedCast<IntPtrT>(base_),
|
||||
assembler_->ElementOffsetFromIndex(last, SYSTEM_POINTER_ELEMENTS, mode));
|
||||
assembler_->BuildFastLoop<IntPtrT>(
|
||||
TNode<RawPtrT> start = assembler_->RawPtrSub(
|
||||
base_,
|
||||
assembler_->ElementOffsetFromIndex(first, SYSTEM_POINTER_ELEMENTS));
|
||||
TNode<RawPtrT> end = assembler_->RawPtrSub(
|
||||
base_, assembler_->ElementOffsetFromIndex(last, SYSTEM_POINTER_ELEMENTS));
|
||||
assembler_->BuildFastLoop<RawPtrT>(
|
||||
vars, start, end,
|
||||
[&](TNode<IntPtrT> current) {
|
||||
Node* arg = assembler_->Load(MachineType::AnyTagged(), current);
|
||||
[&](TNode<RawPtrT> current) {
|
||||
TNode<Object> arg = assembler_->Load<Object>(current);
|
||||
body(arg);
|
||||
},
|
||||
-kSystemPointerSize, CodeStubAssembler::IndexAdvanceMode::kPost);
|
||||
}
|
||||
|
||||
void CodeStubArguments::PopAndReturn(Node* value) {
|
||||
Node* pop_count;
|
||||
TNode<IntPtrT> pop_count;
|
||||
if (receiver_mode_ == ReceiverMode::kHasReceiver) {
|
||||
pop_count = assembler_->IntPtrOrSmiAdd(
|
||||
argc_, assembler_->IntPtrOrSmiConstant(1, argc_mode_), argc_mode_);
|
||||
pop_count = assembler_->IntPtrAdd(argc_, assembler_->IntPtrConstant(1));
|
||||
} else {
|
||||
pop_count = argc_;
|
||||
}
|
||||
|
||||
assembler_->PopAndReturn(assembler_->ParameterToIntPtr(pop_count, argc_mode_),
|
||||
value);
|
||||
assembler_->PopAndReturn(pop_count, value);
|
||||
}
|
||||
|
||||
TNode<BoolT> CodeStubAssembler::IsFastElementsKind(
|
||||
@ -14003,8 +14002,7 @@ TNode<Object> CodeStubAssembler::GetArgumentValue(TorqueStructArguments args,
|
||||
|
||||
TorqueStructArguments CodeStubAssembler::GetFrameArguments(
|
||||
TNode<RawPtrT> frame, TNode<IntPtrT> argc) {
|
||||
return CodeStubArguments(this, argc, frame, INTPTR_PARAMETERS)
|
||||
.GetTorqueArguments();
|
||||
return CodeStubArguments(this, argc, frame).GetTorqueArguments();
|
||||
}
|
||||
|
||||
void CodeStubAssembler::Print(const char* s) {
|
||||
|
@ -299,11 +299,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
|
||||
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) {
|
||||
if (mode == SMI_PARAMETERS) value = SmiUntag(value);
|
||||
return UncheckedCast<IntPtrT>(value);
|
||||
}
|
||||
|
||||
template <typename TIndex>
|
||||
TNode<TIndex> IntPtrToParameter(TNode<IntPtrT> value);
|
||||
|
||||
Node* IntPtrToParameter(SloppyTNode<IntPtrT> value, ParameterMode mode) {
|
||||
if (mode == SMI_PARAMETERS) return SmiTag(value);
|
||||
return value;
|
||||
@ -453,6 +459,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
|
||||
TNode<Smi> OpName(TNode<Smi> a, TNode<Smi> b) { return SmiOpName(a, b); } \
|
||||
TNode<IntPtrT> OpName(TNode<IntPtrT> a, TNode<IntPtrT> 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.
|
||||
PARAMETER_BINOP(IntPtrOrSmiMin, IntPtrMin, SmiMin)
|
||||
@ -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<IntPtrT> a, TNode<IntPtrT> 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.
|
||||
PARAMETER_BINOP(IntPtrOrSmiEqual, IntPtrEqual, SmiEqual)
|
||||
PARAMETER_BINOP(IntPtrOrSmiEqual, WordEqual, SmiEqual)
|
||||
PARAMETER_BINOP(IntPtrOrSmiNotEqual, WordNotEqual, SmiNotEqual)
|
||||
PARAMETER_BINOP(IntPtrOrSmiLessThan, IntPtrLessThan, SmiLessThan)
|
||||
PARAMETER_BINOP(IntPtrOrSmiLessThanOrEqual, IntPtrLessThanOrEqual,
|
||||
@ -3804,32 +3817,48 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
|
||||
}
|
||||
};
|
||||
|
||||
// template <typename TIndex>
|
||||
class V8_EXPORT_PRIVATE CodeStubArguments {
|
||||
public:
|
||||
using Node = compiler::Node;
|
||||
enum ReceiverMode { kHasReceiver, kNoReceiver };
|
||||
|
||||
// |argc| is an intptr value which 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, Node* argc,
|
||||
// |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,
|
||||
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
|
||||
: CodeStubArguments(assembler, argc, nullptr,
|
||||
CodeStubAssembler::INTPTR_PARAMETERS, receiver_mode) {
|
||||
}
|
||||
: CodeStubArguments(assembler, argc, TNode<RawPtrT>(), receiver_mode) {}
|
||||
|
||||
// |argc| is either a smi or intptr depending on |param_mode|. The arguments
|
||||
// include a receiver iff |receiver_mode| is kHasReceiver.
|
||||
CodeStubArguments(CodeStubAssembler* assembler, Node* argc, Node* fp,
|
||||
CodeStubAssembler::ParameterMode param_mode,
|
||||
CodeStubArguments(CodeStubAssembler* assembler, TNode<Int32T> argc,
|
||||
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
|
||||
: CodeStubArguments(assembler, assembler->ChangeInt32ToIntPtr(argc),
|
||||
TNode<RawPtrT>(), receiver_mode) {}
|
||||
|
||||
// TODO(v8:9708): Consider removing this variant
|
||||
CodeStubArguments(CodeStubAssembler* assembler, TNode<Smi> argc,
|
||||
ReceiverMode receiver_mode = ReceiverMode::kHasReceiver)
|
||||
: 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);
|
||||
|
||||
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
|
||||
// struct of values.
|
||||
CodeStubArguments(CodeStubAssembler* assembler,
|
||||
TorqueStructArguments torque_arguments)
|
||||
: assembler_(assembler),
|
||||
argc_mode_(CodeStubAssembler::INTPTR_PARAMETERS),
|
||||
receiver_mode_(ReceiverMode::kHasReceiver),
|
||||
argc_(torque_arguments.length),
|
||||
base_(torque_arguments.base),
|
||||
@ -3842,14 +3871,17 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
|
||||
void SetReceiver(TNode<Object> object) const;
|
||||
|
||||
// Computes address of the index'th argument.
|
||||
TNode<WordT> AtIndexPtr(Node* index,
|
||||
CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) const;
|
||||
TNode<RawPtrT> AtIndexPtr(TNode<IntPtrT> index) const;
|
||||
TNode<RawPtrT> AtIndexPtr(TNode<Smi> index) const {
|
||||
return AtIndexPtr(assembler_->ParameterToIntPtr(index));
|
||||
}
|
||||
|
||||
// |index| is zero-based and does not include the receiver
|
||||
TNode<Object> AtIndex(Node* index,
|
||||
CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) const;
|
||||
TNode<Object> AtIndex(TNode<IntPtrT> index) const;
|
||||
// TODO(v8:9708): Consider removing this variant
|
||||
TNode<Object> AtIndex(TNode<Smi> index) const {
|
||||
return AtIndex(assembler_->ParameterToIntPtr(index));
|
||||
}
|
||||
|
||||
TNode<Object> AtIndex(int index) const;
|
||||
|
||||
@ -3859,15 +3891,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
|
||||
TNode<Object> GetOptionalArgumentValue(int index,
|
||||
TNode<Object> default_value);
|
||||
|
||||
Node* GetLength(CodeStubAssembler::ParameterMode mode) const {
|
||||
DCHECK_EQ(mode, argc_mode_);
|
||||
return argc_;
|
||||
}
|
||||
TNode<IntPtrT> GetLength() const { return argc_; }
|
||||
|
||||
TorqueStructArguments GetTorqueArguments() const {
|
||||
DCHECK_EQ(argc_mode_, CodeStubAssembler::INTPTR_PARAMETERS);
|
||||
return TorqueStructArguments{assembler_->UncheckedCast<RawPtrT>(fp_), base_,
|
||||
assembler_->UncheckedCast<IntPtrT>(argc_)};
|
||||
return TorqueStructArguments{fp_, base_, argc_};
|
||||
}
|
||||
|
||||
TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index) {
|
||||
@ -3875,28 +3902,34 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
|
||||
}
|
||||
TNode<Object> GetOptionalArgumentValue(TNode<IntPtrT> index,
|
||||
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.
|
||||
void ForEach(const ForEachBodyFunction& body, Node* first = nullptr,
|
||||
Node* last = nullptr,
|
||||
CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS) {
|
||||
template <typename TIndex>
|
||||
void ForEach(const ForEachBodyFunction& body,
|
||||
TNode<TIndex> first = TNode<TIndex>(),
|
||||
TNode<TIndex> last = TNode<TIndex>()) {
|
||||
CodeStubAssembler::VariableList list(0, assembler_->zone());
|
||||
ForEach(list, body, first, last);
|
||||
}
|
||||
|
||||
// Iteration doesn't include the receiver. |first| and |last| are zero-based.
|
||||
void ForEach(const CodeStubAssembler::VariableList& vars,
|
||||
const ForEachBodyFunction& body, Node* first = nullptr,
|
||||
Node* last = nullptr,
|
||||
CodeStubAssembler::ParameterMode mode =
|
||||
CodeStubAssembler::INTPTR_PARAMETERS);
|
||||
const ForEachBodyFunction& body,
|
||||
TNode<IntPtrT> first = TNode<IntPtrT>(),
|
||||
TNode<IntPtrT> last = TNode<IntPtrT>());
|
||||
|
||||
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);
|
||||
|
||||
@ -3904,11 +3937,10 @@ class V8_EXPORT_PRIVATE CodeStubArguments {
|
||||
Node* GetArguments();
|
||||
|
||||
CodeStubAssembler* assembler_;
|
||||
CodeStubAssembler::ParameterMode argc_mode_;
|
||||
ReceiverMode receiver_mode_;
|
||||
Node* argc_;
|
||||
TNode<IntPtrT> argc_;
|
||||
TNode<RawPtrT> base_;
|
||||
Node* fp_;
|
||||
TNode<RawPtrT> fp_;
|
||||
};
|
||||
|
||||
class ToDirectStringAssembler : public CodeStubAssembler {
|
||||
|
@ -847,8 +847,12 @@ class V8_EXPORT_PRIVATE CodeAssembler {
|
||||
TNode<RawPtrT> RawPtrAdd(TNode<RawPtrT> left, TNode<IntPtrT> right) {
|
||||
return ReinterpretCast<RawPtrT>(IntPtrAdd(left, right));
|
||||
}
|
||||
TNode<RawPtrT> RawPtrAdd(TNode<IntPtrT> left, TNode<RawPtrT> right) {
|
||||
return ReinterpretCast<RawPtrT>(IntPtrAdd(left, right));
|
||||
TNode<RawPtrT> RawPtrSub(TNode<RawPtrT> left, TNode<IntPtrT> 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);
|
||||
|
@ -329,8 +329,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
|
||||
// FixedArray backing store -> Smi or object elements.
|
||||
{
|
||||
TNode<IntPtrT> offset = ElementOffsetFromIndex(
|
||||
index, PACKED_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
TNode<IntPtrT> offset =
|
||||
ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize);
|
||||
// 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.
|
||||
// If we know that we're storing beyond the previous array length, we
|
||||
@ -399,8 +399,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
PACKED_SMI_ELEMENTS, target_kind, slow);
|
||||
// Reload migrated elements.
|
||||
TNode<FixedArrayBase> double_elements = LoadElements(receiver);
|
||||
TNode<IntPtrT> double_offset = ElementOffsetFromIndex(
|
||||
index, PACKED_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
TNode<IntPtrT> double_offset =
|
||||
ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize);
|
||||
// Make sure we do not store signalling NaNs into double arrays.
|
||||
TNode<Float64T> double_value =
|
||||
Float64SilenceNaN(LoadHeapNumberValue(CAST(value)));
|
||||
@ -432,8 +432,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
&check_cow_elements);
|
||||
// FixedDoubleArray backing store -> double elements.
|
||||
{
|
||||
TNode<IntPtrT> offset = ElementOffsetFromIndex(
|
||||
index, PACKED_DOUBLE_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
TNode<IntPtrT> offset =
|
||||
ElementOffsetFromIndex(index, PACKED_DOUBLE_ELEMENTS, kHeaderSize);
|
||||
// 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.
|
||||
{
|
||||
@ -481,8 +481,8 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
|
||||
PACKED_DOUBLE_ELEMENTS, target_kind, slow);
|
||||
// Reload migrated elements.
|
||||
TNode<FixedArrayBase> fast_elements = LoadElements(receiver);
|
||||
TNode<IntPtrT> fast_offset = ElementOffsetFromIndex(
|
||||
index, PACKED_ELEMENTS, INTPTR_PARAMETERS, kHeaderSize);
|
||||
TNode<IntPtrT> fast_offset =
|
||||
ElementOffsetFromIndex(index, PACKED_ELEMENTS, kHeaderSize);
|
||||
Store(fast_elements, fast_offset, value);
|
||||
MaybeUpdateLengthAndReturn(receiver, index, value, update_length);
|
||||
}
|
||||
|
@ -1997,12 +1997,9 @@ TEST(Arguments) {
|
||||
|
||||
CodeStubArguments arguments(&m, m.IntPtrConstant(3));
|
||||
|
||||
CSA_ASSERT(
|
||||
&m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12))));
|
||||
CSA_ASSERT(
|
||||
&m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(Smi::FromInt(13))));
|
||||
CSA_ASSERT(
|
||||
&m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14))));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(0), m.SmiConstant(12)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(1), m.SmiConstant(13)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(2), m.SmiConstant(14)));
|
||||
|
||||
arguments.PopAndReturn(arguments.GetReceiver());
|
||||
|
||||
@ -2022,21 +2019,14 @@ TEST(ArgumentsWithSmiConstantIndices) {
|
||||
CodeAssemblerTester asm_tester(isolate, kNumParams);
|
||||
CodeStubAssembler m(asm_tester.state());
|
||||
|
||||
CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr,
|
||||
CodeStubAssembler::SMI_PARAMETERS);
|
||||
CodeStubArguments arguments(&m, m.SmiConstant(3));
|
||||
|
||||
CSA_ASSERT(&m,
|
||||
m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0),
|
||||
CodeStubAssembler::SMI_PARAMETERS),
|
||||
m.SmiConstant(Smi::FromInt(12))));
|
||||
CSA_ASSERT(&m,
|
||||
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))));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(0)),
|
||||
m.SmiConstant(12)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(1)),
|
||||
m.SmiConstant(13)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(m.SmiConstant(2)),
|
||||
m.SmiConstant(14)));
|
||||
|
||||
arguments.PopAndReturn(arguments.GetReceiver());
|
||||
|
||||
@ -2075,21 +2065,14 @@ TEST(ArgumentsWithSmiIndices) {
|
||||
CodeAssemblerTester asm_tester(isolate, kNumParams);
|
||||
CodeStubAssembler m(asm_tester.state());
|
||||
|
||||
CodeStubArguments arguments(&m, m.SmiConstant(3), nullptr,
|
||||
CodeStubAssembler::SMI_PARAMETERS);
|
||||
CodeStubArguments arguments(&m, m.SmiConstant(3));
|
||||
|
||||
CSA_ASSERT(&m,
|
||||
m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0),
|
||||
CodeStubAssembler::SMI_PARAMETERS),
|
||||
m.SmiConstant(Smi::FromInt(12))));
|
||||
CSA_ASSERT(&m,
|
||||
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))));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 0)),
|
||||
m.SmiConstant(12)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 1)),
|
||||
m.SmiConstant(13)));
|
||||
CSA_ASSERT(&m, m.TaggedEqual(arguments.AtIndex(NonConstantSmi(&m, 2)),
|
||||
m.SmiConstant(14)));
|
||||
|
||||
arguments.PopAndReturn(arguments.GetReceiver());
|
||||
|
||||
@ -2116,7 +2099,7 @@ TEST(ArgumentsForEach) {
|
||||
|
||||
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));
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user