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-string-gen.h" | 5 #include "src/builtins/builtins-string-gen.h" |
6 | 6 |
7 #include "src/builtins/builtins-regexp-gen.h" | 7 #include "src/builtins/builtins-regexp-gen.h" |
8 #include "src/builtins/builtins-utils-gen.h" | 8 #include "src/builtins/builtins-utils-gen.h" |
9 #include "src/builtins/builtins.h" | 9 #include "src/builtins/builtins.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 | 1386 |
1387 return CallBuiltin(Builtins::kRegExpSplit, context, separator, | 1387 return CallBuiltin(Builtins::kRegExpSplit, context, separator, |
1388 subject_string, limit); | 1388 subject_string, limit); |
1389 }, | 1389 }, |
1390 [=](Node* fn) { | 1390 [=](Node* fn) { |
1391 Callable call_callable = CodeFactory::Call(isolate()); | 1391 Callable call_callable = CodeFactory::Call(isolate()); |
1392 return CallJS(call_callable, context, fn, separator, receiver, limit); | 1392 return CallJS(call_callable, context, fn, separator, receiver, limit); |
1393 }); | 1393 }); |
1394 | 1394 |
1395 // String and integer conversions. | 1395 // String and integer conversions. |
1396 // TODO(jgruber): The old implementation used Uint32Max instead of SmiMax - | |
1397 // but AFAIK there should not be a difference since arrays are capped at Smi | |
1398 // lengths. | |
1399 | 1396 |
1400 Node* const subject_string = ToString_Inline(context, receiver); | 1397 Node* const subject_string = ToString_Inline(context, receiver); |
1401 Node* const limit_number = | 1398 Node* const limit_number = |
1402 Select(IsUndefined(limit), [=]() { return SmiConstant(Smi::kMaxValue); }, | 1399 Select(IsUndefined(limit), [=]() { return NumberConstant(kMaxUInt32); }, |
1403 [=]() { return ToUint32(context, limit); }, | 1400 [=]() { return ToUint32(context, limit); }, |
1404 MachineRepresentation::kTagged); | 1401 MachineRepresentation::kTagged); |
1405 Node* const separator_string = ToString_Inline(context, separator); | 1402 Node* const separator_string = ToString_Inline(context, separator); |
1406 | 1403 |
1407 // Shortcut for {limit} == 0. | 1404 // Shortcut for {limit} == 0. |
1408 { | 1405 { |
1409 Label next(this); | 1406 Label next(this); |
1410 GotoIfNot(SmiEqual(limit_number, smi_zero), &next); | 1407 GotoIfNot(SmiEqual(limit_number, smi_zero), &next); |
1411 | 1408 |
1412 const ElementsKind kind = FAST_ELEMENTS; | 1409 const ElementsKind kind = FAST_ELEMENTS; |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, | 1816 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, |
1820 HeapConstant(factory()->NewStringFromAsciiChecked( | 1817 HeapConstant(factory()->NewStringFromAsciiChecked( |
1821 "String Iterator.prototype.next", TENURED)), | 1818 "String Iterator.prototype.next", TENURED)), |
1822 iterator); | 1819 iterator); |
1823 Unreachable(); | 1820 Unreachable(); |
1824 } | 1821 } |
1825 } | 1822 } |
1826 | 1823 |
1827 } // namespace internal | 1824 } // namespace internal |
1828 } // namespace v8 | 1825 } // namespace v8 |
OLD | NEW |