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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 | 1266 |
1267 // JS other operators. | 1267 // JS other operators. |
1268 | 1268 |
1269 | 1269 |
1270 Type* Typer::Visitor::TypeJSCallConstruct(Node* node) { | 1270 Type* Typer::Visitor::TypeJSCallConstruct(Node* node) { |
1271 return Type::Receiver(); | 1271 return Type::Receiver(); |
1272 } | 1272 } |
1273 | 1273 |
1274 | 1274 |
1275 Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { | 1275 Type* Typer::Visitor::JSCallFunctionTyper(Type* fun, Typer* t) { |
1276 if (fun->IsFunction()) { | |
1277 return fun->AsFunction()->Result(); | |
1278 } | |
1279 if (fun->IsConstant() && fun->AsConstant()->Value()->IsJSFunction()) { | 1276 if (fun->IsConstant() && fun->AsConstant()->Value()->IsJSFunction()) { |
1280 Handle<JSFunction> function = | 1277 Handle<JSFunction> function = |
1281 Handle<JSFunction>::cast(fun->AsConstant()->Value()); | 1278 Handle<JSFunction>::cast(fun->AsConstant()->Value()); |
1282 if (function->shared()->HasBuiltinFunctionId()) { | 1279 if (function->shared()->HasBuiltinFunctionId()) { |
1283 switch (function->shared()->builtin_function_id()) { | 1280 switch (function->shared()->builtin_function_id()) { |
1284 case kMathRandom: | 1281 case kMathRandom: |
1285 return Type::OrderedNumber(); | 1282 return Type::OrderedNumber(); |
1286 case kMathFloor: | 1283 case kMathFloor: |
1287 case kMathCeil: | 1284 case kMathCeil: |
1288 case kMathRound: | 1285 case kMathRound: |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1703 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1707 if (Type::IsInteger(*value)) { | 1704 if (Type::IsInteger(*value)) { |
1708 return Type::Range(value->Number(), value->Number(), zone()); | 1705 return Type::Range(value->Number(), value->Number(), zone()); |
1709 } | 1706 } |
1710 return Type::Constant(value, zone()); | 1707 return Type::Constant(value, zone()); |
1711 } | 1708 } |
1712 | 1709 |
1713 } // namespace compiler | 1710 } // namespace compiler |
1714 } // namespace internal | 1711 } // namespace internal |
1715 } // namespace v8 | 1712 } // namespace v8 |
OLD | NEW |