| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef V8_BUILTINS_H_ | 5 #ifndef V8_BUILTINS_H_ |
| 6 #define V8_BUILTINS_H_ | 6 #define V8_BUILTINS_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 | 10 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 namespace compiler { | |
| 15 | |
| 16 // Forward declarations. | 14 // Forward declarations. |
| 17 class CodeStubAssembler; | 15 class CodeStubAssembler; |
| 18 | 16 |
| 19 } // namespace compiler | |
| 20 | |
| 21 // Specifies extra arguments required by a C++ builtin. | 17 // Specifies extra arguments required by a C++ builtin. |
| 22 enum class BuiltinExtraArguments : uint8_t { | 18 enum class BuiltinExtraArguments : uint8_t { |
| 23 kNone = 0u, | 19 kNone = 0u, |
| 24 kTarget = 1u << 0, | 20 kTarget = 1u << 0, |
| 25 kNewTarget = 1u << 1, | 21 kNewTarget = 1u << 1, |
| 26 kTargetAndNewTarget = kTarget | kNewTarget | 22 kTargetAndNewTarget = kTarget | kNewTarget |
| 27 }; | 23 }; |
| 28 | 24 |
| 29 inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) { | 25 inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) { |
| 30 return static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs); | 26 return static_cast<uint8_t>(lhs) & static_cast<uint8_t>(rhs); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 static void Generate_FunctionPrototypeApply(MacroAssembler* masm); | 580 static void Generate_FunctionPrototypeApply(MacroAssembler* masm); |
| 585 static void Generate_FunctionPrototypeCall(MacroAssembler* masm); | 581 static void Generate_FunctionPrototypeCall(MacroAssembler* masm); |
| 586 | 582 |
| 587 static void Generate_ReflectApply(MacroAssembler* masm); | 583 static void Generate_ReflectApply(MacroAssembler* masm); |
| 588 static void Generate_ReflectConstruct(MacroAssembler* masm); | 584 static void Generate_ReflectConstruct(MacroAssembler* masm); |
| 589 | 585 |
| 590 static void Generate_InternalArrayCode(MacroAssembler* masm); | 586 static void Generate_InternalArrayCode(MacroAssembler* masm); |
| 591 static void Generate_ArrayCode(MacroAssembler* masm); | 587 static void Generate_ArrayCode(MacroAssembler* masm); |
| 592 | 588 |
| 593 // ES6 section 20.2.2.10 Math.ceil ( x ) | 589 // ES6 section 20.2.2.10 Math.ceil ( x ) |
| 594 static void Generate_MathCeil(compiler::CodeStubAssembler* assembler); | 590 static void Generate_MathCeil(CodeStubAssembler* assembler); |
| 595 // ES6 section 20.2.2.11 Math.clz32 ( x ) | 591 // ES6 section 20.2.2.11 Math.clz32 ( x ) |
| 596 static void Generate_MathClz32(compiler::CodeStubAssembler* assembler); | 592 static void Generate_MathClz32(CodeStubAssembler* assembler); |
| 597 // ES6 section 20.2.2.16 Math.floor ( x ) | 593 // ES6 section 20.2.2.16 Math.floor ( x ) |
| 598 static void Generate_MathFloor(compiler::CodeStubAssembler* assembler); | 594 static void Generate_MathFloor(CodeStubAssembler* assembler); |
| 599 enum class MathMaxMinKind { kMax, kMin }; | 595 enum class MathMaxMinKind { kMax, kMin }; |
| 600 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); | 596 static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind); |
| 601 // ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values ) | 597 // ES6 section 20.2.2.24 Math.max ( value1, value2 , ...values ) |
| 602 static void Generate_MathMax(MacroAssembler* masm) { | 598 static void Generate_MathMax(MacroAssembler* masm) { |
| 603 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); | 599 Generate_MathMaxMin(masm, MathMaxMinKind::kMax); |
| 604 } | 600 } |
| 605 // ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values ) | 601 // ES6 section 20.2.2.25 Math.min ( value1, value2 , ...values ) |
| 606 static void Generate_MathMin(MacroAssembler* masm) { | 602 static void Generate_MathMin(MacroAssembler* masm) { |
| 607 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); | 603 Generate_MathMaxMin(masm, MathMaxMinKind::kMin); |
| 608 } | 604 } |
| 609 // ES6 section 20.2.2.28 Math.round ( x ) | 605 // ES6 section 20.2.2.28 Math.round ( x ) |
| 610 static void Generate_MathRound(compiler::CodeStubAssembler* assembler); | 606 static void Generate_MathRound(CodeStubAssembler* assembler); |
| 611 // ES6 section 20.2.2.32 Math.sqrt ( x ) | 607 // ES6 section 20.2.2.32 Math.sqrt ( x ) |
| 612 static void Generate_MathSqrt(compiler::CodeStubAssembler* assembler); | 608 static void Generate_MathSqrt(CodeStubAssembler* assembler); |
| 613 // ES6 section 20.2.2.35 Math.trunc ( x ) | 609 // ES6 section 20.2.2.35 Math.trunc ( x ) |
| 614 static void Generate_MathTrunc(compiler::CodeStubAssembler* assembler); | 610 static void Generate_MathTrunc(CodeStubAssembler* assembler); |
| 615 | 611 |
| 616 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case. | 612 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Call]] case. |
| 617 static void Generate_NumberConstructor(MacroAssembler* masm); | 613 static void Generate_NumberConstructor(MacroAssembler* masm); |
| 618 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case. | 614 // ES6 section 20.1.1.1 Number ( [ value ] ) for the [[Construct]] case. |
| 619 static void Generate_NumberConstructor_ConstructStub(MacroAssembler* masm); | 615 static void Generate_NumberConstructor_ConstructStub(MacroAssembler* masm); |
| 620 | 616 |
| 621 // ES6 section 25.3.1.2 Generator.prototype.next ( value ) | 617 // ES6 section 25.3.1.2 Generator.prototype.next ( value ) |
| 622 static void Generate_GeneratorPrototypeNext( | 618 static void Generate_GeneratorPrototypeNext(CodeStubAssembler* assembler); |
| 623 compiler::CodeStubAssembler* assembler); | |
| 624 // ES6 section 25.3.1.3 Generator.prototype.return ( value ) | 619 // ES6 section 25.3.1.3 Generator.prototype.return ( value ) |
| 625 static void Generate_GeneratorPrototypeReturn( | 620 static void Generate_GeneratorPrototypeReturn(CodeStubAssembler* assembler); |
| 626 compiler::CodeStubAssembler* assembler); | |
| 627 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) | 621 // ES6 section 25.3.1.4 Generator.prototype.throw ( exception ) |
| 628 static void Generate_GeneratorPrototypeThrow( | 622 static void Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler); |
| 629 compiler::CodeStubAssembler* assembler); | |
| 630 | 623 |
| 631 // ES6 section 19.1.3.2 Object.prototype.hasOwnProperty | 624 // ES6 section 19.1.3.2 Object.prototype.hasOwnProperty |
| 632 static void Generate_ObjectHasOwnProperty( | 625 static void Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler); |
| 633 compiler::CodeStubAssembler* assembler); | |
| 634 | 626 |
| 635 // ES6 section 21.1.3.1 String.prototype.charAt ( pos ) | 627 // ES6 section 21.1.3.1 String.prototype.charAt ( pos ) |
| 636 static void Generate_StringPrototypeCharAt( | 628 static void Generate_StringPrototypeCharAt(CodeStubAssembler* assembler); |
| 637 compiler::CodeStubAssembler* assembler); | |
| 638 // ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) | 629 // ES6 section 21.1.3.2 String.prototype.charCodeAt ( pos ) |
| 639 static void Generate_StringPrototypeCharCodeAt( | 630 static void Generate_StringPrototypeCharCodeAt(CodeStubAssembler* assembler); |
| 640 compiler::CodeStubAssembler* assembler); | |
| 641 | 631 |
| 642 static void Generate_StringConstructor(MacroAssembler* masm); | 632 static void Generate_StringConstructor(MacroAssembler* masm); |
| 643 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); | 633 static void Generate_StringConstructor_ConstructStub(MacroAssembler* masm); |
| 644 static void Generate_OnStackReplacement(MacroAssembler* masm); | 634 static void Generate_OnStackReplacement(MacroAssembler* masm); |
| 645 static void Generate_InterruptCheck(MacroAssembler* masm); | 635 static void Generate_InterruptCheck(MacroAssembler* masm); |
| 646 static void Generate_StackCheck(MacroAssembler* masm); | 636 static void Generate_StackCheck(MacroAssembler* masm); |
| 647 | 637 |
| 648 static void Generate_InterpreterEntryTrampoline(MacroAssembler* masm); | 638 static void Generate_InterpreterEntryTrampoline(MacroAssembler* masm); |
| 649 static void Generate_InterpreterExitTrampoline(MacroAssembler* masm); | 639 static void Generate_InterpreterExitTrampoline(MacroAssembler* masm); |
| 650 static void Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 640 static void Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 667 MacroAssembler* masm); \ | 657 MacroAssembler* masm); \ |
| 668 static void Generate_Make##C##CodeYoungAgainOddMarking( \ | 658 static void Generate_Make##C##CodeYoungAgainOddMarking( \ |
| 669 MacroAssembler* masm); | 659 MacroAssembler* masm); |
| 670 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) | 660 CODE_AGE_LIST(DECLARE_CODE_AGE_BUILTIN_GENERATOR) |
| 671 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR | 661 #undef DECLARE_CODE_AGE_BUILTIN_GENERATOR |
| 672 | 662 |
| 673 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); | 663 static void Generate_MarkCodeAsToBeExecutedOnce(MacroAssembler* masm); |
| 674 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); | 664 static void Generate_MarkCodeAsExecutedOnce(MacroAssembler* masm); |
| 675 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); | 665 static void Generate_MarkCodeAsExecutedTwice(MacroAssembler* masm); |
| 676 | 666 |
| 677 static void Generate_AtomicsLoadCheck(compiler::CodeStubAssembler* assembler); | 667 static void Generate_AtomicsLoadCheck(CodeStubAssembler* assembler); |
| 678 | 668 |
| 679 static void InitBuiltinFunctionTable(); | 669 static void InitBuiltinFunctionTable(); |
| 680 | 670 |
| 681 bool initialized_; | 671 bool initialized_; |
| 682 | 672 |
| 683 friend class BuiltinFunctionTable; | 673 friend class BuiltinFunctionTable; |
| 684 friend class Isolate; | 674 friend class Isolate; |
| 685 | 675 |
| 686 DISALLOW_COPY_AND_ASSIGN(Builtins); | 676 DISALLOW_COPY_AND_ASSIGN(Builtins); |
| 687 }; | 677 }; |
| 688 | 678 |
| 689 } // namespace internal | 679 } // namespace internal |
| 690 } // namespace v8 | 680 } // namespace v8 |
| 691 | 681 |
| 692 #endif // V8_BUILTINS_H_ | 682 #endif // V8_BUILTINS_H_ |
| OLD | NEW |