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), to_(this, MachineRepresentation::kTagged) { |
| 16 to_.Bind(SmiConstant(0)); |
| 17 } |
16 | 18 |
17 typedef std::function<Node*(Node* o, Node* len)> BuiltinResultGenerator; | 19 typedef std::function<Node*(Node* context, Node* o, Node* len)> |
18 typedef std::function<void(Node* a, Node* pK, Node* value)> | 20 BuiltinResultGenerator; |
| 21 typedef std::function<void(Node* context, Node* a)> |
| 22 BuiltinResultIndexInitializer; |
| 23 typedef std::function<void(Node* context, Node* value, Node* a, |
| 24 Node* callback_result)> |
19 CallResultProcessor; | 25 CallResultProcessor; |
20 | 26 |
21 void GenerateIteratingArrayBuiltinBody( | 27 void GenerateIteratingArrayBuiltinBody( |
22 const char* name, const BuiltinResultGenerator& generator, | 28 const char* name, const BuiltinResultGenerator& generator, |
23 const CallResultProcessor& processor, | 29 const CallResultProcessor& processor, |
24 const Callable& slow_case_continuation) { | 30 const Callable& slow_case_continuation) { |
25 // TODO(ishell): use constants from Descriptor once the JSFunction linkage | 31 // TODO(ishell): use constants from Descriptor once the JSFunction linkage |
26 // arguments are reordered. | 32 // arguments are reordered. |
27 Node* receiver = Parameter(IteratingArrayBuiltinDescriptor::kReceiver); | 33 Node* receiver = Parameter(IteratingArrayBuiltinDescriptor::kReceiver); |
28 Node* callbackfn = Parameter(IteratingArrayBuiltinDescriptor::kCallback); | 34 Node* callbackfn = Parameter(IteratingArrayBuiltinDescriptor::kCallback); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 86 |
81 Bind(&type_exception); | 87 Bind(&type_exception); |
82 { | 88 { |
83 CallRuntime(Runtime::kThrowTypeError, context, | 89 CallRuntime(Runtime::kThrowTypeError, context, |
84 SmiConstant(MessageTemplate::kCalledNonCallable), callbackfn); | 90 SmiConstant(MessageTemplate::kCalledNonCallable), callbackfn); |
85 Unreachable(); | 91 Unreachable(); |
86 } | 92 } |
87 | 93 |
88 Bind(&done); | 94 Bind(&done); |
89 | 95 |
90 Node* a = generator(o, len); | 96 Node* a = generator(context, o, len); |
91 | 97 |
92 // 6. If thisArg was supplied, let T be thisArg; else let T be undefined. | 98 // 6. If thisArg was supplied, let T be thisArg; else let T be undefined. |
93 // [Already done by the arguments adapter] | 99 // [Already done by the arguments adapter] |
94 | 100 |
95 HandleFastElements(context, this_arg, o, len, callbackfn, processor, a, k, | 101 HandleFastElements(context, this_arg, o, len, callbackfn, processor, a, k, |
96 &slow); | 102 &slow); |
97 | 103 |
98 // 7. Let k be 0. | 104 // 7. Let k be 0. |
99 // Already done above in initialization of the Variable k | 105 // Already done above in initialization of the Variable k |
100 | 106 |
101 Bind(&slow); | 107 Bind(&slow); |
102 | 108 |
103 Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, | 109 Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, |
104 MachineType::TaggedPointer()); | 110 MachineType::TaggedPointer()); |
105 TailCallStub( | 111 TailCallStub( |
106 slow_case_continuation, context, target, new_target, | 112 slow_case_continuation, context, target, new_target, |
107 Int32Constant(IteratingArrayBuiltinLoopContinuationDescriptor::kArity), | 113 Int32Constant(IteratingArrayBuiltinLoopContinuationDescriptor::kArity), |
108 receiver, callbackfn, this_arg, a, o, k.value(), len); | 114 receiver, callbackfn, this_arg, a, o, k.value(), len); |
109 } | 115 } |
110 | 116 |
111 void GenerateIteratingArrayBuiltinLoopContinuation( | 117 void GenerateIteratingArrayBuiltinLoopContinuation( |
| 118 const BuiltinResultIndexInitializer& index_initializer, |
112 const CallResultProcessor& processor) { | 119 const CallResultProcessor& processor) { |
113 // TODO(ishell): use constants from Descriptor once the JSFunction linkage | 120 // TODO(ishell): use constants from Descriptor once the JSFunction linkage |
114 // arguments are reordered. | 121 // arguments are reordered. |
115 Node* callbackfn = | 122 Node* callbackfn = |
116 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kCallback); | 123 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kCallback); |
117 Node* this_arg = | 124 Node* this_arg = |
118 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kThisArg); | 125 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kThisArg); |
119 Node* a = | 126 Node* a = |
120 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kArray); | 127 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kArray); |
121 Node* o = | 128 Node* o = |
122 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kObject); | 129 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kObject); |
123 Node* initial_k = | 130 Node* initial_k = |
124 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kInitialK); | 131 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kInitialK); |
125 Node* len = | 132 Node* len = |
126 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kLength); | 133 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kLength); |
127 Node* context = | 134 Node* context = |
128 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kContext); | 135 Parameter(IteratingArrayBuiltinLoopContinuationDescriptor::kContext); |
129 | 136 |
| 137 index_initializer(context, a); |
| 138 |
130 // 8. Repeat, while k < len | 139 // 8. Repeat, while k < len |
131 Variable k(this, MachineRepresentation::kTagged, initial_k); | 140 Variable k(this, MachineRepresentation::kTagged, initial_k); |
132 Label loop(this, &k); | 141 VariableList list({&k, &to_}, zone()); |
| 142 Label loop(this, list); |
133 Label after_loop(this); | 143 Label after_loop(this); |
134 Goto(&loop); | 144 Goto(&loop); |
135 Bind(&loop); | 145 Bind(&loop); |
136 { | 146 { |
137 GotoUnlessNumberLessThan(k.value(), len, &after_loop); | 147 GotoUnlessNumberLessThan(k.value(), len, &after_loop); |
138 | 148 |
139 Label done_element(this); | 149 Label done_element(this, &to_); |
140 // a. Let Pk be ToString(k). | 150 // a. Let Pk be ToString(k). |
141 Node* p_k = ToString(context, k.value()); | 151 Node* p_k = ToString(context, k.value()); |
142 | 152 |
143 // b. Let kPresent be HasProperty(O, Pk). | 153 // b. Let kPresent be HasProperty(O, Pk). |
144 // c. ReturnIfAbrupt(kPresent). | 154 // c. ReturnIfAbrupt(kPresent). |
145 Node* k_present = HasProperty(o, p_k, context); | 155 Node* k_present = HasProperty(o, p_k, context); |
146 | 156 |
147 // d. If kPresent is true, then | 157 // d. If kPresent is true, then |
148 GotoIf(WordNotEqual(k_present, TrueConstant()), &done_element); | 158 GotoIf(WordNotEqual(k_present, TrueConstant()), &done_element); |
149 | 159 |
150 // i. Let kValue be Get(O, Pk). | 160 // i. Let kValue be Get(O, Pk). |
151 // ii. ReturnIfAbrupt(kValue). | 161 // ii. ReturnIfAbrupt(kValue). |
152 Node* k_value = GetProperty(context, o, k.value()); | 162 Node* k_value = GetProperty(context, o, k.value()); |
153 | 163 |
154 // iii. Let funcResult be Call(callbackfn, T, «kValue, k, O»). | 164 // iii. Let funcResult be Call(callbackfn, T, «kValue, k, O»). |
155 // iv. ReturnIfAbrupt(funcResult). | 165 // iv. ReturnIfAbrupt(funcResult). |
156 Node* result = CallJS(CodeFactory::Call(isolate()), context, callbackfn, | 166 Node* callback_result = |
157 this_arg, k_value, k.value(), o); | 167 CallJS(CodeFactory::Call(isolate()), context, callbackfn, this_arg, |
| 168 k_value, k.value(), o); |
158 | 169 |
159 processor(a, p_k, result); | 170 processor(context, k_value, a, callback_result); |
160 Goto(&done_element); | 171 Goto(&done_element); |
161 Bind(&done_element); | 172 Bind(&done_element); |
162 | 173 |
163 // e. Increase k by 1. | 174 // e. Increase k by 1. |
164 k.Bind(NumberInc(k.value())); | 175 k.Bind(NumberInc(k.value())); |
165 Goto(&loop); | 176 Goto(&loop); |
166 } | 177 } |
167 Bind(&after_loop); | 178 Bind(&after_loop); |
168 Return(a); | 179 Return(a); |
169 } | 180 } |
170 | 181 |
171 void ForEachProcessor(Node* a, Node* p_k, Node* value) {} | 182 Node* FilterResultGenerator(Node* context, Node* o, Node* len) { |
| 183 // 7. Let A be ArraySpeciesCreate(O, 0). |
| 184 return ArraySpeciesCreate(context, o, SmiConstant(0)); |
| 185 } |
172 | 186 |
173 void SomeProcessor(Node* a, Node* p_k, Node* value) { | 187 void FilterResultIndexReinitializer(Node* context, Node* a) { |
| 188 Variable merged_length(this, MachineRepresentation::kTagged); |
| 189 Label has_length(this, &merged_length), not_js_array(this); |
| 190 GotoIf(DoesntHaveInstanceType(a, JS_ARRAY_TYPE), ¬_js_array); |
| 191 merged_length.Bind(LoadJSArrayLength(a)); |
| 192 Goto(&has_length); |
| 193 Bind(¬_js_array); |
| 194 Node* len_property = |
| 195 GetProperty(context, a, isolate()->factory()->length_string()); |
| 196 merged_length.Bind( |
| 197 CallStub(CodeFactory::ToLength(isolate()), context, len_property)); |
| 198 Goto(&has_length); |
| 199 Bind(&has_length); |
| 200 Node* len = merged_length.value(); |
| 201 |
| 202 to_.Bind(len); |
| 203 } |
| 204 |
| 205 void ForEachProcessor(Node* context, Node* value, Node* a, |
| 206 Node* callback_result) {} |
| 207 |
| 208 void SomeProcessor(Node* context, Node* value, Node* a, |
| 209 Node* callback_result) { |
174 Label false_continue(this), return_true(this); | 210 Label false_continue(this), return_true(this); |
175 BranchIfToBooleanIsTrue(value, &return_true, &false_continue); | 211 BranchIfToBooleanIsTrue(callback_result, &return_true, &false_continue); |
176 Bind(&return_true); | 212 Bind(&return_true); |
177 Return(TrueConstant()); | 213 Return(TrueConstant()); |
178 Bind(&false_continue); | 214 Bind(&false_continue); |
179 } | 215 } |
180 | 216 |
181 void EveryProcessor(Node* a, Node* p_k, Node* value) { | 217 void EveryProcessor(Node* context, Node* value, Node* a, |
| 218 Node* callback_result) { |
182 Label true_continue(this), return_false(this); | 219 Label true_continue(this), return_false(this); |
183 BranchIfToBooleanIsTrue(value, &true_continue, &return_false); | 220 BranchIfToBooleanIsTrue(callback_result, &true_continue, &return_false); |
184 Bind(&return_false); | 221 Bind(&return_false); |
185 Return(FalseConstant()); | 222 Return(FalseConstant()); |
186 Bind(&true_continue); | 223 Bind(&true_continue); |
187 } | 224 } |
188 | 225 |
| 226 void FilterProcessor(Node* context, Node* value, Node* a, |
| 227 Node* callback_result) { |
| 228 Label true_continue(this, &to_), false_continue(this); |
| 229 BranchIfToBooleanIsTrue(callback_result, &true_continue, &false_continue); |
| 230 Bind(&true_continue); |
| 231 |
| 232 // 1. let status be CreateDataPropertyOrThrow(A, ToString(to), kValue). |
| 233 // 2. ReturnIfAbrupt(status) |
| 234 Node* const p_to = ToString(context, to_.value()); |
| 235 CallRuntime(Runtime::kCreateDataProperty, context, a, p_to, value); |
| 236 |
| 237 // 3. Increase to by 1. |
| 238 to_.Bind(NumberInc(to_.value())); |
| 239 Goto(&false_continue); |
| 240 Bind(&false_continue); |
| 241 } |
| 242 |
189 private: | 243 private: |
190 Node* VisitAllFastElementsOneKind(Node* context, ElementsKind kind, | 244 Node* VisitAllFastElementsOneKind(Node* context, ElementsKind kind, |
191 Node* this_arg, Node* o, Node* len, | 245 Node* this_arg, Node* o, Node* len, |
192 Node* callbackfn, | 246 Node* callbackfn, |
193 const CallResultProcessor& processor, | 247 const CallResultProcessor& processor, |
194 Node* a, Label* array_changed, | 248 Node* a, Label* array_changed, |
195 ParameterMode mode) { | 249 ParameterMode mode) { |
196 Comment("begin VisitAllFastElementsOneKind"); | 250 Comment("begin VisitAllFastElementsOneKind"); |
197 Variable original_map(this, MachineRepresentation::kTagged); | 251 Variable original_map(this, MachineRepresentation::kTagged); |
198 original_map.Bind(LoadMap(o)); | 252 original_map.Bind(LoadMap(o)); |
199 VariableList list({&original_map}, zone()); | 253 VariableList list({&original_map, &to_}, zone()); |
200 Node* last_index = nullptr; | 254 Node* last_index = nullptr; |
201 BuildFastLoop( | 255 BuildFastLoop( |
202 list, IntPtrOrSmiConstant(0, mode), TaggedToParameter(len, mode), | 256 list, IntPtrOrSmiConstant(0, mode), TaggedToParameter(len, mode), |
203 [=, &original_map, &last_index](Node* index) { | 257 [=, &original_map, &last_index](Node* index) { |
204 last_index = index; | 258 last_index = index; |
205 Label one_element_done(this), hole_element(this); | 259 Label one_element_done(this), hole_element(this); |
206 | 260 |
207 // Check if o's map has changed during the callback. If so, we have to | 261 // Check if o's map has changed during the callback. If so, we have to |
208 // fall back to the slower spec implementation for the rest of the | 262 // fall back to the slower spec implementation for the rest of the |
209 // iteration. | 263 // iteration. |
(...skipping 18 matching lines...) Expand all Loading... |
228 Node* offset = ElementOffsetFromIndex(index, kind, mode, base_size); | 282 Node* offset = ElementOffsetFromIndex(index, kind, mode, base_size); |
229 Node* value = nullptr; | 283 Node* value = nullptr; |
230 if (kind == FAST_ELEMENTS) { | 284 if (kind == FAST_ELEMENTS) { |
231 value = LoadObjectField(elements, offset); | 285 value = LoadObjectField(elements, offset); |
232 GotoIf(WordEqual(value, TheHoleConstant()), &hole_element); | 286 GotoIf(WordEqual(value, TheHoleConstant()), &hole_element); |
233 } else { | 287 } else { |
234 Node* double_value = | 288 Node* double_value = |
235 LoadDoubleWithHoleCheck(elements, offset, &hole_element); | 289 LoadDoubleWithHoleCheck(elements, offset, &hole_element); |
236 value = AllocateHeapNumberWithValue(double_value); | 290 value = AllocateHeapNumberWithValue(double_value); |
237 } | 291 } |
238 Node* result = CallJS(CodeFactory::Call(isolate()), context, | 292 Node* callback_result = |
239 callbackfn, this_arg, value, tagged_index, o); | 293 CallJS(CodeFactory::Call(isolate()), context, callbackfn, |
240 processor(a, tagged_index, result); | 294 this_arg, value, tagged_index, o); |
| 295 processor(context, value, a, callback_result); |
241 Goto(&one_element_done); | 296 Goto(&one_element_done); |
242 | 297 |
243 Bind(&hole_element); | 298 Bind(&hole_element); |
244 // Check if o's prototype change unexpectedly has elements after the | 299 // Check if o's prototype change unexpectedly has elements after the |
245 // callback in the case of a hole. | 300 // callback in the case of a hole. |
246 BranchIfPrototypesHaveNoElements(o_map, &one_element_done, | 301 BranchIfPrototypesHaveNoElements(o_map, &one_element_done, |
247 array_changed); | 302 array_changed); |
248 | 303 |
249 Bind(&one_element_done); | 304 Bind(&one_element_done); |
250 }, | 305 }, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 processor, a, &array_changed, mode); | 358 processor, a, &array_changed, mode); |
304 | 359 |
305 // No exception, return success | 360 // No exception, return success |
306 Return(a); | 361 Return(a); |
307 | 362 |
308 Bind(&array_changed); | 363 Bind(&array_changed); |
309 k.Bind(ParameterToTagged(last_index, mode)); | 364 k.Bind(ParameterToTagged(last_index, mode)); |
310 Goto(slow); | 365 Goto(slow); |
311 } | 366 } |
312 } | 367 } |
| 368 |
| 369 Variable to_; |
313 }; | 370 }; |
314 | 371 |
315 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { | 372 TF_BUILTIN(FastArrayPush, CodeStubAssembler) { |
316 Variable arg_index(this, MachineType::PointerRepresentation()); | 373 Variable arg_index(this, MachineType::PointerRepresentation()); |
317 Label default_label(this, &arg_index); | 374 Label default_label(this, &arg_index); |
318 Label smi_transition(this); | 375 Label smi_transition(this); |
319 Label object_push_pre(this); | 376 Label object_push_pre(this); |
320 Label object_push(this, &arg_index); | 377 Label object_push(this, &arg_index); |
321 Label double_push(this, &arg_index); | 378 Label double_push(this, &arg_index); |
322 Label double_transition(this); | 379 Label double_transition(this); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 { | 520 { |
464 Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, | 521 Node* target = LoadFromFrame(StandardFrameConstants::kFunctionOffset, |
465 MachineType::TaggedPointer()); | 522 MachineType::TaggedPointer()); |
466 TailCallStub(CodeFactory::ArrayPush(isolate()), context, target, new_target, | 523 TailCallStub(CodeFactory::ArrayPush(isolate()), context, target, new_target, |
467 argc); | 524 argc); |
468 } | 525 } |
469 } | 526 } |
470 | 527 |
471 TF_BUILTIN(ArrayForEachLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 528 TF_BUILTIN(ArrayForEachLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
472 GenerateIteratingArrayBuiltinLoopContinuation( | 529 GenerateIteratingArrayBuiltinLoopContinuation( |
473 [this](Node* a, Node* p_k, Node* value) { | 530 [](Node* context, Node* a) {}, |
474 ForEachProcessor(a, p_k, value); | 531 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 532 ForEachProcessor(context, value, a, callback_result); |
| 533 }); |
| 534 } |
| 535 |
| 536 TF_BUILTIN(ArrayFilter, ArrayBuiltinCodeStubAssembler) { |
| 537 GenerateIteratingArrayBuiltinBody( |
| 538 "Array.prototype.filter", |
| 539 [=](Node* context, Node* o, Node* len) { |
| 540 return FilterResultGenerator(context, o, len); |
| 541 }, |
| 542 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 543 FilterProcessor(context, value, a, callback_result); |
| 544 }, |
| 545 CodeFactory::ArrayFilterLoopContinuation(isolate())); |
| 546 } |
| 547 |
| 548 TF_BUILTIN(ArrayFilterLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
| 549 GenerateIteratingArrayBuiltinLoopContinuation( |
| 550 [this](Node* context, Node* a) { |
| 551 FilterResultIndexReinitializer(context, a); |
| 552 }, |
| 553 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 554 FilterProcessor(context, value, a, callback_result); |
475 }); | 555 }); |
476 } | 556 } |
477 | 557 |
478 TF_BUILTIN(ArrayForEach, ArrayBuiltinCodeStubAssembler) { | 558 TF_BUILTIN(ArrayForEach, ArrayBuiltinCodeStubAssembler) { |
479 GenerateIteratingArrayBuiltinBody( | 559 GenerateIteratingArrayBuiltinBody( |
480 "Array.prototype.forEach", | 560 "Array.prototype.forEach", |
481 [=](Node*, Node*) { return UndefinedConstant(); }, | 561 [=](Node*, Node*, Node*) { return UndefinedConstant(); }, |
482 [this](Node* a, Node* p_k, Node* value) { | 562 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
483 ForEachProcessor(a, p_k, value); | 563 ForEachProcessor(context, value, a, callback_result); |
484 }, | 564 }, |
485 CodeFactory::ArrayForEachLoopContinuation(isolate())); | 565 CodeFactory::ArrayForEachLoopContinuation(isolate())); |
486 } | 566 } |
487 | 567 |
488 TF_BUILTIN(ArraySomeLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 568 TF_BUILTIN(ArraySomeLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
489 GenerateIteratingArrayBuiltinLoopContinuation( | 569 GenerateIteratingArrayBuiltinLoopContinuation( |
490 [this](Node* a, Node* p_k, Node* value) { | 570 [](Node* context, Node* a) {}, |
491 SomeProcessor(a, p_k, value); | 571 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 572 SomeProcessor(context, value, a, callback_result); |
492 }); | 573 }); |
493 } | 574 } |
494 | 575 |
495 TF_BUILTIN(ArraySome, ArrayBuiltinCodeStubAssembler) { | 576 TF_BUILTIN(ArraySome, ArrayBuiltinCodeStubAssembler) { |
496 GenerateIteratingArrayBuiltinBody( | 577 GenerateIteratingArrayBuiltinBody( |
497 "Array.prototype.some", [=](Node*, Node*) { return FalseConstant(); }, | 578 "Array.prototype.some", |
498 [this](Node* a, Node* p_k, Node* value) { SomeProcessor(a, p_k, value); }, | 579 [=](Node*, Node*, Node*) { return FalseConstant(); }, |
| 580 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 581 SomeProcessor(context, value, a, callback_result); |
| 582 }, |
499 CodeFactory::ArraySomeLoopContinuation(isolate())); | 583 CodeFactory::ArraySomeLoopContinuation(isolate())); |
500 } | 584 } |
501 | 585 |
502 TF_BUILTIN(ArrayEveryLoopContinuation, ArrayBuiltinCodeStubAssembler) { | 586 TF_BUILTIN(ArrayEveryLoopContinuation, ArrayBuiltinCodeStubAssembler) { |
503 GenerateIteratingArrayBuiltinLoopContinuation( | 587 GenerateIteratingArrayBuiltinLoopContinuation( |
504 [this](Node* a, Node* p_k, Node* value) { | 588 [](Node* context, Node* a) {}, |
505 EveryProcessor(a, p_k, value); | 589 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 590 EveryProcessor(context, value, a, callback_result); |
506 }); | 591 }); |
507 } | 592 } |
508 | 593 |
509 TF_BUILTIN(ArrayEvery, ArrayBuiltinCodeStubAssembler) { | 594 TF_BUILTIN(ArrayEvery, ArrayBuiltinCodeStubAssembler) { |
510 GenerateIteratingArrayBuiltinBody( | 595 GenerateIteratingArrayBuiltinBody( |
511 "Array.prototype.every", [=](Node*, Node*) { return TrueConstant(); }, | 596 "Array.prototype.every", |
512 [this](Node* a, Node* p_k, Node* value) { | 597 [=](Node*, Node*, Node*) { return TrueConstant(); }, |
513 EveryProcessor(a, p_k, value); | 598 [this](Node* context, Node* value, Node* a, Node* callback_result) { |
| 599 EveryProcessor(context, value, a, callback_result); |
514 }, | 600 }, |
515 CodeFactory::ArrayEveryLoopContinuation(isolate())); | 601 CodeFactory::ArrayEveryLoopContinuation(isolate())); |
516 } | 602 } |
517 | 603 |
518 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { | 604 TF_BUILTIN(ArrayIsArray, CodeStubAssembler) { |
519 Node* object = Parameter(Descriptor::kArg); | 605 Node* object = Parameter(Descriptor::kArg); |
520 Node* context = Parameter(Descriptor::kContext); | 606 Node* context = Parameter(Descriptor::kContext); |
521 | 607 |
522 Label call_runtime(this), return_true(this), return_false(this); | 608 Label call_runtime(this), return_true(this), return_false(this); |
523 | 609 |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 { | 1655 { |
1570 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); | 1656 Node* message = SmiConstant(MessageTemplate::kDetachedOperation); |
1571 CallRuntime(Runtime::kThrowTypeError, context, message, | 1657 CallRuntime(Runtime::kThrowTypeError, context, message, |
1572 HeapConstant(operation)); | 1658 HeapConstant(operation)); |
1573 Unreachable(); | 1659 Unreachable(); |
1574 } | 1660 } |
1575 } | 1661 } |
1576 | 1662 |
1577 } // namespace internal | 1663 } // namespace internal |
1578 } // namespace v8 | 1664 } // namespace v8 |
OLD | NEW |