OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 10 matching lines...) Expand all Loading... |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_CODE_STUBS_H_ | 28 #ifndef V8_CODE_STUBS_H_ |
29 #define V8_CODE_STUBS_H_ | 29 #define V8_CODE_STUBS_H_ |
30 | 30 |
| 31 #include "globals.h" |
| 32 |
31 namespace v8 { | 33 namespace v8 { |
32 namespace internal { | 34 namespace internal { |
33 | 35 |
34 // List of code stubs used on all platforms. The order in this list is important | 36 // List of code stubs used on all platforms. The order in this list is important |
35 // as only the stubs up to and including RecordWrite allows nested stub calls. | 37 // as only the stubs up to and including RecordWrite allows nested stub calls. |
36 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
37 V(CallFunction) \ | 39 V(CallFunction) \ |
38 V(GenericBinaryOp) \ | 40 V(GenericBinaryOp) \ |
39 V(StringAdd) \ | 41 V(StringAdd) \ |
40 V(SubString) \ | 42 V(SubString) \ |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void RecordCodeGeneration(Code* code, MacroAssembler* masm); | 134 void RecordCodeGeneration(Code* code, MacroAssembler* masm); |
133 | 135 |
134 // Returns information for computing the number key. | 136 // Returns information for computing the number key. |
135 virtual Major MajorKey() = 0; | 137 virtual Major MajorKey() = 0; |
136 virtual int MinorKey() = 0; | 138 virtual int MinorKey() = 0; |
137 | 139 |
138 // The CallFunctionStub needs to override this so it can encode whether a | 140 // The CallFunctionStub needs to override this so it can encode whether a |
139 // lazily generated function should be fully optimized or not. | 141 // lazily generated function should be fully optimized or not. |
140 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } | 142 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } |
141 | 143 |
| 144 // GenericBinaryOpStub needs to override this. |
| 145 virtual int GetCodeKind(); |
| 146 |
| 147 // GenericBinaryOpStub needs to override this. |
| 148 virtual InlineCacheState GetICState() { |
| 149 return UNINITIALIZED; |
| 150 } |
| 151 |
142 // Returns a name for logging/debugging purposes. | 152 // Returns a name for logging/debugging purposes. |
143 virtual const char* GetName() { return MajorName(MajorKey(), false); } | 153 virtual const char* GetName() { return MajorName(MajorKey(), false); } |
144 | 154 |
145 #ifdef DEBUG | 155 #ifdef DEBUG |
146 virtual void Print() { PrintF("%s\n", GetName()); } | 156 virtual void Print() { PrintF("%s\n", GetName()); } |
147 #endif | 157 #endif |
148 | 158 |
149 // Computes the key based on major and minor. | 159 // Computes the key based on major and minor. |
150 uint32_t GetKey() { | 160 uint32_t GetKey() { |
151 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); | 161 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); |
152 return MinorKeyBits::encode(MinorKey()) | | 162 return MinorKeyBits::encode(MinorKey()) | |
153 MajorKeyBits::encode(MajorKey()); | 163 MajorKeyBits::encode(MajorKey()); |
154 } | 164 } |
155 | 165 |
156 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } | 166 bool AllowsStubCalls() { return MajorKey() <= RecordWrite; } |
157 | 167 |
158 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; | 168 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; |
159 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; | 169 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; |
160 | 170 |
161 friend class BreakPointIterator; | 171 friend class BreakPointIterator; |
162 }; | 172 }; |
163 | 173 |
164 } } // namespace v8::internal | 174 } } // namespace v8::internal |
165 | 175 |
166 #endif // V8_CODE_STUBS_H_ | 176 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |