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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 case IrOpcode::k##x: \ | 101 case IrOpcode::k##x: \ |
102 return UpdateType(node, TypeBinaryOp(node, x)); | 102 return UpdateType(node, TypeBinaryOp(node, x)); |
103 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) | 103 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) |
104 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) | 104 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) |
105 #undef DECLARE_CASE | 105 #undef DECLARE_CASE |
106 | 106 |
107 #define DECLARE_CASE(x) \ | 107 #define DECLARE_CASE(x) \ |
108 case IrOpcode::k##x: \ | 108 case IrOpcode::k##x: \ |
109 return UpdateType(node, TypeUnaryOp(node, x)); | 109 return UpdateType(node, TypeUnaryOp(node, x)); |
110 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) | 110 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) |
| 111 SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE) |
111 #undef DECLARE_CASE | 112 #undef DECLARE_CASE |
112 | 113 |
113 #define DECLARE_CASE(x) case IrOpcode::k##x: | 114 #define DECLARE_CASE(x) case IrOpcode::k##x: |
114 DECLARE_CASE(Loop) | 115 DECLARE_CASE(Loop) |
115 DECLARE_CASE(Branch) | 116 DECLARE_CASE(Branch) |
116 DECLARE_CASE(IfTrue) | 117 DECLARE_CASE(IfTrue) |
117 DECLARE_CASE(IfFalse) | 118 DECLARE_CASE(IfFalse) |
118 DECLARE_CASE(IfSuccess) | 119 DECLARE_CASE(IfSuccess) |
119 DECLARE_CASE(Switch) | 120 DECLARE_CASE(Switch) |
120 DECLARE_CASE(IfValue) | 121 DECLARE_CASE(IfValue) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 case IrOpcode::k##x: \ | 167 case IrOpcode::k##x: \ |
167 return TypeBinaryOp(node, x); | 168 return TypeBinaryOp(node, x); |
168 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) | 169 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_CASE) |
169 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) | 170 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_CASE) |
170 #undef DECLARE_CASE | 171 #undef DECLARE_CASE |
171 | 172 |
172 #define DECLARE_CASE(x) \ | 173 #define DECLARE_CASE(x) \ |
173 case IrOpcode::k##x: \ | 174 case IrOpcode::k##x: \ |
174 return TypeUnaryOp(node, x); | 175 return TypeUnaryOp(node, x); |
175 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) | 176 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_CASE) |
| 177 SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_CASE) |
176 #undef DECLARE_CASE | 178 #undef DECLARE_CASE |
177 | 179 |
178 #define DECLARE_CASE(x) case IrOpcode::k##x: | 180 #define DECLARE_CASE(x) case IrOpcode::k##x: |
179 DECLARE_CASE(Loop) | 181 DECLARE_CASE(Loop) |
180 DECLARE_CASE(Branch) | 182 DECLARE_CASE(Branch) |
181 DECLARE_CASE(IfTrue) | 183 DECLARE_CASE(IfTrue) |
182 DECLARE_CASE(IfFalse) | 184 DECLARE_CASE(IfFalse) |
183 DECLARE_CASE(IfSuccess) | 185 DECLARE_CASE(IfSuccess) |
184 DECLARE_CASE(Switch) | 186 DECLARE_CASE(Switch) |
185 DECLARE_CASE(IfValue) | 187 DECLARE_CASE(IfValue) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 static Type* ToLength(Type*, Typer*); | 269 static Type* ToLength(Type*, Typer*); |
268 static Type* ToName(Type*, Typer*); | 270 static Type* ToName(Type*, Typer*); |
269 static Type* ToNumber(Type*, Typer*); | 271 static Type* ToNumber(Type*, Typer*); |
270 static Type* ToObject(Type*, Typer*); | 272 static Type* ToObject(Type*, Typer*); |
271 static Type* ToString(Type*, Typer*); | 273 static Type* ToString(Type*, Typer*); |
272 #define DECLARE_METHOD(Name) \ | 274 #define DECLARE_METHOD(Name) \ |
273 static Type* Name(Type* type, Typer* t) { \ | 275 static Type* Name(Type* type, Typer* t) { \ |
274 return t->operation_typer_.Name(type); \ | 276 return t->operation_typer_.Name(type); \ |
275 } | 277 } |
276 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) | 278 SIMPLIFIED_NUMBER_UNOP_LIST(DECLARE_METHOD) |
| 279 SIMPLIFIED_SPECULATIVE_NUMBER_UNOP_LIST(DECLARE_METHOD) |
277 #undef DECLARE_METHOD | 280 #undef DECLARE_METHOD |
278 #define DECLARE_METHOD(Name) \ | 281 #define DECLARE_METHOD(Name) \ |
279 static Type* Name(Type* lhs, Type* rhs, Typer* t) { \ | 282 static Type* Name(Type* lhs, Type* rhs, Typer* t) { \ |
280 return t->operation_typer_.Name(lhs, rhs); \ | 283 return t->operation_typer_.Name(lhs, rhs); \ |
281 } | 284 } |
282 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) | 285 SIMPLIFIED_NUMBER_BINOP_LIST(DECLARE_METHOD) |
283 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) | 286 SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_METHOD) |
284 #undef DECLARE_METHOD | 287 #undef DECLARE_METHOD |
285 | 288 |
286 static Type* ObjectIsDetectableCallable(Type*, Typer*); | 289 static Type* ObjectIsDetectableCallable(Type*, Typer*); |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1995 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1993 if (Type::IsInteger(*value)) { | 1996 if (Type::IsInteger(*value)) { |
1994 return Type::Range(value->Number(), value->Number(), zone()); | 1997 return Type::Range(value->Number(), value->Number(), zone()); |
1995 } | 1998 } |
1996 return Type::NewConstant(value, zone()); | 1999 return Type::NewConstant(value, zone()); |
1997 } | 2000 } |
1998 | 2001 |
1999 } // namespace compiler | 2002 } // namespace compiler |
2000 } // namespace internal | 2003 } // namespace internal |
2001 } // namespace v8 | 2004 } // namespace v8 |
OLD | NEW |