| 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/compiler/typer.h" | 5 #include "src/compiler/typer.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 | 8 |
| 9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 return UpdateType(node, Type##x(node)); | 87 return UpdateType(node, Type##x(node)); |
| 88 DECLARE_CASE(Start) | 88 DECLARE_CASE(Start) |
| 89 DECLARE_CASE(IfException) | 89 DECLARE_CASE(IfException) |
| 90 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 90 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 91 COMMON_OP_LIST(DECLARE_CASE) | 91 COMMON_OP_LIST(DECLARE_CASE) |
| 92 SIMPLIFIED_COMPARE_BINOP_LIST(DECLARE_CASE) | 92 SIMPLIFIED_COMPARE_BINOP_LIST(DECLARE_CASE) |
| 93 SIMPLIFIED_OTHER_OP_LIST(DECLARE_CASE) | 93 SIMPLIFIED_OTHER_OP_LIST(DECLARE_CASE) |
| 94 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 94 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 95 JS_OBJECT_OP_LIST(DECLARE_CASE) | 95 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 96 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 96 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 97 JS_CALL_OP_LIST(DECLARE_CASE) |
| 97 JS_OTHER_OP_LIST(DECLARE_CASE) | 98 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 98 #undef DECLARE_CASE | 99 #undef DECLARE_CASE |
| 99 | 100 |
| 100 #define DECLARE_CASE(x) \ | 101 #define DECLARE_CASE(x) \ |
| 101 case IrOpcode::k##x: \ | 102 case IrOpcode::k##x: \ |
| 102 return UpdateType(node, TypeBinaryOp(node, x)); | 103 return UpdateType(node, TypeBinaryOp(node, x)); |
| 103 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) | 104 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) |
| 104 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) | 105 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) |
| 105 #undef DECLARE_CASE | 106 #undef DECLARE_CASE |
| 106 | 107 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); | 154 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); |
| 154 DECLARE_CASE(Start) | 155 DECLARE_CASE(Start) |
| 155 DECLARE_CASE(IfException) | 156 DECLARE_CASE(IfException) |
| 156 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 157 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 157 COMMON_OP_LIST(DECLARE_CASE) | 158 COMMON_OP_LIST(DECLARE_CASE) |
| 158 SIMPLIFIED_COMPARE_BINOP_LIST(DECLARE_CASE) | 159 SIMPLIFIED_COMPARE_BINOP_LIST(DECLARE_CASE) |
| 159 SIMPLIFIED_OTHER_OP_LIST(DECLARE_CASE) | 160 SIMPLIFIED_OTHER_OP_LIST(DECLARE_CASE) |
| 160 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 161 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 161 JS_OBJECT_OP_LIST(DECLARE_CASE) | 162 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 162 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 163 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 164 JS_CALL_OP_LIST(DECLARE_CASE) |
| 163 JS_OTHER_OP_LIST(DECLARE_CASE) | 165 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 164 #undef DECLARE_CASE | 166 #undef DECLARE_CASE |
| 165 | 167 |
| 166 #define DECLARE_CASE(x) \ | 168 #define DECLARE_CASE(x) \ |
| 167 case IrOpcode::k##x: \ | 169 case IrOpcode::k##x: \ |
| 168 return TypeBinaryOp(node, x); | 170 return TypeBinaryOp(node, x); |
| 169 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) | 171 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) |
| 170 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) | 172 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) |
| 171 #undef DECLARE_CASE | 173 #undef DECLARE_CASE |
| 172 | 174 |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 case kWeakSetHas: | 1599 case kWeakSetHas: |
| 1598 return Type::Boolean(); | 1600 return Type::Boolean(); |
| 1599 default: | 1601 default: |
| 1600 break; | 1602 break; |
| 1601 } | 1603 } |
| 1602 } | 1604 } |
| 1603 } | 1605 } |
| 1604 return Type::NonInternal(); | 1606 return Type::NonInternal(); |
| 1605 } | 1607 } |
| 1606 | 1608 |
| 1607 Type* Typer::Visitor::TypeJSCallForwardVarargs(Node* node) { | |
| 1608 return TypeUnaryOp(node, JSCallTyper); | |
| 1609 } | |
| 1610 | |
| 1611 Type* Typer::Visitor::TypeJSCall(Node* node) { | 1609 Type* Typer::Visitor::TypeJSCall(Node* node) { |
| 1612 // TODO(bmeurer): We could infer better types if we wouldn't ignore the | 1610 // TODO(bmeurer): We could infer better types if we wouldn't ignore the |
| 1613 // argument types for the JSCallTyper above. | 1611 // argument types for the JSCallTyper above. |
| 1614 return TypeUnaryOp(node, JSCallTyper); | 1612 return TypeUnaryOp(node, JSCallTyper); |
| 1615 } | 1613 } |
| 1616 | 1614 |
| 1615 Type* Typer::Visitor::TypeJSCallForwardVarargs(Node* node) { |
| 1616 return TypeUnaryOp(node, JSCallTyper); |
| 1617 } |
| 1618 |
| 1619 Type* Typer::Visitor::TypeJSCallVarargs(Node* node) { |
| 1620 return TypeUnaryOp(node, JSCallTyper); |
| 1621 } |
| 1622 |
| 1617 Type* Typer::Visitor::TypeJSCallWithArrayLike(Node* node) { | 1623 Type* Typer::Visitor::TypeJSCallWithArrayLike(Node* node) { |
| 1618 return TypeUnaryOp(node, JSCallTyper); | 1624 return TypeUnaryOp(node, JSCallTyper); |
| 1619 } | 1625 } |
| 1620 | 1626 |
| 1621 Type* Typer::Visitor::TypeJSCallWithSpread(Node* node) { | 1627 Type* Typer::Visitor::TypeJSCallWithSpread(Node* node) { |
| 1622 return TypeUnaryOp(node, JSCallTyper); | 1628 return TypeUnaryOp(node, JSCallTyper); |
| 1623 } | 1629 } |
| 1624 | 1630 |
| 1625 Type* Typer::Visitor::TypeJSCallRuntime(Node* node) { | 1631 Type* Typer::Visitor::TypeJSCallRuntime(Node* node) { |
| 1626 switch (CallRuntimeParametersOf(node->op()).id()) { | 1632 switch (CallRuntimeParametersOf(node->op()).id()) { |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 2024 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 2019 if (Type::IsInteger(*value)) { | 2025 if (Type::IsInteger(*value)) { |
| 2020 return Type::Range(value->Number(), value->Number(), zone()); | 2026 return Type::Range(value->Number(), value->Number(), zone()); |
| 2021 } | 2027 } |
| 2022 return Type::NewConstant(value, zone()); | 2028 return Type::NewConstant(value, zone()); |
| 2023 } | 2029 } |
| 2024 | 2030 |
| 2025 } // namespace compiler | 2031 } // namespace compiler |
| 2026 } // namespace internal | 2032 } // namespace internal |
| 2027 } // namespace v8 | 2033 } // namespace v8 |
| OLD | NEW |