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