| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // initially generated. | 161 // initially generated. |
| 162 void RecordCodeGeneration(Code* code, MacroAssembler* masm); | 162 void RecordCodeGeneration(Code* code, MacroAssembler* masm); |
| 163 | 163 |
| 164 // Finish the code object after it has been generated. | 164 // Finish the code object after it has been generated. |
| 165 virtual void FinishCode(Code* code) { } | 165 virtual void FinishCode(Code* code) { } |
| 166 | 166 |
| 167 // Returns information for computing the number key. | 167 // Returns information for computing the number key. |
| 168 virtual Major MajorKey() = 0; | 168 virtual Major MajorKey() = 0; |
| 169 virtual int MinorKey() = 0; | 169 virtual int MinorKey() = 0; |
| 170 | 170 |
| 171 // The CallFunctionStub needs to override this so it can encode whether a | |
| 172 // lazily generated function should be fully optimized or not. | |
| 173 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } | |
| 174 | |
| 175 // BinaryOpStub needs to override this. | 171 // BinaryOpStub needs to override this. |
| 176 virtual int GetCodeKind(); | 172 virtual int GetCodeKind(); |
| 177 | 173 |
| 178 // BinaryOpStub needs to override this. | 174 // BinaryOpStub needs to override this. |
| 179 virtual InlineCacheState GetICState() { | 175 virtual InlineCacheState GetICState() { |
| 180 return UNINITIALIZED; | 176 return UNINITIALIZED; |
| 181 } | 177 } |
| 182 | 178 |
| 183 // Returns a name for logging/debugging purposes. | 179 // Returns a name for logging/debugging purposes. |
| 184 SmartArrayPointer<const char> GetName(); | 180 SmartArrayPointer<const char> GetName(); |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 private: | 635 private: |
| 640 Major MajorKey() { return RegExpConstructResult; } | 636 Major MajorKey() { return RegExpConstructResult; } |
| 641 int MinorKey() { return 0; } | 637 int MinorKey() { return 0; } |
| 642 | 638 |
| 643 void Generate(MacroAssembler* masm); | 639 void Generate(MacroAssembler* masm); |
| 644 }; | 640 }; |
| 645 | 641 |
| 646 | 642 |
| 647 class CallFunctionStub: public CodeStub { | 643 class CallFunctionStub: public CodeStub { |
| 648 public: | 644 public: |
| 649 CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags) | 645 CallFunctionStub(int argc, CallFunctionFlags flags) |
| 650 : argc_(argc), in_loop_(in_loop), flags_(flags) { } | 646 : argc_(argc), flags_(flags) { } |
| 651 | 647 |
| 652 void Generate(MacroAssembler* masm); | 648 void Generate(MacroAssembler* masm); |
| 653 | 649 |
| 654 static int ExtractArgcFromMinorKey(int minor_key) { | 650 static int ExtractArgcFromMinorKey(int minor_key) { |
| 655 return ArgcBits::decode(minor_key); | 651 return ArgcBits::decode(minor_key); |
| 656 } | 652 } |
| 657 | 653 |
| 658 private: | 654 private: |
| 659 int argc_; | 655 int argc_; |
| 660 InLoopFlag in_loop_; | |
| 661 CallFunctionFlags flags_; | 656 CallFunctionFlags flags_; |
| 662 | 657 |
| 663 virtual void PrintName(StringStream* stream); | 658 virtual void PrintName(StringStream* stream); |
| 664 | 659 |
| 665 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 660 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
| 666 class InLoopBits: public BitField<InLoopFlag, 0, 1> {}; | 661 class FlagBits: public BitField<CallFunctionFlags, 0, 1> {}; |
| 667 class FlagBits: public BitField<CallFunctionFlags, 1, 1> {}; | 662 class ArgcBits: public BitField<unsigned, 1, 32 - 1> {}; |
| 668 class ArgcBits: public BitField<int, 2, 32 - 2> {}; | |
| 669 | 663 |
| 670 Major MajorKey() { return CallFunction; } | 664 Major MajorKey() { return CallFunction; } |
| 671 int MinorKey() { | 665 int MinorKey() { |
| 672 // Encode the parameters in a unique 32 bit value. | 666 // Encode the parameters in a unique 32 bit value. |
| 673 return InLoopBits::encode(in_loop_) | 667 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); |
| 674 | FlagBits::encode(flags_) | |
| 675 | ArgcBits::encode(argc_); | |
| 676 } | 668 } |
| 677 | 669 |
| 678 InLoopFlag InLoop() { return in_loop_; } | |
| 679 | |
| 680 bool ReceiverMightBeImplicit() { | 670 bool ReceiverMightBeImplicit() { |
| 681 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; | 671 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; |
| 682 } | 672 } |
| 683 }; | 673 }; |
| 684 | 674 |
| 685 | 675 |
| 686 enum StringIndexFlags { | 676 enum StringIndexFlags { |
| 687 // Accepts smis or heap numbers. | 677 // Accepts smis or heap numbers. |
| 688 STRING_INDEX_IS_NUMBER, | 678 STRING_INDEX_IS_NUMBER, |
| 689 | 679 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 bool result); | 948 bool result); |
| 959 void GenerateTypeTransition(MacroAssembler* masm); | 949 void GenerateTypeTransition(MacroAssembler* masm); |
| 960 | 950 |
| 961 Register tos_; | 951 Register tos_; |
| 962 Types types_; | 952 Types types_; |
| 963 }; | 953 }; |
| 964 | 954 |
| 965 } } // namespace v8::internal | 955 } } // namespace v8::internal |
| 966 | 956 |
| 967 #endif // V8_CODE_STUBS_H_ | 957 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |