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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 // Gets the major key from a code object that is a code stub or binary op IC. | 138 // Gets the major key from a code object that is a code stub or binary op IC. |
139 static Major GetMajorKey(Code* code_stub) { | 139 static Major GetMajorKey(Code* code_stub) { |
140 return static_cast<Major>(code_stub->major_key()); | 140 return static_cast<Major>(code_stub->major_key()); |
141 } | 141 } |
142 | 142 |
143 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 143 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
144 | 144 |
145 virtual ~CodeStub() {} | 145 virtual ~CodeStub() {} |
146 | 146 |
| 147 bool CompilingCallsToThisStubIsGCSafe() { |
| 148 bool is_pregenerated = IsPregenerated(); |
| 149 #ifdef DEBUG |
| 150 Code* code = NULL; |
| 151 ASSERT(!is_pregenerated || FindCodeInCache(&code)); |
| 152 #endif |
| 153 return is_pregenerated; |
| 154 } |
| 155 |
147 // See comment above, where Instanceof is defined. | 156 // See comment above, where Instanceof is defined. |
148 virtual bool CompilingCallsToThisStubIsGCSafe() { | 157 virtual bool IsPregenerated() { |
149 return MajorKey() <= Instanceof; | 158 return MajorKey() <= Instanceof; |
150 } | 159 } |
151 | 160 |
152 static void GenerateStubsAheadOfTime(); | 161 static void GenerateStubsAheadOfTime(); |
153 static void GenerateFPStubs(); | 162 static void GenerateFPStubs(); |
154 | 163 |
155 // Some stubs put untagged junk on the stack that cannot be scanned by the | 164 // Some stubs put untagged junk on the stack that cannot be scanned by the |
156 // GC. This means that we must be statically sure that no GC can occur while | 165 // GC. This means that we must be statically sure that no GC can occur while |
157 // they are running. If that is the case they should override this to return | 166 // they are running. If that is the case they should override this to return |
158 // true, which will cause an assertion if we try to call something that can | 167 // true, which will cause an assertion if we try to call something that can |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 explicit CEntryStub(int result_size, | 566 explicit CEntryStub(int result_size, |
558 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 567 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
559 : result_size_(result_size), save_doubles_(save_doubles) { } | 568 : result_size_(result_size), save_doubles_(save_doubles) { } |
560 | 569 |
561 void Generate(MacroAssembler* masm); | 570 void Generate(MacroAssembler* masm); |
562 | 571 |
563 // The version of this stub that doesn't save doubles is generated ahead of | 572 // The version of this stub that doesn't save doubles is generated ahead of |
564 // time, so it's OK to call it from other stubs that can't cope with GC during | 573 // time, so it's OK to call it from other stubs that can't cope with GC during |
565 // their code generation. On machines that always have gp registers (x64) we | 574 // their code generation. On machines that always have gp registers (x64) we |
566 // can generate both variants ahead of time. | 575 // can generate both variants ahead of time. |
567 virtual bool CompilingCallsToThisStubIsGCSafe(); | 576 virtual bool IsPregenerated(); |
568 | 577 |
569 private: | 578 private: |
570 void GenerateCore(MacroAssembler* masm, | 579 void GenerateCore(MacroAssembler* masm, |
571 Label* throw_normal_exception, | 580 Label* throw_normal_exception, |
572 Label* throw_termination_exception, | 581 Label* throw_termination_exception, |
573 Label* throw_out_of_memory_exception, | 582 Label* throw_out_of_memory_exception, |
574 bool do_gc, | 583 bool do_gc, |
575 bool always_allocate_scope); | 584 bool always_allocate_scope); |
576 void GenerateThrowTOS(MacroAssembler* masm); | 585 void GenerateThrowTOS(MacroAssembler* masm); |
577 void GenerateThrowUncatchable(MacroAssembler* masm, | 586 void GenerateThrowUncatchable(MacroAssembler* masm, |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 bool result); | 988 bool result); |
980 void GenerateTypeTransition(MacroAssembler* masm); | 989 void GenerateTypeTransition(MacroAssembler* masm); |
981 | 990 |
982 Register tos_; | 991 Register tos_; |
983 Types types_; | 992 Types types_; |
984 }; | 993 }; |
985 | 994 |
986 } } // namespace v8::internal | 995 } } // namespace v8::internal |
987 | 996 |
988 #endif // V8_CODE_STUBS_H_ | 997 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |