| 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 "src/base/flags.h" | 7 #include "src/base/flags.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 #define DECLARE_CASE(x) \ | 91 #define DECLARE_CASE(x) \ |
| 92 case IrOpcode::k##x: \ | 92 case IrOpcode::k##x: \ |
| 93 return UpdateType(node, Type##x(node)); | 93 return UpdateType(node, Type##x(node)); |
| 94 DECLARE_CASE(Start) | 94 DECLARE_CASE(Start) |
| 95 DECLARE_CASE(IfException) | 95 DECLARE_CASE(IfException) |
| 96 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 96 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 97 COMMON_OP_LIST(DECLARE_CASE) | 97 COMMON_OP_LIST(DECLARE_CASE) |
| 98 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 98 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
| 99 MACHINE_OP_LIST(DECLARE_CASE) | 99 MACHINE_OP_LIST(DECLARE_CASE) |
| 100 MACHINE_SIMD_OP_LIST(DECLARE_CASE) | |
| 101 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 100 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 102 JS_OBJECT_OP_LIST(DECLARE_CASE) | 101 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 103 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 102 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 104 JS_OTHER_OP_LIST(DECLARE_CASE) | 103 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 105 #undef DECLARE_CASE | 104 #undef DECLARE_CASE |
| 106 | 105 |
| 107 #define DECLARE_CASE(x) case IrOpcode::k##x: | 106 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 108 DECLARE_CASE(Loop) | 107 DECLARE_CASE(Loop) |
| 109 DECLARE_CASE(Branch) | 108 DECLARE_CASE(Branch) |
| 110 DECLARE_CASE(IfTrue) | 109 DECLARE_CASE(IfTrue) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 137 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) | 136 JS_SIMPLE_BINOP_LIST(DECLARE_CASE) |
| 138 #undef DECLARE_CASE | 137 #undef DECLARE_CASE |
| 139 | 138 |
| 140 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); | 139 #define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node); |
| 141 DECLARE_CASE(Start) | 140 DECLARE_CASE(Start) |
| 142 DECLARE_CASE(IfException) | 141 DECLARE_CASE(IfException) |
| 143 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: | 142 // VALUE_OP_LIST without JS_SIMPLE_BINOP_LIST: |
| 144 COMMON_OP_LIST(DECLARE_CASE) | 143 COMMON_OP_LIST(DECLARE_CASE) |
| 145 SIMPLIFIED_OP_LIST(DECLARE_CASE) | 144 SIMPLIFIED_OP_LIST(DECLARE_CASE) |
| 146 MACHINE_OP_LIST(DECLARE_CASE) | 145 MACHINE_OP_LIST(DECLARE_CASE) |
| 147 MACHINE_SIMD_OP_LIST(DECLARE_CASE) | |
| 148 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) | 146 JS_SIMPLE_UNOP_LIST(DECLARE_CASE) |
| 149 JS_OBJECT_OP_LIST(DECLARE_CASE) | 147 JS_OBJECT_OP_LIST(DECLARE_CASE) |
| 150 JS_CONTEXT_OP_LIST(DECLARE_CASE) | 148 JS_CONTEXT_OP_LIST(DECLARE_CASE) |
| 151 JS_OTHER_OP_LIST(DECLARE_CASE) | 149 JS_OTHER_OP_LIST(DECLARE_CASE) |
| 152 #undef DECLARE_CASE | 150 #undef DECLARE_CASE |
| 153 | 151 |
| 154 #define DECLARE_CASE(x) case IrOpcode::k##x: | 152 #define DECLARE_CASE(x) case IrOpcode::k##x: |
| 155 DECLARE_CASE(Loop) | 153 DECLARE_CASE(Loop) |
| 156 DECLARE_CASE(Branch) | 154 DECLARE_CASE(Branch) |
| 157 DECLARE_CASE(IfTrue) | 155 DECLARE_CASE(IfTrue) |
| (...skipping 2356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 Type* Typer::Visitor::TypeInt32PairSub(Node* node) { return Type::Internal(); } | 2512 Type* Typer::Visitor::TypeInt32PairSub(Node* node) { return Type::Internal(); } |
| 2515 | 2513 |
| 2516 Type* Typer::Visitor::TypeInt32PairMul(Node* node) { return Type::Internal(); } | 2514 Type* Typer::Visitor::TypeInt32PairMul(Node* node) { return Type::Internal(); } |
| 2517 | 2515 |
| 2518 Type* Typer::Visitor::TypeWord32PairShl(Node* node) { return Type::Internal(); } | 2516 Type* Typer::Visitor::TypeWord32PairShl(Node* node) { return Type::Internal(); } |
| 2519 | 2517 |
| 2520 Type* Typer::Visitor::TypeWord32PairShr(Node* node) { return Type::Internal(); } | 2518 Type* Typer::Visitor::TypeWord32PairShr(Node* node) { return Type::Internal(); } |
| 2521 | 2519 |
| 2522 Type* Typer::Visitor::TypeWord32PairSar(Node* node) { return Type::Internal(); } | 2520 Type* Typer::Visitor::TypeWord32PairSar(Node* node) { return Type::Internal(); } |
| 2523 | 2521 |
| 2524 // SIMD type methods. | 2522 // Heap constants. |
| 2525 | 2523 |
| 2526 #define SIMD_RETURN_SIMD(Name) \ | |
| 2527 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Simd(); } | |
| 2528 MACHINE_SIMD_RETURN_SIMD_OP_LIST(SIMD_RETURN_SIMD) | |
| 2529 #undef SIMD_RETURN_SIMD | |
| 2530 | |
| 2531 #define SIMD_RETURN_NUM(Name) \ | |
| 2532 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Number(); } | |
| 2533 MACHINE_SIMD_RETURN_NUM_OP_LIST(SIMD_RETURN_NUM) | |
| 2534 #undef SIMD_RETURN_NUM | |
| 2535 | |
| 2536 #define SIMD_RETURN_BOOL(Name) \ | |
| 2537 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Boolean(); } | |
| 2538 MACHINE_SIMD_RETURN_BOOL_OP_LIST(SIMD_RETURN_BOOL) | |
| 2539 #undef SIMD_RETURN_BOOL | |
| 2540 | |
| 2541 // Heap constants. | |
| 2542 | 2524 |
| 2543 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 2525 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
| 2544 if (value->IsJSTypedArray()) { | 2526 if (value->IsJSTypedArray()) { |
| 2545 switch (JSTypedArray::cast(*value)->type()) { | 2527 switch (JSTypedArray::cast(*value)->type()) { |
| 2546 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 2528 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
| 2547 case kExternal##Type##Array: \ | 2529 case kExternal##Type##Array: \ |
| 2548 return typer_->cache_.k##Type##Array; | 2530 return typer_->cache_.k##Type##Array; |
| 2549 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2531 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
| 2550 #undef TYPED_ARRAY_CASE | 2532 #undef TYPED_ARRAY_CASE |
| 2551 } | 2533 } |
| 2552 } | 2534 } |
| 2553 if (Type::IsInteger(*value)) { | 2535 if (Type::IsInteger(*value)) { |
| 2554 return Type::Range(value->Number(), value->Number(), zone()); | 2536 return Type::Range(value->Number(), value->Number(), zone()); |
| 2555 } | 2537 } |
| 2556 return Type::Constant(value, zone()); | 2538 return Type::Constant(value, zone()); |
| 2557 } | 2539 } |
| 2558 | 2540 |
| 2559 } // namespace compiler | 2541 } // namespace compiler |
| 2560 } // namespace internal | 2542 } // namespace internal |
| 2561 } // namespace v8 | 2543 } // namespace v8 |
| OLD | NEW |