| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
| 6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 V(StoreArrayLiteralElement) \ | 69 V(StoreArrayLiteralElement) \ |
| 70 V(StubFailureTrampoline) \ | 70 V(StubFailureTrampoline) \ |
| 71 V(ArrayConstructor) \ | 71 V(ArrayConstructor) \ |
| 72 V(InternalArrayConstructor) \ | 72 V(InternalArrayConstructor) \ |
| 73 V(ProfileEntryHook) \ | 73 V(ProfileEntryHook) \ |
| 74 V(StoreGlobal) \ | 74 V(StoreGlobal) \ |
| 75 V(CallApiFunction) \ | 75 V(CallApiFunction) \ |
| 76 V(CallApiGetter) \ | 76 V(CallApiGetter) \ |
| 77 /* IC Handler stubs */ \ | 77 /* IC Handler stubs */ \ |
| 78 V(LoadField) \ | 78 V(LoadField) \ |
| 79 V(LoadConstant) \ |
| 79 V(StringLength) | 80 V(StringLength) |
| 80 | 81 |
| 81 // List of code stubs only used on ARM 32 bits platforms. | 82 // List of code stubs only used on ARM 32 bits platforms. |
| 82 #if V8_TARGET_ARCH_ARM | 83 #if V8_TARGET_ARCH_ARM |
| 83 #define CODE_STUB_LIST_ARM(V) \ | 84 #define CODE_STUB_LIST_ARM(V) \ |
| 84 V(GetProperty) \ | 85 V(GetProperty) \ |
| 85 V(SetProperty) \ | 86 V(SetProperty) \ |
| 86 V(InvokeBuiltin) \ | 87 V(InvokeBuiltin) \ |
| 87 V(DirectCEntry) | 88 V(DirectCEntry) |
| 88 #else | 89 #else |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 virtual int MinorKey() const { return 0; } | 897 virtual int MinorKey() const { return 0; } |
| 897 }; | 898 }; |
| 898 | 899 |
| 899 | 900 |
| 900 class HandlerStub : public HydrogenCodeStub { | 901 class HandlerStub : public HydrogenCodeStub { |
| 901 public: | 902 public: |
| 902 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } | 903 virtual Code::Kind GetCodeKind() const { return Code::HANDLER; } |
| 903 virtual ExtraICState GetExtraICState() const { return kind(); } | 904 virtual ExtraICState GetExtraICState() const { return kind(); } |
| 904 virtual InlineCacheState GetICState() { return MONOMORPHIC; } | 905 virtual InlineCacheState GetICState() { return MONOMORPHIC; } |
| 905 | 906 |
| 907 virtual void InitializeInterfaceDescriptor( |
| 908 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
| 909 |
| 906 protected: | 910 protected: |
| 907 explicit HandlerStub(Isolate* isolate) | 911 explicit HandlerStub(Isolate* isolate) |
| 908 : HydrogenCodeStub(isolate), bit_field_(0) {} | 912 : HydrogenCodeStub(isolate), bit_field_(0) {} |
| 909 virtual int NotMissMinorKey() const { return bit_field_; } | 913 virtual int NotMissMinorKey() const { return bit_field_; } |
| 910 virtual Code::Kind kind() const = 0; | 914 virtual Code::Kind kind() const = 0; |
| 911 int bit_field_; | 915 int bit_field_; |
| 912 }; | 916 }; |
| 913 | 917 |
| 914 | 918 |
| 915 class LoadFieldStub: public HandlerStub { | 919 class LoadFieldStub: public HandlerStub { |
| 916 public: | 920 public: |
| 917 LoadFieldStub(Isolate* isolate, FieldIndex index) | 921 LoadFieldStub(Isolate* isolate, FieldIndex index) |
| 918 : HandlerStub(isolate), index_(index) { | 922 : HandlerStub(isolate), index_(index) { |
| 919 int property_index_key = index_.GetLoadFieldStubKey(); | 923 int property_index_key = index_.GetLoadFieldStubKey(); |
| 920 bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key); | 924 bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key); |
| 921 } | 925 } |
| 922 | 926 |
| 923 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 927 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 924 | 928 |
| 925 virtual void InitializeInterfaceDescriptor( | |
| 926 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 927 | |
| 928 Representation representation() { | 929 Representation representation() { |
| 929 if (unboxed_double()) return Representation::Double(); | 930 if (unboxed_double()) return Representation::Double(); |
| 930 return Representation::Tagged(); | 931 return Representation::Tagged(); |
| 931 } | 932 } |
| 932 | 933 |
| 933 FieldIndex index() const { return index_; } | 934 FieldIndex index() const { return index_; } |
| 934 bool unboxed_double() { return index_.is_double(); } | 935 bool unboxed_double() { return index_.is_double(); } |
| 935 | 936 |
| 936 protected: | 937 protected: |
| 937 explicit LoadFieldStub(Isolate* isolate); | 938 explicit LoadFieldStub(Isolate* isolate); |
| 938 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 939 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 939 virtual Code::StubType GetStubType() { return Code::FAST; } | 940 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 940 | 941 |
| 941 private: | 942 private: |
| 942 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 943 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 943 virtual CodeStub::Major MajorKey() const { return LoadField; } | 944 virtual CodeStub::Major MajorKey() const { return LoadField; } |
| 944 FieldIndex index_; | 945 FieldIndex index_; |
| 945 }; | 946 }; |
| 946 | 947 |
| 947 | 948 |
| 949 class LoadConstantStub : public HandlerStub { |
| 950 public: |
| 951 LoadConstantStub(Isolate* isolate, int descriptor) : HandlerStub(isolate) { |
| 952 bit_field_ = descriptor; |
| 953 } |
| 954 |
| 955 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 956 |
| 957 int descriptor() const { return bit_field_; } |
| 958 |
| 959 protected: |
| 960 explicit LoadConstantStub(Isolate* isolate); |
| 961 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 962 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 963 |
| 964 private: |
| 965 virtual CodeStub::Major MajorKey() const { return LoadConstant; } |
| 966 }; |
| 967 |
| 968 |
| 948 class StringLengthStub: public HandlerStub { | 969 class StringLengthStub: public HandlerStub { |
| 949 public: | 970 public: |
| 950 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} | 971 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {} |
| 951 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 972 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 952 virtual void InitializeInterfaceDescriptor( | |
| 953 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 954 | 973 |
| 955 protected: | 974 protected: |
| 956 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 975 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 957 virtual Code::StubType GetStubType() { return Code::FAST; } | 976 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 958 | 977 |
| 959 private: | 978 private: |
| 960 virtual CodeStub::Major MajorKey() const { return StringLength; } | 979 virtual CodeStub::Major MajorKey() const { return StringLength; } |
| 961 }; | 980 }; |
| 962 | 981 |
| 963 | 982 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 985 Code::FindAndReplacePattern pattern; | 1004 Code::FindAndReplacePattern pattern; |
| 986 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); | 1005 pattern.Add(isolate()->factory()->global_property_cell_map(), cell); |
| 987 return CodeStub::GetCodeCopy(pattern); | 1006 return CodeStub::GetCodeCopy(pattern); |
| 988 } | 1007 } |
| 989 } | 1008 } |
| 990 | 1009 |
| 991 virtual Code::Kind kind() const { return Code::STORE_IC; } | 1010 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 992 | 1011 |
| 993 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 1012 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 994 | 1013 |
| 995 virtual void InitializeInterfaceDescriptor( | |
| 996 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 997 | |
| 998 bool is_constant() const { | 1014 bool is_constant() const { |
| 999 return IsConstantBits::decode(bit_field_); | 1015 return IsConstantBits::decode(bit_field_); |
| 1000 } | 1016 } |
| 1001 bool check_global() const { | 1017 bool check_global() const { |
| 1002 return CheckGlobalBits::decode(bit_field_); | 1018 return CheckGlobalBits::decode(bit_field_); |
| 1003 } | 1019 } |
| 1004 void set_is_constant(bool value) { | 1020 void set_is_constant(bool value) { |
| 1005 bit_field_ = IsConstantBits::update(bit_field_, value); | 1021 bit_field_ = IsConstantBits::update(bit_field_, value); |
| 1006 } | 1022 } |
| 1007 | 1023 |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2468 | 2484 |
| 2469 | 2485 |
| 2470 class CallDescriptors { | 2486 class CallDescriptors { |
| 2471 public: | 2487 public: |
| 2472 static void InitializeForIsolate(Isolate* isolate); | 2488 static void InitializeForIsolate(Isolate* isolate); |
| 2473 }; | 2489 }; |
| 2474 | 2490 |
| 2475 } } // namespace v8::internal | 2491 } } // namespace v8::internal |
| 2476 | 2492 |
| 2477 #endif // V8_CODE_STUBS_H_ | 2493 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |