| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 static void GeneratePreMonomorphic(MacroAssembler* masm); | 209 static void GeneratePreMonomorphic(MacroAssembler* masm); |
| 210 static void GenerateMiss(MacroAssembler* masm); | 210 static void GenerateMiss(MacroAssembler* masm); |
| 211 static void GenerateMegamorphic(MacroAssembler* masm); | 211 static void GenerateMegamorphic(MacroAssembler* masm); |
| 212 static void GenerateNormal(MacroAssembler* masm); | 212 static void GenerateNormal(MacroAssembler* masm); |
| 213 | 213 |
| 214 // Specialized code generator routines. | 214 // Specialized code generator routines. |
| 215 static void GenerateArrayLength(MacroAssembler* masm); | 215 static void GenerateArrayLength(MacroAssembler* masm); |
| 216 static void GenerateStringLength(MacroAssembler* masm); | 216 static void GenerateStringLength(MacroAssembler* masm); |
| 217 static void GenerateFunctionPrototype(MacroAssembler* masm); | 217 static void GenerateFunctionPrototype(MacroAssembler* masm); |
| 218 | 218 |
| 219 // The offset from the inlined patch site to the start of the |
| 220 // inlined load instruction. It is 7 bytes (test eax, imm) plus |
| 221 // 6 bytes (jne slow_label). |
| 222 static const int kOffsetToLoadInstruction = 13; |
| 223 |
| 219 private: | 224 private: |
| 220 static void Generate(MacroAssembler* masm, const ExternalReference& f); | 225 static void Generate(MacroAssembler* masm, const ExternalReference& f); |
| 221 | 226 |
| 222 // Update the inline cache and the global stub cache based on the | 227 // Update the inline cache and the global stub cache based on the |
| 223 // lookup result. | 228 // lookup result. |
| 224 void UpdateCaches(LookupResult* lookup, | 229 void UpdateCaches(LookupResult* lookup, |
| 225 State state, | 230 State state, |
| 226 Handle<Object> object, | 231 Handle<Object> object, |
| 227 Handle<String> name); | 232 Handle<String> name); |
| 228 | 233 |
| 229 // Stub accessors. | 234 // Stub accessors. |
| 230 static Code* megamorphic_stub() { | 235 static Code* megamorphic_stub() { |
| 231 return Builtins::builtin(Builtins::LoadIC_Megamorphic); | 236 return Builtins::builtin(Builtins::LoadIC_Megamorphic); |
| 232 } | 237 } |
| 233 static Code* initialize_stub() { | 238 static Code* initialize_stub() { |
| 234 return Builtins::builtin(Builtins::LoadIC_Initialize); | 239 return Builtins::builtin(Builtins::LoadIC_Initialize); |
| 235 } | 240 } |
| 236 static Code* pre_monomorphic_stub() { | 241 static Code* pre_monomorphic_stub() { |
| 237 return Builtins::builtin(Builtins::LoadIC_PreMonomorphic); | 242 return Builtins::builtin(Builtins::LoadIC_PreMonomorphic); |
| 238 } | 243 } |
| 239 | 244 |
| 240 static void Clear(Address address, Code* target); | 245 static void Clear(Address address, Code* target); |
| 246 |
| 247 // Clear the use of the inlined version. |
| 248 static void ClearInlinedVersion(Address address); |
| 249 |
| 250 static bool PatchInlinedLoad(Address address, Object* map, int index); |
| 251 |
| 241 friend class IC; | 252 friend class IC; |
| 242 }; | 253 }; |
| 243 | 254 |
| 244 | 255 |
| 245 class KeyedLoadIC: public IC { | 256 class KeyedLoadIC: public IC { |
| 246 public: | 257 public: |
| 247 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); } | 258 KeyedLoadIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_keyed_load_stub()); } |
| 248 | 259 |
| 249 Object* Load(State state, Handle<Object> object, Handle<Object> key); | 260 Object* Load(State state, Handle<Object> object, Handle<Object> key); |
| 250 | 261 |
| 251 // Code generator routines. | 262 // Code generator routines. |
| 252 static void GenerateMiss(MacroAssembler* masm); | 263 static void GenerateMiss(MacroAssembler* masm); |
| 253 static void GenerateInitialize(MacroAssembler* masm); | 264 static void GenerateInitialize(MacroAssembler* masm); |
| 254 static void GeneratePreMonomorphic(MacroAssembler* masm); | 265 static void GeneratePreMonomorphic(MacroAssembler* masm); |
| 255 static void GenerateGeneric(MacroAssembler* masm); | 266 static void GenerateGeneric(MacroAssembler* masm); |
| 256 | 267 |
| 257 // Check if this IC corresponds to an inlined version. | |
| 258 static bool HasInlinedVersion(Address address); | |
| 259 | |
| 260 // Clear the use of the inlined version. | 268 // Clear the use of the inlined version. |
| 261 static void ClearInlinedVersion(Address address); | 269 static void ClearInlinedVersion(Address address); |
| 262 | 270 |
| 263 private: | 271 private: |
| 264 static void Generate(MacroAssembler* masm, const ExternalReference& f); | 272 static void Generate(MacroAssembler* masm, const ExternalReference& f); |
| 265 | 273 |
| 266 // Update the inline cache. | 274 // Update the inline cache. |
| 267 void UpdateCaches(LookupResult* lookup, | 275 void UpdateCaches(LookupResult* lookup, |
| 268 State state, | 276 State state, |
| 269 Handle<Object> object, | 277 Handle<Object> object, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 280 return Builtins::builtin(Builtins::KeyedLoadIC_Generic); | 288 return Builtins::builtin(Builtins::KeyedLoadIC_Generic); |
| 281 } | 289 } |
| 282 static Code* pre_monomorphic_stub() { | 290 static Code* pre_monomorphic_stub() { |
| 283 return Builtins::builtin(Builtins::KeyedLoadIC_PreMonomorphic); | 291 return Builtins::builtin(Builtins::KeyedLoadIC_PreMonomorphic); |
| 284 } | 292 } |
| 285 | 293 |
| 286 static void Clear(Address address, Code* target); | 294 static void Clear(Address address, Code* target); |
| 287 | 295 |
| 288 // Support for patching the map that is checked in an inlined | 296 // Support for patching the map that is checked in an inlined |
| 289 // version of keyed load. | 297 // version of keyed load. |
| 290 static void PatchInlinedMapCheck(Address address, Object* map); | 298 static bool PatchInlinedLoad(Address address, Object* map); |
| 291 | 299 |
| 292 friend class IC; | 300 friend class IC; |
| 293 }; | 301 }; |
| 294 | 302 |
| 295 | 303 |
| 296 class StoreIC: public IC { | 304 class StoreIC: public IC { |
| 297 public: | 305 public: |
| 298 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); } | 306 StoreIC() : IC(NO_EXTRA_FRAME) { ASSERT(target()->is_store_stub()); } |
| 299 | 307 |
| 300 Object* Store(State state, | 308 Object* Store(State state, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 } | 376 } |
| 369 | 377 |
| 370 static void Clear(Address address, Code* target); | 378 static void Clear(Address address, Code* target); |
| 371 friend class IC; | 379 friend class IC; |
| 372 }; | 380 }; |
| 373 | 381 |
| 374 | 382 |
| 375 } } // namespace v8::internal | 383 } } // namespace v8::internal |
| 376 | 384 |
| 377 #endif // V8_IC_H_ | 385 #endif // V8_IC_H_ |
| OLD | NEW |