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 { |
11 | 11 |
12 class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler { | 12 class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler { |
13 public: | 13 public: |
14 explicit ArrayBuiltinCodeStubAssembler(compiler::CodeAssemblerState* state) | 14 explicit ArrayBuiltinCodeStubAssembler(compiler::CodeAssemblerState* state) |
15 : CodeStubAssembler(state), | 15 : CodeStubAssembler(state), |
16 k_(this, MachineRepresentation::kTagged), | 16 k_(this, MachineRepresentation::kTagged), |
17 a_(this, MachineRepresentation::kTagged), | 17 a_(this, MachineRepresentation::kTagged), |
18 to_(this, MachineRepresentation::kTagged, SmiConstant(0)) {} | 18 to_(this, MachineRepresentation::kTagged, SmiConstant(0)), |
19 | 19 fully_spec_compliant_(this, {&k_, &a_, &to_}) {} |
20 typedef std::function<Node*(ArrayBuiltinCodeStubAssembler* masm)> | |
21 BuiltinResultGenerator; | |
22 | 20 |
23 typedef std::function<void(ArrayBuiltinCodeStubAssembler* masm)> | 21 typedef std::function<void(ArrayBuiltinCodeStubAssembler* masm)> |
24 BuiltinResultIndexInitializer; | 22 BuiltinResultGenerator; |
25 | 23 |
26 typedef std::function<Node*(ArrayBuiltinCodeStubAssembler* masm, | 24 typedef std::function<Node*(ArrayBuiltinCodeStubAssembler* masm, |
27 Node* k_value, Node* k)> | 25 Node* k_value, Node* k)> |
28 CallResultProcessor; | 26 CallResultProcessor; |
29 | 27 |
30 typedef std::function<void(ArrayBuiltinCodeStubAssembler* masm)> | 28 typedef std::function<void(ArrayBuiltinCodeStubAssembler* masm)> |
31 PostLoopAction; | 29 PostLoopAction; |
32 | 30 |
33 Node* ForEachResultGenerator() { return UndefinedConstant(); } | 31 void ForEachResultGenerator() { a_.Bind(UndefinedConstant()); } |
34 | 32 |
35 Node* ForEachProcessor(Node* k_value, Node* k) { | 33 Node* ForEachProcessor(Node* k_value, Node* k) { |
36 CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), this_arg(), | 34 CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), this_arg(), |
37 k_value, k, o()); | 35 k_value, k, o()); |
38 return a(); | 36 return a(); |
39 } | 37 } |
40 | 38 |
41 Node* SomeResultGenerator() { return FalseConstant(); } | 39 void SomeResultGenerator() { a_.Bind(FalseConstant()); } |
42 | 40 |
43 Node* SomeProcessor(Node* k_value, Node* k) { | 41 Node* SomeProcessor(Node* k_value, Node* k) { |
44 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 42 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
45 this_arg(), k_value, k, o()); | 43 this_arg(), k_value, k, o()); |
46 Label false_continue(this), return_true(this); | 44 Label false_continue(this), return_true(this); |
47 BranchIfToBooleanIsTrue(value, &return_true, &false_continue); | 45 BranchIfToBooleanIsTrue(value, &return_true, &false_continue); |
48 BIND(&return_true); | 46 BIND(&return_true); |
49 ReturnFromBuiltin(TrueConstant()); | 47 ReturnFromBuiltin(TrueConstant()); |
50 BIND(&false_continue); | 48 BIND(&false_continue); |
51 return a(); | 49 return a(); |
52 } | 50 } |
53 | 51 |
54 Node* EveryResultGenerator() { return TrueConstant(); } | 52 void EveryResultGenerator() { a_.Bind(TrueConstant()); } |
55 | 53 |
56 Node* EveryProcessor(Node* k_value, Node* k) { | 54 Node* EveryProcessor(Node* k_value, Node* k) { |
57 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 55 Node* value = CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
58 this_arg(), k_value, k, o()); | 56 this_arg(), k_value, k, o()); |
59 Label true_continue(this), return_false(this); | 57 Label true_continue(this), return_false(this); |
60 BranchIfToBooleanIsTrue(value, &true_continue, &return_false); | 58 BranchIfToBooleanIsTrue(value, &true_continue, &return_false); |
61 BIND(&return_false); | 59 BIND(&return_false); |
62 ReturnFromBuiltin(FalseConstant()); | 60 ReturnFromBuiltin(FalseConstant()); |
63 BIND(&true_continue); | 61 BIND(&true_continue); |
64 return a(); | 62 return a(); |
65 } | 63 } |
66 | 64 |
67 Node* ReduceResultGenerator() { return this_arg(); } | 65 void ReduceResultGenerator() { return a_.Bind(this_arg()); } |
68 | 66 |
69 Node* ReduceProcessor(Node* k_value, Node* k) { | 67 Node* ReduceProcessor(Node* k_value, Node* k) { |
70 VARIABLE(result, MachineRepresentation::kTagged); | 68 VARIABLE(result, MachineRepresentation::kTagged); |
71 Label done(this, {&result}), initial(this); | 69 Label done(this, {&result}), initial(this); |
72 GotoIf(WordEqual(a(), TheHoleConstant()), &initial); | 70 GotoIf(WordEqual(a(), TheHoleConstant()), &initial); |
73 result.Bind(CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), | 71 result.Bind(CallJS(CodeFactory::Call(isolate()), context(), callbackfn(), |
74 UndefinedConstant(), a(), k_value, k, o())); | 72 UndefinedConstant(), a(), k_value, k, o())); |
75 Goto(&done); | 73 Goto(&done); |
76 | 74 |
77 BIND(&initial); | 75 BIND(&initial); |
78 result.Bind(k_value); | 76 result.Bind(k_value); |
79 Goto(&done); | 77 Goto(&done); |
80 | 78 |
81 BIND(&done); | 79 BIND(&done); |
82 return result.value(); | 80 return result.value(); |
83 } | 81 } |
84 | 82 |
85 void ReducePostLoopAction() { | 83 void ReducePostLoopAction() { |
86 Label ok(this); | 84 Label ok(this); |
87 GotoIf(WordNotEqual(a(), TheHoleConstant()), &ok); | 85 GotoIf(WordNotEqual(a(), TheHoleConstant()), &ok); |
88 CallRuntime(Runtime::kThrowTypeError, context(), | 86 CallRuntime(Runtime::kThrowTypeError, context(), |
89 SmiConstant(MessageTemplate::kReduceNoInitial)); | 87 SmiConstant(MessageTemplate::kReduceNoInitial)); |
90 Unreachable(); | 88 Unreachable(); |
91 BIND(&ok); | 89 BIND(&ok); |
92 } | 90 } |
93 | 91 |
94 Node* FilterResultGenerator() { | 92 void FilterResultGenerator() { |
95 // 7. Let A be ArraySpeciesCreate(O, 0). | 93 // 7. Let A be ArraySpeciesCreate(O, 0). |
96 return ArraySpeciesCreate(context(), o(), SmiConstant(0)); | 94 a_.Bind(ArraySpeciesCreate(context(), o(), SmiConstant(0))); |
97 } | 95 } |
98 | 96 |
99 Node* FilterProcessor(Node* k_value, Node* k) { | 97 Node* FilterProcessor(Node* k_value, Node* k) { |
100 // ii. Let selected be ToBoolean(? Call(callbackfn, T, kValue, k, O)). | 98 // ii. Let selected be ToBoolean(? Call(callbackfn, T, kValue, k, O)). |
101 Node* selected = CallJS(CodeFactory::Call(isolate()), context(), | 99 Node* selected = CallJS(CodeFactory::Call(isolate()), context(), |
102 callbackfn(), this_arg(), k_value, k, o()); | 100 callbackfn(), this_arg(), k_value, k, o()); |
103 Label true_continue(this, &to_), false_continue(this); | 101 Label true_continue(this, &to_), false_continue(this); |
104 BranchIfToBooleanIsTrue(selected, &true_continue, &false_continue); | 102 BranchIfToBooleanIsTrue(selected, &true_continue, &false_continue); |
105 BIND(&true_continue); | 103 BIND(&true_continue); |
106 // iii. If selected is true, then... | 104 // iii. If selected is true, then... |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 { | 153 { |
156 // 2. Increase to by 1. | 154 // 2. Increase to by 1. |
157 to_.Bind(NumberInc(to_.value())); | 155 to_.Bind(NumberInc(to_.value())); |
158 Goto(&false_continue); | 156 Goto(&false_continue); |
159 } | 157 } |
160 } | 158 } |
161 BIND(&false_continue); | 159 BIND(&false_continue); |
162 return a(); | 160 return a(); |
163 } | 161 } |
164 | 162 |
165 Node* MapResultGenerator() { | 163 void MapResultGenerator() { |
166 // 5. Let A be ? ArraySpeciesCreate(O, len). | 164 Label runtime(this), done(this, {&a_}); |
167 return ArraySpeciesCreate(context(), o(), len_); | 165 GotoIf(DoesntHaveInstanceType(o(), JS_ARRAY_TYPE), &runtime); |
| 166 Node* o_map = LoadMap(o()); |
| 167 Node* const initial_array_prototype = LoadContextElement( |
| 168 LoadNativeContext(context()), Context::INITIAL_ARRAY_PROTOTYPE_INDEX); |
| 169 Node* proto = LoadMapPrototype(o_map); |
| 170 GotoIf(WordNotEqual(proto, initial_array_prototype), &runtime); |
| 171 |
| 172 Node* species_protector = SpeciesProtectorConstant(); |
| 173 Node* value = LoadObjectField(species_protector, Cell::kValueOffset); |
| 174 Node* const protector_invalid = SmiConstant(Isolate::kProtectorInvalid); |
| 175 GotoIf(WordEqual(value, protector_invalid), &runtime); |
| 176 |
| 177 Node* const initial_array_constructor = LoadContextElement( |
| 178 LoadNativeContext(context()), Context::ARRAY_FUNCTION_INDEX); |
| 179 a_.Bind(ConstructJS(CodeFactory::Construct(isolate()), context(), |
| 180 initial_array_constructor, len_)); |
| 181 Goto(&done); |
| 182 |
| 183 BIND(&runtime); |
| 184 { |
| 185 // 5. Let A be ? ArraySpeciesCreate(O, len). |
| 186 Node* constructor = |
| 187 CallRuntime(Runtime::kArraySpeciesConstructor, context(), o()); |
| 188 a_.Bind(ConstructJS(CodeFactory::Construct(isolate()), context(), |
| 189 constructor, len_)); |
| 190 Goto(&fully_spec_compliant_); |
| 191 } |
| 192 BIND(&done); |
168 } | 193 } |
169 | 194 |
170 Node* MapProcessor(Node* k_value, Node* k) { | 195 Node* SpecCompliantMapProcessor(Node* k_value, Node* k) { |
171 // i. Let kValue be ? Get(O, Pk). Performed by the caller of MapProcessor. | 196 // i. Let kValue be ? Get(O, Pk). Performed by the caller of |
| 197 // SpecCompliantMapProcessor. |
172 // ii. Let mappedValue be ? Call(callbackfn, T, kValue, k, O). | 198 // ii. Let mappedValue be ? Call(callbackfn, T, kValue, k, O). |
173 Node* mappedValue = CallJS(CodeFactory::Call(isolate()), context(), | 199 Node* mappedValue = CallJS(CodeFactory::Call(isolate()), context(), |
174 callbackfn(), this_arg(), k_value, k, o()); | 200 callbackfn(), this_arg(), k_value, k, o()); |
| 201 |
| 202 // iii. Perform ? CreateDataPropertyOrThrow(A, Pk, mappedValue). |
| 203 CallRuntime(Runtime::kCreateDataProperty, context(), a(), k, mappedValue); |
| 204 return a(); |
| 205 } |
| 206 |
| 207 Node* FastMapProcessor(Node* k_value, Node* k) { |
| 208 // i. Let kValue be ? Get(O, Pk). Performed by the caller of |
| 209 // FastMapProcessor. |
| 210 // ii. Let mappedValue be ? Call(callbackfn, T, kValue, k, O). |
| 211 Node* mappedValue = CallJS(CodeFactory::Call(isolate()), context(), |
| 212 callbackfn(), this_arg(), k_value, k, o()); |
175 | 213 |
176 Label finished(this); | 214 Label finished(this); |
177 Node* kind = nullptr; | 215 Node* kind = nullptr; |
178 Node* elements = nullptr; | 216 Node* elements = nullptr; |
179 | 217 |
180 // If a() is a JSArray, we can have a fast path. | 218 // If a() is a JSArray, we can have a fast path. |
181 // mode is SMI_PARAMETERS because k has tagged representation. | 219 // mode is SMI_PARAMETERS because k has tagged representation. |
182 ParameterMode mode = SMI_PARAMETERS; | 220 ParameterMode mode = SMI_PARAMETERS; |
183 Label fast(this); | 221 Label fast(this); |
184 Label runtime(this); | 222 Label runtime(this); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 callbackfn_ = callbackfn; | 299 callbackfn_ = callbackfn; |
262 this_arg_ = this_arg; | 300 this_arg_ = this_arg; |
263 argc_ = argc; | 301 argc_ = argc; |
264 } | 302 } |
265 | 303 |
266 void GenerateIteratingArrayBuiltinBody( | 304 void GenerateIteratingArrayBuiltinBody( |
267 const char* name, const BuiltinResultGenerator& generator, | 305 const char* name, const BuiltinResultGenerator& generator, |
268 const CallResultProcessor& processor, const PostLoopAction& action, | 306 const CallResultProcessor& processor, const PostLoopAction& action, |
269 const Callable& slow_case_continuation, | 307 const Callable& slow_case_continuation, |
270 ForEachDirection direction = ForEachDirection::kForward) { | 308 ForEachDirection direction = ForEachDirection::kForward) { |
271 Label non_array(this), slow(this, {&k_, &a_, &to_}), | 309 Label non_array(this), array_changes(this, {&k_, &a_, &to_}); |
272 array_changes(this, {&k_, &a_, &to_}); | |
273 | 310 |
274 // TODO(danno): Seriously? Do we really need to throw the exact error | 311 // TODO(danno): Seriously? Do we really need to throw the exact error |
275 // message on null and undefined so that the webkit tests pass? | 312 // message on null and undefined so that the webkit tests pass? |
276 Label throw_null_undefined_exception(this, Label::kDeferred); | 313 Label throw_null_undefined_exception(this, Label::kDeferred); |
277 GotoIf(WordEqual(receiver(), NullConstant()), | 314 GotoIf(WordEqual(receiver(), NullConstant()), |
278 &throw_null_undefined_exception); | 315 &throw_null_undefined_exception); |
279 GotoIf(WordEqual(receiver(), UndefinedConstant()), | 316 GotoIf(WordEqual(receiver(), UndefinedConstant()), |
280 &throw_null_undefined_exception); | 317 &throw_null_undefined_exception); |
281 | 318 |
282 // By the book: taken directly from the ECMAScript 2015 specification | 319 // By the book: taken directly from the ECMAScript 2015 specification |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // 6. If thisArg was supplied, let T be thisArg; else let T be undefined. | 366 // 6. If thisArg was supplied, let T be thisArg; else let T be undefined. |
330 // [Already done by the arguments adapter] | 367 // [Already done by the arguments adapter] |
331 | 368 |
332 if (direction == ForEachDirection::kForward) { | 369 if (direction == ForEachDirection::kForward) { |
333 // 7. Let k be 0. | 370 // 7. Let k be 0. |
334 k_.Bind(SmiConstant(0)); | 371 k_.Bind(SmiConstant(0)); |
335 } else { | 372 } else { |
336 k_.Bind(NumberDec(len())); | 373 k_.Bind(NumberDec(len())); |
337 } | 374 } |
338 | 375 |
339 a_.Bind(generator(this)); | 376 generator(this); |
340 | 377 |
341 HandleFastElements(processor, action, &slow, direction); | 378 HandleFastElements(processor, action, &fully_spec_compliant_, direction); |
342 | 379 |
343 BIND(&slow); | 380 BIND(&fully_spec_compliant_); |
344 | 381 |
345 Node* result = | 382 Node* result = |
346 CallStub(slow_case_continuation, context(), receiver(), callbackfn(), | 383 CallStub(slow_case_continuation, context(), receiver(), callbackfn(), |
347 this_arg(), a_.value(), o(), k_.value(), len(), to_.value()); | 384 this_arg(), a_.value(), o(), k_.value(), len(), to_.value()); |
348 ReturnFromBuiltin(result); | 385 ReturnFromBuiltin(result); |
349 } | 386 } |
350 | 387 |
351 void InitIteratingArrayBuiltinLoopContinuation(Node* context, Node* receiver, | 388 void InitIteratingArrayBuiltinLoopContinuation(Node* context, Node* receiver, |
352 Node* callbackfn, | 389 Node* callbackfn, |
353 Node* this_arg, Node* a, | 390 Node* this_arg, Node* a, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 label_ptrs.push_back(&label); | 470 label_ptrs.push_back(&label); |
434 } | 471 } |
435 | 472 |
436 BIND(&distinguish_types); | 473 BIND(&distinguish_types); |
437 | 474 |
438 if (direction == ForEachDirection::kForward) { | 475 if (direction == ForEachDirection::kForward) { |
439 k_.Bind(SmiConstant(0)); | 476 k_.Bind(SmiConstant(0)); |
440 } else { | 477 } else { |
441 k_.Bind(NumberDec(len())); | 478 k_.Bind(NumberDec(len())); |
442 } | 479 } |
443 a_.Bind(generator(this)); | 480 generator(this); |
444 Node* elements_type = LoadInstanceType(LoadElements(o_)); | 481 Node* elements_type = LoadInstanceType(LoadElements(o_)); |
445 Switch(elements_type, &unexpected_instance_type, instance_types.data(), | 482 Switch(elements_type, &unexpected_instance_type, instance_types.data(), |
446 label_ptrs.data(), labels.size()); | 483 label_ptrs.data(), labels.size()); |
447 | 484 |
448 for (size_t i = 0; i < labels.size(); ++i) { | 485 for (size_t i = 0; i < labels.size(); ++i) { |
449 BIND(&labels[i]); | 486 BIND(&labels[i]); |
450 Label done(this); | 487 Label done(this); |
451 // TODO(tebbi): Silently cancelling the loop on buffer detachment is a | 488 // TODO(tebbi): Silently cancelling the loop on buffer detachment is a |
452 // spec violation. Should go to &detached and throw a TypeError instead. | 489 // spec violation. Should go to &detached and throw a TypeError instead. |
453 VisitAllTypedArrayElements( | 490 VisitAllTypedArrayElements( |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 Node* o_ = nullptr; | 720 Node* o_ = nullptr; |
684 Node* this_arg_ = nullptr; | 721 Node* this_arg_ = nullptr; |
685 Node* len_ = nullptr; | 722 Node* len_ = nullptr; |
686 Node* context_ = nullptr; | 723 Node* context_ = nullptr; |
687 Node* receiver_ = nullptr; | 724 Node* receiver_ = nullptr; |
688 Node* new_target_ = nullptr; | 725 Node* new_target_ = nullptr; |
689 Node* argc_ = nullptr; | 726 Node* argc_ = nullptr; |
690 Variable k_; | 727 Variable k_; |
691 Variable a_; | 728 Variable a_; |
692 Variable to_; | 729 Variable to_; |
| 730 Label fully_spec_compliant_; |
693 }; | 731 }; |
694 | 732 |
695 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { | 733 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { |
696 VARIABLE(arg_index, MachineType::PointerRepresentation()); | 734 VARIABLE(arg_index, MachineType::PointerRepresentation()); |
697 Label default_label(this, &arg_index); | 735 Label default_label(this, &arg_index); |
698 Label smi_transition(this); | 736 Label smi_transition(this); |
699 Label object_push_pre(this); | 737 Label object_push_pre(this); |
700 Label object_push(this, &arg_index); | 738 Label object_push(this, &arg_index); |
701 Label double_push(this, &arg_index); | 739 Label double_push(this, &arg_index); |
702 Label double_transition(this); | 740 Label double_transition(this); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 Node* object = Parameter(Descriptor::kObject); | 1199 Node* object = Parameter(Descriptor::kObject); |
1162 Node* initial_k = Parameter(Descriptor::kInitialK); | 1200 Node* initial_k = Parameter(Descriptor::kInitialK); |
1163 Node* len = Parameter(Descriptor::kLength); | 1201 Node* len = Parameter(Descriptor::kLength); |
1164 Node* to = Parameter(Descriptor::kTo); | 1202 Node* to = Parameter(Descriptor::kTo); |
1165 | 1203 |
1166 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, | 1204 InitIteratingArrayBuiltinLoopContinuation(context, receiver, callbackfn, |
1167 this_arg, array, object, initial_k, | 1205 this_arg, array, object, initial_k, |
1168 len, to); | 1206 len, to); |
1169 | 1207 |
1170 GenerateIteratingArrayBuiltinLoopContinuation( | 1208 GenerateIteratingArrayBuiltinLoopContinuation( |
1171 &ArrayBuiltinCodeStubAssembler::MapProcessor, | 1209 &ArrayBuiltinCodeStubAssembler::SpecCompliantMapProcessor, |
1172 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); | 1210 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction); |
1173 } | 1211 } |
1174 | 1212 |
1175 TF_BUILTIN(ArrayMap, ArrayBuiltinCodeStubAssembler) { | 1213 TF_BUILTIN(ArrayMap, ArrayBuiltinCodeStubAssembler) { |
1176 Node* argc = | 1214 Node* argc = |
1177 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); | 1215 ChangeInt32ToIntPtr(Parameter(BuiltinDescriptor::kArgumentsCount)); |
1178 CodeStubArguments args(this, argc); | 1216 CodeStubArguments args(this, argc); |
1179 Node* context = Parameter(BuiltinDescriptor::kContext); | 1217 Node* context = Parameter(BuiltinDescriptor::kContext); |
1180 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); | 1218 Node* new_target = Parameter(BuiltinDescriptor::kNewTarget); |
1181 Node* receiver = args.GetReceiver(); | 1219 Node* receiver = args.GetReceiver(); |
1182 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); | 1220 Node* callbackfn = args.GetOptionalArgumentValue(0, UndefinedConstant()); |
1183 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); | 1221 Node* this_arg = args.GetOptionalArgumentValue(1, UndefinedConstant()); |
1184 | 1222 |
1185 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, | 1223 InitIteratingArrayBuiltinBody(context, receiver, callbackfn, this_arg, |
1186 new_target, argc); | 1224 new_target, argc); |
1187 | 1225 |
1188 GenerateIteratingArrayBuiltinBody( | 1226 GenerateIteratingArrayBuiltinBody( |
1189 "Array.prototype.map", &ArrayBuiltinCodeStubAssembler::MapResultGenerator, | 1227 "Array.prototype.map", &ArrayBuiltinCodeStubAssembler::MapResultGenerator, |
1190 &ArrayBuiltinCodeStubAssembler::MapProcessor, | 1228 &ArrayBuiltinCodeStubAssembler::FastMapProcessor, |
1191 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, | 1229 &ArrayBuiltinCodeStubAssembler::NullPostLoopAction, |
1192 Builtins::CallableFor(isolate(), Builtins::kArrayMapLoopContinuation)); | 1230 Builtins::CallableFor(isolate(), Builtins::kArrayMapLoopContinuation)); |
1193 } | 1231 } |
1194 | 1232 |
1195 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { | 1233 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { |
1196 Node* object = Parameter(Descriptor::kArg); | 1234 Node* object = Parameter(Descriptor::kArg); |
1197 Node* context = Parameter(Descriptor::kContext); | 1235 Node* context = Parameter(Descriptor::kContext); |
1198 | 1236 |
1199 Label call_runtime(this), return_true(this), return_false(this); | 1237 Label call_runtime(this), return_true(this), return_false(this); |
1200 | 1238 |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 { | 2284 { |
2247 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 2285 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); |
2248 CallRuntime(Runtime::kThrowTypeError, context, message, | 2286 CallRuntime(Runtime::kThrowTypeError, context, message, |
2249 HeapConstant(operation)); | 2287 HeapConstant(operation)); |
2250 Unreachable(); | 2288 Unreachable(); |
2251 } | 2289 } |
2252 } | 2290 } |
2253 | 2291 |
2254 } // namespace internal | 2292 } // namespace internal |
2255 } // namespace v8 | 2293 } // namespace v8 |
OLD | NEW |