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/base/flags.h" | 5 #include "src/base/flags.h" |
6 #include "src/bootstrapper.h" | 6 #include "src/bootstrapper.h" |
7 #include "src/compiler/graph-reducer.h" | 7 #include "src/compiler/graph-reducer.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 #define DECLARE_CASE(x) \ | 221 #define DECLARE_CASE(x) \ |
222 case IrOpcode::k##x: \ | 222 case IrOpcode::k##x: \ |
223 return UpdateBounds(node, TypeBinaryOp(node, x##Typer)); | 223 return UpdateBounds(node, TypeBinaryOp(node, x##Typer)); |
224 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 224 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
225 #undef DECLARE_CASE | 225 #undef DECLARE_CASE |
226 | 226 |
227 #define DECLARE_CASE(x) \ | 227 #define DECLARE_CASE(x) \ |
228 case IrOpcode::k##x: \ | 228 case IrOpcode::k##x: \ |
229 return UpdateBounds(node, Type##x(node)); | 229 return UpdateBounds(node, Type##x(node)); |
230 DECLARE_CASE(Start) | 230 DECLARE_CASE(Start) |
| 231 DECLARE_CASE(IfException) |
231 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 232 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
232 COMMON_OP_LIST(DECLARE_CASE) | 233 COMMON_OP_LIST(DECLARE_CASE) |
233 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 234 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
234 MACHINE_OP_LIST(DECLARE_CASE) | 235 MACHINE_OP_LIST(DECLARE_CASE) |
235 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 236 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
236 JS_OBJECT_OP_LIST(DECLARE_CASE) | 237 JS_OBJECT_OP_LIST(DECLARE_CASE) |
237 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 238 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
238 JS_OTHER_OP_LIST(DECLARE_CASE) | 239 JS_OTHER_OP_LIST(DECLARE_CASE) |
239 #undef DECLARE_CASE | 240 #undef DECLARE_CASE |
240 | 241 |
241 #define DECLARE_CASE(x) case IrOpcode::k##x: | 242 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 243 DECLARE_CASE(Dead) |
| 244 DECLARE_CASE(Loop) |
| 245 DECLARE_CASE(Branch) |
| 246 DECLARE_CASE(IfTrue) |
| 247 DECLARE_CASE(IfFalse) |
| 248 DECLARE_CASE(IfSuccess) |
| 249 DECLARE_CASE(Switch) |
| 250 DECLARE_CASE(IfValue) |
| 251 DECLARE_CASE(IfDefault) |
| 252 DECLARE_CASE(Merge) |
| 253 DECLARE_CASE(Deoptimize) |
| 254 DECLARE_CASE(Return) |
| 255 DECLARE_CASE(OsrNormalEntry) |
| 256 DECLARE_CASE(OsrLoopEntry) |
| 257 DECLARE_CASE(Throw) |
242 DECLARE_CASE(End) | 258 DECLARE_CASE(End) |
243 INNER_CONTROL_OP_LIST(DECLARE_CASE) | |
244 #undef DECLARE_CASE | 259 #undef DECLARE_CASE |
245 break; | 260 break; |
246 } | 261 } |
247 return NoChange(); | 262 return NoChange(); |
248 } | 263 } |
249 | 264 |
250 Bounds TypeNode(Node* node) { | 265 Bounds TypeNode(Node* node) { |
251 switch (node->opcode()) { | 266 switch (node->opcode()) { |
252 #define DECLARE_CASE(x) \ | 267 #define DECLARE_CASE(x) \ |
253 case IrOpcode::k##x: return TypeBinaryOp(node, x##Typer); | 268 case IrOpcode::k##x: return TypeBinaryOp(node, x##Typer); |
254 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 269 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
255 #undef DECLARE_CASE | 270 #undef DECLARE_CASE |
256 | 271 |
257 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); | 272 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); |
258 DECLARE_CASE(Start) | 273 DECLARE_CASE(Start) |
| 274 DECLARE_CASE(IfException) |
259 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 275 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
260 COMMON_OP_LIST(DECLARE_CASE) | 276 COMMON_OP_LIST(DECLARE_CASE) |
261 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 277 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
262 MACHINE_OP_LIST(DECLARE_CASE) | 278 MACHINE_OP_LIST(DECLARE_CASE) |
263 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 279 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
264 JS_OBJECT_OP_LIST(DECLARE_CASE) | 280 JS_OBJECT_OP_LIST(DECLARE_CASE) |
265 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 281 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
266 JS_OTHER_OP_LIST(DECLARE_CASE) | 282 JS_OTHER_OP_LIST(DECLARE_CASE) |
267 #undef DECLARE_CASE | 283 #undef DECLARE_CASE |
268 | 284 |
269 #define DECLARE_CASE(x) case IrOpcode::k##x: | 285 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 286 DECLARE_CASE(Dead) |
| 287 DECLARE_CASE(Loop) |
| 288 DECLARE_CASE(Branch) |
| 289 DECLARE_CASE(IfTrue) |
| 290 DECLARE_CASE(IfFalse) |
| 291 DECLARE_CASE(IfSuccess) |
| 292 DECLARE_CASE(Switch) |
| 293 DECLARE_CASE(IfValue) |
| 294 DECLARE_CASE(IfDefault) |
| 295 DECLARE_CASE(Merge) |
| 296 DECLARE_CASE(Deoptimize) |
| 297 DECLARE_CASE(Return) |
| 298 DECLARE_CASE(OsrNormalEntry) |
| 299 DECLARE_CASE(OsrLoopEntry) |
| 300 DECLARE_CASE(Throw) |
270 DECLARE_CASE(End) | 301 DECLARE_CASE(End) |
271 INNER_CONTROL_OP_LIST(DECLARE_CASE) | |
272 #undef DECLARE_CASE | 302 #undef DECLARE_CASE |
273 break; | 303 break; |
274 } | 304 } |
275 UNREACHABLE(); | 305 UNREACHABLE(); |
276 return Bounds(); | 306 return Bounds(); |
277 } | 307 } |
278 | 308 |
279 Type* TypeConstant(Handle<Object> value); | 309 Type* TypeConstant(Handle<Object> value); |
280 | 310 |
281 private: | 311 private: |
282 Typer* typer_; | 312 Typer* typer_; |
283 MaybeHandle<Context> context_; | 313 MaybeHandle<Context> context_; |
284 ZoneSet<NodeId> weakened_nodes_; | 314 ZoneSet<NodeId> weakened_nodes_; |
285 | 315 |
286 #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node); | 316 #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node); |
287 DECLARE_METHOD(Start) | 317 DECLARE_METHOD(Start) |
| 318 DECLARE_METHOD(IfException) |
288 VALUE_OP_LIST(DECLARE_METHOD) | 319 VALUE_OP_LIST(DECLARE_METHOD) |
289 #undef DECLARE_METHOD | 320 #undef DECLARE_METHOD |
290 | 321 |
291 Bounds BoundsOrNone(Node* node) { | 322 Bounds BoundsOrNone(Node* node) { |
292 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) | 323 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) |
293 : Bounds(Type::None()); | 324 : Bounds(Type::None()); |
294 } | 325 } |
295 | 326 |
296 Bounds Operand(Node* node, int i) { | 327 Bounds Operand(Node* node, int i) { |
297 Node* operand_node = NodeProperties::GetValueInput(node, i); | 328 Node* operand_node = NodeProperties::GetValueInput(node, i); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 626 |
596 | 627 |
597 // Control operators. | 628 // Control operators. |
598 | 629 |
599 | 630 |
600 Bounds Typer::Visitor::TypeStart(Node* node) { | 631 Bounds Typer::Visitor::TypeStart(Node* node) { |
601 return Bounds(Type::None(zone()), Type::Internal(zone())); | 632 return Bounds(Type::None(zone()), Type::Internal(zone())); |
602 } | 633 } |
603 | 634 |
604 | 635 |
| 636 Bounds Typer::Visitor::TypeIfException(Node* node) { |
| 637 return Bounds::Unbounded(zone()); |
| 638 } |
| 639 |
| 640 |
605 // Common operators. | 641 // Common operators. |
606 | 642 |
607 | 643 |
608 Bounds Typer::Visitor::TypeAlways(Node* node) { | 644 Bounds Typer::Visitor::TypeAlways(Node* node) { |
609 return Bounds(Type::None(zone()), Type::Boolean(zone())); | 645 return Bounds(Type::None(zone()), Type::Boolean(zone())); |
610 } | 646 } |
611 | 647 |
612 | 648 |
613 Bounds Typer::Visitor::TypeParameter(Node* node) { | 649 Bounds Typer::Visitor::TypeParameter(Node* node) { |
614 return Bounds::Unbounded(zone()); | 650 return Bounds::Unbounded(zone()); |
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2337 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2302 #undef TYPED_ARRAY_CASE | 2338 #undef TYPED_ARRAY_CASE |
2303 } | 2339 } |
2304 } | 2340 } |
2305 return Type::Constant(value, zone()); | 2341 return Type::Constant(value, zone()); |
2306 } | 2342 } |
2307 | 2343 |
2308 } // namespace compiler | 2344 } // namespace compiler |
2309 } // namespace internal | 2345 } // namespace internal |
2310 } // namespace v8 | 2346 } // namespace v8 |
OLD | NEW |