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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 141 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
142 | 142 |
143 virtual ~CodeStub() {} | 143 virtual ~CodeStub() {} |
144 | 144 |
145 // See comment above, where Instanceof is defined. | 145 // See comment above, where Instanceof is defined. |
146 virtual bool CompilingCallsToThisStubIsGCSafe() { | 146 virtual bool CompilingCallsToThisStubIsGCSafe() { |
147 return MajorKey() <= Instanceof; | 147 return MajorKey() <= Instanceof; |
148 } | 148 } |
149 | 149 |
| 150 |
| 151 static void GenerateStubsAheadOfTime(); |
| 152 |
150 // Some stubs put untagged junk on the stack that cannot be scanned by the | 153 // Some stubs put untagged junk on the stack that cannot be scanned by the |
151 // GC. This means that we must be statically sure that no GC can occur while | 154 // GC. This means that we must be statically sure that no GC can occur while |
152 // they are running. If that is the case they should override this to return | 155 // they are running. If that is the case they should override this to return |
153 // true, which will cause an assertion if we try to call something that can | 156 // true, which will cause an assertion if we try to call something that can |
154 // GC or if we try to put a stack frame on top of the junk, which would not | 157 // GC or if we try to put a stack frame on top of the junk, which would not |
155 // result in a traversable stack. | 158 // result in a traversable stack. |
156 virtual bool SometimesSetsUpAFrame() { return true; } | 159 virtual bool SometimesSetsUpAFrame() { return true; } |
157 | 160 |
158 protected: | 161 protected: |
159 static const int kMajorBits = 6; | 162 static const int kMajorBits = 6; |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 class CEntryStub : public CodeStub { | 545 class CEntryStub : public CodeStub { |
543 public: | 546 public: |
544 explicit CEntryStub(int result_size) | 547 explicit CEntryStub(int result_size) |
545 : result_size_(result_size), save_doubles_(false) { } | 548 : result_size_(result_size), save_doubles_(false) { } |
546 | 549 |
547 void Generate(MacroAssembler* masm); | 550 void Generate(MacroAssembler* masm); |
548 void SaveDoubles() { save_doubles_ = true; } | 551 void SaveDoubles() { save_doubles_ = true; } |
549 | 552 |
550 // The version of this stub that doesn't save doubles is generated ahead of | 553 // The version of this stub that doesn't save doubles is generated ahead of |
551 // time, so it's OK to call it from other stubs that can't cope with GC during | 554 // time, so it's OK to call it from other stubs that can't cope with GC during |
552 // their code generation. | 555 // their code generation. On machines that always have gp registers (x64) we |
553 virtual bool CompilingCallsToThisStubIsGCSafe() { return !save_doubles_; } | 556 // can generate both variants ahead of time. |
| 557 virtual bool CompilingCallsToThisStubIsGCSafe(); |
554 | 558 |
555 private: | 559 private: |
556 void GenerateCore(MacroAssembler* masm, | 560 void GenerateCore(MacroAssembler* masm, |
557 Label* throw_normal_exception, | 561 Label* throw_normal_exception, |
558 Label* throw_termination_exception, | 562 Label* throw_termination_exception, |
559 Label* throw_out_of_memory_exception, | 563 Label* throw_out_of_memory_exception, |
560 bool do_gc, | 564 bool do_gc, |
561 bool always_allocate_scope); | 565 bool always_allocate_scope); |
562 void GenerateThrowTOS(MacroAssembler* masm); | 566 void GenerateThrowTOS(MacroAssembler* masm); |
563 void GenerateThrowUncatchable(MacroAssembler* masm, | 567 void GenerateThrowUncatchable(MacroAssembler* masm, |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 bool result); | 969 bool result); |
966 void GenerateTypeTransition(MacroAssembler* masm); | 970 void GenerateTypeTransition(MacroAssembler* masm); |
967 | 971 |
968 Register tos_; | 972 Register tos_; |
969 Types types_; | 973 Types types_; |
970 }; | 974 }; |
971 | 975 |
972 } } // namespace v8::internal | 976 } } // namespace v8::internal |
973 | 977 |
974 #endif // V8_CODE_STUBS_H_ | 978 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |