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