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 11 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Address address() const { return address_; } | 188 Address address() const { return address_; } |
188 | 189 |
189 IC::UtilityId id() const { return id_; } | 190 IC::UtilityId id() const { return id_; } |
190 private: | 191 private: |
191 Address address_; | 192 Address address_; |
192 IC::UtilityId id_; | 193 IC::UtilityId id_; |
193 }; | 194 }; |
194 | 195 |
195 | 196 |
196 class CallICBase: public IC { | 197 class CallICBase: public IC { |
| 198 public: |
| 199 class Contextual: public BitField<bool, 0, 1> {}; |
| 200 class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; |
| 201 |
197 protected: | 202 protected: |
198 CallICBase(Code::Kind kind, Isolate* isolate) | 203 CallICBase(Code::Kind kind, Isolate* isolate) |
199 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} | 204 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
200 | 205 |
201 public: | 206 public: |
202 MUST_USE_RESULT MaybeObject* LoadFunction(State state, | 207 MUST_USE_RESULT MaybeObject* LoadFunction(State state, |
203 Code::ExtraICState extra_ic_state, | 208 Code::ExtraICState extra_ic_state, |
204 Handle<Object> object, | 209 Handle<Object> object, |
205 Handle<String> name); | 210 Handle<String> name); |
206 | 211 |
(...skipping 20 matching lines...) Expand all Loading... |
227 Handle<String> name); | 232 Handle<String> name); |
228 | 233 |
229 // Returns a JSFunction if the object can be called as a function, | 234 // Returns a JSFunction if the object can be called as a function, |
230 // and patches the stack to be ready for the call. | 235 // and patches the stack to be ready for the call. |
231 // Otherwise, it returns the undefined value. | 236 // Otherwise, it returns the undefined value. |
232 Object* TryCallAsFunction(Object* object); | 237 Object* TryCallAsFunction(Object* object); |
233 | 238 |
234 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); | 239 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); |
235 | 240 |
236 static void Clear(Address address, Code* target); | 241 static void Clear(Address address, Code* target); |
| 242 |
237 friend class IC; | 243 friend class IC; |
238 }; | 244 }; |
239 | 245 |
240 | 246 |
241 class CallIC: public CallICBase { | 247 class CallIC: public CallICBase { |
242 public: | 248 public: |
243 explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { | 249 explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { |
244 ASSERT(target()->is_call_stub()); | 250 ASSERT(target()->is_call_stub()); |
245 } | 251 } |
246 | 252 |
247 // Code generator routines. | 253 // Code generator routines. |
248 static void GenerateInitialize(MacroAssembler* masm, int argc) { | 254 static void GenerateInitialize(MacroAssembler* masm, |
249 GenerateMiss(masm, argc); | 255 int argc, |
| 256 Code::ExtraICState extra_ic_state) { |
| 257 GenerateMiss(masm, argc, extra_ic_state); |
250 } | 258 } |
251 static void GenerateMiss(MacroAssembler* masm, int argc); | 259 static void GenerateMiss(MacroAssembler* masm, |
252 static void GenerateMegamorphic(MacroAssembler* masm, int argc); | 260 int argc, |
| 261 Code::ExtraICState extra_ic_state); |
| 262 static void GenerateMegamorphic(MacroAssembler* masm, |
| 263 int argc, |
| 264 Code::ExtraICState extra_ic_state); |
253 static void GenerateNormal(MacroAssembler* masm, int argc); | 265 static void GenerateNormal(MacroAssembler* masm, int argc); |
254 }; | 266 }; |
255 | 267 |
256 | 268 |
257 class KeyedCallIC: public CallICBase { | 269 class KeyedCallIC: public CallICBase { |
258 public: | 270 public: |
259 explicit KeyedCallIC(Isolate* isolate) | 271 explicit KeyedCallIC(Isolate* isolate) |
260 : CallICBase(Code::KEYED_CALL_IC, isolate) { | 272 : CallICBase(Code::KEYED_CALL_IC, isolate) { |
261 ASSERT(target()->is_keyed_call_stub()); | 273 ASSERT(target()->is_keyed_call_stub()); |
262 } | 274 } |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 | 727 |
716 Token::Value op_; | 728 Token::Value op_; |
717 }; | 729 }; |
718 | 730 |
719 // Helper for TRBinaryOpIC and CompareIC. | 731 // Helper for TRBinaryOpIC and CompareIC. |
720 void PatchInlinedSmiCode(Address address); | 732 void PatchInlinedSmiCode(Address address); |
721 | 733 |
722 } } // namespace v8::internal | 734 } } // namespace v8::internal |
723 | 735 |
724 #endif // V8_IC_H_ | 736 #endif // V8_IC_H_ |
OLD | NEW |