| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 IC::UtilityId id_; | 235 IC::UtilityId id_; |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 | 238 |
| 239 class CallICBase: public IC { | 239 class CallICBase: public IC { |
| 240 public: | 240 public: |
| 241 class Contextual: public BitField<bool, 0, 1> {}; | 241 class Contextual: public BitField<bool, 0, 1> {}; |
| 242 class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; | 242 class StringStubState: public BitField<StringStubFeedback, 1, 1> {}; |
| 243 | 243 |
| 244 // Returns a JSFunction or a Failure. | 244 // Returns a JSFunction or a Failure. |
| 245 MUST_USE_RESULT MaybeObject* LoadFunction(Code::ExtraICState extra_ic_state, | 245 MUST_USE_RESULT MaybeObject* LoadFunction(Handle<Object> object, |
| 246 Handle<Object> object, | |
| 247 Handle<String> name); | 246 Handle<String> name); |
| 248 | 247 |
| 249 protected: | 248 protected: |
| 250 CallICBase(Code::Kind kind, Isolate* isolate) | 249 CallICBase(Code::Kind kind, Isolate* isolate) |
| 251 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} | 250 : IC(EXTRA_CALL_FRAME, isolate), kind_(kind) {} |
| 252 | 251 |
| 253 bool TryUpdateExtraICState(LookupResult* lookup, | 252 virtual Code::ExtraICState extra_ic_state() { return Code::kNoExtraICState; } |
| 254 Handle<Object> object, | |
| 255 Code::ExtraICState* extra_ic_state); | |
| 256 | 253 |
| 257 // Compute a monomorphic stub if possible, otherwise return a null handle. | 254 // Compute a monomorphic stub if possible, otherwise return a null handle. |
| 258 Handle<Code> ComputeMonomorphicStub(LookupResult* lookup, | 255 Handle<Code> ComputeMonomorphicStub(LookupResult* lookup, |
| 259 Code::ExtraICState extra_state, | 256 Code::ExtraICState extra_state, |
| 260 Handle<Object> object, | 257 Handle<Object> object, |
| 261 Handle<String> name); | 258 Handle<String> name); |
| 262 | 259 |
| 263 // Update the inline cache and the global stub cache based on the lookup | 260 // Update the inline cache and the global stub cache based on the lookup |
| 264 // result. | 261 // result. |
| 265 void UpdateCaches(LookupResult* lookup, | 262 void UpdateCaches(LookupResult* lookup, |
| 266 Code::ExtraICState extra_ic_state, | |
| 267 Handle<Object> object, | 263 Handle<Object> object, |
| 268 Handle<String> name); | 264 Handle<String> name); |
| 269 | 265 |
| 270 // Returns a JSFunction if the object can be called as a function, and | 266 // Returns a JSFunction if the object can be called as a function, and |
| 271 // patches the stack to be ready for the call. Otherwise, it returns the | 267 // patches the stack to be ready for the call. Otherwise, it returns the |
| 272 // undefined value. | 268 // undefined value. |
| 273 Handle<Object> TryCallAsFunction(Handle<Object> object); | 269 Handle<Object> TryCallAsFunction(Handle<Object> object); |
| 274 | 270 |
| 275 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); | 271 void ReceiverToObjectIfRequired(Handle<Object> callee, Handle<Object> object); |
| 276 | 272 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 291 Code::ExtraICState extra_state); | 287 Code::ExtraICState extra_state); |
| 292 | 288 |
| 293 Code::Kind kind_; | 289 Code::Kind kind_; |
| 294 | 290 |
| 295 friend class IC; | 291 friend class IC; |
| 296 }; | 292 }; |
| 297 | 293 |
| 298 | 294 |
| 299 class CallIC: public CallICBase { | 295 class CallIC: public CallICBase { |
| 300 public: | 296 public: |
| 301 explicit CallIC(Isolate* isolate) : CallICBase(Code::CALL_IC, isolate) { | 297 explicit CallIC(Isolate* isolate) |
| 298 : CallICBase(Code::CALL_IC, isolate), |
| 299 extra_ic_state_(target()->extra_ic_state()) { |
| 302 ASSERT(target()->is_call_stub()); | 300 ASSERT(target()->is_call_stub()); |
| 303 } | 301 } |
| 304 | 302 |
| 305 // Code generator routines. | 303 // Code generator routines. |
| 306 static void GenerateInitialize(MacroAssembler* masm, | 304 static void GenerateInitialize(MacroAssembler* masm, |
| 307 int argc, | 305 int argc, |
| 308 Code::ExtraICState extra_state) { | 306 Code::ExtraICState extra_state) { |
| 309 GenerateMiss(masm, argc, extra_state); | 307 GenerateMiss(masm, argc, extra_state); |
| 310 } | 308 } |
| 311 | 309 |
| 312 static void GenerateMiss(MacroAssembler* masm, | 310 static void GenerateMiss(MacroAssembler* masm, |
| 313 int argc, | 311 int argc, |
| 314 Code::ExtraICState extra_state) { | 312 Code::ExtraICState extra_state) { |
| 315 CallICBase::GenerateMiss(masm, argc, IC::kCallIC_Miss, extra_state); | 313 CallICBase::GenerateMiss(masm, argc, IC::kCallIC_Miss, extra_state); |
| 316 } | 314 } |
| 317 | 315 |
| 318 static void GenerateMegamorphic(MacroAssembler* masm, | 316 static void GenerateMegamorphic(MacroAssembler* masm, |
| 319 int argc, | 317 int argc, |
| 320 Code::ExtraICState extra_ic_state); | 318 Code::ExtraICState extra_ic_state); |
| 321 | 319 |
| 322 static void GenerateNormal(MacroAssembler* masm, int argc) { | 320 static void GenerateNormal(MacroAssembler* masm, int argc) { |
| 323 CallICBase::GenerateNormal(masm, argc); | 321 CallICBase::GenerateNormal(masm, argc); |
| 324 GenerateMiss(masm, argc, Code::kNoExtraICState); | 322 GenerateMiss(masm, argc, Code::kNoExtraICState); |
| 325 } | 323 } |
| 324 bool TryUpdateExtraICState(LookupResult* lookup, Handle<Object> object); |
| 325 |
| 326 protected: |
| 327 virtual Code::ExtraICState extra_ic_state() { return extra_ic_state_; } |
| 328 |
| 329 private: |
| 330 Code::ExtraICState extra_ic_state_; |
| 326 }; | 331 }; |
| 327 | 332 |
| 328 | 333 |
| 329 class KeyedCallIC: public CallICBase { | 334 class KeyedCallIC: public CallICBase { |
| 330 public: | 335 public: |
| 331 explicit KeyedCallIC(Isolate* isolate) | 336 explicit KeyedCallIC(Isolate* isolate) |
| 332 : CallICBase(Code::KEYED_CALL_IC, isolate) { | 337 : CallICBase(Code::KEYED_CALL_IC, isolate) { |
| 333 ASSERT(target()->is_keyed_call_stub()); | 338 ASSERT(target()->is_keyed_call_stub()); |
| 334 } | 339 } |
| 335 | 340 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 857 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 854 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 855 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 856 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 857 | 862 |
| 858 | 863 |
| 859 } } // namespace v8::internal | 864 } } // namespace v8::internal |
| 860 | 865 |
| 861 #endif // V8_IC_H_ | 866 #endif // V8_IC_H_ |
| OLD | NEW |