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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 Handle<Object> key); | 162 Handle<Object> key); |
163 Failure* ReferenceError(const char* type, Handle<String> name); | 163 Failure* ReferenceError(const char* type, Handle<String> name); |
164 | 164 |
165 // Access the target code for the given IC address. | 165 // Access the target code for the given IC address. |
166 static inline Code* GetTargetAtAddress(Address address); | 166 static inline Code* GetTargetAtAddress(Address address); |
167 static inline void SetTargetAtAddress(Address address, Code* target); | 167 static inline void SetTargetAtAddress(Address address, Code* target); |
168 static void PostPatching(Address address, Code* target, Code* old_target); | 168 static void PostPatching(Address address, Code* target, Code* old_target); |
169 | 169 |
170 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, | 170 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
171 Handle<Code> handler, | 171 Handle<Code> handler, |
172 Handle<String> name) { | 172 Handle<String> name, |
| 173 StrictModeFlag strict_mode) { |
173 set_target(*handler); | 174 set_target(*handler); |
174 } | 175 } |
175 bool UpdatePolymorphicIC(State state, | 176 bool UpdatePolymorphicIC(State state, |
176 StrictModeFlag strict_mode, | |
177 Handle<JSObject> receiver, | 177 Handle<JSObject> receiver, |
178 Handle<String> name, | 178 Handle<String> name, |
179 Handle<Code> code); | 179 Handle<Code> code, |
| 180 StrictModeFlag strict_mode); |
| 181 |
| 182 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 183 CodeHandleList* handlers, |
| 184 int number_of_valid_maps, |
| 185 Handle<Name> name, |
| 186 StrictModeFlag strict_mode) { |
| 187 UNREACHABLE(); |
| 188 return Handle<Code>::null(); |
| 189 }; |
| 190 |
180 void CopyICToMegamorphicCache(Handle<String> name); | 191 void CopyICToMegamorphicCache(Handle<String> name); |
181 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); | 192 bool IsTransitionedMapOfMonomorphicTarget(Map* receiver_map); |
182 void PatchCache(State state, | 193 void PatchCache(State state, |
183 StrictModeFlag strict_mode, | 194 StrictModeFlag strict_mode, |
184 Handle<JSObject> receiver, | 195 Handle<JSObject> receiver, |
185 Handle<String> name, | 196 Handle<String> name, |
186 Handle<Code> code); | 197 Handle<Code> code); |
187 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); | 198 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code); |
188 virtual Handle<Code> megamorphic_stub() { | 199 virtual Handle<Code> megamorphic_stub() { |
189 UNREACHABLE(); | 200 UNREACHABLE(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 virtual Handle<Code> megamorphic_stub() { | 395 virtual Handle<Code> megamorphic_stub() { |
385 return isolate()->builtins()->LoadIC_Megamorphic(); | 396 return isolate()->builtins()->LoadIC_Megamorphic(); |
386 } | 397 } |
387 | 398 |
388 // Update the inline cache and the global stub cache based on the | 399 // Update the inline cache and the global stub cache based on the |
389 // lookup result. | 400 // lookup result. |
390 void UpdateCaches(LookupResult* lookup, | 401 void UpdateCaches(LookupResult* lookup, |
391 State state, | 402 State state, |
392 Handle<Object> object, | 403 Handle<Object> object, |
393 Handle<String> name); | 404 Handle<String> name); |
| 405 |
394 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, | 406 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
395 Handle<Code> handler, | 407 Handle<Code> handler, |
396 Handle<String> name); | 408 Handle<String> name, |
| 409 StrictModeFlag strict_mode); |
| 410 |
| 411 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 412 CodeHandleList* handlers, |
| 413 int number_of_valid_maps, |
| 414 Handle<Name> name, |
| 415 StrictModeFlag strict_mode); |
| 416 |
397 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
398 Handle<JSObject> receiver, | 418 Handle<JSObject> receiver, |
399 Handle<String> name); | 419 Handle<String> name); |
400 | 420 |
401 private: | 421 private: |
402 // Stub accessors. | 422 // Stub accessors. |
403 static Handle<Code> initialize_stub() { | 423 static Handle<Code> initialize_stub() { |
404 return Isolate::Current()->builtins()->LoadIC_Initialize(); | 424 return Isolate::Current()->builtins()->LoadIC_Initialize(); |
405 } | 425 } |
406 virtual Handle<Code> pre_monomorphic_stub() { | 426 virtual Handle<Code> pre_monomorphic_stub() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 virtual Handle<Code> megamorphic_stub() { | 480 virtual Handle<Code> megamorphic_stub() { |
461 return isolate()->builtins()->KeyedLoadIC_Generic(); | 481 return isolate()->builtins()->KeyedLoadIC_Generic(); |
462 } | 482 } |
463 virtual Handle<Code> generic_stub() const { | 483 virtual Handle<Code> generic_stub() const { |
464 return isolate()->builtins()->KeyedLoadIC_Generic(); | 484 return isolate()->builtins()->KeyedLoadIC_Generic(); |
465 } | 485 } |
466 | 486 |
467 // Update the inline cache. | 487 // Update the inline cache. |
468 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, | 488 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
469 Handle<Code> handler, | 489 Handle<Code> handler, |
470 Handle<String> name); | 490 Handle<String> name, |
| 491 StrictModeFlag strict_mode); |
471 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
472 Handle<JSObject> receiver, | 493 Handle<JSObject> receiver, |
473 Handle<String> name); | 494 Handle<String> name); |
474 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
475 | 496 |
476 private: | 497 private: |
477 // Stub accessors. | 498 // Stub accessors. |
478 static Handle<Code> initialize_stub() { | 499 static Handle<Code> initialize_stub() { |
479 return Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); | 500 return Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); |
480 } | 501 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 virtual Handle<Code> generic_stub_strict() const { | 558 virtual Handle<Code> generic_stub_strict() const { |
538 return isolate()->builtins()->StoreIC_Generic_Strict(); | 559 return isolate()->builtins()->StoreIC_Generic_Strict(); |
539 } | 560 } |
540 virtual Handle<Code> global_proxy_stub() { | 561 virtual Handle<Code> global_proxy_stub() { |
541 return isolate()->builtins()->StoreIC_GlobalProxy(); | 562 return isolate()->builtins()->StoreIC_GlobalProxy(); |
542 } | 563 } |
543 virtual Handle<Code> global_proxy_stub_strict() { | 564 virtual Handle<Code> global_proxy_stub_strict() { |
544 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); | 565 return isolate()->builtins()->StoreIC_GlobalProxy_Strict(); |
545 } | 566 } |
546 | 567 |
| 568 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 569 Handle<Code> handler, |
| 570 Handle<String> name, |
| 571 StrictModeFlag strict_mode); |
| 572 |
| 573 virtual Handle<Code> ComputePolymorphicIC(MapHandleList* receiver_maps, |
| 574 CodeHandleList* handlers, |
| 575 int number_of_valid_maps, |
| 576 Handle<Name> name, |
| 577 StrictModeFlag strict_mode); |
547 | 578 |
548 // Update the inline cache and the global stub cache based on the | 579 // Update the inline cache and the global stub cache based on the |
549 // lookup result. | 580 // lookup result. |
550 void UpdateCaches(LookupResult* lookup, | 581 void UpdateCaches(LookupResult* lookup, |
551 State state, | 582 State state, |
552 StrictModeFlag strict_mode, | 583 StrictModeFlag strict_mode, |
553 Handle<JSObject> receiver, | 584 Handle<JSObject> receiver, |
554 Handle<String> name, | 585 Handle<String> name, |
555 Handle<Object> value); | 586 Handle<Object> value); |
556 // Compute the code stub for this store; used for rewriting to | 587 // Compute the code stub for this store; used for rewriting to |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 return isolate()->builtins()->KeyedStoreIC_Generic(); | 666 return isolate()->builtins()->KeyedStoreIC_Generic(); |
636 } | 667 } |
637 virtual Handle<Code> megamorphic_stub_strict() { | 668 virtual Handle<Code> megamorphic_stub_strict() { |
638 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 669 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
639 } | 670 } |
640 | 671 |
641 Handle<Code> StoreElementStub(Handle<JSObject> receiver, | 672 Handle<Code> StoreElementStub(Handle<JSObject> receiver, |
642 KeyedAccessStoreMode store_mode, | 673 KeyedAccessStoreMode store_mode, |
643 StrictModeFlag strict_mode); | 674 StrictModeFlag strict_mode); |
644 | 675 |
| 676 virtual void UpdateMonomorphicIC(Handle<JSObject> receiver, |
| 677 Handle<Code> handler, |
| 678 Handle<String> name, |
| 679 StrictModeFlag strict_mode); |
| 680 |
645 private: | 681 private: |
646 void set_target(Code* code) { | 682 void set_target(Code* code) { |
647 // Strict mode must be preserved across IC patching. | 683 // Strict mode must be preserved across IC patching. |
648 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 684 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
649 Code::GetStrictMode(target()->extra_ic_state())); | 685 Code::GetStrictMode(target()->extra_ic_state())); |
650 IC::set_target(code); | 686 IC::set_target(code); |
651 } | 687 } |
652 | 688 |
653 // Stub accessors. | 689 // Stub accessors. |
654 static Handle<Code> initialize_stub() { | 690 static Handle<Code> initialize_stub() { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); | 858 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedStoreIC_MissFromStubFailure); |
823 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 859 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
824 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 860 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
825 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 861 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
826 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 862 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
827 | 863 |
828 | 864 |
829 } } // namespace v8::internal | 865 } } // namespace v8::internal |
830 | 866 |
831 #endif // V8_IC_H_ | 867 #endif // V8_IC_H_ |
OLD | NEW |