Chromium Code Reviews| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 #define DECLARE_CASE(x) \ | 236 #define DECLARE_CASE(x) \ |
| 237 case IrOpcode::k##x: \ | 237 case IrOpcode::k##x: \ |
| 238 return UpdateBounds(node, TypeBinaryOp(node, x##Typer)); | 238 return UpdateBounds(node, TypeBinaryOp(node, x##Typer)); |
| 239 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 239 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
| 240 #undef DECLARE_CASE | 240 #undef DECLARE_CASE |
| 241 | 241 |
| 242 #define DECLARE_CASE(x) \ | 242 #define DECLARE_CASE(x) \ |
| 243 case IrOpcode::k##x: \ | 243 case IrOpcode::k##x: \ |
| 244 return UpdateBounds(node, Type##x(node)); | 244 return UpdateBounds(node, Type##x(node)); |
| 245 DECLARE_CASE(Start) | 245 DECLARE_CASE(Start) |
| 246 DECLARE_CASE(IfException) | |
| 246 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 247 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 247 COMMON_OP_LIST(DECLARE_CASE) | 248 COMMON_OP_LIST(DECLARE_CASE) |
| 248 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 249 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
| 249 MACHINE_OP_LIST(DECLARE_CASE) | 250 MACHINE_OP_LIST(DECLARE_CASE) |
| 250 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 251 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 251 JS_OBJECT_OP_LIST(DECLARE_CASE) | 252 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 252 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 253 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 253 JS_OTHER_OP_LIST(DECLARE_CASE) | 254 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 254 #undef DECLARE_CASE | 255 #undef DECLARE_CASE |
| 255 | 256 |
| 256 #define DECLARE_CASE(x) case IrOpcode::k##x: | 257 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 258 DECLARE_CASE(Dead) | |
| 259 DECLARE_CASE(Loop) | |
| 260 DECLARE_CASE(Branch) | |
| 261 DECLARE_CASE(IfTrue) | |
| 262 DECLARE_CASE(IfFalse) | |
| 263 DECLARE_CASE(IfSuccess) | |
| 264 DECLARE_CASE(Switch) | |
| 265 DECLARE_CASE(IfValue) | |
| 266 DECLARE_CASE(IfDefault) | |
| 267 DECLARE_CASE(Merge) | |
| 268 DECLARE_CASE(Deoptimize) | |
| 269 DECLARE_CASE(Return) | |
| 270 DECLARE_CASE(OsrNormalEntry) | |
| 271 DECLARE_CASE(OsrLoopEntry) | |
| 272 DECLARE_CASE(Throw) | |
| 257 DECLARE_CASE(End) | 273 DECLARE_CASE(End) |
| 258 INNER_CONTROL_OP_LIST(DECLARE_CASE) | |
|
titzer
2015/03/17 16:11:32
I like expanding the INNER_CONTROL_OP_LIST but can
Michael Starzinger
2015/03/31 11:58:44
Acknowledged. Happy to do that, would it be OK wit
| |
| 259 #undef DECLARE_CASE | 274 #undef DECLARE_CASE |
| 260 break; | 275 break; |
| 261 } | 276 } |
| 262 return NoChange(); | 277 return NoChange(); |
| 263 } | 278 } |
| 264 | 279 |
| 265 Bounds TypeNode(Node* node) { | 280 Bounds TypeNode(Node* node) { |
| 266 switch (node->opcode()) { | 281 switch (node->opcode()) { |
| 267 #define DECLARE_CASE(x) \ | 282 #define DECLARE_CASE(x) \ |
| 268 case IrOpcode::k##x: return TypeBinaryOp(node, x##Typer); | 283 case IrOpcode::k##x: return TypeBinaryOp(node, x##Typer); |
| 269 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 284 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
| 270 #undef DECLARE_CASE | 285 #undef DECLARE_CASE |
| 271 | 286 |
| 272 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); | 287 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); |
| 273 DECLARE_CASE(Start) | 288 DECLARE_CASE(Start) |
| 289 DECLARE_CASE(IfException) | |
| 274 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 290 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 275 COMMON_OP_LIST(DECLARE_CASE) | 291 COMMON_OP_LIST(DECLARE_CASE) |
| 276 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 292 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
| 277 MACHINE_OP_LIST(DECLARE_CASE) | 293 MACHINE_OP_LIST(DECLARE_CASE) |
| 278 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 294 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 279 JS_OBJECT_OP_LIST(DECLARE_CASE) | 295 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 280 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 296 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 281 JS_OTHER_OP_LIST(DECLARE_CASE) | 297 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 282 #undef DECLARE_CASE | 298 #undef DECLARE_CASE |
| 283 | 299 |
| 284 #define DECLARE_CASE(x) case IrOpcode::k##x: | 300 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 301 DECLARE_CASE(Dead) | |
| 302 DECLARE_CASE(Loop) | |
| 303 DECLARE_CASE(Branch) | |
| 304 DECLARE_CASE(IfTrue) | |
| 305 DECLARE_CASE(IfFalse) | |
| 306 DECLARE_CASE(IfSuccess) | |
| 307 DECLARE_CASE(Switch) | |
| 308 DECLARE_CASE(IfValue) | |
| 309 DECLARE_CASE(IfDefault) | |
| 310 DECLARE_CASE(Merge) | |
| 311 DECLARE_CASE(Deoptimize) | |
| 312 DECLARE_CASE(Return) | |
| 313 DECLARE_CASE(OsrNormalEntry) | |
| 314 DECLARE_CASE(OsrLoopEntry) | |
| 315 DECLARE_CASE(Throw) | |
| 285 DECLARE_CASE(End) | 316 DECLARE_CASE(End) |
| 286 INNER_CONTROL_OP_LIST(DECLARE_CASE) | |
| 287 #undef DECLARE_CASE | 317 #undef DECLARE_CASE |
| 288 break; | 318 break; |
| 289 } | 319 } |
| 290 UNREACHABLE(); | 320 UNREACHABLE(); |
| 291 return Bounds(); | 321 return Bounds(); |
| 292 } | 322 } |
| 293 | 323 |
| 294 Type* TypeConstant(Handle<Object> value); | 324 Type* TypeConstant(Handle<Object> value); |
| 295 | 325 |
| 296 private: | 326 private: |
| 297 Typer* typer_; | 327 Typer* typer_; |
| 298 MaybeHandle<Context> context_; | 328 MaybeHandle<Context> context_; |
| 299 | 329 |
| 300 #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node); | 330 #define DECLARE_METHOD(x) inline Bounds Type##x(Node* node); |
| 301 DECLARE_METHOD(Start) | 331 DECLARE_METHOD(Start) |
| 332 DECLARE_METHOD(IfException) | |
| 302 VALUE_OP_LIST(DECLARE_METHOD) | 333 VALUE_OP_LIST(DECLARE_METHOD) |
| 303 #undef DECLARE_METHOD | 334 #undef DECLARE_METHOD |
| 304 | 335 |
| 305 Bounds BoundsOrNone(Node* node) { | 336 Bounds BoundsOrNone(Node* node) { |
| 306 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) | 337 return NodeProperties::IsTyped(node) ? NodeProperties::GetBounds(node) |
| 307 : Bounds(Type::None()); | 338 : Bounds(Type::None()); |
| 308 } | 339 } |
| 309 | 340 |
| 310 Bounds Operand(Node* node, int i) { | 341 Bounds Operand(Node* node, int i) { |
| 311 Node* operand_node = NodeProperties::GetValueInput(node, i); | 342 Node* operand_node = NodeProperties::GetValueInput(node, i); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 | 633 |
| 603 | 634 |
| 604 // Control operators. | 635 // Control operators. |
| 605 | 636 |
| 606 | 637 |
| 607 Bounds Typer::Visitor::TypeStart(Node* node) { | 638 Bounds Typer::Visitor::TypeStart(Node* node) { |
| 608 return Bounds(Type::None(zone()), Type::Internal(zone())); | 639 return Bounds(Type::None(zone()), Type::Internal(zone())); |
| 609 } | 640 } |
| 610 | 641 |
| 611 | 642 |
| 643 Bounds Typer::Visitor::TypeIfException(Node* node) { | |
| 644 return Bounds::Unbounded(zone()); | |
| 645 } | |
| 646 | |
| 647 | |
| 612 // Common operators. | 648 // Common operators. |
| 613 | 649 |
| 614 | 650 |
| 615 Bounds Typer::Visitor::TypeAlways(Node* node) { | 651 Bounds Typer::Visitor::TypeAlways(Node* node) { |
| 616 return Bounds(Type::None(zone()), Type::Boolean(zone())); | 652 return Bounds(Type::None(zone()), Type::Boolean(zone())); |
| 617 } | 653 } |
| 618 | 654 |
| 619 | 655 |
| 620 Bounds Typer::Visitor::TypeParameter(Node* node) { | 656 Bounds Typer::Visitor::TypeParameter(Node* node) { |
| 621 return Bounds::Unbounded(zone()); | 657 return Bounds::Unbounded(zone()); |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2217 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2253 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 2218 #undef TYPED_ARRAY_CASE | 2254 #undef TYPED_ARRAY_CASE |
| 2219 } | 2255 } |
| 2220 } | 2256 } |
| 2221 return Type::Constant(value, zone()); | 2257 return Type::Constant(value, zone()); |
| 2222 } | 2258 } |
| 2223 | 2259 |
| 2224 } // namespace compiler | 2260 } // namespace compiler |
| 2225 } // namespace internal | 2261 } // namespace internal |
| 2226 } // namespace v8 | 2262 } // namespace v8 |
| OLD | NEW |