OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_COMPILER_JS_GRAPH_H_ | 5 #ifndef V8_COMPILER_JS_GRAPH_H_ |
6 #define V8_COMPILER_JS_GRAPH_H_ | 6 #define V8_COMPILER_JS_GRAPH_H_ |
7 | 7 |
8 #include "src/compiler/common-node-cache.h" | 8 #include "src/compiler/common-node-cache.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
(...skipping 68 matching lines...) Loading... |
79 } | 79 } |
80 | 80 |
81 // Creates a Int32Constant/Int64Constant node, depending on the word size of | 81 // Creates a Int32Constant/Int64Constant node, depending on the word size of |
82 // the target machine. | 82 // the target machine. |
83 // TODO(turbofan): Code using Int32Constant/Int64Constant to store pointer | 83 // TODO(turbofan): Code using Int32Constant/Int64Constant to store pointer |
84 // constants is probably not serializable. | 84 // constants is probably not serializable. |
85 Node* IntPtrConstant(intptr_t value) { | 85 Node* IntPtrConstant(intptr_t value) { |
86 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value)) | 86 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value)) |
87 : Int64Constant(static_cast<int64_t>(value)); | 87 : Int64Constant(static_cast<int64_t>(value)); |
88 } | 88 } |
| 89 template <typename T> |
| 90 Node* PointerConstant(T* value) { |
| 91 return IntPtrConstant(bit_cast<intptr_t>(value)); |
| 92 } |
89 | 93 |
90 // Creates a Float32Constant node, usually canonicalized. | 94 // Creates a Float32Constant node, usually canonicalized. |
91 Node* Float32Constant(float value); | 95 Node* Float32Constant(float value); |
92 | 96 |
93 // Creates a Float64Constant node, usually canonicalized. | 97 // Creates a Float64Constant node, usually canonicalized. |
94 Node* Float64Constant(double value); | 98 Node* Float64Constant(double value); |
95 | 99 |
96 // Creates an ExternalConstant node, usually canonicalized. | 100 // Creates an ExternalConstant node, usually canonicalized. |
97 Node* ExternalConstant(ExternalReference ref); | 101 Node* ExternalConstant(ExternalReference ref); |
98 | 102 |
(...skipping 36 matching lines...) Loading... |
135 Factory* factory() { return isolate()->factory(); } | 139 Factory* factory() { return isolate()->factory(); } |
136 | 140 |
137 DISALLOW_COPY_AND_ASSIGN(JSGraph); | 141 DISALLOW_COPY_AND_ASSIGN(JSGraph); |
138 }; | 142 }; |
139 | 143 |
140 } // namespace compiler | 144 } // namespace compiler |
141 } // namespace internal | 145 } // namespace internal |
142 } // namespace v8 | 146 } // namespace v8 |
143 | 147 |
144 #endif | 148 #endif |
OLD | NEW |