OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class CallInterfaceDescriptor; | 16 class CallInterfaceDescriptor; |
17 class StatsCounter; | 17 class StatsCounter; |
18 class StubCache; | 18 class StubCache; |
19 | 19 |
20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; | 20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
21 | 21 |
22 enum class UnicodeEncoding { | 22 enum class UnicodeEncoding { |
23 // Different unicode encodings in a |word32|: | 23 // Different unicode encodings in a |word32|: |
24 UTF16, // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate | 24 UTF16, // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate |
25 UTF32, // full UTF32 code unit / Unicode codepoint | 25 UTF32, // full UTF32 code unit / Unicode codepoint |
26 }; | 26 }; |
27 | 27 |
| 28 #define HEAP_CONSTANT_LIST(V) \ |
| 29 V(empty_string, EmptyString) \ |
| 30 V(FixedArrayMap, FixedArrayMap) \ |
| 31 V(FixedCOWArrayMap, FixedCOWArrayMap) \ |
| 32 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \ |
| 33 V(HeapNumberMap, HeapNumberMap) \ |
| 34 V(MinusZeroValue, MinusZero) \ |
| 35 V(NanValue, Nan) \ |
| 36 V(NullValue, Null) \ |
| 37 V(UndefinedValue, Undefined) \ |
| 38 V(TheHoleValue, TheHole) |
| 39 |
28 // Provides JavaScript-specific "macro-assembler" functionality on top of the | 40 // Provides JavaScript-specific "macro-assembler" functionality on top of the |
29 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, | 41 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
30 // it's possible to add JavaScript-specific useful CodeAssembler "macros" | 42 // it's possible to add JavaScript-specific useful CodeAssembler "macros" |
31 // without modifying files in the compiler directory (and requiring a review | 43 // without modifying files in the compiler directory (and requiring a review |
32 // from a compiler directory OWNER). | 44 // from a compiler directory OWNER). |
33 class CodeStubAssembler : public compiler::CodeAssembler { | 45 class CodeStubAssembler : public compiler::CodeAssembler { |
34 public: | 46 public: |
35 // Create with CallStub linkage. | 47 // Create with CallStub linkage. |
36 // |result_size| specifies the number of results returned by the stub. | 48 // |result_size| specifies the number of results returned by the stub. |
37 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. | 49 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) { | 81 compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) { |
70 if (mode != SMI_PARAMETERS) value = SmiUntag(value); | 82 if (mode != SMI_PARAMETERS) value = SmiUntag(value); |
71 return value; | 83 return value; |
72 } | 84 } |
73 | 85 |
74 compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) { | 86 compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) { |
75 if (mode != SMI_PARAMETERS) value = SmiTag(value); | 87 if (mode != SMI_PARAMETERS) value = SmiTag(value); |
76 return value; | 88 return value; |
77 } | 89 } |
78 | 90 |
| 91 compiler::Node* NoContextConstant(); |
79 compiler::Node* BooleanMapConstant(); | 92 compiler::Node* BooleanMapConstant(); |
80 compiler::Node* EmptyStringConstant(); | 93 #define HEAP_CONSTANT_ACCESSOR(rootName, name) compiler::Node* name##Constant(); |
81 compiler::Node* FixedArrayMapConstant(); | 94 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR) |
82 compiler::Node* FixedCowArrayMapConstant(); | 95 #undef HEAP_CONSTANT_ACCESSOR |
83 compiler::Node* FixedDoubleArrayMapConstant(); | 96 |
84 compiler::Node* HeapNumberMapConstant(); | 97 compiler::Node* IsBooleanMap(compiler::Node* value); |
85 compiler::Node* NoContextConstant(); | 98 #define HEAP_CONSTANT_TEST(rootName, name) \ |
86 compiler::Node* NanConstant(); | 99 compiler::Node* Is##name(compiler::Node* value); |
87 compiler::Node* NullConstant(); | 100 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST) |
88 compiler::Node* MinusZeroConstant(); | 101 #undef HEAP_CONSTANT_TEST |
89 compiler::Node* UndefinedConstant(); | 102 |
90 compiler::Node* TheHoleConstant(); | |
91 compiler::Node* HashSeed(); | 103 compiler::Node* HashSeed(); |
92 compiler::Node* StaleRegisterConstant(); | 104 compiler::Node* StaleRegisterConstant(); |
93 | 105 |
94 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); | 106 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); |
95 | 107 |
96 // Float64 operations. | 108 // Float64 operations. |
97 compiler::Node* Float64Ceil(compiler::Node* x); | 109 compiler::Node* Float64Ceil(compiler::Node* x); |
98 compiler::Node* Float64Floor(compiler::Node* x); | 110 compiler::Node* Float64Floor(compiler::Node* x); |
99 compiler::Node* Float64Round(compiler::Node* x); | 111 compiler::Node* Float64Round(compiler::Node* x); |
100 compiler::Node* Float64Trunc(compiler::Node* x); | 112 compiler::Node* Float64Trunc(compiler::Node* x); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 Label* bailout); | 875 Label* bailout); |
864 | 876 |
865 static const int kElementLoopUnrollThreshold = 8; | 877 static const int kElementLoopUnrollThreshold = 8; |
866 }; | 878 }; |
867 | 879 |
868 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 880 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
869 | 881 |
870 } // namespace internal | 882 } // namespace internal |
871 } // namespace v8 | 883 } // namespace v8 |
872 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 884 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |