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 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2554 Type* Typer::Visitor::TypeInt32PairSub(Node* node) { return Type::Internal(); } | 2556 Type* Typer::Visitor::TypeInt32PairSub(Node* node) { return Type::Internal(); } |
2555 | 2557 |
2556 Type* Typer::Visitor::TypeInt32PairMul(Node* node) { return Type::Internal(); } | 2558 Type* Typer::Visitor::TypeInt32PairMul(Node* node) { return Type::Internal(); } |
2557 | 2559 |
2558 Type* Typer::Visitor::TypeWord32PairShl(Node* node) { return Type::Internal(); } | 2560 Type* Typer::Visitor::TypeWord32PairShl(Node* node) { return Type::Internal(); } |
2559 | 2561 |
2560 Type* Typer::Visitor::TypeWord32PairShr(Node* node) { return Type::Internal(); } | 2562 Type* Typer::Visitor::TypeWord32PairShr(Node* node) { return Type::Internal(); } |
2561 | 2563 |
2562 Type* Typer::Visitor::TypeWord32PairSar(Node* node) { return Type::Internal(); } | 2564 Type* Typer::Visitor::TypeWord32PairSar(Node* node) { return Type::Internal(); } |
2563 | 2565 |
| 2566 // SIMD type methods. |
| 2567 |
| 2568 #define SIMD_RETURN_SIMD(Name) \ |
| 2569 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Simd(); } |
| 2570 MACHINE_SIMD_RETURN_SIMD_OP_LIST(SIMD_RETURN_SIMD) |
| 2571 #undef SIMD_RETURN_SIMD |
| 2572 |
| 2573 #define SIMD_RETURN_NUM(Name) \ |
| 2574 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Number(); } |
| 2575 MACHINE_SIMD_RETURN_NUM_OP_LIST(SIMD_RETURN_NUM) |
| 2576 #undef SIMD_RETURN_NUM |
| 2577 |
| 2578 #define SIMD_RETURN_BOOL(Name) \ |
| 2579 Type* Typer::Visitor::Type##Name(Node* node) { return Type::Boolean(); } |
| 2580 MACHINE_SIMD_RETURN_BOOL_OP_LIST(SIMD_RETURN_BOOL) |
| 2581 #undef SIMD_RETURN_BOOL |
| 2582 |
2564 // Heap constants. | 2583 // Heap constants. |
2565 | 2584 |
2566 | |
2567 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 2585 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
2568 if (value->IsJSTypedArray()) { | 2586 if (value->IsJSTypedArray()) { |
2569 switch (JSTypedArray::cast(*value)->type()) { | 2587 switch (JSTypedArray::cast(*value)->type()) { |
2570 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 2588 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
2571 case kExternal##Type##Array: \ | 2589 case kExternal##Type##Array: \ |
2572 return typer_->cache_.k##Type##Array; | 2590 return typer_->cache_.k##Type##Array; |
2573 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2591 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2574 #undef TYPED_ARRAY_CASE | 2592 #undef TYPED_ARRAY_CASE |
2575 } | 2593 } |
2576 } | 2594 } |
2577 if (Type::IsInteger(*value)) { | 2595 if (Type::IsInteger(*value)) { |
2578 return Type::Range(value->Number(), value->Number(), zone()); | 2596 return Type::Range(value->Number(), value->Number(), zone()); |
2579 } | 2597 } |
2580 return Type::Constant(value, zone()); | 2598 return Type::Constant(value, zone()); |
2581 } | 2599 } |
2582 | 2600 |
2583 } // namespace compiler | 2601 } // namespace compiler |
2584 } // namespace internal | 2602 } // namespace internal |
2585 } // namespace v8 | 2603 } // namespace v8 |
OLD | NEW |