| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 virtual ~IC() {} | 95 virtual ~IC() {} |
| 96 | 96 |
| 97 // Get the call-site target; used for determining the state. | 97 // Get the call-site target; used for determining the state. |
| 98 Code* target() const { return GetTargetAtAddress(address()); } | 98 Code* target() const { return GetTargetAtAddress(address()); } |
| 99 inline Address address() const; | 99 inline Address address() const; |
| 100 | 100 |
| 101 // Compute the current IC state based on the target stub, receiver and name. | 101 // Compute the current IC state based on the target stub, receiver and name. |
| 102 static State StateFrom(Code* target, Object* receiver, Object* name); | 102 static State StateFrom(Code* target, Object* receiver, Object* name); |
| 103 | 103 |
| 104 // Clear the inline cache to initial state. | 104 // Clear the inline cache to initial state. |
| 105 static void Clear(Address address); | 105 static void Clear(Isolate* isolate, Address address); |
| 106 | 106 |
| 107 // Computes the reloc info for this IC. This is a fairly expensive | 107 // Computes the reloc info for this IC. This is a fairly expensive |
| 108 // operation as it has to search through the heap to find the code | 108 // operation as it has to search through the heap to find the code |
| 109 // object that contains this IC site. | 109 // object that contains this IC site. |
| 110 RelocInfo::Mode ComputeMode(); | 110 RelocInfo::Mode ComputeMode(); |
| 111 | 111 |
| 112 // Returns if this IC is for contextual (no explicit receiver) | 112 // Returns if this IC is for contextual (no explicit receiver) |
| 113 // access to properties. | 113 // access to properties. |
| 114 bool IsUndeclaredGlobal(Handle<Object> receiver) { | 114 bool IsUndeclaredGlobal(Handle<Object> receiver) { |
| 115 if (receiver->IsGlobalObject()) { | 115 if (receiver->IsGlobalObject()) { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 int number_of_valid_maps, | 413 int number_of_valid_maps, |
| 414 Handle<Name> name, | 414 Handle<Name> name, |
| 415 StrictModeFlag strict_mode); | 415 StrictModeFlag strict_mode); |
| 416 | 416 |
| 417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 417 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
| 418 Handle<JSObject> receiver, | 418 Handle<JSObject> receiver, |
| 419 Handle<String> name); | 419 Handle<String> name); |
| 420 | 420 |
| 421 private: | 421 private: |
| 422 // Stub accessors. | 422 // Stub accessors. |
| 423 static Handle<Code> initialize_stub() { | 423 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 424 return Isolate::Current()->builtins()->LoadIC_Initialize(); | 424 return isolate->builtins()->LoadIC_Initialize(); |
| 425 } | 425 } |
| 426 virtual Handle<Code> pre_monomorphic_stub() { | 426 virtual Handle<Code> pre_monomorphic_stub() { |
| 427 return isolate()->builtins()->LoadIC_PreMonomorphic(); | 427 return isolate()->builtins()->LoadIC_PreMonomorphic(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 static void Clear(Address address, Code* target); | 430 static void Clear(Isolate* isolate, Address address, Code* target); |
| 431 | 431 |
| 432 friend class IC; | 432 friend class IC; |
| 433 }; | 433 }; |
| 434 | 434 |
| 435 | 435 |
| 436 enum ICMissMode { | 436 enum ICMissMode { |
| 437 MISS_FORCE_GENERIC, | 437 MISS_FORCE_GENERIC, |
| 438 MISS | 438 MISS |
| 439 }; | 439 }; |
| 440 | 440 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 Handle<Code> handler, | 489 Handle<Code> handler, |
| 490 Handle<String> name, | 490 Handle<String> name, |
| 491 StrictModeFlag strict_mode); | 491 StrictModeFlag strict_mode); |
| 492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, | 492 virtual Handle<Code> ComputeLoadHandler(LookupResult* lookup, |
| 493 Handle<JSObject> receiver, | 493 Handle<JSObject> receiver, |
| 494 Handle<String> name); | 494 Handle<String> name); |
| 495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } | 495 virtual void UpdateMegamorphicCache(Map* map, Name* name, Code* code) { } |
| 496 | 496 |
| 497 private: | 497 private: |
| 498 // Stub accessors. | 498 // Stub accessors. |
| 499 static Handle<Code> initialize_stub() { | 499 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 500 return Isolate::Current()->builtins()->KeyedLoadIC_Initialize(); | 500 return isolate->builtins()->KeyedLoadIC_Initialize(); |
| 501 } | 501 } |
| 502 virtual Handle<Code> pre_monomorphic_stub() { | 502 virtual Handle<Code> pre_monomorphic_stub() { |
| 503 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic(); | 503 return isolate()->builtins()->KeyedLoadIC_PreMonomorphic(); |
| 504 } | 504 } |
| 505 Handle<Code> indexed_interceptor_stub() { | 505 Handle<Code> indexed_interceptor_stub() { |
| 506 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); | 506 return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor(); |
| 507 } | 507 } |
| 508 Handle<Code> non_strict_arguments_stub() { | 508 Handle<Code> non_strict_arguments_stub() { |
| 509 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); | 509 return isolate()->builtins()->KeyedLoadIC_NonStrictArguments(); |
| 510 } | 510 } |
| 511 Handle<Code> string_stub() { | 511 Handle<Code> string_stub() { |
| 512 return isolate()->builtins()->KeyedLoadIC_String(); | 512 return isolate()->builtins()->KeyedLoadIC_String(); |
| 513 } | 513 } |
| 514 | 514 |
| 515 static void Clear(Address address, Code* target); | 515 static void Clear(Isolate* isolate, Address address, Code* target); |
| 516 | 516 |
| 517 friend class IC; | 517 friend class IC; |
| 518 }; | 518 }; |
| 519 | 519 |
| 520 | 520 |
| 521 class StoreIC: public IC { | 521 class StoreIC: public IC { |
| 522 public: | 522 public: |
| 523 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { | 523 StoreIC(FrameDepth depth, Isolate* isolate) : IC(depth, isolate) { |
| 524 ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub()); | 524 ASSERT(target()->is_store_stub() || target()->is_keyed_store_stub()); |
| 525 } | 525 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 Handle<Object> value); | 594 Handle<Object> value); |
| 595 | 595 |
| 596 private: | 596 private: |
| 597 void set_target(Code* code) { | 597 void set_target(Code* code) { |
| 598 // Strict mode must be preserved across IC patching. | 598 // Strict mode must be preserved across IC patching. |
| 599 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 599 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
| 600 Code::GetStrictMode(target()->extra_ic_state())); | 600 Code::GetStrictMode(target()->extra_ic_state())); |
| 601 IC::set_target(code); | 601 IC::set_target(code); |
| 602 } | 602 } |
| 603 | 603 |
| 604 static Handle<Code> initialize_stub() { | 604 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 605 return Isolate::Current()->builtins()->StoreIC_Initialize(); | 605 return isolate->builtins()->StoreIC_Initialize(); |
| 606 } | 606 } |
| 607 static Handle<Code> initialize_stub_strict() { | 607 static Handle<Code> initialize_stub_strict(Isolate* isolate) { |
| 608 return Isolate::Current()->builtins()->StoreIC_Initialize_Strict(); | 608 return isolate->builtins()->StoreIC_Initialize_Strict(); |
| 609 } | 609 } |
| 610 static void Clear(Address address, Code* target); | 610 static void Clear(Isolate* isolate, Address address, Code* target); |
| 611 | 611 |
| 612 friend class IC; | 612 friend class IC; |
| 613 }; | 613 }; |
| 614 | 614 |
| 615 | 615 |
| 616 enum KeyedStoreCheckMap { | 616 enum KeyedStoreCheckMap { |
| 617 kDontCheckMap, | 617 kDontCheckMap, |
| 618 kCheckMap | 618 kCheckMap |
| 619 }; | 619 }; |
| 620 | 620 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 678 |
| 679 private: | 679 private: |
| 680 void set_target(Code* code) { | 680 void set_target(Code* code) { |
| 681 // Strict mode must be preserved across IC patching. | 681 // Strict mode must be preserved across IC patching. |
| 682 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == | 682 ASSERT(Code::GetStrictMode(code->extra_ic_state()) == |
| 683 Code::GetStrictMode(target()->extra_ic_state())); | 683 Code::GetStrictMode(target()->extra_ic_state())); |
| 684 IC::set_target(code); | 684 IC::set_target(code); |
| 685 } | 685 } |
| 686 | 686 |
| 687 // Stub accessors. | 687 // Stub accessors. |
| 688 static Handle<Code> initialize_stub() { | 688 static Handle<Code> initialize_stub(Isolate* isolate) { |
| 689 return Isolate::Current()->builtins()->KeyedStoreIC_Initialize(); | 689 return isolate->builtins()->KeyedStoreIC_Initialize(); |
| 690 } | 690 } |
| 691 static Handle<Code> initialize_stub_strict() { | 691 static Handle<Code> initialize_stub_strict(Isolate* isolate) { |
| 692 return Isolate::Current()->builtins()->KeyedStoreIC_Initialize_Strict(); | 692 return isolate->builtins()->KeyedStoreIC_Initialize_Strict(); |
| 693 } | 693 } |
| 694 Handle<Code> generic_stub() const { | 694 Handle<Code> generic_stub() const { |
| 695 return isolate()->builtins()->KeyedStoreIC_Generic(); | 695 return isolate()->builtins()->KeyedStoreIC_Generic(); |
| 696 } | 696 } |
| 697 Handle<Code> generic_stub_strict() const { | 697 Handle<Code> generic_stub_strict() const { |
| 698 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); | 698 return isolate()->builtins()->KeyedStoreIC_Generic_Strict(); |
| 699 } | 699 } |
| 700 Handle<Code> non_strict_arguments_stub() { | 700 Handle<Code> non_strict_arguments_stub() { |
| 701 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); | 701 return isolate()->builtins()->KeyedStoreIC_NonStrictArguments(); |
| 702 } | 702 } |
| 703 | 703 |
| 704 static void Clear(Address address, Code* target); | 704 static void Clear(Isolate* isolate, Address address, Code* target); |
| 705 | 705 |
| 706 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, | 706 KeyedAccessStoreMode GetStoreMode(Handle<JSObject> receiver, |
| 707 Handle<Object> key, | 707 Handle<Object> key, |
| 708 Handle<Object> value); | 708 Handle<Object> value); |
| 709 | 709 |
| 710 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, | 710 Handle<Map> ComputeTransitionedMap(Handle<JSObject> receiver, |
| 711 KeyedAccessStoreMode store_mode); | 711 KeyedAccessStoreMode store_mode); |
| 712 | 712 |
| 713 friend class IC; | 713 friend class IC; |
| 714 }; | 714 }; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 State TargetState(State old_state, | 800 State TargetState(State old_state, |
| 801 State old_left, | 801 State old_left, |
| 802 State old_right, | 802 State old_right, |
| 803 bool has_inlined_smi_code, | 803 bool has_inlined_smi_code, |
| 804 Handle<Object> x, | 804 Handle<Object> x, |
| 805 Handle<Object> y); | 805 Handle<Object> y); |
| 806 | 806 |
| 807 bool strict() const { return op_ == Token::EQ_STRICT; } | 807 bool strict() const { return op_ == Token::EQ_STRICT; } |
| 808 Condition GetCondition() const { return ComputeCondition(op_); } | 808 Condition GetCondition() const { return ComputeCondition(op_); } |
| 809 | 809 |
| 810 static Code* GetRawUninitialized(Token::Value op); | 810 static Code* GetRawUninitialized(Isolate* isolate, Token::Value op); |
| 811 | 811 |
| 812 static void Clear(Address address, Code* target); | 812 static void Clear(Isolate* isolate, Address address, Code* target); |
| 813 | 813 |
| 814 Token::Value op_; | 814 Token::Value op_; |
| 815 | 815 |
| 816 friend class IC; | 816 friend class IC; |
| 817 }; | 817 }; |
| 818 | 818 |
| 819 | 819 |
| 820 class CompareNilIC: public IC { | 820 class CompareNilIC: public IC { |
| 821 public: | 821 public: |
| 822 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} | 822 explicit CompareNilIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} |
| (...skipping 26 matching lines...) Expand all Loading... |
| 849 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); | 849 DECLARE_RUNTIME_FUNCTION(MaybeObject*, UnaryOpIC_Miss); |
| 850 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); | 850 DECLARE_RUNTIME_FUNCTION(MaybeObject*, StoreIC_MissFromStubFailure); |
| 851 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); | 851 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ElementsTransitionAndStoreIC_Miss); |
| 852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); | 852 DECLARE_RUNTIME_FUNCTION(MaybeObject*, CompareNilIC_Miss); |
| 853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); | 853 DECLARE_RUNTIME_FUNCTION(MaybeObject*, ToBooleanIC_Miss); |
| 854 | 854 |
| 855 | 855 |
| 856 } } // namespace v8::internal | 856 } } // namespace v8::internal |
| 857 | 857 |
| 858 #endif // V8_IC_H_ | 858 #endif // V8_IC_H_ |
| OLD | NEW |