Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: src/builtins/builtins-array.cc

Issue 2734323004: [cleanup] Refactor remaining builtins-*.cc to use TF_BUILTIN macro (Closed)
Patch Set: drop unused variable Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/builtins/builtins-conversion.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-array.cc
diff --git a/src/builtins/builtins-array.cc b/src/builtins/builtins-array.cc
index 5d3d4c1c7305051e48ee83c6652c66bd2fee9595..85a49284b72953e4cace97be637c92fb54e98058 100644
--- a/src/builtins/builtins-array.cc
+++ b/src/builtins/builtins-array.cc
@@ -188,76 +188,63 @@ BUILTIN(ArrayPush) {
return Smi::FromInt(new_length);
}
-void Builtins::Generate_FastArrayPush(compiler::CodeAssemblerState* state) {
- typedef compiler::Node Node;
- typedef CodeStubAssembler::Label Label;
- typedef CodeStubAssembler::Variable Variable;
- CodeStubAssembler assembler(state);
- Variable arg_index(&assembler, MachineType::PointerRepresentation());
- Label default_label(&assembler, &arg_index);
- Label smi_transition(&assembler);
- Label object_push_pre(&assembler);
- Label object_push(&assembler, &arg_index);
- Label double_push(&assembler, &arg_index);
- Label double_transition(&assembler);
- Label runtime(&assembler, Label::kDeferred);
-
- Node* argc = assembler.Parameter(BuiltinDescriptor::kArgumentsCount);
- Node* context = assembler.Parameter(BuiltinDescriptor::kContext);
- Node* new_target = assembler.Parameter(BuiltinDescriptor::kNewTarget);
-
- CodeStubArguments args(&assembler, assembler.ChangeInt32ToIntPtr(argc));
+TF_BUILTIN(FastArrayPush, CodeStubAssembler) {
+ Variable arg_index(this, MachineType::PointerRepresentation());
+ Label default_label(this, &arg_index);
+ Label smi_transition(this);
+ Label object_push_pre(this);
+ Label object_push(this, &arg_index);
+ Label double_push(this, &arg_index);
+ Label double_transition(this);
+ Label runtime(this, Label::kDeferred);
+
+ Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount);
+ Node* context = Parameter(BuiltinDescriptor::kContext);
+ Node* new_target = Parameter(BuiltinDescriptor::kNewTarget);
+
+ CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
Node* receiver = args.GetReceiver();
Node* kind = nullptr;
- Label fast(&assembler);
- {
- assembler.BranchIfFastJSArray(
- receiver, context, CodeStubAssembler::FastJSArrayAccessMode::ANY_ACCESS,
- &fast, &runtime);
- }
+ Label fast(this);
+ BranchIfFastJSArray(receiver, context, FastJSArrayAccessMode::ANY_ACCESS,
+ &fast, &runtime);
- assembler.Bind(&fast);
+ Bind(&fast);
{
// Disallow pushing onto prototypes. It might be the JSArray prototype.
// Disallow pushing onto non-extensible objects.
- assembler.Comment("Disallow pushing onto prototypes");
- Node* map = assembler.LoadMap(receiver);
- Node* bit_field2 = assembler.LoadMapBitField2(map);
+ Comment("Disallow pushing onto prototypes");
+ Node* map = LoadMap(receiver);
+ Node* bit_field2 = LoadMapBitField2(map);
int mask = static_cast<int>(Map::IsPrototypeMapBits::kMask) |
(1 << Map::kIsExtensible);
- Node* test = assembler.Word32And(bit_field2, assembler.Int32Constant(mask));
- assembler.GotoIf(
- assembler.Word32NotEqual(
- test, assembler.Int32Constant(1 << Map::kIsExtensible)),
- &runtime);
+ Node* test = Word32And(bit_field2, Int32Constant(mask));
+ GotoIf(Word32NotEqual(test, Int32Constant(1 << Map::kIsExtensible)),
+ &runtime);
// Disallow pushing onto arrays in dictionary named property mode. We need
// to figure out whether the length property is still writable.
- assembler.Comment(
- "Disallow pushing onto arrays in dictionary named property mode");
- assembler.GotoIf(assembler.IsDictionaryMap(map), &runtime);
+ Comment("Disallow pushing onto arrays in dictionary named property mode");
+ GotoIf(IsDictionaryMap(map), &runtime);
// Check whether the length property is writable. The length property is the
// only default named property on arrays. It's nonconfigurable, hence is
// guaranteed to stay the first property.
- Node* descriptors = assembler.LoadMapDescriptors(map);
- Node* details = assembler.LoadFixedArrayElement(
- descriptors, DescriptorArray::ToDetailsIndex(0));
- assembler.GotoIf(
- assembler.IsSetSmi(details, PropertyDetails::kAttributesReadOnlyMask),
- &runtime);
-
- arg_index.Bind(assembler.IntPtrConstant(0));
- kind = assembler.DecodeWord32<Map::ElementsKindBits>(bit_field2);
-
- assembler.GotoIf(
- assembler.Int32GreaterThan(
- kind, assembler.Int32Constant(FAST_HOLEY_SMI_ELEMENTS)),
- &object_push_pre);
-
- Node* new_length = assembler.BuildAppendJSArray(
- FAST_SMI_ELEMENTS, context, receiver, args, arg_index, &smi_transition);
+ Node* descriptors = LoadMapDescriptors(map);
+ Node* details =
+ LoadFixedArrayElement(descriptors, DescriptorArray::ToDetailsIndex(0));
+ GotoIf(IsSetSmi(details, PropertyDetails::kAttributesReadOnlyMask),
+ &runtime);
+
+ arg_index.Bind(IntPtrConstant(0));
+ kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
+
+ GotoIf(Int32GreaterThan(kind, Int32Constant(FAST_HOLEY_SMI_ELEMENTS)),
+ &object_push_pre);
+
+ Node* new_length = BuildAppendJSArray(FAST_SMI_ELEMENTS, context, receiver,
+ args, arg_index, &smi_transition);
args.PopAndReturn(new_length);
}
@@ -265,48 +252,46 @@ void Builtins::Generate_FastArrayPush(compiler::CodeAssemblerState* state) {
// transition the array for only the single next element. If the argument is
// a smi, the failure is due to some other reason and we should fall back on
// the most generic implementation for the rest of the array.
- assembler.Bind(&smi_transition);
+ Bind(&smi_transition);
{
Node* arg = args.AtIndex(arg_index.value());
- assembler.GotoIf(assembler.TaggedIsSmi(arg), &default_label);
- Node* length = assembler.LoadJSArrayLength(receiver);
+ GotoIf(TaggedIsSmi(arg), &default_label);
+ Node* length = LoadJSArrayLength(receiver);
// TODO(danno): Use the KeyedStoreGeneric stub here when possible,
// calling into the runtime to do the elements transition is overkill.
- assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg,
- assembler.SmiConstant(STRICT));
- assembler.Increment(arg_index);
+ CallRuntime(Runtime::kSetProperty, context, receiver, length, arg,
+ SmiConstant(STRICT));
+ Increment(arg_index);
// The runtime SetProperty call could have converted the array to dictionary
// mode, which must be detected to abort the fast-path.
- Node* map = assembler.LoadMap(receiver);
- Node* bit_field2 = assembler.LoadMapBitField2(map);
- Node* kind = assembler.DecodeWord32<Map::ElementsKindBits>(bit_field2);
- assembler.GotoIf(assembler.Word32Equal(
- kind, assembler.Int32Constant(DICTIONARY_ELEMENTS)),
- &default_label);
+ Node* map = LoadMap(receiver);
+ Node* bit_field2 = LoadMapBitField2(map);
+ Node* kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
+ GotoIf(Word32Equal(kind, Int32Constant(DICTIONARY_ELEMENTS)),
+ &default_label);
- assembler.GotoIfNotNumber(arg, &object_push);
- assembler.Goto(&double_push);
+ GotoIfNotNumber(arg, &object_push);
+ Goto(&double_push);
}
- assembler.Bind(&object_push_pre);
+ Bind(&object_push_pre);
{
- assembler.Branch(assembler.Int32GreaterThan(
- kind, assembler.Int32Constant(FAST_HOLEY_ELEMENTS)),
- &double_push, &object_push);
+ Branch(Int32GreaterThan(kind, Int32Constant(FAST_HOLEY_ELEMENTS)),
+ &double_push, &object_push);
}
- assembler.Bind(&object_push);
+ Bind(&object_push);
{
- Node* new_length = assembler.BuildAppendJSArray(
- FAST_ELEMENTS, context, receiver, args, arg_index, &default_label);
+ Node* new_length = BuildAppendJSArray(FAST_ELEMENTS, context, receiver,
+ args, arg_index, &default_label);
args.PopAndReturn(new_length);
}
- assembler.Bind(&double_push);
+ Bind(&double_push);
{
Node* new_length =
- assembler.BuildAppendJSArray(FAST_DOUBLE_ELEMENTS, context, receiver,
- args, arg_index, &double_transition);
+ BuildAppendJSArray(FAST_DOUBLE_ELEMENTS, context, receiver, args,
+ arg_index, &double_transition);
args.PopAndReturn(new_length);
}
@@ -314,47 +299,46 @@ void Builtins::Generate_FastArrayPush(compiler::CodeAssemblerState* state) {
// transition the array for only the single next element. If the argument is
// a double, the failure is due to some other reason and we should fall back
// on the most generic implementation for the rest of the array.
- assembler.Bind(&double_transition);
+ Bind(&double_transition);
{
Node* arg = args.AtIndex(arg_index.value());
- assembler.GotoIfNumber(arg, &default_label);
- Node* length = assembler.LoadJSArrayLength(receiver);
+ GotoIfNumber(arg, &default_label);
+ Node* length = LoadJSArrayLength(receiver);
// TODO(danno): Use the KeyedStoreGeneric stub here when possible,
// calling into the runtime to do the elements transition is overkill.
- assembler.CallRuntime(Runtime::kSetProperty, context, receiver, length, arg,
- assembler.SmiConstant(STRICT));
- assembler.Increment(arg_index);
+ CallRuntime(Runtime::kSetProperty, context, receiver, length, arg,
+ SmiConstant(STRICT));
+ Increment(arg_index);
// The runtime SetProperty call could have converted the array to dictionary
// mode, which must be detected to abort the fast-path.
- Node* map = assembler.LoadMap(receiver);
- Node* bit_field2 = assembler.LoadMapBitField2(map);
- Node* kind = assembler.DecodeWord32<Map::ElementsKindBits>(bit_field2);
- assembler.GotoIf(assembler.Word32Equal(
- kind, assembler.Int32Constant(DICTIONARY_ELEMENTS)),
- &default_label);
- assembler.Goto(&object_push);
+ Node* map = LoadMap(receiver);
+ Node* bit_field2 = LoadMapBitField2(map);
+ Node* kind = DecodeWord32<Map::ElementsKindBits>(bit_field2);
+ GotoIf(Word32Equal(kind, Int32Constant(DICTIONARY_ELEMENTS)),
+ &default_label);
+ Goto(&object_push);
}
// Fallback that stores un-processed arguments using the full, heavyweight
// SetProperty machinery.
- assembler.Bind(&default_label);
+ Bind(&default_label);
{
args.ForEach(
- [&assembler, receiver, context](Node* arg) {
- Node* length = assembler.LoadJSArrayLength(receiver);
- assembler.CallRuntime(Runtime::kSetProperty, context, receiver,
- length, arg, assembler.SmiConstant(STRICT));
+ [this, receiver, context](Node* arg) {
+ Node* length = LoadJSArrayLength(receiver);
+ CallRuntime(Runtime::kSetProperty, context, receiver, length, arg,
+ SmiConstant(STRICT));
},
arg_index.value());
- args.PopAndReturn(assembler.LoadJSArrayLength(receiver));
+ args.PopAndReturn(LoadJSArrayLength(receiver));
}
- assembler.Bind(&runtime);
+ Bind(&runtime);
{
- Node* target = assembler.LoadFromFrame(
- StandardFrameConstants::kFunctionOffset, MachineType::TaggedPointer());
- assembler.TailCallStub(CodeFactory::ArrayPush(assembler.isolate()), context,
- target, new_target, argc);
+ Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset,
+ MachineType::TaggedPointer());
+ TailCallStub(CodeFactory::ArrayPush(isolate()), context, target, new_target,
+ argc);
}
}
@@ -1645,38 +1629,30 @@ BUILTIN(ArrayConcat) {
return Slow_ArrayConcat(&args, species, isolate);
}
-void Builtins::Generate_ArrayIsArray(compiler::CodeAssemblerState* state) {
- typedef compiler::Node Node;
- typedef CodeStubAssembler::Label Label;
- CodeStubAssembler assembler(state);
-
- Node* object = assembler.Parameter(1);
- Node* context = assembler.Parameter(4);
+TF_BUILTIN(ArrayIsArray, CodeStubAssembler) {
+ Node* object = Parameter(1);
+ Node* context = Parameter(4);
- Label call_runtime(&assembler), return_true(&assembler),
- return_false(&assembler);
+ Label call_runtime(this), return_true(this), return_false(this);
- assembler.GotoIf(assembler.TaggedIsSmi(object), &return_false);
- Node* instance_type = assembler.LoadInstanceType(object);
+ GotoIf(TaggedIsSmi(object), &return_false);
+ Node* instance_type = LoadInstanceType(object);
- assembler.GotoIf(assembler.Word32Equal(
- instance_type, assembler.Int32Constant(JS_ARRAY_TYPE)),
- &return_true);
+ GotoIf(Word32Equal(instance_type, Int32Constant(JS_ARRAY_TYPE)),
+ &return_true);
// TODO(verwaest): Handle proxies in-place.
- assembler.Branch(assembler.Word32Equal(
- instance_type, assembler.Int32Constant(JS_PROXY_TYPE)),
- &call_runtime, &return_false);
+ Branch(Word32Equal(instance_type, Int32Constant(JS_PROXY_TYPE)),
+ &call_runtime, &return_false);
- assembler.Bind(&return_true);
- assembler.Return(assembler.BooleanConstant(true));
+ Bind(&return_true);
+ Return(BooleanConstant(true));
- assembler.Bind(&return_false);
- assembler.Return(assembler.BooleanConstant(false));
+ Bind(&return_false);
+ Return(BooleanConstant(false));
- assembler.Bind(&call_runtime);
- assembler.Return(
- assembler.CallRuntime(Runtime::kArrayIsArray, context, object));
+ Bind(&call_runtime);
+ Return(CallRuntime(Runtime::kArrayIsArray, context, object));
}
TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
@@ -1694,8 +1670,7 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
// Take slow path if not a JSArray, if retrieving elements requires
// traversing prototype, or if access checks are required.
- BranchIfFastJSArray(array, context,
- CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ,
+ BranchIfFastJSArray(array, context, FastJSArrayAccessMode::INBOUNDS_READ,
&init_len, &call_runtime);
Bind(&init_len);
@@ -1917,7 +1892,7 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
// Load double value or continue if it contains a double hole.
Node* element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+ INTPTR_PARAMETERS, &continue_loop);
Branch(Float64Equal(element_k, search_num.value()), &return_true,
&continue_loop);
@@ -1935,7 +1910,7 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
// Load double value or continue if it contains a double hole.
Node* element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+ INTPTR_PARAMETERS, &continue_loop);
BranchIfFloat64IsNaN(element_k, &return_true, &continue_loop);
Bind(&continue_loop);
@@ -1949,9 +1924,9 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
GotoIfNot(UintPtrLessThan(index_var.value(), len), &return_false);
// Check if the element is a double hole, but don't load it.
- LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::None(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS, &return_true);
+ LoadFixedDoubleArrayElement(elements, index_var.value(),
+ MachineType::None(), 0, INTPTR_PARAMETERS,
+ &return_true);
index_var.Bind(IntPtrAdd(index_var.value(), IntPtrConstant(1)));
Goto(&hole_loop);
@@ -1969,116 +1944,100 @@ TF_BUILTIN(ArrayIncludes, CodeStubAssembler) {
search_element, start_from));
}
-void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
- typedef compiler::Node Node;
- typedef CodeStubAssembler::Label Label;
- typedef CodeStubAssembler::Variable Variable;
- CodeStubAssembler assembler(state);
-
- Node* array = assembler.Parameter(0);
- Node* search_element = assembler.Parameter(1);
- Node* start_from = assembler.Parameter(2);
- Node* context = assembler.Parameter(3 + 2);
-
- Node* intptr_zero = assembler.IntPtrConstant(0);
- Node* intptr_one = assembler.IntPtrConstant(1);
+TF_BUILTIN(ArrayIndexOf, CodeStubAssembler) {
+ Node* array = Parameter(0);
+ Node* search_element = Parameter(1);
+ Node* start_from = Parameter(2);
+ Node* context = Parameter(3 + 2);
- Node* undefined = assembler.UndefinedConstant();
+ Node* intptr_zero = IntPtrConstant(0);
+ Node* intptr_one = IntPtrConstant(1);
- Variable len_var(&assembler, MachineType::PointerRepresentation()),
- index_var(&assembler, MachineType::PointerRepresentation()),
- start_from_var(&assembler, MachineType::PointerRepresentation());
+ Variable len_var(this, MachineType::PointerRepresentation()),
+ index_var(this, MachineType::PointerRepresentation()),
+ start_from_var(this, MachineType::PointerRepresentation());
- Label init_k(&assembler), return_found(&assembler),
- return_not_found(&assembler), call_runtime(&assembler);
+ Label init_k(this), return_found(this), return_not_found(this),
+ call_runtime(this);
- Label init_len(&assembler);
+ Label init_len(this);
index_var.Bind(intptr_zero);
len_var.Bind(intptr_zero);
// Take slow path if not a JSArray, if retrieving elements requires
// traversing prototype, or if access checks are required.
- assembler.BranchIfFastJSArray(
- array, context, CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ,
- &init_len, &call_runtime);
+ BranchIfFastJSArray(array, context, FastJSArrayAccessMode::INBOUNDS_READ,
+ &init_len, &call_runtime);
- assembler.Bind(&init_len);
+ Bind(&init_len);
{
// JSArray length is always an Smi for fast arrays.
- CSA_ASSERT(&assembler, assembler.TaggedIsSmi(assembler.LoadObjectField(
- array, JSArray::kLengthOffset)));
- Node* len =
- assembler.LoadAndUntagObjectField(array, JSArray::kLengthOffset);
+ CSA_ASSERT(this,
+ TaggedIsSmi(LoadObjectField(array, JSArray::kLengthOffset)));
+ Node* len = LoadAndUntagObjectField(array, JSArray::kLengthOffset);
len_var.Bind(len);
- assembler.Branch(assembler.WordEqual(len_var.value(), intptr_zero),
- &return_not_found, &init_k);
+ Branch(WordEqual(len_var.value(), intptr_zero), &return_not_found, &init_k);
}
- assembler.Bind(&init_k);
+ Bind(&init_k);
{
- Label done(&assembler), init_k_smi(&assembler), init_k_heap_num(&assembler),
- init_k_zero(&assembler), init_k_n(&assembler);
- Node* tagged_n = assembler.ToInteger(context, start_from);
+ Label done(this), init_k_smi(this), init_k_heap_num(this),
+ init_k_zero(this), init_k_n(this);
+ Node* tagged_n = ToInteger(context, start_from);
- assembler.Branch(assembler.TaggedIsSmi(tagged_n), &init_k_smi,
- &init_k_heap_num);
+ Branch(TaggedIsSmi(tagged_n), &init_k_smi, &init_k_heap_num);
- assembler.Bind(&init_k_smi);
+ Bind(&init_k_smi);
{
- start_from_var.Bind(assembler.SmiUntag(tagged_n));
- assembler.Goto(&init_k_n);
+ start_from_var.Bind(SmiUntag(tagged_n));
+ Goto(&init_k_n);
}
- assembler.Bind(&init_k_heap_num);
+ Bind(&init_k_heap_num);
{
- Label do_return_not_found(&assembler);
+ Label do_return_not_found(this);
// This round is lossless for all valid lengths.
- Node* fp_len = assembler.RoundIntPtrToFloat64(len_var.value());
- Node* fp_n = assembler.LoadHeapNumberValue(tagged_n);
- assembler.GotoIf(assembler.Float64GreaterThanOrEqual(fp_n, fp_len),
- &do_return_not_found);
- start_from_var.Bind(assembler.ChangeInt32ToIntPtr(
- assembler.TruncateFloat64ToWord32(fp_n)));
- assembler.Goto(&init_k_n);
-
- assembler.Bind(&do_return_not_found);
+ Node* fp_len = RoundIntPtrToFloat64(len_var.value());
+ Node* fp_n = LoadHeapNumberValue(tagged_n);
+ GotoIf(Float64GreaterThanOrEqual(fp_n, fp_len), &do_return_not_found);
+ start_from_var.Bind(ChangeInt32ToIntPtr(TruncateFloat64ToWord32(fp_n)));
+ Goto(&init_k_n);
+
+ Bind(&do_return_not_found);
{
index_var.Bind(intptr_zero);
- assembler.Goto(&return_not_found);
+ Goto(&return_not_found);
}
}
- assembler.Bind(&init_k_n);
+ Bind(&init_k_n);
{
- Label if_positive(&assembler), if_negative(&assembler), done(&assembler);
- assembler.Branch(
- assembler.IntPtrLessThan(start_from_var.value(), intptr_zero),
- &if_negative, &if_positive);
+ Label if_positive(this), if_negative(this), done(this);
+ Branch(IntPtrLessThan(start_from_var.value(), intptr_zero), &if_negative,
+ &if_positive);
- assembler.Bind(&if_positive);
+ Bind(&if_positive);
{
index_var.Bind(start_from_var.value());
- assembler.Goto(&done);
+ Goto(&done);
}
- assembler.Bind(&if_negative);
+ Bind(&if_negative);
{
- index_var.Bind(
- assembler.IntPtrAdd(len_var.value(), start_from_var.value()));
- assembler.Branch(
- assembler.IntPtrLessThan(index_var.value(), intptr_zero),
- &init_k_zero, &done);
+ index_var.Bind(IntPtrAdd(len_var.value(), start_from_var.value()));
+ Branch(IntPtrLessThan(index_var.value(), intptr_zero), &init_k_zero,
+ &done);
}
- assembler.Bind(&init_k_zero);
+ Bind(&init_k_zero);
{
index_var.Bind(intptr_zero);
- assembler.Goto(&done);
+ Goto(&done);
}
- assembler.Bind(&done);
+ Bind(&done);
}
}
@@ -2087,357 +2046,291 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
FAST_HOLEY_ELEMENTS, FAST_DOUBLE_ELEMENTS, FAST_HOLEY_DOUBLE_ELEMENTS,
};
- Label if_smiorobjects(&assembler), if_packed_doubles(&assembler),
- if_holey_doubles(&assembler);
+ Label if_smiorobjects(this), if_packed_doubles(this), if_holey_doubles(this);
Label* element_kind_handlers[] = {&if_smiorobjects, &if_smiorobjects,
&if_smiorobjects, &if_smiorobjects,
&if_packed_doubles, &if_holey_doubles};
- Node* map = assembler.LoadMap(array);
- Node* elements_kind = assembler.LoadMapElementsKind(map);
- Node* elements = assembler.LoadElements(array);
- assembler.Switch(elements_kind, &return_not_found, kElementsKind,
- element_kind_handlers, arraysize(kElementsKind));
+ Node* map = LoadMap(array);
+ Node* elements_kind = LoadMapElementsKind(map);
+ Node* elements = LoadElements(array);
+ Switch(elements_kind, &return_not_found, kElementsKind, element_kind_handlers,
+ arraysize(kElementsKind));
- assembler.Bind(&if_smiorobjects);
+ Bind(&if_smiorobjects);
{
- Variable search_num(&assembler, MachineRepresentation::kFloat64);
- Label ident_loop(&assembler, &index_var),
- heap_num_loop(&assembler, &search_num),
- string_loop(&assembler, &index_var), undef_loop(&assembler, &index_var),
- not_smi(&assembler), not_heap_num(&assembler);
-
- assembler.GotoIfNot(assembler.TaggedIsSmi(search_element), &not_smi);
- search_num.Bind(assembler.SmiToFloat64(search_element));
- assembler.Goto(&heap_num_loop);
-
- assembler.Bind(&not_smi);
- assembler.GotoIf(assembler.WordEqual(search_element, undefined),
- &undef_loop);
- Node* map = assembler.LoadMap(search_element);
- assembler.GotoIfNot(assembler.IsHeapNumberMap(map), &not_heap_num);
- search_num.Bind(assembler.LoadHeapNumberValue(search_element));
- assembler.Goto(&heap_num_loop);
-
- assembler.Bind(&not_heap_num);
- Node* search_type = assembler.LoadMapInstanceType(map);
- assembler.GotoIf(assembler.IsStringInstanceType(search_type), &string_loop);
- assembler.Goto(&ident_loop);
-
- assembler.Bind(&ident_loop);
- {
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
- Node* element_k =
- assembler.LoadFixedArrayElement(elements, index_var.value());
- assembler.GotoIf(assembler.WordEqual(element_k, search_element),
- &return_found);
-
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&ident_loop);
- }
+ Variable search_num(this, MachineRepresentation::kFloat64);
+ Label ident_loop(this, &index_var), heap_num_loop(this, &search_num),
+ string_loop(this, &index_var), not_smi(this), not_heap_num(this);
- assembler.Bind(&undef_loop);
+ GotoIfNot(TaggedIsSmi(search_element), &not_smi);
+ search_num.Bind(SmiToFloat64(search_element));
+ Goto(&heap_num_loop);
+
+ Bind(&not_smi);
+ Node* map = LoadMap(search_element);
+ GotoIfNot(IsHeapNumberMap(map), &not_heap_num);
+ search_num.Bind(LoadHeapNumberValue(search_element));
+ Goto(&heap_num_loop);
+
+ Bind(&not_heap_num);
+ Node* search_type = LoadMapInstanceType(map);
+ GotoIf(IsStringInstanceType(search_type), &string_loop);
+ Goto(&ident_loop);
+
+ Bind(&ident_loop);
{
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
- Node* element_k =
- assembler.LoadFixedArrayElement(elements, index_var.value());
- assembler.GotoIf(assembler.WordEqual(element_k, undefined),
- &return_found);
-
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&undef_loop);
+ GotoIfNot(UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
+ Node* element_k = LoadFixedArrayElement(elements, index_var.value());
+ GotoIf(WordEqual(element_k, search_element), &return_found);
+
+ index_var.Bind(IntPtrAdd(index_var.value(), intptr_one));
+ Goto(&ident_loop);
}
- assembler.Bind(&heap_num_loop);
+ Bind(&heap_num_loop);
{
- Label not_nan_loop(&assembler, &index_var);
- assembler.BranchIfFloat64IsNaN(search_num.value(), &return_not_found,
- &not_nan_loop);
+ Label not_nan_loop(this, &index_var);
+ BranchIfFloat64IsNaN(search_num.value(), &return_not_found,
+ &not_nan_loop);
- assembler.Bind(&not_nan_loop);
+ Bind(&not_nan_loop);
{
- Label continue_loop(&assembler), not_smi(&assembler);
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
- Node* element_k =
- assembler.LoadFixedArrayElement(elements, index_var.value());
- assembler.GotoIfNot(assembler.TaggedIsSmi(element_k), &not_smi);
- assembler.Branch(
- assembler.Float64Equal(search_num.value(),
- assembler.SmiToFloat64(element_k)),
- &return_found, &continue_loop);
-
- assembler.Bind(&not_smi);
- assembler.GotoIfNot(
- assembler.IsHeapNumberMap(assembler.LoadMap(element_k)),
- &continue_loop);
- assembler.Branch(
- assembler.Float64Equal(search_num.value(),
- assembler.LoadHeapNumberValue(element_k)),
- &return_found, &continue_loop);
-
- assembler.Bind(&continue_loop);
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&not_nan_loop);
+ Label continue_loop(this), not_smi(this);
+ GotoIfNot(UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
+ Node* element_k = LoadFixedArrayElement(elements, index_var.value());
+ GotoIfNot(TaggedIsSmi(element_k), &not_smi);
+ Branch(Float64Equal(search_num.value(), SmiToFloat64(element_k)),
+ &return_found, &continue_loop);
+
+ Bind(&not_smi);
+ GotoIfNot(IsHeapNumber(element_k), &continue_loop);
+ Branch(Float64Equal(search_num.value(), LoadHeapNumberValue(element_k)),
+ &return_found, &continue_loop);
+
+ Bind(&continue_loop);
+ index_var.Bind(IntPtrAdd(index_var.value(), intptr_one));
+ Goto(&not_nan_loop);
}
}
- assembler.Bind(&string_loop);
+ Bind(&string_loop);
{
- Label continue_loop(&assembler);
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
- Node* element_k =
- assembler.LoadFixedArrayElement(elements, index_var.value());
- assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
- assembler.GotoIfNot(
- assembler.IsStringInstanceType(assembler.LoadInstanceType(element_k)),
- &continue_loop);
+ Label continue_loop(this);
+ GotoIfNot(UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
+ Node* element_k = LoadFixedArrayElement(elements, index_var.value());
+ GotoIf(TaggedIsSmi(element_k), &continue_loop);
+ GotoIfNot(IsString(element_k), &continue_loop);
// TODO(bmeurer): Consider inlining the StringEqual logic here.
- Callable callable = CodeFactory::StringEqual(assembler.isolate());
- Node* result =
- assembler.CallStub(callable, context, search_element, element_k);
- assembler.Branch(
- assembler.WordEqual(assembler.BooleanConstant(true), result),
- &return_found, &continue_loop);
-
- assembler.Bind(&continue_loop);
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&string_loop);
+ Callable callable = CodeFactory::StringEqual(isolate());
+ Node* result = CallStub(callable, context, search_element, element_k);
+ Branch(WordEqual(BooleanConstant(true), result), &return_found,
+ &continue_loop);
+
+ Bind(&continue_loop);
+ index_var.Bind(IntPtrAdd(index_var.value(), intptr_one));
+ Goto(&string_loop);
}
}
- assembler.Bind(&if_packed_doubles);
+ Bind(&if_packed_doubles);
{
- Label not_nan_loop(&assembler, &index_var), search_notnan(&assembler);
- Variable search_num(&assembler, MachineRepresentation::kFloat64);
+ Label not_nan_loop(this, &index_var), search_notnan(this);
+ Variable search_num(this, MachineRepresentation::kFloat64);
- assembler.GotoIfNot(assembler.TaggedIsSmi(search_element), &search_notnan);
- search_num.Bind(assembler.SmiToFloat64(search_element));
- assembler.Goto(&not_nan_loop);
+ GotoIfNot(TaggedIsSmi(search_element), &search_notnan);
+ search_num.Bind(SmiToFloat64(search_element));
+ Goto(&not_nan_loop);
- assembler.Bind(&search_notnan);
- assembler.GotoIfNot(
- assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
- &return_not_found);
+ Bind(&search_notnan);
+ GotoIfNot(IsHeapNumber(search_element), &return_not_found);
- search_num.Bind(assembler.LoadHeapNumberValue(search_element));
+ search_num.Bind(LoadHeapNumberValue(search_element));
- assembler.BranchIfFloat64IsNaN(search_num.value(), &return_not_found,
- &not_nan_loop);
+ BranchIfFloat64IsNaN(search_num.value(), &return_not_found, &not_nan_loop);
// Search for HeapNumber
- assembler.Bind(&not_nan_loop);
+ Bind(&not_nan_loop);
{
- Label continue_loop(&assembler);
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
- Node* element_k = assembler.LoadFixedDoubleArrayElement(
- elements, index_var.value(), MachineType::Float64());
- assembler.Branch(assembler.Float64Equal(element_k, search_num.value()),
- &return_found, &continue_loop);
- assembler.Bind(&continue_loop);
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&not_nan_loop);
+ GotoIfNot(UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
+ Node* element_k = LoadFixedDoubleArrayElement(elements, index_var.value(),
+ MachineType::Float64());
+ GotoIf(Float64Equal(element_k, search_num.value()), &return_found);
+
+ index_var.Bind(IntPtrAdd(index_var.value(), intptr_one));
+ Goto(&not_nan_loop);
}
}
- assembler.Bind(&if_holey_doubles);
+ Bind(&if_holey_doubles);
{
- Label not_nan_loop(&assembler, &index_var), search_notnan(&assembler);
- Variable search_num(&assembler, MachineRepresentation::kFloat64);
+ Label not_nan_loop(this, &index_var), search_notnan(this);
+ Variable search_num(this, MachineRepresentation::kFloat64);
- assembler.GotoIfNot(assembler.TaggedIsSmi(search_element), &search_notnan);
- search_num.Bind(assembler.SmiToFloat64(search_element));
- assembler.Goto(&not_nan_loop);
+ GotoIfNot(TaggedIsSmi(search_element), &search_notnan);
+ search_num.Bind(SmiToFloat64(search_element));
+ Goto(&not_nan_loop);
- assembler.Bind(&search_notnan);
- assembler.GotoIfNot(
- assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
- &return_not_found);
+ Bind(&search_notnan);
+ GotoIfNot(IsHeapNumber(search_element), &return_not_found);
- search_num.Bind(assembler.LoadHeapNumberValue(search_element));
+ search_num.Bind(LoadHeapNumberValue(search_element));
- assembler.BranchIfFloat64IsNaN(search_num.value(), &return_not_found,
- &not_nan_loop);
+ BranchIfFloat64IsNaN(search_num.value(), &return_not_found, &not_nan_loop);
// Search for HeapNumber
- assembler.Bind(&not_nan_loop);
+ Bind(&not_nan_loop);
{
- Label continue_loop(&assembler);
- assembler.GotoIfNot(
- assembler.UintPtrLessThan(index_var.value(), len_var.value()),
- &return_not_found);
+ Label continue_loop(this);
+ GotoIfNot(UintPtrLessThan(index_var.value(), len_var.value()),
+ &return_not_found);
// Load double value or continue if it contains a double hole.
- Node* element_k = assembler.LoadFixedDoubleArrayElement(
+ Node* element_k = LoadFixedDoubleArrayElement(
elements, index_var.value(), MachineType::Float64(), 0,
- CodeStubAssembler::INTPTR_PARAMETERS, &continue_loop);
+ INTPTR_PARAMETERS, &continue_loop);
- assembler.Branch(assembler.Float64Equal(element_k, search_num.value()),
- &return_found, &continue_loop);
- assembler.Bind(&continue_loop);
- index_var.Bind(assembler.IntPtrAdd(index_var.value(), intptr_one));
- assembler.Goto(&not_nan_loop);
+ Branch(Float64Equal(element_k, search_num.value()), &return_found,
+ &continue_loop);
+ Bind(&continue_loop);
+ index_var.Bind(IntPtrAdd(index_var.value(), intptr_one));
+ Goto(&not_nan_loop);
}
}
- assembler.Bind(&return_found);
- assembler.Return(assembler.SmiTag(index_var.value()));
+ Bind(&return_found);
+ Return(SmiTag(index_var.value()));
- assembler.Bind(&return_not_found);
- assembler.Return(assembler.NumberConstant(-1));
+ Bind(&return_not_found);
+ Return(NumberConstant(-1));
- assembler.Bind(&call_runtime);
- assembler.Return(assembler.CallRuntime(Runtime::kArrayIndexOf, context, array,
- search_element, start_from));
+ Bind(&call_runtime);
+ Return(CallRuntime(Runtime::kArrayIndexOf, context, array, search_element,
+ start_from));
}
-namespace {
-
-template <IterationKind kIterationKind>
-void Generate_ArrayPrototypeIterationMethod(
- compiler::CodeAssemblerState* state) {
- typedef compiler::Node Node;
- typedef CodeStubAssembler::Label Label;
- typedef CodeStubAssembler::Variable Variable;
- CodeStubAssembler assembler(state);
+class ArrayPrototypeIterationAssembler : public CodeStubAssembler {
+ public:
+ explicit ArrayPrototypeIterationAssembler(compiler::CodeAssemblerState* state)
+ : CodeStubAssembler(state) {}
- Node* receiver = assembler.Parameter(0);
- Node* context = assembler.Parameter(3);
+ protected:
+ void Generate_ArrayPrototypeIterationMethod(IterationKind iteration_kind) {
+ Node* receiver = Parameter(0);
+ Node* context = Parameter(3);
- Variable var_array(&assembler, MachineRepresentation::kTagged);
- Variable var_map(&assembler, MachineRepresentation::kTagged);
- Variable var_type(&assembler, MachineRepresentation::kWord32);
+ Variable var_array(this, MachineRepresentation::kTagged);
+ Variable var_map(this, MachineRepresentation::kTagged);
+ Variable var_type(this, MachineRepresentation::kWord32);
- Label if_isnotobject(&assembler, Label::kDeferred);
- Label create_array_iterator(&assembler);
+ Label if_isnotobject(this, Label::kDeferred);
+ Label create_array_iterator(this);
- assembler.GotoIf(assembler.TaggedIsSmi(receiver), &if_isnotobject);
- var_array.Bind(receiver);
- var_map.Bind(assembler.LoadMap(receiver));
- var_type.Bind(assembler.LoadMapInstanceType(var_map.value()));
- assembler.Branch(assembler.IsJSReceiverInstanceType(var_type.value()),
- &create_array_iterator, &if_isnotobject);
+ GotoIf(TaggedIsSmi(receiver), &if_isnotobject);
+ var_array.Bind(receiver);
+ var_map.Bind(LoadMap(receiver));
+ var_type.Bind(LoadMapInstanceType(var_map.value()));
+ Branch(IsJSReceiverInstanceType(var_type.value()), &create_array_iterator,
+ &if_isnotobject);
- assembler.Bind(&if_isnotobject);
- {
- Callable callable = CodeFactory::ToObject(assembler.isolate());
- Node* result = assembler.CallStub(callable, context, receiver);
- var_array.Bind(result);
- var_map.Bind(assembler.LoadMap(result));
- var_type.Bind(assembler.LoadMapInstanceType(var_map.value()));
- assembler.Goto(&create_array_iterator);
- }
-
- assembler.Bind(&create_array_iterator);
- assembler.Return(
- assembler.CreateArrayIterator(var_array.value(), var_map.value(),
- var_type.value(), context, kIterationKind));
-}
+ Bind(&if_isnotobject);
+ {
+ Callable callable = CodeFactory::ToObject(isolate());
+ Node* result = CallStub(callable, context, receiver);
+ var_array.Bind(result);
+ var_map.Bind(LoadMap(result));
+ var_type.Bind(LoadMapInstanceType(var_map.value()));
+ Goto(&create_array_iterator);
+ }
-} // namespace
+ Bind(&create_array_iterator);
+ Return(CreateArrayIterator(var_array.value(), var_map.value(),
+ var_type.value(), context, iteration_kind));
+ }
+};
-void Builtins::Generate_ArrayPrototypeValues(
- compiler::CodeAssemblerState* state) {
- Generate_ArrayPrototypeIterationMethod<IterationKind::kValues>(state);
+TF_BUILTIN(ArrayPrototypeValues, ArrayPrototypeIterationAssembler) {
+ Generate_ArrayPrototypeIterationMethod(IterationKind::kValues);
}
-void Builtins::Generate_ArrayPrototypeEntries(
- compiler::CodeAssemblerState* state) {
- Generate_ArrayPrototypeIterationMethod<IterationKind::kEntries>(state);
+TF_BUILTIN(ArrayPrototypeEntries, ArrayPrototypeIterationAssembler) {
+ Generate_ArrayPrototypeIterationMethod(IterationKind::kEntries);
}
-void Builtins::Generate_ArrayPrototypeKeys(
- compiler::CodeAssemblerState* state) {
- Generate_ArrayPrototypeIterationMethod<IterationKind::kKeys>(state);
+TF_BUILTIN(ArrayPrototypeKeys, ArrayPrototypeIterationAssembler) {
+ Generate_ArrayPrototypeIterationMethod(IterationKind::kKeys);
}
-void Builtins::Generate_ArrayIteratorPrototypeNext(
- compiler::CodeAssemblerState* state) {
- typedef compiler::Node Node;
- typedef CodeStubAssembler::Label Label;
- typedef CodeStubAssembler::Variable Variable;
- CodeStubAssembler assembler(state);
-
- Handle<String> operation = assembler.factory()->NewStringFromAsciiChecked(
+TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
+ Handle<String> operation = factory()->NewStringFromAsciiChecked(
"Array Iterator.prototype.next", TENURED);
- Node* iterator = assembler.Parameter(0);
- Node* context = assembler.Parameter(3);
+ Node* iterator = Parameter(0);
+ Node* context = Parameter(3);
- Variable var_value(&assembler, MachineRepresentation::kTagged);
- Variable var_done(&assembler, MachineRepresentation::kTagged);
+ Variable var_value(this, MachineRepresentation::kTagged);
+ Variable var_done(this, MachineRepresentation::kTagged);
// Required, or else `throw_bad_receiver` fails a DCHECK due to these
// variables not being bound along all paths, despite not being used.
- var_done.Bind(assembler.TrueConstant());
- var_value.Bind(assembler.UndefinedConstant());
+ var_done.Bind(TrueConstant());
+ var_value.Bind(UndefinedConstant());
- Label throw_bad_receiver(&assembler, Label::kDeferred);
- Label set_done(&assembler);
- Label allocate_key_result(&assembler);
- Label allocate_entry_if_needed(&assembler);
- Label allocate_iterator_result(&assembler);
- Label generic_values(&assembler);
+ Label throw_bad_receiver(this, Label::kDeferred);
+ Label set_done(this);
+ Label allocate_key_result(this);
+ Label allocate_entry_if_needed(this);
+ Label allocate_iterator_result(this);
+ Label generic_values(this);
// If O does not have all of the internal slots of an Array Iterator Instance
// (22.1.5.3), throw a TypeError exception
- assembler.GotoIf(assembler.TaggedIsSmi(iterator), &throw_bad_receiver);
- Node* instance_type = assembler.LoadInstanceType(iterator);
- assembler.GotoIf(
- assembler.Uint32LessThan(
- assembler.Int32Constant(LAST_ARRAY_ITERATOR_TYPE -
- FIRST_ARRAY_ITERATOR_TYPE),
- assembler.Int32Sub(instance_type, assembler.Int32Constant(
- FIRST_ARRAY_ITERATOR_TYPE))),
+ GotoIf(TaggedIsSmi(iterator), &throw_bad_receiver);
+ Node* instance_type = LoadInstanceType(iterator);
+ GotoIf(
+ Uint32LessThan(
+ Int32Constant(LAST_ARRAY_ITERATOR_TYPE - FIRST_ARRAY_ITERATOR_TYPE),
+ Int32Sub(instance_type, Int32Constant(FIRST_ARRAY_ITERATOR_TYPE))),
&throw_bad_receiver);
// Let a be O.[[IteratedObject]].
- Node* array = assembler.LoadObjectField(
- iterator, JSArrayIterator::kIteratedObjectOffset);
+ Node* array =
+ LoadObjectField(iterator, JSArrayIterator::kIteratedObjectOffset);
// Let index be O.[[ArrayIteratorNextIndex]].
- Node* index =
- assembler.LoadObjectField(iterator, JSArrayIterator::kNextIndexOffset);
- Node* orig_map = assembler.LoadObjectField(
- iterator, JSArrayIterator::kIteratedObjectMapOffset);
- Node* array_map = assembler.LoadMap(array);
+ Node* index = LoadObjectField(iterator, JSArrayIterator::kNextIndexOffset);
+ Node* orig_map =
+ LoadObjectField(iterator, JSArrayIterator::kIteratedObjectMapOffset);
+ Node* array_map = LoadMap(array);
- Label if_isfastarray(&assembler), if_isnotfastarray(&assembler),
- if_isdetached(&assembler, Label::kDeferred);
+ Label if_isfastarray(this), if_isnotfastarray(this),
+ if_isdetached(this, Label::kDeferred);
- assembler.Branch(assembler.WordEqual(orig_map, array_map), &if_isfastarray,
- &if_isnotfastarray);
+ Branch(WordEqual(orig_map, array_map), &if_isfastarray, &if_isnotfastarray);
- assembler.Bind(&if_isfastarray);
+ Bind(&if_isfastarray);
{
- CSA_ASSERT(&assembler,
- assembler.Word32Equal(assembler.LoadMapInstanceType(array_map),
- assembler.Int32Constant(JS_ARRAY_TYPE)));
+ CSA_ASSERT(this, Word32Equal(LoadMapInstanceType(array_map),
+ Int32Constant(JS_ARRAY_TYPE)));
- Node* length = assembler.LoadObjectField(array, JSArray::kLengthOffset);
+ Node* length = LoadObjectField(array, JSArray::kLengthOffset);
- CSA_ASSERT(&assembler, assembler.TaggedIsSmi(length));
- CSA_ASSERT(&assembler, assembler.TaggedIsSmi(index));
+ CSA_ASSERT(this, TaggedIsSmi(length));
+ CSA_ASSERT(this, TaggedIsSmi(index));
- assembler.GotoIfNot(assembler.SmiBelow(index, length), &set_done);
+ GotoIfNot(SmiBelow(index, length), &set_done);
- Node* one = assembler.SmiConstant(Smi::FromInt(1));
- assembler.StoreObjectFieldNoWriteBarrier(iterator,
- JSArrayIterator::kNextIndexOffset,
- assembler.SmiAdd(index, one));
+ Node* one = SmiConstant(Smi::FromInt(1));
+ StoreObjectFieldNoWriteBarrier(iterator, JSArrayIterator::kNextIndexOffset,
+ SmiAdd(index, one));
- var_done.Bind(assembler.FalseConstant());
- Node* elements = assembler.LoadElements(array);
+ var_done.Bind(FalseConstant());
+ Node* elements = LoadElements(array);
static int32_t kInstanceType[] = {
JS_FAST_ARRAY_KEY_ITERATOR_TYPE,
@@ -2455,8 +2348,8 @@ void Builtins::Generate_ArrayIteratorPrototypeNext(
JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE,
};
- Label packed_object_values(&assembler), holey_object_values(&assembler),
- packed_double_values(&assembler), holey_double_values(&assembler);
+ Label packed_object_values(this), holey_object_values(this),
+ packed_double_values(this), holey_double_values(this);
Label* kInstanceTypeHandlers[] = {
&allocate_key_result, &packed_object_values, &holey_object_values,
&packed_object_values, &holey_object_values, &packed_double_values,
@@ -2464,192 +2357,164 @@ void Builtins::Generate_ArrayIteratorPrototypeNext(
&packed_object_values, &holey_object_values, &packed_double_values,
&holey_double_values};
- assembler.Switch(instance_type, &throw_bad_receiver, kInstanceType,
- kInstanceTypeHandlers, arraysize(kInstanceType));
+ Switch(instance_type, &throw_bad_receiver, kInstanceType,
+ kInstanceTypeHandlers, arraysize(kInstanceType));
- assembler.Bind(&packed_object_values);
+ Bind(&packed_object_values);
{
- var_value.Bind(assembler.LoadFixedArrayElement(
- elements, index, 0, CodeStubAssembler::SMI_PARAMETERS));
- assembler.Goto(&allocate_entry_if_needed);
+ var_value.Bind(LoadFixedArrayElement(elements, index, 0, SMI_PARAMETERS));
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&packed_double_values);
+ Bind(&packed_double_values);
{
- Node* value = assembler.LoadFixedDoubleArrayElement(
- elements, index, MachineType::Float64(), 0,
- CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.AllocateHeapNumberWithValue(value));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value = LoadFixedDoubleArrayElement(
+ elements, index, MachineType::Float64(), 0, SMI_PARAMETERS);
+ var_value.Bind(AllocateHeapNumberWithValue(value));
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&holey_object_values);
+ Bind(&holey_object_values);
{
// Check the array_protector cell, and take the slow path if it's invalid.
- Node* invalid =
- assembler.SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
- Node* cell = assembler.LoadRoot(Heap::kArrayProtectorRootIndex);
- Node* cell_value =
- assembler.LoadObjectField(cell, PropertyCell::kValueOffset);
- assembler.GotoIf(assembler.WordEqual(cell_value, invalid),
- &generic_values);
-
- var_value.Bind(assembler.UndefinedConstant());
- Node* value = assembler.LoadFixedArrayElement(
- elements, index, 0, CodeStubAssembler::SMI_PARAMETERS);
- assembler.GotoIf(assembler.WordEqual(value, assembler.TheHoleConstant()),
- &allocate_entry_if_needed);
+ Node* invalid = SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
+ Node* cell = LoadRoot(Heap::kArrayProtectorRootIndex);
+ Node* cell_value = LoadObjectField(cell, PropertyCell::kValueOffset);
+ GotoIf(WordEqual(cell_value, invalid), &generic_values);
+
+ var_value.Bind(UndefinedConstant());
+ Node* value = LoadFixedArrayElement(elements, index, 0, SMI_PARAMETERS);
+ GotoIf(WordEqual(value, TheHoleConstant()), &allocate_entry_if_needed);
var_value.Bind(value);
- assembler.Goto(&allocate_entry_if_needed);
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&holey_double_values);
+ Bind(&holey_double_values);
{
// Check the array_protector cell, and take the slow path if it's invalid.
- Node* invalid =
- assembler.SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
- Node* cell = assembler.LoadRoot(Heap::kArrayProtectorRootIndex);
- Node* cell_value =
- assembler.LoadObjectField(cell, PropertyCell::kValueOffset);
- assembler.GotoIf(assembler.WordEqual(cell_value, invalid),
- &generic_values);
-
- var_value.Bind(assembler.UndefinedConstant());
- Node* value = assembler.LoadFixedDoubleArrayElement(
- elements, index, MachineType::Float64(), 0,
- CodeStubAssembler::SMI_PARAMETERS, &allocate_entry_if_needed);
- var_value.Bind(assembler.AllocateHeapNumberWithValue(value));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* invalid = SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
+ Node* cell = LoadRoot(Heap::kArrayProtectorRootIndex);
+ Node* cell_value = LoadObjectField(cell, PropertyCell::kValueOffset);
+ GotoIf(WordEqual(cell_value, invalid), &generic_values);
+
+ var_value.Bind(UndefinedConstant());
+ Node* value = LoadFixedDoubleArrayElement(
+ elements, index, MachineType::Float64(), 0, SMI_PARAMETERS,
+ &allocate_entry_if_needed);
+ var_value.Bind(AllocateHeapNumberWithValue(value));
+ Goto(&allocate_entry_if_needed);
}
}
- assembler.Bind(&if_isnotfastarray);
+ Bind(&if_isnotfastarray);
{
- Label if_istypedarray(&assembler), if_isgeneric(&assembler);
+ Label if_istypedarray(this), if_isgeneric(this);
// If a is undefined, return CreateIterResultObject(undefined, true)
- assembler.GotoIf(assembler.WordEqual(array, assembler.UndefinedConstant()),
- &allocate_iterator_result);
+ GotoIf(WordEqual(array, UndefinedConstant()), &allocate_iterator_result);
- Node* array_type = assembler.LoadInstanceType(array);
- assembler.Branch(
- assembler.Word32Equal(array_type,
- assembler.Int32Constant(JS_TYPED_ARRAY_TYPE)),
- &if_istypedarray, &if_isgeneric);
+ Node* array_type = LoadInstanceType(array);
+ Branch(Word32Equal(array_type, Int32Constant(JS_TYPED_ARRAY_TYPE)),
+ &if_istypedarray, &if_isgeneric);
- assembler.Bind(&if_isgeneric);
+ Bind(&if_isgeneric);
{
- Label if_wasfastarray(&assembler);
+ Label if_wasfastarray(this);
Node* length = nullptr;
{
- Variable var_length(&assembler, MachineRepresentation::kTagged);
- Label if_isarray(&assembler), if_isnotarray(&assembler),
- done(&assembler);
- assembler.Branch(
- assembler.Word32Equal(array_type,
- assembler.Int32Constant(JS_ARRAY_TYPE)),
- &if_isarray, &if_isnotarray);
-
- assembler.Bind(&if_isarray);
+ Variable var_length(this, MachineRepresentation::kTagged);
+ Label if_isarray(this), if_isnotarray(this), done(this);
+ Branch(Word32Equal(array_type, Int32Constant(JS_ARRAY_TYPE)),
+ &if_isarray, &if_isnotarray);
+
+ Bind(&if_isarray);
{
- var_length.Bind(
- assembler.LoadObjectField(array, JSArray::kLengthOffset));
+ var_length.Bind(LoadObjectField(array, JSArray::kLengthOffset));
// Invalidate protector cell if needed
- assembler.Branch(
- assembler.WordNotEqual(orig_map, assembler.UndefinedConstant()),
- &if_wasfastarray, &done);
+ Branch(WordNotEqual(orig_map, UndefinedConstant()), &if_wasfastarray,
+ &done);
- assembler.Bind(&if_wasfastarray);
+ Bind(&if_wasfastarray);
{
- Label if_invalid(&assembler, Label::kDeferred);
+ Label if_invalid(this, Label::kDeferred);
// A fast array iterator transitioned to a slow iterator during
// iteration. Invalidate fast_array_iteration_prtoector cell to
// prevent potential deopt loops.
- assembler.StoreObjectFieldNoWriteBarrier(
+ StoreObjectFieldNoWriteBarrier(
iterator, JSArrayIterator::kIteratedObjectMapOffset,
- assembler.UndefinedConstant());
- assembler.GotoIf(
- assembler.Uint32LessThanOrEqual(
- instance_type, assembler.Int32Constant(
- JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE)),
- &done);
+ UndefinedConstant());
+ GotoIf(Uint32LessThanOrEqual(
+ instance_type,
+ Int32Constant(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE)),
+ &done);
Node* invalid =
- assembler.SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
- Node* cell =
- assembler.LoadRoot(Heap::kFastArrayIterationProtectorRootIndex);
- assembler.StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset,
- invalid);
- assembler.Goto(&done);
+ SmiConstant(Smi::FromInt(Isolate::kProtectorInvalid));
+ Node* cell = LoadRoot(Heap::kFastArrayIterationProtectorRootIndex);
+ StoreObjectFieldNoWriteBarrier(cell, Cell::kValueOffset, invalid);
+ Goto(&done);
}
}
- assembler.Bind(&if_isnotarray);
+ Bind(&if_isnotarray);
{
- Node* length_string = assembler.HeapConstant(
- assembler.isolate()->factory()->length_string());
- Callable get_property = CodeFactory::GetProperty(assembler.isolate());
- Node* length =
- assembler.CallStub(get_property, context, array, length_string);
- Callable to_length = CodeFactory::ToLength(assembler.isolate());
- var_length.Bind(assembler.CallStub(to_length, context, length));
- assembler.Goto(&done);
+ Node* length_string = HeapConstant(factory()->length_string());
+ Callable get_property = CodeFactory::GetProperty(isolate());
+ Node* length = CallStub(get_property, context, array, length_string);
+ Callable to_length = CodeFactory::ToLength(isolate());
+ var_length.Bind(CallStub(to_length, context, length));
+ Goto(&done);
}
- assembler.Bind(&done);
+ Bind(&done);
length = var_length.value();
}
- assembler.GotoUnlessNumberLessThan(index, length, &set_done);
+ GotoUnlessNumberLessThan(index, length, &set_done);
- assembler.StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset,
- assembler.NumberInc(index));
- var_done.Bind(assembler.FalseConstant());
+ StoreObjectField(iterator, JSArrayIterator::kNextIndexOffset,
+ NumberInc(index));
+ var_done.Bind(FalseConstant());
- assembler.Branch(
- assembler.Uint32LessThanOrEqual(
- instance_type,
- assembler.Int32Constant(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE)),
+ Branch(
+ Uint32LessThanOrEqual(
+ instance_type, Int32Constant(JS_GENERIC_ARRAY_KEY_ITERATOR_TYPE)),
&allocate_key_result, &generic_values);
- assembler.Bind(&generic_values);
+ Bind(&generic_values);
{
- Callable get_property = CodeFactory::GetProperty(assembler.isolate());
- var_value.Bind(assembler.CallStub(get_property, context, array, index));
- assembler.Goto(&allocate_entry_if_needed);
+ Callable get_property = CodeFactory::GetProperty(isolate());
+ var_value.Bind(CallStub(get_property, context, array, index));
+ Goto(&allocate_entry_if_needed);
}
}
- assembler.Bind(&if_istypedarray);
+ Bind(&if_istypedarray);
{
- Node* buffer =
- assembler.LoadObjectField(array, JSTypedArray::kBufferOffset);
- assembler.GotoIf(assembler.IsDetachedBuffer(buffer), &if_isdetached);
+ Node* buffer = LoadObjectField(array, JSTypedArray::kBufferOffset);
+ GotoIf(IsDetachedBuffer(buffer), &if_isdetached);
- Node* length =
- assembler.LoadObjectField(array, JSTypedArray::kLengthOffset);
+ Node* length = LoadObjectField(array, JSTypedArray::kLengthOffset);
- CSA_ASSERT(&assembler, assembler.TaggedIsSmi(length));
- CSA_ASSERT(&assembler, assembler.TaggedIsSmi(index));
+ CSA_ASSERT(this, TaggedIsSmi(length));
+ CSA_ASSERT(this, TaggedIsSmi(index));
- assembler.GotoIfNot(assembler.SmiBelow(index, length), &set_done);
+ GotoIfNot(SmiBelow(index, length), &set_done);
- Node* one = assembler.SmiConstant(1);
- assembler.StoreObjectFieldNoWriteBarrier(
- iterator, JSArrayIterator::kNextIndexOffset,
- assembler.SmiAdd(index, one));
- var_done.Bind(assembler.FalseConstant());
+ Node* one = SmiConstant(1);
+ StoreObjectFieldNoWriteBarrier(
+ iterator, JSArrayIterator::kNextIndexOffset, SmiAdd(index, one));
+ var_done.Bind(FalseConstant());
- Node* elements = assembler.LoadElements(array);
- Node* base_ptr = assembler.LoadObjectField(
- elements, FixedTypedArrayBase::kBasePointerOffset);
- Node* external_ptr = assembler.LoadObjectField(
- elements, FixedTypedArrayBase::kExternalPointerOffset,
- MachineType::Pointer());
- Node* data_ptr = assembler.IntPtrAdd(
- assembler.BitcastTaggedToWord(base_ptr), external_ptr);
+ Node* elements = LoadElements(array);
+ Node* base_ptr =
+ LoadObjectField(elements, FixedTypedArrayBase::kBasePointerOffset);
+ Node* external_ptr =
+ LoadObjectField(elements, FixedTypedArrayBase::kExternalPointerOffset,
+ MachineType::Pointer());
+ Node* data_ptr = IntPtrAdd(BitcastTaggedToWord(base_ptr), external_ptr);
static int32_t kInstanceType[] = {
JS_TYPED_ARRAY_KEY_ITERATOR_TYPE,
@@ -2673,10 +2538,9 @@ void Builtins::Generate_ArrayIteratorPrototypeNext(
JS_FLOAT64_ARRAY_VALUE_ITERATOR_TYPE,
};
- Label uint8_values(&assembler), int8_values(&assembler),
- uint16_values(&assembler), int16_values(&assembler),
- uint32_values(&assembler), int32_values(&assembler),
- float32_values(&assembler), float64_values(&assembler);
+ Label uint8_values(this), int8_values(this), uint16_values(this),
+ int16_values(this), uint32_values(this), int32_values(this),
+ float32_values(this), float64_values(this);
Label* kInstanceTypeHandlers[] = {
&allocate_key_result, &uint8_values, &uint8_values,
&int8_values, &uint16_values, &int16_values,
@@ -2687,156 +2551,140 @@ void Builtins::Generate_ArrayIteratorPrototypeNext(
&float64_values,
};
- var_done.Bind(assembler.FalseConstant());
- assembler.Switch(instance_type, &throw_bad_receiver, kInstanceType,
- kInstanceTypeHandlers, arraysize(kInstanceType));
+ var_done.Bind(FalseConstant());
+ Switch(instance_type, &throw_bad_receiver, kInstanceType,
+ kInstanceTypeHandlers, arraysize(kInstanceType));
- assembler.Bind(&uint8_values);
+ Bind(&uint8_values);
{
- Node* value_uint8 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, UINT8_ELEMENTS, CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.SmiFromWord32(value_uint8));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_uint8 = LoadFixedTypedArrayElement(
+ data_ptr, index, UINT8_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(SmiFromWord32(value_uint8));
+ Goto(&allocate_entry_if_needed);
}
-
- assembler.Bind(&int8_values);
+ Bind(&int8_values);
{
- Node* value_int8 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, INT8_ELEMENTS, CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.SmiFromWord32(value_int8));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_int8 = LoadFixedTypedArrayElement(
+ data_ptr, index, INT8_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(SmiFromWord32(value_int8));
+ Goto(&allocate_entry_if_needed);
}
-
- assembler.Bind(&uint16_values);
+ Bind(&uint16_values);
{
- Node* value_uint16 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, UINT16_ELEMENTS,
- CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.SmiFromWord32(value_uint16));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_uint16 = LoadFixedTypedArrayElement(
+ data_ptr, index, UINT16_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(SmiFromWord32(value_uint16));
+ Goto(&allocate_entry_if_needed);
}
-
- assembler.Bind(&int16_values);
+ Bind(&int16_values);
{
- Node* value_int16 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, INT16_ELEMENTS, CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.SmiFromWord32(value_int16));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_int16 = LoadFixedTypedArrayElement(
+ data_ptr, index, INT16_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(SmiFromWord32(value_int16));
+ Goto(&allocate_entry_if_needed);
}
-
- assembler.Bind(&uint32_values);
+ Bind(&uint32_values);
{
- Node* value_uint32 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, UINT32_ELEMENTS,
- CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.ChangeUint32ToTagged(value_uint32));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_uint32 = LoadFixedTypedArrayElement(
+ data_ptr, index, UINT32_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(ChangeUint32ToTagged(value_uint32));
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&int32_values);
+ Bind(&int32_values);
{
- Node* value_int32 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, INT32_ELEMENTS, CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.ChangeInt32ToTagged(value_int32));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_int32 = LoadFixedTypedArrayElement(
+ data_ptr, index, INT32_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(ChangeInt32ToTagged(value_int32));
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&float32_values);
+ Bind(&float32_values);
{
- Node* value_float32 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, FLOAT32_ELEMENTS,
- CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.AllocateHeapNumberWithValue(
- assembler.ChangeFloat32ToFloat64(value_float32)));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_float32 = LoadFixedTypedArrayElement(
+ data_ptr, index, FLOAT32_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(
+ AllocateHeapNumberWithValue(ChangeFloat32ToFloat64(value_float32)));
+ Goto(&allocate_entry_if_needed);
}
- assembler.Bind(&float64_values);
+ Bind(&float64_values);
{
- Node* value_float64 = assembler.LoadFixedTypedArrayElement(
- data_ptr, index, FLOAT64_ELEMENTS,
- CodeStubAssembler::SMI_PARAMETERS);
- var_value.Bind(assembler.AllocateHeapNumberWithValue(value_float64));
- assembler.Goto(&allocate_entry_if_needed);
+ Node* value_float64 = LoadFixedTypedArrayElement(
+ data_ptr, index, FLOAT64_ELEMENTS, SMI_PARAMETERS);
+ var_value.Bind(AllocateHeapNumberWithValue(value_float64));
+ Goto(&allocate_entry_if_needed);
}
}
}
- assembler.Bind(&set_done);
+ Bind(&set_done);
{
- assembler.StoreObjectFieldNoWriteBarrier(
- iterator, JSArrayIterator::kIteratedObjectOffset,
- assembler.UndefinedConstant());
- assembler.Goto(&allocate_iterator_result);
+ StoreObjectFieldNoWriteBarrier(
+ iterator, JSArrayIterator::kIteratedObjectOffset, UndefinedConstant());
+ Goto(&allocate_iterator_result);
}
- assembler.Bind(&allocate_key_result);
+ Bind(&allocate_key_result);
{
var_value.Bind(index);
- var_done.Bind(assembler.FalseConstant());
- assembler.Goto(&allocate_iterator_result);
+ var_done.Bind(FalseConstant());
+ Goto(&allocate_iterator_result);
}
- assembler.Bind(&allocate_entry_if_needed);
+ Bind(&allocate_entry_if_needed);
{
- assembler.GotoIf(
- assembler.Int32GreaterThan(
- instance_type,
- assembler.Int32Constant(LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE)),
- &allocate_iterator_result);
-
- Node* elements = assembler.AllocateFixedArray(FAST_ELEMENTS,
- assembler.IntPtrConstant(2));
- assembler.StoreFixedArrayElement(elements, 0, index, SKIP_WRITE_BARRIER);
- assembler.StoreFixedArrayElement(elements, 1, var_value.value(),
- SKIP_WRITE_BARRIER);
-
- Node* entry = assembler.Allocate(JSArray::kSize);
- Node* map =
- assembler.LoadContextElement(assembler.LoadNativeContext(context),
- Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX);
-
- assembler.StoreMapNoWriteBarrier(entry, map);
- assembler.StoreObjectFieldRoot(entry, JSArray::kPropertiesOffset,
- Heap::kEmptyFixedArrayRootIndex);
- assembler.StoreObjectFieldNoWriteBarrier(entry, JSArray::kElementsOffset,
- elements);
- assembler.StoreObjectFieldNoWriteBarrier(
- entry, JSArray::kLengthOffset, assembler.SmiConstant(Smi::FromInt(2)));
+ GotoIf(Int32GreaterThan(instance_type,
+ Int32Constant(LAST_ARRAY_KEY_VALUE_ITERATOR_TYPE)),
+ &allocate_iterator_result);
+
+ Node* elements = AllocateFixedArray(FAST_ELEMENTS, IntPtrConstant(2));
+ StoreFixedArrayElement(elements, 0, index, SKIP_WRITE_BARRIER);
+ StoreFixedArrayElement(elements, 1, var_value.value(), SKIP_WRITE_BARRIER);
+
+ Node* entry = Allocate(JSArray::kSize);
+ Node* map = LoadContextElement(LoadNativeContext(context),
+ Context::JS_ARRAY_FAST_ELEMENTS_MAP_INDEX);
+
+ StoreMapNoWriteBarrier(entry, map);
+ StoreObjectFieldRoot(entry, JSArray::kPropertiesOffset,
+ Heap::kEmptyFixedArrayRootIndex);
+ StoreObjectFieldNoWriteBarrier(entry, JSArray::kElementsOffset, elements);
+ StoreObjectFieldNoWriteBarrier(entry, JSArray::kLengthOffset,
+ SmiConstant(Smi::FromInt(2)));
var_value.Bind(entry);
- assembler.Goto(&allocate_iterator_result);
+ Goto(&allocate_iterator_result);
}
- assembler.Bind(&allocate_iterator_result);
+ Bind(&allocate_iterator_result);
{
- Node* result = assembler.Allocate(JSIteratorResult::kSize);
- Node* map =
- assembler.LoadContextElement(assembler.LoadNativeContext(context),
- Context::ITERATOR_RESULT_MAP_INDEX);
- assembler.StoreMapNoWriteBarrier(result, map);
- assembler.StoreObjectFieldRoot(result, JSIteratorResult::kPropertiesOffset,
- Heap::kEmptyFixedArrayRootIndex);
- assembler.StoreObjectFieldRoot(result, JSIteratorResult::kElementsOffset,
- Heap::kEmptyFixedArrayRootIndex);
- assembler.StoreObjectFieldNoWriteBarrier(
- result, JSIteratorResult::kValueOffset, var_value.value());
- assembler.StoreObjectFieldNoWriteBarrier(
- result, JSIteratorResult::kDoneOffset, var_done.value());
- assembler.Return(result);
- }
-
- assembler.Bind(&throw_bad_receiver);
+ Node* result = Allocate(JSIteratorResult::kSize);
+ Node* map = LoadContextElement(LoadNativeContext(context),
+ Context::ITERATOR_RESULT_MAP_INDEX);
+ StoreMapNoWriteBarrier(result, map);
+ StoreObjectFieldRoot(result, JSIteratorResult::kPropertiesOffset,
+ Heap::kEmptyFixedArrayRootIndex);
+ StoreObjectFieldRoot(result, JSIteratorResult::kElementsOffset,
+ Heap::kEmptyFixedArrayRootIndex);
+ StoreObjectFieldNoWriteBarrier(result, JSIteratorResult::kValueOffset,
+ var_value.value());
+ StoreObjectFieldNoWriteBarrier(result, JSIteratorResult::kDoneOffset,
+ var_done.value());
+ Return(result);
+ }
+
+ Bind(&throw_bad_receiver);
{
// The {receiver} is not a valid JSArrayIterator.
- assembler.CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context,
- assembler.HeapConstant(operation), iterator);
- assembler.Unreachable();
+ CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context,
+ HeapConstant(operation), iterator);
+ Unreachable();
}
- assembler.Bind(&if_isdetached);
+ Bind(&if_isdetached);
{
- Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation);
- assembler.CallRuntime(Runtime::kThrowTypeError, context, message,
- assembler.HeapConstant(operation));
- assembler.Unreachable();
+ Node* message = SmiConstant(MessageTemplate::kDetachedOperation);
+ CallRuntime(Runtime::kThrowTypeError, context, message,
+ HeapConstant(operation));
+ Unreachable();
}
}
« no previous file with comments | « no previous file | src/builtins/builtins-conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698