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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 V(SubString) \ | 43 V(SubString) \ |
44 V(StringCompare) \ | 44 V(StringCompare) \ |
45 V(Compare) \ | 45 V(Compare) \ |
46 V(CompareIC) \ | 46 V(CompareIC) \ |
47 V(MathPow) \ | 47 V(MathPow) \ |
48 V(RecordWrite) \ | 48 V(RecordWrite) \ |
49 V(StoreBufferOverflow) \ | 49 V(StoreBufferOverflow) \ |
50 V(RegExpExec) \ | 50 V(RegExpExec) \ |
51 V(TranscendentalCache) \ | 51 V(TranscendentalCache) \ |
52 V(Instanceof) \ | 52 V(Instanceof) \ |
53 /* All stubs above this line only exist in a few versions, which are */ \ | |
54 /* generated ahead of time. Therefore compiling a call to one of */ \ | |
55 /* them can't cause a new stub to be compiled, so compiling a call to */ \ | |
56 /* them is GC safe. The ones below this line exist in many variants */ \ | |
57 /* so code compiling a call to one can cause a GC. This means they */ \ | |
58 /* can't be called from other stubs, since stub generation code is */ \ | |
59 /* not GC safe. */ \ | |
60 V(ConvertToDouble) \ | 53 V(ConvertToDouble) \ |
61 V(WriteInt32ToHeapNumber) \ | 54 V(WriteInt32ToHeapNumber) \ |
62 V(StackCheck) \ | 55 V(StackCheck) \ |
63 V(FastNewClosure) \ | 56 V(FastNewClosure) \ |
64 V(FastNewContext) \ | 57 V(FastNewContext) \ |
65 V(FastCloneShallowArray) \ | 58 V(FastCloneShallowArray) \ |
66 V(RevertToNumber) \ | 59 V(RevertToNumber) \ |
67 V(ToBoolean) \ | 60 V(ToBoolean) \ |
68 V(ToNumber) \ | 61 V(ToNumber) \ |
69 V(CounterOp) \ | 62 V(CounterOp) \ |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 bool CompilingCallsToThisStubIsGCSafe() { | 140 bool CompilingCallsToThisStubIsGCSafe() { |
148 bool is_pregenerated = IsPregenerated(); | 141 bool is_pregenerated = IsPregenerated(); |
149 #ifdef DEBUG | 142 #ifdef DEBUG |
150 Code* code = NULL; | 143 Code* code = NULL; |
151 ASSERT(!is_pregenerated || FindCodeInCache(&code)); | 144 ASSERT(!is_pregenerated || FindCodeInCache(&code)); |
152 #endif | 145 #endif |
153 return is_pregenerated; | 146 return is_pregenerated; |
154 } | 147 } |
155 | 148 |
156 // See comment above, where Instanceof is defined. | 149 // See comment above, where Instanceof is defined. |
157 virtual bool IsPregenerated() { | 150 virtual bool IsPregenerated() { return false; } |
158 return MajorKey() <= Instanceof; | |
159 } | |
160 | 151 |
161 static void GenerateStubsAheadOfTime(); | 152 static void GenerateStubsAheadOfTime(); |
162 static void GenerateFPStubs(); | 153 static void GenerateFPStubs(); |
163 | 154 |
164 // Some stubs put untagged junk on the stack that cannot be scanned by the | 155 // Some stubs put untagged junk on the stack that cannot be scanned by the |
165 // GC. This means that we must be statically sure that no GC can occur while | 156 // GC. This means that we must be statically sure that no GC can occur while |
166 // they are running. If that is the case they should override this to return | 157 // they are running. If that is the case they should override this to return |
167 // true, which will cause an assertion if we try to call something that can | 158 // true, which will cause an assertion if we try to call something that can |
168 // GC or if we try to put a stack frame on top of the junk, which would not | 159 // GC or if we try to put a stack frame on top of the junk, which would not |
169 // result in a traversable stack. | 160 // result in a traversable stack. |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 558 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
568 : result_size_(result_size), save_doubles_(save_doubles) { } | 559 : result_size_(result_size), save_doubles_(save_doubles) { } |
569 | 560 |
570 void Generate(MacroAssembler* masm); | 561 void Generate(MacroAssembler* masm); |
571 | 562 |
572 // The version of this stub that doesn't save doubles is generated ahead of | 563 // The version of this stub that doesn't save doubles is generated ahead of |
573 // time, so it's OK to call it from other stubs that can't cope with GC during | 564 // time, so it's OK to call it from other stubs that can't cope with GC during |
574 // their code generation. On machines that always have gp registers (x64) we | 565 // their code generation. On machines that always have gp registers (x64) we |
575 // can generate both variants ahead of time. | 566 // can generate both variants ahead of time. |
576 virtual bool IsPregenerated(); | 567 virtual bool IsPregenerated(); |
| 568 static void GenerateFixedRegStubsAheadOfTime(); |
577 | 569 |
578 private: | 570 private: |
579 void GenerateCore(MacroAssembler* masm, | 571 void GenerateCore(MacroAssembler* masm, |
580 Label* throw_normal_exception, | 572 Label* throw_normal_exception, |
581 Label* throw_termination_exception, | 573 Label* throw_termination_exception, |
582 Label* throw_out_of_memory_exception, | 574 Label* throw_out_of_memory_exception, |
583 bool do_gc, | 575 bool do_gc, |
584 bool always_allocate_scope); | 576 bool always_allocate_scope); |
585 void GenerateThrowTOS(MacroAssembler* masm); | 577 void GenerateThrowTOS(MacroAssembler* masm); |
586 void GenerateThrowUncatchable(MacroAssembler* masm, | 578 void GenerateThrowUncatchable(MacroAssembler* masm, |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 bool result); | 1006 bool result); |
1015 void GenerateTypeTransition(MacroAssembler* masm); | 1007 void GenerateTypeTransition(MacroAssembler* masm); |
1016 | 1008 |
1017 Register tos_; | 1009 Register tos_; |
1018 Types types_; | 1010 Types types_; |
1019 }; | 1011 }; |
1020 | 1012 |
1021 } } // namespace v8::internal | 1013 } } // namespace v8::internal |
1022 | 1014 |
1023 #endif // V8_CODE_STUBS_H_ | 1015 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |