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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Construct the IC structure with the given number of extra | 91 // Construct the IC structure with the given number of extra |
92 // JavaScript frames on the stack. | 92 // JavaScript frames on the stack. |
93 IC(FrameDepth depth, Isolate* isolate); | 93 IC(FrameDepth depth, Isolate* isolate); |
94 virtual ~IC() {} | 94 virtual ~IC() {} |
95 | 95 |
96 // Get the call-site target; used for determining the state. | 96 // Get the call-site target; used for determining the state. |
97 Code* target() const { return GetTargetAtAddress(address()); } | 97 Code* target() const { return GetTargetAtAddress(address()); } |
98 inline Address address() const; | 98 inline Address address() const; |
99 | 99 |
100 virtual bool IsGeneric() const { return false; } | |
101 | |
102 // Compute the current IC state based on the target stub, receiver and name. | 100 // Compute the current IC state based on the target stub, receiver and name. |
103 static State StateFrom(Code* target, Object* receiver, Object* name); | 101 static State StateFrom(Code* target, Object* receiver, Object* name); |
104 | 102 |
105 // Clear the inline cache to initial state. | 103 // Clear the inline cache to initial state. |
106 static void Clear(Address address); | 104 static void Clear(Address address); |
107 | 105 |
108 // Computes the reloc info for this IC. This is a fairly expensive | 106 // Computes the reloc info for this IC. This is a fairly expensive |
109 // operation as it has to search through the heap to find the code | 107 // operation as it has to search through the heap to find the code |
110 // object that contains this IC site. | 108 // object that contains this IC site. |
111 RelocInfo::Mode ComputeMode(); | 109 RelocInfo::Mode ComputeMode(); |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Access check is necessary explicitly since generic stub does not perform | 510 // Access check is necessary explicitly since generic stub does not perform |
513 // map checks. | 511 // map checks. |
514 static const int kSlowCaseBitFieldMask = | 512 static const int kSlowCaseBitFieldMask = |
515 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); | 513 (1 << Map::kIsAccessCheckNeeded) | (1 << Map::kHasIndexedInterceptor); |
516 | 514 |
517 virtual Handle<Code> GetElementStubWithoutMapCheck( | 515 virtual Handle<Code> GetElementStubWithoutMapCheck( |
518 bool is_js_array, | 516 bool is_js_array, |
519 ElementsKind elements_kind, | 517 ElementsKind elements_kind, |
520 KeyedAccessGrowMode grow_mode); | 518 KeyedAccessGrowMode grow_mode); |
521 | 519 |
522 virtual bool IsGeneric() const { | |
523 return target() == *generic_stub(); | |
524 } | |
525 | |
526 protected: | 520 protected: |
527 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } | 521 virtual Code::Kind kind() const { return Code::KEYED_LOAD_IC; } |
528 | 522 |
529 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, | 523 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
530 StrictModeFlag strict_mode, | 524 StrictModeFlag strict_mode, |
531 KeyedAccessGrowMode grow_mode); | 525 KeyedAccessGrowMode grow_mode); |
532 | 526 |
533 virtual Handle<Code> string_stub() { | 527 virtual Handle<Code> string_stub() { |
534 return isolate()->builtins()->KeyedLoadIC_String(); | 528 return isolate()->builtins()->KeyedLoadIC_String(); |
535 } | 529 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); | 667 static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode); |
674 static void GenerateNonStrictArguments(MacroAssembler* masm); | 668 static void GenerateNonStrictArguments(MacroAssembler* masm); |
675 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); | 669 static void GenerateTransitionElementsSmiToDouble(MacroAssembler* masm); |
676 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); | 670 static void GenerateTransitionElementsDoubleToObject(MacroAssembler* masm); |
677 | 671 |
678 virtual Handle<Code> GetElementStubWithoutMapCheck( | 672 virtual Handle<Code> GetElementStubWithoutMapCheck( |
679 bool is_js_array, | 673 bool is_js_array, |
680 ElementsKind elements_kind, | 674 ElementsKind elements_kind, |
681 KeyedAccessGrowMode grow_mode); | 675 KeyedAccessGrowMode grow_mode); |
682 | 676 |
683 virtual bool IsGeneric() const { | |
684 return target() == *generic_stub() || | |
685 target() == *generic_stub_strict(); | |
686 } | |
687 | |
688 protected: | 677 protected: |
689 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } | 678 virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; } |
690 | 679 |
691 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, | 680 virtual Handle<Code> ComputePolymorphicStub(MapHandleList* receiver_maps, |
692 StrictModeFlag strict_mode, | 681 StrictModeFlag strict_mode, |
693 KeyedAccessGrowMode grow_mode); | 682 KeyedAccessGrowMode grow_mode); |
694 | 683 |
695 private: | 684 private: |
696 // Update the inline cache. | 685 // Update the inline cache. |
697 void UpdateCaches(LookupResult* lookup, | 686 void UpdateCaches(LookupResult* lookup, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 841 |
853 // Helper for BinaryOpIC and CompareIC. | 842 // Helper for BinaryOpIC and CompareIC. |
854 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; | 843 enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK }; |
855 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); | 844 void PatchInlinedSmiCode(Address address, InlinedSmiCheck check); |
856 | 845 |
857 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss); | 846 DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss); |
858 | 847 |
859 } } // namespace v8::internal | 848 } } // namespace v8::internal |
860 | 849 |
861 #endif // V8_IC_H_ | 850 #endif // V8_IC_H_ |
OLD | NEW |