| 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/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
| 9 #include "src/compiler/common-node-cache.h" | 9 #include "src/compiler/common-node-cache.h" |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 101 } |
| 102 | 102 |
| 103 // Creates a Int32Constant/Int64Constant node, depending on the word size of | 103 // Creates a Int32Constant/Int64Constant node, depending on the word size of |
| 104 // the target machine. | 104 // the target machine. |
| 105 // TODO(turbofan): Code using Int32Constant/Int64Constant to store pointer | 105 // TODO(turbofan): Code using Int32Constant/Int64Constant to store pointer |
| 106 // constants is probably not serializable. | 106 // constants is probably not serializable. |
| 107 Node* IntPtrConstant(intptr_t value) { | 107 Node* IntPtrConstant(intptr_t value) { |
| 108 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value)) | 108 return machine()->Is32() ? Int32Constant(static_cast<int32_t>(value)) |
| 109 : Int64Constant(static_cast<int64_t>(value)); | 109 : Int64Constant(static_cast<int64_t>(value)); |
| 110 } | 110 } |
| 111 template <typename T> | |
| 112 Node* PointerConstant(T* value) { | |
| 113 return IntPtrConstant(bit_cast<intptr_t>(value)); | |
| 114 } | |
| 115 | 111 |
| 116 Node* RelocatableInt32Constant(int32_t value, RelocInfo::Mode rmode); | 112 Node* RelocatableInt32Constant(int32_t value, RelocInfo::Mode rmode); |
| 117 Node* RelocatableInt64Constant(int64_t value, RelocInfo::Mode rmode); | 113 Node* RelocatableInt64Constant(int64_t value, RelocInfo::Mode rmode); |
| 118 Node* RelocatableIntPtrConstant(intptr_t value, RelocInfo::Mode rmode); | 114 Node* RelocatableIntPtrConstant(intptr_t value, RelocInfo::Mode rmode); |
| 119 | 115 |
| 120 // Creates a Float32Constant node, usually canonicalized. | 116 // Creates a Float32Constant node, usually canonicalized. |
| 121 Node* Float32Constant(float value); | 117 Node* Float32Constant(float value); |
| 122 | 118 |
| 123 // Creates a Float64Constant node, usually canonicalized. | 119 // Creates a Float64Constant node, usually canonicalized. |
| 124 Node* Float64Constant(double value); | 120 Node* Float64Constant(double value); |
| 125 | 121 |
| 122 // Creates a PointerConstant node (asm.js only). |
| 123 Node* PointerConstant(intptr_t value); |
| 124 template <typename T> |
| 125 Node* PointerConstant(T* value) { |
| 126 return PointerConstant(bit_cast<intptr_t>(value)); |
| 127 } |
| 128 |
| 126 // Creates an ExternalConstant node, usually canonicalized. | 129 // Creates an ExternalConstant node, usually canonicalized. |
| 127 Node* ExternalConstant(ExternalReference ref); | 130 Node* ExternalConstant(ExternalReference ref); |
| 128 Node* ExternalConstant(Runtime::FunctionId function_id); | 131 Node* ExternalConstant(Runtime::FunctionId function_id); |
| 129 | 132 |
| 130 Node* SmiConstant(int32_t immediate) { | 133 Node* SmiConstant(int32_t immediate) { |
| 131 DCHECK(Smi::IsValid(immediate)); | 134 DCHECK(Smi::IsValid(immediate)); |
| 132 return Constant(immediate); | 135 return Constant(immediate); |
| 133 } | 136 } |
| 134 | 137 |
| 135 // Creates a dummy Constant node, used to satisfy calling conventions of | 138 // Creates a dummy Constant node, used to satisfy calling conventions of |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 Node* NumberConstant(double value); | 197 Node* NumberConstant(double value); |
| 195 | 198 |
| 196 DISALLOW_COPY_AND_ASSIGN(JSGraph); | 199 DISALLOW_COPY_AND_ASSIGN(JSGraph); |
| 197 }; | 200 }; |
| 198 | 201 |
| 199 } // namespace compiler | 202 } // namespace compiler |
| 200 } // namespace internal | 203 } // namespace internal |
| 201 } // namespace v8 | 204 } // namespace v8 |
| 202 | 205 |
| 203 #endif | 206 #endif |
| OLD | NEW |