OLD | NEW |
1 // Copyright 2006-2009 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 10 matching lines...) Expand all Loading... |
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_IC_H_ | 28 #ifndef V8_IC_H_ |
29 #define V8_IC_H_ | 29 #define V8_IC_H_ |
30 | 30 |
31 #include "macro-assembler.h" | 31 #include "macro-assembler.h" |
| 32 #include "type-info.h" |
32 | 33 |
33 namespace v8 { | 34 namespace v8 { |
34 namespace internal { | 35 namespace internal { |
35 | 36 |
36 | 37 |
37 // IC_UTIL_LIST defines all utility functions called from generated | 38 // IC_UTIL_LIST defines all utility functions called from generated |
38 // inline caching code. The argument for the macro, ICU, is the function name. | 39 // inline caching code. The argument for the macro, ICU, is the function name. |
39 #define IC_UTIL_LIST(ICU) \ | 40 #define IC_UTIL_LIST(ICU) \ |
40 ICU(LoadIC_Miss) \ | 41 ICU(LoadIC_Miss) \ |
41 ICU(KeyedLoadIC_Miss) \ | 42 ICU(KeyedLoadIC_Miss) \ |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 Address address() const { return address_; } | 185 Address address() const { return address_; } |
185 | 186 |
186 IC::UtilityId id() const { return id_; } | 187 IC::UtilityId id() const { return id_; } |
187 private: | 188 private: |
188 Address address_; | 189 Address address_; |
189 IC::UtilityId id_; | 190 IC::UtilityId id_; |
190 }; | 191 }; |
191 | 192 |
192 | 193 |
193 class CallICBase: public IC { | 194 class CallICBase: public IC { |
| 195 public: |
| 196 class Contextual: public BitField<bool, 0, 1> {}; |
| 197 class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; |
| 198 |
194 protected: | 199 protected: |
195 CallICBase(Code::Kind kind, Isolate* isolate) | 200 CallICBase(Code::Kind kind, Isolate* isolate) |
196 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} | 201 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
197 | 202 |
198 public: | 203 public: |
199 MUST_USE_RESULT MaybeObject* LoadFunction(State state, | 204 MUST_USE_RESULT MaybeObject* LoadFunction(State state, |
200 Code::ExtraICState extra_ic_state, | 205 Code::ExtraICState extra_ic_state, |
201 Handle<Object> object, | 206 Handle<Object> object, |
202 Handle<String> name); | 207 Handle<String> name); |
203 | 208 |
(...skipping 20 matching lines...) Expand all Loading... |
224 Handle<String> name); | 229 Handle<String> name); |
225 | 230 |
226 // Returns a JSFunction if the object can be called as a function, | 231 // Returns a JSFunction if the object can be called as a function, |
227 // and patches the stack to be ready for the call. | 232 // and patches the stack to be ready for the call. |
228 // Otherwise, it returns the undefined value. | 233 // Otherwise, it returns the undefined value. |
229 Object* TryCallAsFunction(Object* object); | 234 Object* TryCallAsFunction(Object* object); |
230 | 235 |
231 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); | 236 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); |
232 | 237 |
233 static void Clear(Address address, Code* target); | 238 static void Clear(Address address, Code* target); |
| 239 |
234 friend class IC; | 240 friend class IC; |
235 }; | 241 }; |
236 | 242 |
237 | 243 |
238 class CallIC: public CallICBase { | 244 class CallIC: public CallICBase { |
239 public: | 245 public: |
240 explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { | 246 explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { |
241 ASSERT(target()->is_call_stub()); | 247 ASSERT(target()->is_call_stub()); |
242 } | 248 } |
243 | 249 |
244 // Code generator routines. | 250 // Code generator routines. |
245 static void GenerateInitialize(MacroAssembler* masm, int argc) { | 251 static void GenerateInitialize(MacroAssembler* masm, |
246 GenerateMiss(masm, argc); | 252 int argc, |
| 253 Code::ExtraICState extra_ic_state) { |
| 254 GenerateMiss(masm, argc, extra_ic_state); |
247 } | 255 } |
248 static void GenerateMiss(MacroAssembler* masm, int argc); | 256 static void GenerateMiss(MacroAssembler* masm, |
249 static void GenerateMegamorphic(MacroAssembler* masm, int argc); | 257 int argc, |
| 258 Code::ExtraICState extra_ic_state); |
| 259 static void GenerateMegamorphic(MacroAssembler* masm, |
| 260 int argc, |
| 261 Code::ExtraICState extra_ic_state); |
250 static void GenerateNormal(MacroAssembler* masm, int argc); | 262 static void GenerateNormal(MacroAssembler* masm, int argc); |
251 }; | 263 }; |
252 | 264 |
253 | 265 |
254 class KeyedCallIC: public CallICBase { | 266 class KeyedCallIC: public CallICBase { |
255 public: | 267 public: |
256 explicit KeyedCallIC(Isolate* isolate) | 268 explicit KeyedCallIC(Isolate* isolate) |
257 : CallICBase(Code::KEYED_CALL_IC, isolate) { | 269 : CallICBase(Code::KEYED_CALL_IC, isolate) { |
258 ASSERT(target()->is_keyed_call_stub()); | 270 ASSERT(target()->is_keyed_call_stub()); |
259 } | 271 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 637 |
626 Token::Value op_; | 638 Token::Value op_; |
627 }; | 639 }; |
628 | 640 |
629 // Helper for TRBinaryOpIC and CompareIC. | 641 // Helper for TRBinaryOpIC and CompareIC. |
630 void PatchInlinedSmiCode(Address address); | 642 void PatchInlinedSmiCode(Address address); |
631 | 643 |
632 } } // namespace v8::internal | 644 } } // namespace v8::internal |
633 | 645 |
634 #endif // V8_IC_H_ | 646 #endif // V8_IC_H_ |
OLD | NEW |