| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_CODE_STUBS_H_ | 28 #ifndef V8_CODE_STUBS_H_ |
| 29 #define V8_CODE_STUBS_H_ | 29 #define V8_CODE_STUBS_H_ |
| 30 | 30 |
| 31 #include "allocation.h" |
| 31 #include "globals.h" | 32 #include "globals.h" |
| 32 | 33 |
| 33 namespace v8 { | 34 namespace v8 { |
| 34 namespace internal { | 35 namespace internal { |
| 35 | 36 |
| 36 // List of code stubs used on all platforms. The order in this list is important | 37 // List of code stubs used on all platforms. The order in this list is important |
| 37 // as only the stubs up to and including Instanceof allows nested stub calls. | 38 // as only the stubs up to and including Instanceof allows nested stub calls. |
| 38 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 39 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 39 V(CallFunction) \ | 40 V(CallFunction) \ |
| 40 V(TypeRecordingUnaryOp) \ | 41 V(TypeRecordingUnaryOp) \ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 V(GenericUnaryOp) \ | 61 V(GenericUnaryOp) \ |
| 61 V(RevertToNumber) \ | 62 V(RevertToNumber) \ |
| 62 V(ToBoolean) \ | 63 V(ToBoolean) \ |
| 63 V(ToNumber) \ | 64 V(ToNumber) \ |
| 64 V(CounterOp) \ | 65 V(CounterOp) \ |
| 65 V(ArgumentsAccess) \ | 66 V(ArgumentsAccess) \ |
| 66 V(RegExpConstructResult) \ | 67 V(RegExpConstructResult) \ |
| 67 V(NumberToString) \ | 68 V(NumberToString) \ |
| 68 V(CEntry) \ | 69 V(CEntry) \ |
| 69 V(JSEntry) \ | 70 V(JSEntry) \ |
| 70 V(DebuggerStatement) | 71 V(KeyedLoadFastElement) \ |
| 72 V(KeyedStoreFastElement) \ |
| 73 V(KeyedLoadExternalArray) \ |
| 74 V(KeyedStoreExternalArray) \ |
| 75 V(DebuggerStatement) \ |
| 76 V(StringDictionaryNegativeLookup) |
| 71 | 77 |
| 72 // List of code stubs only used on ARM platforms. | 78 // List of code stubs only used on ARM platforms. |
| 73 #ifdef V8_TARGET_ARCH_ARM | 79 #ifdef V8_TARGET_ARCH_ARM |
| 74 #define CODE_STUB_LIST_ARM(V) \ | 80 #define CODE_STUB_LIST_ARM(V) \ |
| 75 V(GetProperty) \ | 81 V(GetProperty) \ |
| 76 V(SetProperty) \ | 82 V(SetProperty) \ |
| 77 V(InvokeBuiltin) \ | 83 V(InvokeBuiltin) \ |
| 78 V(RegExpCEntry) \ | 84 V(RegExpCEntry) \ |
| 79 V(DirectCEntry) | 85 V(DirectCEntry) |
| 80 #else | 86 #else |
| 81 #define CODE_STUB_LIST_ARM(V) | 87 #define CODE_STUB_LIST_ARM(V) |
| 82 #endif | 88 #endif |
| 83 | 89 |
| 84 // List of code stubs only used on MIPS platforms. | 90 // List of code stubs only used on MIPS platforms. |
| 85 #ifdef V8_TARGET_ARCH_MIPS | 91 #ifdef V8_TARGET_ARCH_MIPS |
| 86 #define CODE_STUB_LIST_MIPS(V) \ | 92 #define CODE_STUB_LIST_MIPS(V) \ |
| 87 V(RegExpCEntry) | 93 V(RegExpCEntry) \ |
| 94 V(DirectCEntry) |
| 88 #else | 95 #else |
| 89 #define CODE_STUB_LIST_MIPS(V) | 96 #define CODE_STUB_LIST_MIPS(V) |
| 90 #endif | 97 #endif |
| 91 | 98 |
| 92 // Combined list of code stubs. | 99 // Combined list of code stubs. |
| 93 #define CODE_STUB_LIST(V) \ | 100 #define CODE_STUB_LIST(V) \ |
| 94 CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 101 CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 95 CODE_STUB_LIST_ARM(V) \ | 102 CODE_STUB_LIST_ARM(V) \ |
| 96 CODE_STUB_LIST_MIPS(V) | 103 CODE_STUB_LIST_MIPS(V) |
| 97 | 104 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 426 |
| 420 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } | 427 virtual void FinishCode(Code* code) { code->set_compare_state(state_); } |
| 421 | 428 |
| 422 virtual CodeStub::Major MajorKey() { return CompareIC; } | 429 virtual CodeStub::Major MajorKey() { return CompareIC; } |
| 423 virtual int MinorKey(); | 430 virtual int MinorKey(); |
| 424 | 431 |
| 425 virtual int GetCodeKind() { return Code::COMPARE_IC; } | 432 virtual int GetCodeKind() { return Code::COMPARE_IC; } |
| 426 | 433 |
| 427 void GenerateSmis(MacroAssembler* masm); | 434 void GenerateSmis(MacroAssembler* masm); |
| 428 void GenerateHeapNumbers(MacroAssembler* masm); | 435 void GenerateHeapNumbers(MacroAssembler* masm); |
| 436 void GenerateSymbols(MacroAssembler* masm); |
| 429 void GenerateStrings(MacroAssembler* masm); | 437 void GenerateStrings(MacroAssembler* masm); |
| 430 void GenerateObjects(MacroAssembler* masm); | 438 void GenerateObjects(MacroAssembler* masm); |
| 431 void GenerateMiss(MacroAssembler* masm); | 439 void GenerateMiss(MacroAssembler* masm); |
| 432 | 440 |
| 433 bool strict() const { return op_ == Token::EQ_STRICT; } | 441 bool strict() const { return op_ == Token::EQ_STRICT; } |
| 434 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } | 442 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } |
| 435 | 443 |
| 436 Token::Value op_; | 444 Token::Value op_; |
| 437 CompareIC::State state_; | 445 CompareIC::State state_; |
| 438 }; | 446 }; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 masm_->set_allow_stub_calls(previous_allow_); | 921 masm_->set_allow_stub_calls(previous_allow_); |
| 914 } | 922 } |
| 915 | 923 |
| 916 private: | 924 private: |
| 917 MacroAssembler* masm_; | 925 MacroAssembler* masm_; |
| 918 bool previous_allow_; | 926 bool previous_allow_; |
| 919 | 927 |
| 920 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); | 928 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); |
| 921 }; | 929 }; |
| 922 | 930 |
| 931 #ifdef DEBUG |
| 932 #define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); } |
| 933 #else |
| 934 #define DECLARE_ARRAY_STUB_PRINT(name) |
| 935 #endif |
| 936 |
| 937 |
| 938 class KeyedLoadFastElementStub : public CodeStub { |
| 939 public: |
| 940 explicit KeyedLoadFastElementStub() { |
| 941 } |
| 942 |
| 943 Major MajorKey() { return KeyedLoadFastElement; } |
| 944 int MinorKey() { return 0; } |
| 945 |
| 946 void Generate(MacroAssembler* masm); |
| 947 |
| 948 const char* GetName() { return "KeyedLoadFastElementStub"; } |
| 949 |
| 950 DECLARE_ARRAY_STUB_PRINT(KeyedLoadFastElementStub) |
| 951 }; |
| 952 |
| 953 |
| 954 class KeyedStoreFastElementStub : public CodeStub { |
| 955 public: |
| 956 explicit KeyedStoreFastElementStub(bool is_js_array) |
| 957 : is_js_array_(is_js_array) { } |
| 958 |
| 959 Major MajorKey() { return KeyedStoreFastElement; } |
| 960 int MinorKey() { return is_js_array_ ? 1 : 0; } |
| 961 |
| 962 void Generate(MacroAssembler* masm); |
| 963 |
| 964 const char* GetName() { return "KeyedStoreFastElementStub"; } |
| 965 |
| 966 DECLARE_ARRAY_STUB_PRINT(KeyedStoreFastElementStub) |
| 967 |
| 968 private: |
| 969 bool is_js_array_; |
| 970 }; |
| 971 |
| 972 |
| 973 class KeyedLoadExternalArrayStub : public CodeStub { |
| 974 public: |
| 975 explicit KeyedLoadExternalArrayStub(ExternalArrayType array_type) |
| 976 : array_type_(array_type) { } |
| 977 |
| 978 Major MajorKey() { return KeyedLoadExternalArray; } |
| 979 int MinorKey() { return array_type_; } |
| 980 |
| 981 void Generate(MacroAssembler* masm); |
| 982 |
| 983 const char* GetName() { return "KeyedLoadExternalArrayStub"; } |
| 984 |
| 985 DECLARE_ARRAY_STUB_PRINT(KeyedLoadExternalArrayStub) |
| 986 |
| 987 protected: |
| 988 ExternalArrayType array_type_; |
| 989 }; |
| 990 |
| 991 |
| 992 class KeyedStoreExternalArrayStub : public CodeStub { |
| 993 public: |
| 994 explicit KeyedStoreExternalArrayStub(ExternalArrayType array_type) |
| 995 : array_type_(array_type) { } |
| 996 |
| 997 Major MajorKey() { return KeyedStoreExternalArray; } |
| 998 int MinorKey() { return array_type_; } |
| 999 |
| 1000 void Generate(MacroAssembler* masm); |
| 1001 |
| 1002 const char* GetName() { return "KeyedStoreExternalArrayStub"; } |
| 1003 |
| 1004 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub) |
| 1005 |
| 1006 protected: |
| 1007 ExternalArrayType array_type_; |
| 1008 }; |
| 1009 |
| 1010 |
| 923 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
| 924 | 1012 |
| 925 #endif // V8_CODE_STUBS_H_ | 1013 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |