OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/regexp/regexp-utils.h" | 9 #include "src/regexp/regexp-utils.h" |
10 | 10 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 // ----------------------------------------------------------------------------- | 415 // ----------------------------------------------------------------------------- |
416 // ES6 section 21.1 String Objects | 416 // ES6 section 21.1 String Objects |
417 | 417 |
418 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) | 418 // ES6 section 21.1.2.1 String.fromCharCode ( ...codeUnits ) |
419 TF_BUILTIN(StringFromCharCode, CodeStubAssembler) { | 419 TF_BUILTIN(StringFromCharCode, CodeStubAssembler) { |
420 Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount); | 420 Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount); |
421 Node* context = Parameter(BuiltinDescriptor::kContext); | 421 Node* context = Parameter(BuiltinDescriptor::kContext); |
422 | 422 |
423 CodeStubArguments arguments(this, argc); | 423 CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc)); |
424 // From now on use word-size argc value. | 424 // From now on use word-size argc value. |
425 argc = arguments.GetLength(); | 425 argc = arguments.GetLength(); |
426 | 426 |
427 // Check if we have exactly one argument (plus the implicit receiver), i.e. | 427 // Check if we have exactly one argument (plus the implicit receiver), i.e. |
428 // if the parent frame is not an arguments adaptor frame. | 428 // if the parent frame is not an arguments adaptor frame. |
429 Label if_oneargument(this), if_notoneargument(this); | 429 Label if_oneargument(this), if_notoneargument(this); |
430 Branch(WordEqual(argc, IntPtrConstant(1)), &if_oneargument, | 430 Branch(WordEqual(argc, IntPtrConstant(1)), &if_oneargument, |
431 &if_notoneargument); | 431 &if_notoneargument); |
432 | 432 |
433 Bind(&if_oneargument); | 433 Bind(&if_oneargument); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 TF_BUILTIN(StringPrototypeIndexOf, StringBuiltinsAssembler) { | 879 TF_BUILTIN(StringPrototypeIndexOf, StringBuiltinsAssembler) { |
880 Variable search_string(this, MachineRepresentation::kTagged), | 880 Variable search_string(this, MachineRepresentation::kTagged), |
881 position(this, MachineRepresentation::kTagged); | 881 position(this, MachineRepresentation::kTagged); |
882 Label call_runtime(this), call_runtime_unchecked(this), argc_0(this), | 882 Label call_runtime(this), call_runtime_unchecked(this), argc_0(this), |
883 no_argc_0(this), argc_1(this), no_argc_1(this), argc_2(this), | 883 no_argc_0(this), argc_1(this), no_argc_1(this), argc_2(this), |
884 fast_path(this), return_minus_1(this); | 884 fast_path(this), return_minus_1(this); |
885 | 885 |
886 Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount); | 886 Node* argc = Parameter(BuiltinDescriptor::kArgumentsCount); |
887 Node* context = Parameter(BuiltinDescriptor::kContext); | 887 Node* context = Parameter(BuiltinDescriptor::kContext); |
888 | 888 |
889 CodeStubArguments arguments(this, argc); | 889 CodeStubArguments arguments(this, ChangeInt32ToIntPtr(argc)); |
890 Node* receiver = arguments.GetReceiver(); | 890 Node* receiver = arguments.GetReceiver(); |
891 // From now on use word-size argc value. | 891 // From now on use word-size argc value. |
892 argc = arguments.GetLength(); | 892 argc = arguments.GetLength(); |
893 | 893 |
894 GotoIf(IntPtrEqual(argc, IntPtrConstant(0)), &argc_0); | 894 GotoIf(IntPtrEqual(argc, IntPtrConstant(0)), &argc_0); |
895 GotoIf(IntPtrEqual(argc, IntPtrConstant(1)), &argc_1); | 895 GotoIf(IntPtrEqual(argc, IntPtrConstant(1)), &argc_1); |
896 Goto(&argc_2); | 896 Goto(&argc_2); |
897 Bind(&argc_0); | 897 Bind(&argc_0); |
898 { | 898 { |
899 Comment("0 Argument case"); | 899 Comment("0 Argument case"); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, | 1497 CallRuntime(Runtime::kThrowIncompatibleMethodReceiver, context, |
1498 HeapConstant(factory()->NewStringFromAsciiChecked( | 1498 HeapConstant(factory()->NewStringFromAsciiChecked( |
1499 "String Iterator.prototype.next", TENURED)), | 1499 "String Iterator.prototype.next", TENURED)), |
1500 iterator); | 1500 iterator); |
1501 Return(result); // Never reached. | 1501 Return(result); // Never reached. |
1502 } | 1502 } |
1503 } | 1503 } |
1504 | 1504 |
1505 } // namespace internal | 1505 } // namespace internal |
1506 } // namespace v8 | 1506 } // namespace v8 |
OLD | NEW |