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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { | 1288 Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { |
1289 if (fun->IsFunction()) { | 1289 if (fun->IsFunction()) { |
1290 return fun->AsFunction()->Result(); | 1290 return fun->AsFunction()->Result(); |
1291 } | 1291 } |
1292 if (fun->IsConstant() && fun->AsConstant()->Value()->IsJSFunction()) { | 1292 if (fun->IsConstant() && fun->AsConstant()->Value()->IsJSFunction()) { |
1293 Handle<JSFunction> function = | 1293 Handle<JSFunction> function = |
1294 Handle<JSFunction>::cast(fun->AsConstant()->Value()); | 1294 Handle<JSFunction>::cast(fun->AsConstant()->Value()); |
1295 if (function->shared()->HasBuiltinFunctionId()) { | 1295 if (function->shared()->HasBuiltinFunctionId()) { |
1296 switch (function->shared()->builtin_function_id()) { | 1296 switch (function->shared()->builtin_function_id()) { |
1297 case kMathRandom: | 1297 case kMathRandom: |
1298 return Type::OrderedNumber(); | 1298 return Type::PlainNumber(); |
1299 case kMathFloor: | 1299 case kMathFloor: |
1300 case kMathCeil: | 1300 case kMathCeil: |
1301 case kMathRound: | 1301 case kMathRound: |
1302 case kMathTrunc: | 1302 case kMathTrunc: |
1303 return t->cache_.kIntegerOrMinusZeroOrNaN; | 1303 return t->cache_.kIntegerOrMinusZeroOrNaN; |
1304 // Unary math functions. | 1304 // Unary math functions. |
1305 case kMathAbs: | 1305 case kMathAbs: |
1306 case kMathExp: | 1306 case kMathExp: |
1307 case kMathExpm1: | 1307 case kMathExpm1: |
1308 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); | 1308 return Type::Union(Type::PlainNumber(), Type::NaN(), t->zone()); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1719 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1720 if (Type::IsInteger(*value)) { | 1720 if (Type::IsInteger(*value)) { |
1721 return Type::Range(value->Number(), value->Number(), zone()); | 1721 return Type::Range(value->Number(), value->Number(), zone()); |
1722 } | 1722 } |
1723 return Type::Constant(value, zone()); | 1723 return Type::Constant(value, zone()); |
1724 } | 1724 } |
1725 | 1725 |
1726 } // namespace compiler | 1726 } // namespace compiler |
1727 } // namespace internal | 1727 } // namespace internal |
1728 } // namespace v8 | 1728 } // namespace v8 |
OLD | NEW |