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 #include "src/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 Node* JSGraph::Constant(int32_t value) { | 114 Node* JSGraph::Constant(int32_t value) { |
115 if (value == 0) return ZeroConstant(); | 115 if (value == 0) return ZeroConstant(); |
116 if (value == 1) return OneConstant(); | 116 if (value == 1) return OneConstant(); |
117 return NumberConstant(value); | 117 return NumberConstant(value); |
118 } | 118 } |
119 | 119 |
120 | 120 |
121 Node* JSGraph::Int32Constant(int32_t value) { | 121 Node* JSGraph::Int32Constant(int32_t value) { |
122 Node** loc = cache_.FindInt32Constant(value); | 122 Node** loc = cache_.FindInt32Constant(value); |
123 if (*loc == NULL) { | 123 if (*loc == nullptr) { |
124 *loc = graph()->NewNode(common()->Int32Constant(value)); | 124 *loc = graph()->NewNode(common()->Int32Constant(value)); |
125 } | 125 } |
126 return *loc; | 126 return *loc; |
127 } | 127 } |
128 | 128 |
129 | 129 |
130 Node* JSGraph::Int64Constant(int64_t value) { | 130 Node* JSGraph::Int64Constant(int64_t value) { |
131 Node** loc = cache_.FindInt64Constant(value); | 131 Node** loc = cache_.FindInt64Constant(value); |
132 if (*loc == NULL) { | 132 if (*loc == nullptr) { |
133 *loc = graph()->NewNode(common()->Int64Constant(value)); | 133 *loc = graph()->NewNode(common()->Int64Constant(value)); |
134 } | 134 } |
135 return *loc; | 135 return *loc; |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 Node* JSGraph::NumberConstant(double value) { | 139 Node* JSGraph::NumberConstant(double value) { |
140 Node** loc = cache_.FindNumberConstant(value); | 140 Node** loc = cache_.FindNumberConstant(value); |
141 if (*loc == NULL) { | 141 if (*loc == nullptr) { |
142 *loc = graph()->NewNode(common()->NumberConstant(value)); | 142 *loc = graph()->NewNode(common()->NumberConstant(value)); |
143 } | 143 } |
144 return *loc; | 144 return *loc; |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 Node* JSGraph::Float32Constant(float value) { | 148 Node* JSGraph::Float32Constant(float value) { |
149 Node** loc = cache_.FindFloat32Constant(value); | 149 Node** loc = cache_.FindFloat32Constant(value); |
150 if (*loc == NULL) { | 150 if (*loc == nullptr) { |
151 *loc = graph()->NewNode(common()->Float32Constant(value)); | 151 *loc = graph()->NewNode(common()->Float32Constant(value)); |
152 } | 152 } |
153 return *loc; | 153 return *loc; |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 Node* JSGraph::Float64Constant(double value) { | 157 Node* JSGraph::Float64Constant(double value) { |
158 Node** loc = cache_.FindFloat64Constant(value); | 158 Node** loc = cache_.FindFloat64Constant(value); |
159 if (*loc == NULL) { | 159 if (*loc == nullptr) { |
160 *loc = graph()->NewNode(common()->Float64Constant(value)); | 160 *loc = graph()->NewNode(common()->Float64Constant(value)); |
161 } | 161 } |
162 return *loc; | 162 return *loc; |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 Node* JSGraph::ExternalConstant(ExternalReference reference) { | 166 Node* JSGraph::ExternalConstant(ExternalReference reference) { |
167 Node** loc = cache_.FindExternalConstant(reference); | 167 Node** loc = cache_.FindExternalConstant(reference); |
168 if (*loc == NULL) { | 168 if (*loc == nullptr) { |
169 *loc = graph()->NewNode(common()->ExternalConstant(reference)); | 169 *loc = graph()->NewNode(common()->ExternalConstant(reference)); |
170 } | 170 } |
171 return *loc; | 171 return *loc; |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 Node* JSGraph::ExternalConstant(Runtime::FunctionId function_id) { | 175 Node* JSGraph::ExternalConstant(Runtime::FunctionId function_id) { |
176 return ExternalConstant(ExternalReference(function_id, isolate())); | 176 return ExternalConstant(ExternalReference(function_id, isolate())); |
177 } | 177 } |
178 | 178 |
(...skipping 23 matching lines...) Expand all Loading... |
202 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { | 202 for (size_t i = 0; i < arraysize(cached_nodes_); i++) { |
203 if (Node* node = cached_nodes_[i]) { | 203 if (Node* node = cached_nodes_[i]) { |
204 if (!node->IsDead()) nodes->push_back(node); | 204 if (!node->IsDead()) nodes->push_back(node); |
205 } | 205 } |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 } // namespace compiler | 209 } // namespace compiler |
210 } // namespace internal | 210 } // namespace internal |
211 } // namespace v8 | 211 } // namespace v8 |
OLD | NEW |