| 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" |
| 11 #include "src/globals.h" | 11 #include "src/globals.h" |
| 12 #include "src/macro-assembler.h" | 12 #include "src/macro-assembler.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 // List of code stubs used on all platforms. | 17 // List of code stubs used on all platforms. |
| 18 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ | 18 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ |
| 19 V(CallFunction) \ | 19 V(CallFunction) \ |
| 20 V(CallConstruct) \ | 20 V(CallConstruct) \ |
| 21 V(BinaryOpIC) \ | 21 V(BinaryOpIC) \ |
| 22 V(BinaryOpICWithAllocationSite) \ | 22 V(BinaryOpICWithAllocationSite) \ |
| 23 V(BinaryOpWithAllocationSite) \ | 23 V(BinaryOpWithAllocationSite) \ |
| 24 V(StringAdd) \ | 24 V(StringAdd) \ |
| 25 V(SubString) \ | 25 V(SubString) \ |
| 26 V(StringCompare) \ | 26 V(StringCompare) \ |
| 27 V(Compare) \ | 27 V(Compare) \ |
| 28 V(CompareIC) \ | 28 V(CompareIC) \ |
| 29 V(CompareNilIC) \ | 29 V(CompareNilIC) \ |
| 30 V(MathPow) \ | 30 V(MathPow) \ |
| 31 V(CallIC) \ | 31 V(CallIC) \ |
| 32 V(CallIC_Array) \ | 32 V(CallIC_Array) \ |
| 33 V(FunctionPrototype) \ | 33 V(FunctionPrototype) \ |
| 34 V(RecordWrite) \ | 34 V(RecordWrite) \ |
| 35 V(StoreBufferOverflow) \ | 35 V(StoreBufferOverflow) \ |
| 36 V(RegExpExec) \ | 36 V(RegExpExec) \ |
| 37 V(Instanceof) \ | 37 V(Instanceof) \ |
| 38 V(ConvertToDouble) \ | 38 V(ConvertToDouble) \ |
| 39 V(WriteInt32ToHeapNumber) \ | 39 V(WriteInt32ToHeapNumber) \ |
| 40 V(StackCheck) \ | 40 V(StackCheck) \ |
| 41 V(Interrupt) \ | 41 V(Interrupt) \ |
| 42 V(FastNewClosure) \ | 42 V(FastNewClosure) \ |
| 43 V(FastNewContext) \ | 43 V(FastNewContext) \ |
| 44 V(FastCloneShallowArray) \ | 44 V(FastCloneShallowArray) \ |
| 45 V(FastCloneShallowObject) \ | 45 V(FastCloneShallowObject) \ |
| 46 V(CreateAllocationSite) \ | 46 V(CreateAllocationSite) \ |
| 47 V(ToBoolean) \ | 47 V(ToBoolean) \ |
| 48 V(ToNumber) \ | 48 V(ToNumber) \ |
| 49 V(ArgumentsAccess) \ | 49 V(ArgumentsAccess) \ |
| 50 V(RegExpConstructResult) \ | 50 V(RegExpConstructResult) \ |
| 51 V(NumberToString) \ | 51 V(NumberToString) \ |
| 52 V(DoubleToI) \ | 52 V(DoubleToI) \ |
| 53 V(CEntry) \ | 53 V(CEntry) \ |
| 54 V(JSEntry) \ | 54 V(JSEntry) \ |
| 55 V(KeyedLoadElement) \ | 55 V(KeyedLoadElement) \ |
| 56 V(KeyedLoadGeneric) \ | 56 V(KeyedLoadGeneric) \ |
| 57 V(ArrayNoArgumentConstructor) \ | 57 V(ArrayNoArgumentConstructor) \ |
| 58 V(ArraySingleArgumentConstructor) \ | 58 V(ArraySingleArgumentConstructor) \ |
| 59 V(ArrayNArgumentsConstructor) \ | 59 V(ArrayNArgumentsConstructor) \ |
| 60 V(InternalArrayNoArgumentConstructor) \ | 60 V(InternalArrayNoArgumentConstructor) \ |
| 61 V(InternalArraySingleArgumentConstructor) \ | 61 V(InternalArraySingleArgumentConstructor) \ |
| 62 V(InternalArrayNArgumentsConstructor) \ | 62 V(InternalArrayNArgumentsConstructor) \ |
| 63 V(KeyedStoreElement) \ | 63 V(KeyedStoreElement) \ |
| 64 V(DebuggerStatement) \ | 64 V(DebuggerStatement) \ |
| 65 V(NameDictionaryLookup) \ | 65 V(NameDictionaryLookup) \ |
| 66 V(ElementsTransitionAndStore) \ | 66 V(ElementsTransitionAndStore) \ |
| 67 V(TransitionElementsKind) \ | 67 V(TransitionElementsKind) \ |
| 68 V(StoreArrayLiteralElement) \ | 68 V(StoreArrayLiteralElement) \ |
| 69 V(StubFailureTrampoline) \ | 69 V(StubFailureTrampoline) \ |
| 70 V(ArrayConstructor) \ | 70 V(ArrayConstructor) \ |
| 71 V(InternalArrayConstructor) \ | 71 V(InternalArrayConstructor) \ |
| 72 V(ProfileEntryHook) \ | 72 V(ProfileEntryHook) \ |
| 73 V(StoreGlobal) \ | 73 V(StoreGlobal) \ |
| 74 V(CallApiFunction) \ | 74 V(CallApiFunction) \ |
| 75 V(CallApiGetter) \ | 75 V(CallApiGetter) \ |
| 76 /* IC Handler stubs */ \ | 76 /* IC Handler stubs */ \ |
| 77 V(LoadField) \ | 77 V(LoadField) \ |
| 78 V(KeyedLoadField) \ | 78 V(StringLength) |
| 79 V(StringLength) \ | |
| 80 V(KeyedStringLength) | |
| 81 | 79 |
| 82 // List of code stubs only used on ARM 32 bits platforms. | 80 // List of code stubs only used on ARM 32 bits platforms. |
| 83 #if V8_TARGET_ARCH_ARM | 81 #if V8_TARGET_ARCH_ARM |
| 84 #define CODE_STUB_LIST_ARM(V) \ | 82 #define CODE_STUB_LIST_ARM(V) \ |
| 85 V(GetProperty) \ | 83 V(GetProperty) \ |
| 86 V(SetProperty) \ | 84 V(SetProperty) \ |
| 87 V(InvokeBuiltin) \ | 85 V(InvokeBuiltin) \ |
| 88 V(DirectCEntry) | 86 V(DirectCEntry) |
| 89 #else | 87 #else |
| 90 #define CODE_STUB_LIST_ARM(V) | 88 #define CODE_STUB_LIST_ARM(V) |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1029 |
| 1032 void Initialize(Code::Kind kind) { | 1030 void Initialize(Code::Kind kind) { |
| 1033 bit_field_ = KindBits::encode(kind); | 1031 bit_field_ = KindBits::encode(kind); |
| 1034 } | 1032 } |
| 1035 | 1033 |
| 1036 private: | 1034 private: |
| 1037 virtual CodeStub::Major MajorKey() const { return StringLength; } | 1035 virtual CodeStub::Major MajorKey() const { return StringLength; } |
| 1038 }; | 1036 }; |
| 1039 | 1037 |
| 1040 | 1038 |
| 1041 class KeyedStringLengthStub: public StringLengthStub { | |
| 1042 public: | |
| 1043 explicit KeyedStringLengthStub(Isolate* isolate) : StringLengthStub(isolate) { | |
| 1044 Initialize(Code::KEYED_LOAD_IC); | |
| 1045 } | |
| 1046 virtual void InitializeInterfaceDescriptor( | |
| 1047 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 1048 | |
| 1049 private: | |
| 1050 virtual CodeStub::Major MajorKey() const { return KeyedStringLength; } | |
| 1051 }; | |
| 1052 | |
| 1053 | |
| 1054 class StoreGlobalStub : public HandlerStub { | 1039 class StoreGlobalStub : public HandlerStub { |
| 1055 public: | 1040 public: |
| 1056 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) | 1041 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) |
| 1057 : HandlerStub(isolate) { | 1042 : HandlerStub(isolate) { |
| 1058 bit_field_ = IsConstantBits::encode(is_constant) | | 1043 bit_field_ = IsConstantBits::encode(is_constant) | |
| 1059 CheckGlobalBits::encode(check_global); | 1044 CheckGlobalBits::encode(check_global); |
| 1060 } | 1045 } |
| 1061 | 1046 |
| 1062 static Handle<HeapObject> global_placeholder(Isolate* isolate) { | 1047 static Handle<HeapObject> global_placeholder(Isolate* isolate) { |
| 1063 return isolate->factory()->uninitialized_value(); | 1048 return isolate->factory()->uninitialized_value(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 | 1132 |
| 1148 private: | 1133 private: |
| 1149 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; | 1134 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; |
| 1150 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } | 1135 virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; } |
| 1151 virtual int MinorKey() const V8_OVERRIDE { return 0; } | 1136 virtual int MinorKey() const V8_OVERRIDE { return 0; } |
| 1152 | 1137 |
| 1153 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); | 1138 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); |
| 1154 }; | 1139 }; |
| 1155 | 1140 |
| 1156 | 1141 |
| 1157 class KeyedLoadFieldStub: public LoadFieldStub { | |
| 1158 public: | |
| 1159 KeyedLoadFieldStub(Isolate* isolate, FieldIndex index) | |
| 1160 : LoadFieldStub(isolate, index) { | |
| 1161 Initialize(Code::KEYED_LOAD_IC); | |
| 1162 } | |
| 1163 | |
| 1164 virtual void InitializeInterfaceDescriptor( | |
| 1165 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | |
| 1166 | |
| 1167 private: | |
| 1168 virtual CodeStub::Major MajorKey() const { return KeyedLoadField; } | |
| 1169 }; | |
| 1170 | |
| 1171 | |
| 1172 class BinaryOpICStub : public HydrogenCodeStub { | 1142 class BinaryOpICStub : public HydrogenCodeStub { |
| 1173 public: | 1143 public: |
| 1174 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) | 1144 BinaryOpICStub(Isolate* isolate, Token::Value op, OverwriteMode mode) |
| 1175 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} | 1145 : HydrogenCodeStub(isolate, UNINITIALIZED), state_(isolate, op, mode) {} |
| 1176 | 1146 |
| 1177 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) | 1147 BinaryOpICStub(Isolate* isolate, const BinaryOpIC::State& state) |
| 1178 : HydrogenCodeStub(isolate), state_(state) {} | 1148 : HydrogenCodeStub(isolate), state_(state) {} |
| 1179 | 1149 |
| 1180 static void GenerateAheadOfTime(Isolate* isolate); | 1150 static void GenerateAheadOfTime(Isolate* isolate); |
| 1181 | 1151 |
| (...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 | 2538 |
| 2569 | 2539 |
| 2570 class CallDescriptors { | 2540 class CallDescriptors { |
| 2571 public: | 2541 public: |
| 2572 static void InitializeForIsolate(Isolate* isolate); | 2542 static void InitializeForIsolate(Isolate* isolate); |
| 2573 }; | 2543 }; |
| 2574 | 2544 |
| 2575 } } // namespace v8::internal | 2545 } } // namespace v8::internal |
| 2576 | 2546 |
| 2577 #endif // V8_CODE_STUBS_H_ | 2547 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |