OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/builtins/builtins-utils-gen.h" | 5 #include "src/builtins/builtins-utils-gen.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 Node* SomeResultGenerator() { return FalseConstant(); } | 41 Node* SomeResultGenerator() { return FalseConstant(); } |
42 | 42 |
43 Node* SomeProcessor(Node* k_value, Node* k) { | 43 Node* SomeProcessor(Node* k_value, Node* k) { |
44 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 44 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
45 this_arg(), k_value, k, o()); | 45 this_arg(), k_value, k, o()); |
46 Label false_continue(this), return_true(this); | 46 Label false_continue(this), return_true(this); |
47 BranchIfToBooleanIsTrue(value, &return_true, &false_continue); | 47 BranchIfToBooleanIsTrue(value, &return_true, &false_continue); |
48 BIND(&return_true); | 48 BIND(&return_true); |
49 ReturnFromBuiltin(TrueConstant()); | 49 Return(TrueConstant()); |
50 BIND(&false_continue); | 50 BIND(&false_continue); |
51 return a(); | 51 return a(); |
52 } | 52 } |
53 | 53 |
54 Node* EveryResultGenerator() { return TrueConstant(); } | 54 Node* EveryResultGenerator() { return TrueConstant(); } |
55 | 55 |
56 Node* EveryProcessor(Node* k_value, Node* k) { | 56 Node* EveryProcessor(Node* k_value, Node* k) { |
57 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 57 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
58 this_arg(), k_value, k, o()); | 58 this_arg(), k_value, k, o()); |
59 Label true_continue(this), return_false(this); | 59 Label true_continue(this), return_false(this); |
60 BranchIfToBooleanIsTrue(value, &true_continue, &return_false); | 60 BranchIfToBooleanIsTrue(value, &true_continue, &return_false); |
61 BIND(&return_false); | 61 BIND(&return_false); |
62 ReturnFromBuiltin(FalseConstant()); | 62 Return(FalseConstant()); |
63 BIND(&true_continue); | 63 BIND(&true_continue); |
64 return a(); | 64 return a(); |
65 } | 65 } |
66 | 66 |
67 Node* ReduceResultGenerator() { return this_arg(); } | 67 Node* ReduceResultGenerator() { |
| 68 VARIABLE(a, MachineRepresentation::kTagged, UndefinedConstant()); |
| 69 Label no_initial_value(this), has_initial_value(this), done(this, {&a}); |
| 70 |
| 71 // 8. If initialValue is present, then |
| 72 Node* parent_frame_ptr = LoadParentFramePointer(); |
| 73 Node* marker_or_function = LoadBufferObject( |
| 74 parent_frame_ptr, CommonFrameConstants::kContextOrFrameTypeOffset); |
| 75 GotoIf( |
| 76 MarkerIsNotFrameType(marker_or_function, StackFrame::ARGUMENTS_ADAPTOR), |
| 77 &has_initial_value); |
| 78 |
| 79 // Has arguments adapter, check count. |
| 80 Node* adapted_parameter_count = LoadBufferObject( |
| 81 parent_frame_ptr, ArgumentsAdaptorFrameConstants::kLengthOffset); |
| 82 Branch(SmiLessThan(adapted_parameter_count, |
| 83 SmiConstant(IteratingArrayBuiltinDescriptor::kThisArg)), |
| 84 &no_initial_value, &has_initial_value); |
| 85 |
| 86 // a. Set accumulator to initialValue. |
| 87 BIND(&has_initial_value); |
| 88 a.Bind(this_arg()); |
| 89 Goto(&done); |
| 90 |
| 91 // 9. Else initialValue is not present, |
| 92 BIND(&no_initial_value); |
| 93 |
| 94 // a. Let kPresent be false. |
| 95 a.Bind(TheHoleConstant()); |
| 96 Goto(&done); |
| 97 BIND(&done); |
| 98 return a.value(); |
| 99 } |
68 | 100 |
69 Node* ReduceProcessor(Node* k_value, Node* k) { | 101 Node* ReduceProcessor(Node* k_value, Node* k) { |
70 VARIABLE(result, MachineRepresentation::kTagged); | 102 VARIABLE(result, MachineRepresentation::kTagged); |
71 Label done(this, {&result}), initial(this); | 103 Label done(this, {&result}), initial(this); |
72 GotoIf(WordEqual(a(), TheHoleConstant()), &initial); | 104 GotoIf(WordEqual(a(), TheHoleConstant()), &initial); |
73 result.Bind(CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 105 result.Bind(CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
74 UndefinedConstant(), a(), k_value, k, o())); | 106 UndefinedConstant(), a(), k_value, k, o())); |
75 Goto(&done); | 107 Goto(&done); |
76 | 108 |
77 BIND(&initial); | 109 BIND(&initial); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 BIND(&finished); | 259 BIND(&finished); |
228 return a(); | 260 return a(); |
229 } | 261 } |
230 | 262 |
231 void NullPostLoopAction() {} | 263 void NullPostLoopAction() {} |
232 | 264 |
233 protected: | 265 protected: |
234 Node* context() { return context_; } | 266 Node* context() { return context_; } |
235 Node* receiver() { return receiver_; } | 267 Node* receiver() { return receiver_; } |
236 Node* new_target() { return new_target_; } | 268 Node* new_target() { return new_target_; } |
237 Node* argc() { return argc_; } | |
238 Node* o() { return o_; } | 269 Node* o() { return o_; } |
239 Node* len() { return len_; } | 270 Node* len() { return len_; } |
240 Node* callbackfn() { return callbackfn_; } | 271 Node* callbackfn() { return callbackfn_; } |
241 Node* this_arg() { return this_arg_; } | 272 Node* this_arg() { return this_arg_; } |
242 Node* k() { return k_.value(); } | 273 Node* k() { return k_.value(); } |
243 Node* a() { return a_.value(); } | 274 Node* a() { return a_.value(); } |
244 | 275 |
245 void ReturnFromBuiltin(Node* value) { | |
246 if (argc_ == nullptr) { | |
247 Return(value); | |
248 } else { | |
249 // argc_ doesn't include the receiver, so it has to be added back in | |
250 // manually. | |
251 PopAndReturn(IntPtrAdd(argc_, IntPtrConstant(1)), value); | |
252 } | |
253 } | |
254 | |
255 void InitIteratingArrayBuiltinBody(Node* context, Node* receiver, | 276 void InitIteratingArrayBuiltinBody(Node* context, Node* receiver, |
256 Node* callbackfn, Node* this_arg, | 277 Node* callbackfn, Node* this_arg, |
257 Node* new_target, Node* argc) { | 278 Node* new_target) { |
258 context_ = context; | 279 context_ = context; |
259 receiver_ = receiver; | 280 receiver_ = receiver; |
260 new_target_ = new_target; | 281 new_target_ = new_target; |
261 callbackfn_ = callbackfn; | 282 callbackfn_ = callbackfn; |
262 this_arg_ = this_arg; | 283 this_arg_ = this_arg; |
263 argc_ = argc; | |
264 } | 284 } |
265 | 285 |
266 void GenerateIteratingArrayBuiltinBody( | 286 void GenerateIteratingArrayBuiltinBody( |
267 const char* name, const BuiltinResultGenerator& generator, | 287 const char* name, const BuiltinResultGenerator& generator, |
268 const CallResultProcessor& processor, const PostLoopAction& action, | 288 const CallResultProcessor& processor, const PostLoopAction& action, |
269 const Callable& slow_case_continuation, | 289 const Callable& slow_case_continuation, |
270 ForEachDirection direction = ForEachDirection::kForward) { | 290 ForEachDirection direction = ForEachDirection::kForward) { |
271 Label non_array(this), slow(this, {&k_, &a_, &to_}), | 291 Label non_array(this), slow(this, {&k_, &a_, &to_}), |
272 array_changes(this, {&k_, &a_, &to_}); | 292 array_changes(this, {&k_, &a_, &to_}); |
273 | 293 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } else { | 355 } else { |
336 k_.Bind(NumberDec(len())); | 356 k_.Bind(NumberDec(len())); |
337 } | 357 } |
338 | 358 |
339 a_.Bind(generator(this)); | 359 a_.Bind(generator(this)); |
340 | 360 |
341 HandleFastElements(processor, action, &slow, direction); | 361 HandleFastElements(processor, action, &slow, direction); |
342 | 362 |
343 BIND(&slow); | 363 BIND(&slow); |
344 | 364 |
345 Node* result = | 365 Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, |
346 CallStub(slow_case_continuation, context(), receiver(), callbackfn(), | 366 MachineType::TaggedPointer()); |
347 this_arg(), a_.value(), o(), k_.value(), len(), to_.value()); | 367 TailCallStub( |
348 ReturnFromBuiltin(result); | 368 slow_case_continuation, context(), target, new_target(), |
| 369 Int32Constant(IteratingArrayBuiltinLoopContinuationDescriptor::kArity), |
| 370 receiver(), callbackfn(), this_arg(), a_.value(), o(), k_.value(), |
| 371 len(), to_.value()); |
349 } | 372 } |
350 | 373 |
351 void InitIteratingArrayBuiltinLoopContinuation(Node* context, Node* receiver, | 374 void InitIteratingArrayBuiltinLoopContinuation(Node* context, Node* receiver, |
352 Node* callbackfn, | 375 Node* callbackfn, |
353 Node* this_arg, Node* a, | 376 Node* this_arg, Node* a, |
354 Node* o, Node* initial_k, | 377 Node* o, Node* initial_k, |
355 Node* len, Node* to) { | 378 Node* len, Node* to) { |
356 context_ = context; | 379 context_ = context; |
357 this_arg_ = this_arg; | 380 this_arg_ = this_arg; |
358 callbackfn_ = callbackfn; | 381 callbackfn_ = callbackfn; |
359 argc_ = nullptr; | |
360 a_.Bind(a); | 382 a_.Bind(a); |
361 k_.Bind(initial_k); | 383 k_.Bind(initial_k); |
362 o_ = o; | 384 o_ = o; |
363 len_ = len; | 385 len_ = len; |
364 to_.Bind(to); | 386 to_.Bind(to); |
365 } | 387 } |
366 | 388 |
367 void GenerateIteratingTypedArrayBuiltinBody( | 389 void GenerateIteratingTypedArrayBuiltinBody( |
368 const char* name, const BuiltinResultGenerator& generator, | 390 const char* name, const BuiltinResultGenerator& generator, |
369 const CallResultProcessor& processor, const PostLoopAction& action, | 391 const CallResultProcessor& processor, const PostLoopAction& action, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // TODO(tebbi): Silently cancelling the loop on buffer detachment is a | 473 // TODO(tebbi): Silently cancelling the loop on buffer detachment is a |
452 // spec violation. Should go to &detached and throw a TypeError instead. | 474 // spec violation. Should go to &detached and throw a TypeError instead. |
453 VisitAllTypedArrayElements( | 475 VisitAllTypedArrayElements( |
454 ElementsKindForInstanceType( | 476 ElementsKindForInstanceType( |
455 static_cast<InstanceType>(instance_types[i])), | 477 static_cast<InstanceType>(instance_types[i])), |
456 array_buffer, processor, &done, direction); | 478 array_buffer, processor, &done, direction); |
457 Goto(&done); | 479 Goto(&done); |
458 // No exception, return success | 480 // No exception, return success |
459 BIND(&done); | 481 BIND(&done); |
460 action(this); | 482 action(this); |
461 ReturnFromBuiltin(a_.value()); | 483 Return(a_.value()); |
462 } | 484 } |
463 } | 485 } |
464 | 486 |
465 void GenerateIteratingArrayBuiltinLoopContinuation( | 487 void GenerateIteratingArrayBuiltinLoopContinuation( |
466 const CallResultProcessor& processor, const PostLoopAction& action, | 488 const CallResultProcessor& processor, const PostLoopAction& action, |
467 ForEachDirection direction = ForEachDirection::kForward) { | 489 ForEachDirection direction = ForEachDirection::kForward) { |
468 Label loop(this, {&k_, &a_, &to_}); | 490 Label loop(this, {&k_, &a_, &to_}); |
469 Label after_loop(this); | 491 Label after_loop(this); |
470 Goto(&loop); | 492 Goto(&loop); |
471 BIND(&loop); | 493 BIND(&loop); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 675 |
654 ParameterMode mode = OptimalParameterMode(); | 676 ParameterMode mode = OptimalParameterMode(); |
655 BIND(&fast_elements); | 677 BIND(&fast_elements); |
656 { | 678 { |
657 VisitAllFastElementsOneKind(FAST_ELEMENTS, processor, slow, mode, | 679 VisitAllFastElementsOneKind(FAST_ELEMENTS, processor, slow, mode, |
658 direction); | 680 direction); |
659 | 681 |
660 action(this); | 682 action(this); |
661 | 683 |
662 // No exception, return success | 684 // No exception, return success |
663 ReturnFromBuiltin(a_.value()); | 685 Return(a_.value()); |
664 } | 686 } |
665 | 687 |
666 BIND(&maybe_double_elements); | 688 BIND(&maybe_double_elements); |
667 Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_DOUBLE_ELEMENTS), slow, | 689 Branch(IsElementsKindGreaterThan(kind, FAST_HOLEY_DOUBLE_ELEMENTS), slow, |
668 &fast_double_elements); | 690 &fast_double_elements); |
669 | 691 |
670 BIND(&fast_double_elements); | 692 BIND(&fast_double_elements); |
671 { | 693 { |
672 VisitAllFastElementsOneKind(FAST_DOUBLE_ELEMENTS, processor, slow, mode, | 694 VisitAllFastElementsOneKind(FAST_DOUBLE_ELEMENTS, processor, slow, mode, |
673 direction); | 695 direction); |
674 | 696 |
675 action(this); | 697 action(this); |
676 | 698 |
677 // No exception, return success | 699 // No exception, return success |
678 ReturnFromBuiltin(a_.value()); | 700 Return(a_.value()); |
679 } | 701 } |
680 } | 702 } |
681 | 703 |
682 Node* callbackfn_ = nullptr; | 704 Node* callbackfn_ = nullptr; |
683 Node* o_ = nullptr; | 705 Node* o_ = nullptr; |
684 Node* this_arg_ = nullptr; | 706 Node* this_arg_ = nullptr; |
685 Node* len_ = nullptr; | 707 Node* len_ = nullptr; |
686 Node* context_ = nullptr; | 708 Node* context_ = nullptr; |
687 Node* receiver_ = nullptr; | 709 Node* receiver_ = nullptr; |
688 Node* new_target_ = nullptr; | 710 Node* new_target_ = nullptr; |
689 Node* argc_ = nullptr; | |
690 Variable k_; | 711 Variable k_; |
691 Variable a_; | 712 Variable a_; |
692 Variable to_; | 713 Variable to_; |
693 }; | 714 }; |
694 | 715 |
695 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { | 716 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { |
696 VARIABLE(arg_index, MachineType::PointerRepresentation()); | 717 VARIABLE(arg_index, MachineType::PointerRepresentation()); |
697 Label default_label(this, &arg_index); | 718 Label default_label(this, &arg_index); |
698 Label smi_transition(this); | 719 Label smi_transition(this); |
699 Label object_push_pre(this); | 720 Label object_push_pre(this); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 856 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
836 this_arg, array, object, initial_k, | 857 this_arg, array, object, initial_k, |
837 len, to); | 858 len, to); |
838 | 859 |
839 GenerateIteratingArrayBuiltinLoopContinuation( | 860 GenerateIteratingArrayBuiltinLoopContinuation( |
840 &ArrayBuiltinCodeStubAssembler::ForEachProcessor, | 861 &ArrayBuiltinCodeStubAssembler::ForEachProcessor, |
841 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 862 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
842 } | 863 } |
843 | 864 |
844 TF_BUILTIN(ArrayForEach, ArrayBuiltinCodeStubAssembler) { | 865 TF_BUILTIN(ArrayForEach, ArrayBuiltinCodeStubAssembler) { |
845 Node* argc = | 866 Node* context = Parameter(Descriptor::kContext); |
846 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 867 Node* receiver = Parameter(Descriptor::kReceiver); |
847 CodeStubArguments args(this, argc); | 868 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
848 Node* context = Parameter(BuiltinDescriptor::kContext); | 869 Node* this_arg = Parameter(Descriptor::kThisArg); |
849 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 870 Node* new_target = Parameter(Descriptor::kNewTarget); |
850 Node* receiver = args.GetReceiver(); | |
851 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
852 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
853 | 871 |
854 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 872 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
855 new_target, argc); | 873 new_target); |
856 | 874 |
857 GenerateIteratingArrayBuiltinBody( | 875 GenerateIteratingArrayBuiltinBody( |
858 "Array.prototype.forEach", | 876 "Array.prototype.forEach", |
859 &ArrayBuiltinCodeStubAssembler::ForEachResultGenerator, | 877 &ArrayBuiltinCodeStubAssembler::ForEachResultGenerator, |
860 &ArrayBuiltinCodeStubAssembler::ForEachProcessor, | 878 &ArrayBuiltinCodeStubAssembler::ForEachProcessor, |
861 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 879 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
862 Builtins::CallableFor(isolate(), | 880 CodeFactory::ArrayForEachLoopContinuation(isolate())); |
863 Builtins::kArrayForEachLoopContinuation)); | |
864 } | 881 } |
865 | 882 |
866 TF_BUILTIN(ArraySomeLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 883 TF_BUILTIN(ArraySomeLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
867 Node* context = Parameter(Descriptor::kContext); | 884 Node* context = Parameter(Descriptor::kContext); |
868 Node* receiver = Parameter(Descriptor::kReceiver); | 885 Node* receiver = Parameter(Descriptor::kReceiver); |
869 Node* callbackfn = Parameter(Descriptor::kCallbackFn); | 886 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
870 Node* this_arg = Parameter(Descriptor::kThisArg); | 887 Node* this_arg = Parameter(Descriptor::kThisArg); |
871 Node* array = Parameter(Descriptor::kArray); | 888 Node* array = Parameter(Descriptor::kArray); |
872 Node* object = Parameter(Descriptor::kObject); | 889 Node* object = Parameter(Descriptor::kObject); |
873 Node* initial_k = Parameter(Descriptor::kInitialK); | 890 Node* initial_k = Parameter(Descriptor::kInitialK); |
874 Node* len = Parameter(Descriptor::kLength); | 891 Node* len = Parameter(Descriptor::kLength); |
875 Node* to = Parameter(Descriptor::kTo); | 892 Node* to = Parameter(Descriptor::kTo); |
876 | 893 |
877 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 894 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
878 this_arg, array, object, initial_k, | 895 this_arg, array, object, initial_k, |
879 len, to); | 896 len, to); |
880 | 897 |
881 GenerateIteratingArrayBuiltinLoopContinuation( | 898 GenerateIteratingArrayBuiltinLoopContinuation( |
882 &ArrayBuiltinCodeStubAssembler::SomeProcessor, | 899 &ArrayBuiltinCodeStubAssembler::SomeProcessor, |
883 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 900 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
884 } | 901 } |
885 | 902 |
886 TF_BUILTIN(ArraySome, ArrayBuiltinCodeStubAssembler) { | 903 TF_BUILTIN(ArraySome, ArrayBuiltinCodeStubAssembler) { |
887 Node* argc = | 904 Node* context = Parameter(Descriptor::kContext); |
888 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 905 Node* receiver = Parameter(Descriptor::kReceiver); |
889 CodeStubArguments args(this, argc); | 906 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
890 Node* context = Parameter(BuiltinDescriptor::kContext); | 907 Node* this_arg = Parameter(Descriptor::kThisArg); |
891 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 908 Node* new_target = Parameter(Descriptor::kNewTarget); |
892 Node* receiver = args.GetReceiver(); | |
893 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
894 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
895 | 909 |
896 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 910 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
897 new_target, argc); | 911 new_target); |
898 | 912 |
899 GenerateIteratingArrayBuiltinBody( | 913 GenerateIteratingArrayBuiltinBody( |
900 "Array.prototype.some", | 914 "Array.prototype.some", |
901 &ArrayBuiltinCodeStubAssembler::SomeResultGenerator, | 915 &ArrayBuiltinCodeStubAssembler::SomeResultGenerator, |
902 &ArrayBuiltinCodeStubAssembler::SomeProcessor, | 916 &ArrayBuiltinCodeStubAssembler::SomeProcessor, |
903 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 917 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
904 Builtins::CallableFor(isolate(), Builtins::kArraySomeLoopContinuation)); | 918 CodeFactory::ArraySomeLoopContinuation(isolate())); |
905 } | 919 } |
906 | 920 |
907 TF_BUILTIN(TypedArrayPrototypeSome, ArrayBuiltinCodeStubAssembler) { | 921 TF_BUILTIN(TypedArrayPrototypeSome, ArrayBuiltinCodeStubAssembler) { |
908 Node* argc = | 922 Node* context = Parameter(Descriptor::kContext); |
909 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 923 Node* receiver = Parameter(Descriptor::kReceiver); |
910 CodeStubArguments args(this, argc); | 924 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
911 Node* context = Parameter(BuiltinDescriptor::kContext); | 925 Node* this_arg = Parameter(Descriptor::kThisArg); |
912 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 926 Node* new_target = Parameter(Descriptor::kNewTarget); |
913 Node* receiver = args.GetReceiver(); | |
914 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
915 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
916 | 927 |
917 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 928 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
918 new_target, argc); | 929 new_target); |
919 | 930 |
920 GenerateIteratingTypedArrayBuiltinBody( | 931 GenerateIteratingTypedArrayBuiltinBody( |
921 "%TypedArray%.prototype.some", | 932 "%TypedArray%.prototype.some", |
922 &ArrayBuiltinCodeStubAssembler::SomeResultGenerator, | 933 &ArrayBuiltinCodeStubAssembler::SomeResultGenerator, |
923 &ArrayBuiltinCodeStubAssembler::SomeProcessor, | 934 &ArrayBuiltinCodeStubAssembler::SomeProcessor, |
924 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 935 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
925 } | 936 } |
926 | 937 |
927 TF_BUILTIN(ArrayEveryLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 938 TF_BUILTIN(ArrayEveryLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
928 Node* context = Parameter(Descriptor::kContext); | 939 Node* context = Parameter(Descriptor::kContext); |
929 Node* receiver = Parameter(Descriptor::kReceiver); | 940 Node* receiver = Parameter(Descriptor::kReceiver); |
930 Node* callbackfn = Parameter(Descriptor::kCallbackFn); | 941 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
931 Node* this_arg = Parameter(Descriptor::kThisArg); | 942 Node* this_arg = Parameter(Descriptor::kThisArg); |
932 Node* array = Parameter(Descriptor::kArray); | 943 Node* array = Parameter(Descriptor::kArray); |
933 Node* object = Parameter(Descriptor::kObject); | 944 Node* object = Parameter(Descriptor::kObject); |
934 Node* initial_k = Parameter(Descriptor::kInitialK); | 945 Node* initial_k = Parameter(Descriptor::kInitialK); |
935 Node* len = Parameter(Descriptor::kLength); | 946 Node* len = Parameter(Descriptor::kLength); |
936 Node* to = Parameter(Descriptor::kTo); | 947 Node* to = Parameter(Descriptor::kTo); |
937 | 948 |
938 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 949 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
939 this_arg, array, object, initial_k, | 950 this_arg, array, object, initial_k, |
940 len, to); | 951 len, to); |
941 | 952 |
942 GenerateIteratingArrayBuiltinLoopContinuation( | 953 GenerateIteratingArrayBuiltinLoopContinuation( |
943 &ArrayBuiltinCodeStubAssembler::EveryProcessor, | 954 &ArrayBuiltinCodeStubAssembler::EveryProcessor, |
944 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 955 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
945 } | 956 } |
946 | 957 |
947 TF_BUILTIN(ArrayEvery, ArrayBuiltinCodeStubAssembler) { | 958 TF_BUILTIN(ArrayEvery, ArrayBuiltinCodeStubAssembler) { |
948 Node* argc = | 959 Node* context = Parameter(Descriptor::kContext); |
949 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 960 Node* receiver = Parameter(Descriptor::kReceiver); |
950 CodeStubArguments args(this, argc); | 961 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
951 Node* context = Parameter(BuiltinDescriptor::kContext); | 962 Node* this_arg = Parameter(Descriptor::kThisArg); |
952 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 963 Node* new_target = Parameter(Descriptor::kNewTarget); |
953 Node* receiver = args.GetReceiver(); | |
954 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
955 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
956 | 964 |
957 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 965 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
958 new_target, argc); | 966 new_target); |
959 | 967 |
960 GenerateIteratingArrayBuiltinBody( | 968 GenerateIteratingArrayBuiltinBody( |
961 "Array.prototype.every", | 969 "Array.prototype.every", |
962 &ArrayBuiltinCodeStubAssembler::EveryResultGenerator, | 970 &ArrayBuiltinCodeStubAssembler::EveryResultGenerator, |
963 &ArrayBuiltinCodeStubAssembler::EveryProcessor, | 971 &ArrayBuiltinCodeStubAssembler::EveryProcessor, |
964 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 972 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
965 Builtins::CallableFor(isolate(), Builtins::kArrayEveryLoopContinuation)); | 973 CodeFactory::ArrayEveryLoopContinuation(isolate())); |
966 } | 974 } |
967 | 975 |
968 TF_BUILTIN(TypedArrayPrototypeEvery, ArrayBuiltinCodeStubAssembler) { | 976 TF_BUILTIN(TypedArrayPrototypeEvery, ArrayBuiltinCodeStubAssembler) { |
969 Node* argc = | 977 Node* context = Parameter(Descriptor::kContext); |
970 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 978 Node* receiver = Parameter(Descriptor::kReceiver); |
971 CodeStubArguments args(this, argc); | 979 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
972 Node* context = Parameter(BuiltinDescriptor::kContext); | 980 Node* this_arg = Parameter(Descriptor::kThisArg); |
973 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 981 Node* new_target = Parameter(Descriptor::kNewTarget); |
974 Node* receiver = args.GetReceiver(); | |
975 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
976 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
977 | 982 |
978 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 983 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
979 new_target, argc); | 984 new_target); |
980 | 985 |
981 GenerateIteratingTypedArrayBuiltinBody( | 986 GenerateIteratingTypedArrayBuiltinBody( |
982 "%TypedArray%.prototype.every", | 987 "%TypedArray%.prototype.every", |
983 &ArrayBuiltinCodeStubAssembler::EveryResultGenerator, | 988 &ArrayBuiltinCodeStubAssembler::EveryResultGenerator, |
984 &ArrayBuiltinCodeStubAssembler::EveryProcessor, | 989 &ArrayBuiltinCodeStubAssembler::EveryProcessor, |
985 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 990 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
986 } | 991 } |
987 | 992 |
988 TF_BUILTIN(ArrayReduceLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 993 TF_BUILTIN(ArrayReduceLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
989 Node* context = Parameter(Descriptor::kContext); | 994 Node* context = Parameter(Descriptor::kContext); |
990 Node* receiver = Parameter(Descriptor::kReceiver); | 995 Node* receiver = Parameter(Descriptor::kReceiver); |
991 Node* callbackfn = Parameter(Descriptor::kCallbackFn); | 996 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
992 Node* this_arg = Parameter(Descriptor::kThisArg); | 997 Node* this_arg = Parameter(Descriptor::kThisArg); |
993 Node* accumulator = Parameter(Descriptor::kAccumulator); | 998 Node* accumulator = Parameter(Descriptor::kAccumulator); |
994 Node* object = Parameter(Descriptor::kObject); | 999 Node* object = Parameter(Descriptor::kObject); |
995 Node* initial_k = Parameter(Descriptor::kInitialK); | 1000 Node* initial_k = Parameter(Descriptor::kInitialK); |
996 Node* len = Parameter(Descriptor::kLength); | 1001 Node* len = Parameter(Descriptor::kLength); |
997 Node* to = Parameter(Descriptor::kTo); | 1002 Node* to = Parameter(Descriptor::kTo); |
998 | 1003 |
999 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 1004 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
1000 this_arg, accumulator, object, | 1005 this_arg, accumulator, object, |
1001 initial_k, len, to); | 1006 initial_k, len, to); |
1002 | 1007 |
1003 GenerateIteratingArrayBuiltinLoopContinuation( | 1008 GenerateIteratingArrayBuiltinLoopContinuation( |
1004 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1009 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1005 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction); | 1010 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction); |
1006 } | 1011 } |
1007 | 1012 |
1008 TF_BUILTIN(ArrayReduce, ArrayBuiltinCodeStubAssembler) { | 1013 TF_BUILTIN(ArrayReduce, ArrayBuiltinCodeStubAssembler) { |
1009 Node* argc = | 1014 Node* context = Parameter(Descriptor::kContext); |
1010 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1015 Node* receiver = Parameter(Descriptor::kReceiver); |
1011 CodeStubArguments args(this, argc); | 1016 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1012 Node* context = Parameter(BuiltinDescriptor::kContext); | 1017 Node* initial_value = Parameter(Descriptor::kInitialValue); |
1013 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1018 Node* new_target = Parameter(Descriptor::kNewTarget); |
1014 Node* receiver = args.GetReceiver(); | |
1015 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1016 Node* initial_value = args.GetOptionalArgumentValue(1, TheHoleConstant()); | |
1017 | 1019 |
1018 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, | 1020 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, |
1019 new_target, argc); | 1021 new_target); |
1020 | 1022 |
1021 GenerateIteratingArrayBuiltinBody( | 1023 GenerateIteratingArrayBuiltinBody( |
1022 "Array.prototype.reduce", | 1024 "Array.prototype.reduce", |
1023 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, | 1025 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, |
1024 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1026 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1025 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, | 1027 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, |
1026 Builtins::CallableFor(isolate(), Builtins::kArrayReduceLoopContinuation)); | 1028 CodeFactory::ArrayReduceLoopContinuation(isolate())); |
1027 } | 1029 } |
1028 | 1030 |
1029 TF_BUILTIN(TypedArrayPrototypeReduce, ArrayBuiltinCodeStubAssembler) { | 1031 TF_BUILTIN(TypedArrayPrototypeReduce, ArrayBuiltinCodeStubAssembler) { |
1030 Node* argc = | 1032 Node* context = Parameter(Descriptor::kContext); |
1031 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1033 Node* receiver = Parameter(Descriptor::kReceiver); |
1032 CodeStubArguments args(this, argc); | 1034 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1033 Node* context = Parameter(BuiltinDescriptor::kContext); | 1035 Node* initial_value = Parameter(Descriptor::kInitialValue); |
1034 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1036 Node* new_target = Parameter(Descriptor::kNewTarget); |
1035 Node* receiver = args.GetReceiver(); | |
1036 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1037 Node* initial_value = args.GetOptionalArgumentValue(1, TheHoleConstant()); | |
1038 | 1037 |
1039 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, | 1038 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, |
1040 new_target, argc); | 1039 new_target); |
1041 | 1040 |
1042 GenerateIteratingTypedArrayBuiltinBody( | 1041 GenerateIteratingTypedArrayBuiltinBody( |
1043 "%TypedArray%.prototype.reduce", | 1042 "%TypedArray%.prototype.reduce", |
1044 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, | 1043 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, |
1045 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1044 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1046 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction); | 1045 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction); |
1047 } | 1046 } |
1048 | 1047 |
1049 TF_BUILTIN(ArrayReduceRightLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 1048 TF_BUILTIN(ArrayReduceRightLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
1050 Node* context = Parameter(Descriptor::kContext); | 1049 Node* context = Parameter(Descriptor::kContext); |
(...skipping 10 matching lines...) Expand all Loading... |
1061 this_arg, accumulator, object, | 1060 this_arg, accumulator, object, |
1062 initial_k, len, to); | 1061 initial_k, len, to); |
1063 | 1062 |
1064 GenerateIteratingArrayBuiltinLoopContinuation( | 1063 GenerateIteratingArrayBuiltinLoopContinuation( |
1065 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1064 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1066 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, | 1065 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, |
1067 ForEachDirection::kReverse); | 1066 ForEachDirection::kReverse); |
1068 } | 1067 } |
1069 | 1068 |
1070 TF_BUILTIN(ArrayReduceRight, ArrayBuiltinCodeStubAssembler) { | 1069 TF_BUILTIN(ArrayReduceRight, ArrayBuiltinCodeStubAssembler) { |
1071 Node* argc = | 1070 Node* context = Parameter(Descriptor::kContext); |
1072 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1071 Node* receiver = Parameter(Descriptor::kReceiver); |
1073 CodeStubArguments args(this, argc); | 1072 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1074 Node* context = Parameter(BuiltinDescriptor::kContext); | 1073 Node* initial_value = Parameter(Descriptor::kInitialValue); |
1075 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1074 Node* new_target = Parameter(Descriptor::kNewTarget); |
1076 Node* receiver = args.GetReceiver(); | |
1077 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1078 Node* initial_value = args.GetOptionalArgumentValue(1, TheHoleConstant()); | |
1079 | 1075 |
1080 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, | 1076 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, |
1081 new_target, argc); | 1077 new_target); |
1082 | 1078 |
1083 GenerateIteratingArrayBuiltinBody( | 1079 GenerateIteratingArrayBuiltinBody( |
1084 "Array.prototype.reduceRight", | 1080 "Array.prototype.reduceRight", |
1085 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, | 1081 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, |
1086 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1082 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1087 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, | 1083 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, |
1088 Builtins::CallableFor(isolate(), | 1084 CodeFactory::ArrayReduceRightLoopContinuation(isolate()), |
1089 Builtins::kArrayReduceRightLoopContinuation), | |
1090 ForEachDirection::kReverse); | 1085 ForEachDirection::kReverse); |
1091 } | 1086 } |
1092 | 1087 |
1093 TF_BUILTIN(TypedArrayPrototypeReduceRight, ArrayBuiltinCodeStubAssembler) { | 1088 TF_BUILTIN(TypedArrayPrototypeReduceRight, ArrayBuiltinCodeStubAssembler) { |
1094 Node* argc = | 1089 Node* context = Parameter(Descriptor::kContext); |
1095 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1090 Node* receiver = Parameter(Descriptor::kReceiver); |
1096 CodeStubArguments args(this, argc); | 1091 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1097 Node* context = Parameter(BuiltinDescriptor::kContext); | 1092 Node* initial_value = Parameter(Descriptor::kInitialValue); |
1098 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1093 Node* new_target = Parameter(Descriptor::kNewTarget); |
1099 Node* receiver = args.GetReceiver(); | |
1100 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1101 Node* initial_value = args.GetOptionalArgumentValue(1, TheHoleConstant()); | |
1102 | 1094 |
1103 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, | 1095 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, initial_value, |
1104 new_target, argc); | 1096 new_target); |
1105 | 1097 |
1106 GenerateIteratingTypedArrayBuiltinBody( | 1098 GenerateIteratingTypedArrayBuiltinBody( |
1107 "%TypedArray%.prototype.reduceRight", | 1099 "%TypedArray%.prototype.reduceRight", |
1108 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, | 1100 &ArrayBuiltinCodeStubAssembler::ReduceResultGenerator, |
1109 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, | 1101 &ArrayBuiltinCodeStubAssembler::ReduceProcessor, |
1110 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, | 1102 &ArrayBuiltinCodeStubAssembler::ReducePostLoopAction, |
1111 ForEachDirection::kReverse); | 1103 ForEachDirection::kReverse); |
1112 } | 1104 } |
1113 | 1105 |
1114 TF_BUILTIN(ArrayFilterLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 1106 TF_BUILTIN(ArrayFilterLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
(...skipping 10 matching lines...) Expand all Loading... |
1125 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 1117 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
1126 this_arg, array, object, initial_k, | 1118 this_arg, array, object, initial_k, |
1127 len, to); | 1119 len, to); |
1128 | 1120 |
1129 GenerateIteratingArrayBuiltinLoopContinuation( | 1121 GenerateIteratingArrayBuiltinLoopContinuation( |
1130 &ArrayBuiltinCodeStubAssembler::FilterProcessor, | 1122 &ArrayBuiltinCodeStubAssembler::FilterProcessor, |
1131 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 1123 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
1132 } | 1124 } |
1133 | 1125 |
1134 TF_BUILTIN(ArrayFilter, ArrayBuiltinCodeStubAssembler) { | 1126 TF_BUILTIN(ArrayFilter, ArrayBuiltinCodeStubAssembler) { |
1135 Node* argc = | 1127 Node* context = Parameter(Descriptor::kContext); |
1136 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1128 Node* receiver = Parameter(Descriptor::kReceiver); |
1137 CodeStubArguments args(this, argc); | 1129 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1138 Node* context = Parameter(BuiltinDescriptor::kContext); | 1130 Node* this_arg = Parameter(Descriptor::kThisArg); |
1139 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1131 Node* new_target = Parameter(Descriptor::kNewTarget); |
1140 Node* receiver = args.GetReceiver(); | |
1141 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1142 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
1143 | 1132 |
1144 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 1133 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
1145 new_target, argc); | 1134 new_target); |
1146 | 1135 |
1147 GenerateIteratingArrayBuiltinBody( | 1136 GenerateIteratingArrayBuiltinBody( |
1148 "Array.prototype.filter", | 1137 "Array.prototype.filter", |
1149 &ArrayBuiltinCodeStubAssembler::FilterResultGenerator, | 1138 &ArrayBuiltinCodeStubAssembler::FilterResultGenerator, |
1150 &ArrayBuiltinCodeStubAssembler::FilterProcessor, | 1139 &ArrayBuiltinCodeStubAssembler::FilterProcessor, |
1151 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 1140 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
1152 Builtins::CallableFor(isolate(), Builtins::kArrayFilterLoopContinuation)); | 1141 CodeFactory::ArrayFilterLoopContinuation(isolate())); |
1153 } | 1142 } |
1154 | 1143 |
1155 TF_BUILTIN(ArrayMapLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 1144 TF_BUILTIN(ArrayMapLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
1156 Node* context = Parameter(Descriptor::kContext); | 1145 Node* context = Parameter(Descriptor::kContext); |
1157 Node* receiver = Parameter(Descriptor::kReceiver); | 1146 Node* receiver = Parameter(Descriptor::kReceiver); |
1158 Node* callbackfn = Parameter(Descriptor::kCallbackFn); | 1147 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1159 Node* this_arg = Parameter(Descriptor::kThisArg); | 1148 Node* this_arg = Parameter(Descriptor::kThisArg); |
1160 Node* array = Parameter(Descriptor::kArray); | 1149 Node* array = Parameter(Descriptor::kArray); |
1161 Node* object = Parameter(Descriptor::kObject); | 1150 Node* object = Parameter(Descriptor::kObject); |
1162 Node* initial_k = Parameter(Descriptor::kInitialK); | 1151 Node* initial_k = Parameter(Descriptor::kInitialK); |
1163 Node* len = Parameter(Descriptor::kLength); | 1152 Node* len = Parameter(Descriptor::kLength); |
1164 Node* to = Parameter(Descriptor::kTo); | 1153 Node* to = Parameter(Descriptor::kTo); |
1165 | 1154 |
1166 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 1155 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
1167 this_arg, array, object, initial_k, | 1156 this_arg, array, object, initial_k, |
1168 len, to); | 1157 len, to); |
1169 | 1158 |
1170 GenerateIteratingArrayBuiltinLoopContinuation( | 1159 GenerateIteratingArrayBuiltinLoopContinuation( |
1171 &ArrayBuiltinCodeStubAssembler::MapProcessor, | 1160 &ArrayBuiltinCodeStubAssembler::MapProcessor, |
1172 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 1161 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
1173 } | 1162 } |
1174 | 1163 |
1175 TF_BUILTIN(ArrayMap, ArrayBuiltinCodeStubAssembler) { | 1164 TF_BUILTIN(ArrayMap, ArrayBuiltinCodeStubAssembler) { |
1176 Node* argc = | 1165 Node* context = Parameter(Descriptor::kContext); |
1177 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1166 Node* receiver = Parameter(Descriptor::kReceiver); |
1178 CodeStubArguments args(this, argc); | 1167 Node* callbackfn = Parameter(Descriptor::kCallbackFn); |
1179 Node* context = Parameter(BuiltinDescriptor::kContext); | 1168 Node* this_arg = Parameter(Descriptor::kThisArg); |
1180 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1169 Node* new_target = Parameter(Descriptor::kNewTarget); |
1181 Node* receiver = args.GetReceiver(); | |
1182 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | |
1183 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | |
1184 | 1170 |
1185 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 1171 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
1186 new_target, argc); | 1172 new_target); |
1187 | 1173 |
1188 GenerateIteratingArrayBuiltinBody( | 1174 GenerateIteratingArrayBuiltinBody( |
1189 "Array.prototype.map", &ArrayBuiltinCodeStubAssembler::MapResultGenerator, | 1175 "Array.prototype.map", &ArrayBuiltinCodeStubAssembler::MapResultGenerator, |
1190 &ArrayBuiltinCodeStubAssembler::MapProcessor, | 1176 &ArrayBuiltinCodeStubAssembler::MapProcessor, |
1191 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 1177 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
1192 Builtins::CallableFor(isolate(), Builtins::kArrayMapLoopContinuation)); | 1178 CodeFactory::ArrayMapLoopContinuation(isolate())); |
1193 } | 1179 } |
1194 | 1180 |
1195 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { | 1181 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { |
1196 Node* object = Parameter(Descriptor::kArg); | 1182 Node* object = Parameter(Descriptor::kArg); |
1197 Node* context = Parameter(Descriptor::kContext); | 1183 Node* context = Parameter(Descriptor::kContext); |
1198 | 1184 |
1199 Label call_runtime(this), return_true(this), return_false(this); | 1185 Label call_runtime(this), return_true(this), return_false(this); |
1200 | 1186 |
1201 GotoIf(TaggedIsSmi(object), &return_false); | 1187 GotoIf(TaggedIsSmi(object), &return_false); |
1202 Node* instance_type = LoadInstanceType(object); | 1188 Node* instance_type = LoadInstanceType(object); |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 { | 2232 { |
2247 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 2233 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); |
2248 CallRuntime(Runtime::kThrowTypeError, context, message, | 2234 CallRuntime(Runtime::kThrowTypeError, context, message, |
2249 HeapConstant(operation)); | 2235 HeapConstant(operation)); |
2250 Unreachable(); | 2236 Unreachable(); |
2251 } | 2237 } |
2252 } | 2238 } |
2253 | 2239 |
2254 } // namespace internal | 2240 } // namespace internal |
2255 } // namespace v8 | 2241 } // namespace v8 |
OLD | NEW |