| 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(StoreField) \ |
| 79 V(LoadConstant) \ | 80 V(LoadConstant) \ |
| 80 V(StringLength) | 81 V(StringLength) |
| 81 | 82 |
| 82 // List of code stubs only used on ARM 32 bits platforms. | 83 // List of code stubs only used on ARM 32 bits platforms. |
| 83 #if V8_TARGET_ARCH_ARM | 84 #if V8_TARGET_ARCH_ARM |
| 84 #define CODE_STUB_LIST_ARM(V) \ | 85 #define CODE_STUB_LIST_ARM(V) \ |
| 85 V(GetProperty) \ | 86 V(GetProperty) \ |
| 86 V(SetProperty) \ | 87 V(SetProperty) \ |
| 87 V(InvokeBuiltin) \ | 88 V(InvokeBuiltin) \ |
| 88 V(DirectCEntry) | 89 V(DirectCEntry) |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 virtual int NotMissMinorKey() const { return bit_field_; } | 914 virtual int NotMissMinorKey() const { return bit_field_; } |
| 914 virtual Code::Kind kind() const = 0; | 915 virtual Code::Kind kind() const = 0; |
| 915 int bit_field_; | 916 int bit_field_; |
| 916 }; | 917 }; |
| 917 | 918 |
| 918 | 919 |
| 919 class LoadFieldStub: public HandlerStub { | 920 class LoadFieldStub: public HandlerStub { |
| 920 public: | 921 public: |
| 921 LoadFieldStub(Isolate* isolate, FieldIndex index) | 922 LoadFieldStub(Isolate* isolate, FieldIndex index) |
| 922 : HandlerStub(isolate), index_(index) { | 923 : HandlerStub(isolate), index_(index) { |
| 923 int property_index_key = index_.GetLoadFieldStubKey(); | 924 int property_index_key = index_.GetFieldAccessStubKey(); |
| 924 bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key); | 925 bit_field_ = EncodedLoadFieldByIndexBits::encode(property_index_key); |
| 925 } | 926 } |
| 926 | 927 |
| 927 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | 928 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 928 | 929 |
| 929 Representation representation() { | |
| 930 if (unboxed_double()) return Representation::Double(); | |
| 931 return Representation::Tagged(); | |
| 932 } | |
| 933 | |
| 934 FieldIndex index() const { return index_; } | 930 FieldIndex index() const { return index_; } |
| 935 bool unboxed_double() { return index_.is_double(); } | |
| 936 | 931 |
| 937 protected: | 932 protected: |
| 938 explicit LoadFieldStub(Isolate* isolate); | 933 explicit LoadFieldStub(Isolate* isolate); |
| 939 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 934 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 940 virtual Code::StubType GetStubType() { return Code::FAST; } | 935 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 941 | 936 |
| 942 private: | 937 private: |
| 943 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; | 938 class EncodedLoadFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 944 virtual CodeStub::Major MajorKey() const { return LoadField; } | 939 virtual CodeStub::Major MajorKey() const { return LoadField; } |
| 945 FieldIndex index_; | 940 FieldIndex index_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 973 | 968 |
| 974 protected: | 969 protected: |
| 975 virtual Code::Kind kind() const { return Code::LOAD_IC; } | 970 virtual Code::Kind kind() const { return Code::LOAD_IC; } |
| 976 virtual Code::StubType GetStubType() { return Code::FAST; } | 971 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 977 | 972 |
| 978 private: | 973 private: |
| 979 virtual CodeStub::Major MajorKey() const { return StringLength; } | 974 virtual CodeStub::Major MajorKey() const { return StringLength; } |
| 980 }; | 975 }; |
| 981 | 976 |
| 982 | 977 |
| 978 class StoreFieldStub : public HandlerStub { |
| 979 public: |
| 980 StoreFieldStub(Isolate* isolate, FieldIndex index, |
| 981 Representation representation) |
| 982 : HandlerStub(isolate), index_(index), representation_(representation) { |
| 983 int property_index_key = index_.GetFieldAccessStubKey(); |
| 984 bit_field_ = EncodedStoreFieldByIndexBits::encode(property_index_key) | |
| 985 RepresentationBits::encode( |
| 986 PropertyDetails::EncodeRepresentation(representation)); |
| 987 } |
| 988 |
| 989 virtual Handle<Code> GenerateCode() V8_OVERRIDE; |
| 990 |
| 991 FieldIndex index() const { return index_; } |
| 992 Representation representation() { return representation_; } |
| 993 |
| 994 protected: |
| 995 explicit StoreFieldStub(Isolate* isolate); |
| 996 virtual Code::Kind kind() const { return Code::STORE_IC; } |
| 997 virtual Code::StubType GetStubType() { return Code::FAST; } |
| 998 |
| 999 private: |
| 1000 class EncodedStoreFieldByIndexBits : public BitField<int, 0, 13> {}; |
| 1001 class RepresentationBits : public BitField<int, 13, 4> {}; |
| 1002 virtual CodeStub::Major MajorKey() const { return StoreField; } |
| 1003 FieldIndex index_; |
| 1004 Representation representation_; |
| 1005 }; |
| 1006 |
| 1007 |
| 983 class StoreGlobalStub : public HandlerStub { | 1008 class StoreGlobalStub : public HandlerStub { |
| 984 public: | 1009 public: |
| 985 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1010 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
| 986 : HandlerStub(isolate) { | 1011 : HandlerStub(isolate) { |
| 987 bit_field_ = IsConstantBits::encode(is_constant) | | 1012 bit_field_ = IsConstantBits::encode(is_constant) | |
| 988 CheckGlobalBits::encode(check_global); | 1013 CheckGlobalBits::encode(check_global); |
| 989 } | 1014 } |
| 990 | 1015 |
| 991 static Handle<HeapObject> global_placeholder(Isolate* isolate) { | 1016 static Handle<HeapObject> global_placeholder(Isolate* isolate) { |
| 992 return isolate->factory()->uninitialized_value(); | 1017 return isolate->factory()->uninitialized_value(); |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2484 | 2509 |
| 2485 | 2510 |
| 2486 class CallDescriptors { | 2511 class CallDescriptors { |
| 2487 public: | 2512 public: |
| 2488 static void InitializeForIsolate(Isolate* isolate); | 2513 static void InitializeForIsolate(Isolate* isolate); |
| 2489 }; | 2514 }; |
| 2490 | 2515 |
| 2491 } } // namespace v8::internal | 2516 } } // namespace v8::internal |
| 2492 | 2517 |
| 2493 #endif // V8_CODE_STUBS_H_ | 2518 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |