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.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 | 7 |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 assembler->Return(assembler->NaNConstant()); | 470 assembler->Return(assembler->NaNConstant()); |
471 assembler->Bind(&if_positioninbounds); | 471 assembler->Bind(&if_positioninbounds); |
472 } | 472 } |
473 | 473 |
474 // Load the character at the {position} from the {receiver}. | 474 // Load the character at the {position} from the {receiver}. |
475 Node* value = assembler->StringCharCodeAt(receiver, position); | 475 Node* value = assembler->StringCharCodeAt(receiver, position); |
476 Node* result = assembler->SmiFromWord32(value); | 476 Node* result = assembler->SmiFromWord32(value); |
477 assembler->Return(result); | 477 assembler->Return(result); |
478 } | 478 } |
479 | 479 |
| 480 // ES6 section 21.1.3.8 String.prototype.indexOf ( searchString [ , position ] ) |
| 481 BUILTIN(StringPrototypeIndexOf) { |
| 482 HandleScope handle_scope(isolate); |
| 483 |
| 484 return String::IndexOf(isolate, args.receiver(), |
| 485 args.atOrUndefined(isolate, 1), |
| 486 args.atOrUndefined(isolate, 2)); |
| 487 } |
| 488 |
480 // ES6 section 21.1.3.9 | 489 // ES6 section 21.1.3.9 |
481 // String.prototype.lastIndexOf ( searchString [ , position ] ) | 490 // String.prototype.lastIndexOf ( searchString [ , position ] ) |
482 BUILTIN(StringPrototypeLastIndexOf) { | 491 BUILTIN(StringPrototypeLastIndexOf) { |
483 HandleScope handle_scope(isolate); | 492 HandleScope handle_scope(isolate); |
484 return String::LastIndexOf(isolate, args.receiver(), | 493 return String::LastIndexOf(isolate, args.receiver(), |
485 args.atOrUndefined(isolate, 1), | 494 args.atOrUndefined(isolate, 1), |
486 args.atOrUndefined(isolate, 2)); | 495 args.atOrUndefined(isolate, 2)); |
487 } | 496 } |
488 | 497 |
489 // ES6 section 21.1.3.10 String.prototype.localeCompare ( that ) | 498 // ES6 section 21.1.3.10 String.prototype.localeCompare ( that ) |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 Node* receiver = assembler->Parameter(0); | 620 Node* receiver = assembler->Parameter(0); |
612 Node* context = assembler->Parameter(3); | 621 Node* context = assembler->Parameter(3); |
613 | 622 |
614 Node* result = assembler->ToThisValue( | 623 Node* result = assembler->ToThisValue( |
615 context, receiver, PrimitiveType::kString, "String.prototype.valueOf"); | 624 context, receiver, PrimitiveType::kString, "String.prototype.valueOf"); |
616 assembler->Return(result); | 625 assembler->Return(result); |
617 } | 626 } |
618 | 627 |
619 } // namespace internal | 628 } // namespace internal |
620 } // namespace v8 | 629 } // namespace v8 |
OLD | NEW |