Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/code-stub-assembler.h

Issue 2383473003: [stubs] Add more helper methods for heap constants (Closed)
Patch Set: rebasing onto master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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(BooleanMap, BooleanMap) \
30 V(empty_string, EmptyString) \
31 V(FixedArrayMap, FixedArrayMap) \
32 V(FixedCOWArrayMap, FixedCOWArrayMap) \
33 V(FixedDoubleArrayMap, FixedDoubleArrayMap) \
34 V(HeapNumberMap, HeapNumberMap) \
35 V(MinusZeroValue, MinusZero) \
36 V(NanValue, Nan) \
37 V(NullValue, Null) \
38 V(TheHoleValue, TheHole) \
39 V(UndefinedValue, Undefined)
40
28 // Provides JavaScript-specific "macro-assembler" functionality on top of the 41 // Provides JavaScript-specific "macro-assembler" functionality on top of the
29 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, 42 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler,
30 // it's possible to add JavaScript-specific useful CodeAssembler "macros" 43 // it's possible to add JavaScript-specific useful CodeAssembler "macros"
31 // without modifying files in the compiler directory (and requiring a review 44 // without modifying files in the compiler directory (and requiring a review
32 // from a compiler directory OWNER). 45 // from a compiler directory OWNER).
33 class CodeStubAssembler : public compiler::CodeAssembler { 46 class CodeStubAssembler : public compiler::CodeAssembler {
34 public: 47 public:
35 // Create with CallStub linkage. 48 // Create with CallStub linkage.
36 // |result_size| specifies the number of results returned by the stub. 49 // |result_size| specifies the number of results returned by the stub.
37 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. 50 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) { 82 compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) {
70 if (mode != SMI_PARAMETERS) value = SmiUntag(value); 83 if (mode != SMI_PARAMETERS) value = SmiUntag(value);
71 return value; 84 return value;
72 } 85 }
73 86
74 compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) { 87 compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) {
75 if (mode != SMI_PARAMETERS) value = SmiTag(value); 88 if (mode != SMI_PARAMETERS) value = SmiTag(value);
76 return value; 89 return value;
77 } 90 }
78 91
79 compiler::Node* BooleanMapConstant();
80 compiler::Node* EmptyStringConstant();
81 compiler::Node* FixedArrayMapConstant();
82 compiler::Node* FixedCowArrayMapConstant();
83 compiler::Node* FixedDoubleArrayMapConstant();
84 compiler::Node* HeapNumberMapConstant();
85 compiler::Node* NoContextConstant(); 92 compiler::Node* NoContextConstant();
86 compiler::Node* NanConstant(); 93 #define HEAP_CONSTANT_ACCESSOR(rootName, name) compiler::Node* name##Constant();
87 compiler::Node* NullConstant(); 94 HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR)
88 compiler::Node* MinusZeroConstant(); 95 #undef HEAP_CONSTANT_ACCESSOR
89 compiler::Node* UndefinedConstant(); 96
90 compiler::Node* TheHoleConstant(); 97 #define HEAP_CONSTANT_TEST(rootName, name) \
98 compiler::Node* Is##name(compiler::Node* value);
99 HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST)
100 #undef HEAP_CONSTANT_TEST
101
91 compiler::Node* HashSeed(); 102 compiler::Node* HashSeed();
92 compiler::Node* StaleRegisterConstant(); 103 compiler::Node* StaleRegisterConstant();
93 104
94 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); 105 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode);
95 106
96 // Float64 operations. 107 // Float64 operations.
97 compiler::Node* Float64Ceil(compiler::Node* x); 108 compiler::Node* Float64Ceil(compiler::Node* x);
98 compiler::Node* Float64Floor(compiler::Node* x); 109 compiler::Node* Float64Floor(compiler::Node* x);
99 compiler::Node* Float64Round(compiler::Node* x); 110 compiler::Node* Float64Round(compiler::Node* x);
100 compiler::Node* Float64Trunc(compiler::Node* x); 111 compiler::Node* Float64Trunc(compiler::Node* x);
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 Label* bailout); 881 Label* bailout);
871 882
872 static const int kElementLoopUnrollThreshold = 8; 883 static const int kElementLoopUnrollThreshold = 8;
873 }; 884 };
874 885
875 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); 886 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags);
876 887
877 } // namespace internal 888 } // namespace internal
878 } // namespace v8 889 } // namespace v8
879 #endif // V8_CODE_STUB_ASSEMBLER_H_ 890 #endif // V8_CODE_STUB_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698