Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(904)

Unified Diff: src/compiler/typer.cc

Issue 657793002: Give simple types to Math.Min, Math.Max, Math.Fround, Math.Clz32. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/typer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index b34b5b1bdecc55a60304bbd1465ad1d277caa4b4..1261f7181f4e3112ebafcdb0daac27f44fb9ca8d 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -52,6 +52,8 @@ Typer::Typer(Zone* zone) : zone_(zone) {
number_fun2_ = Type::Function(number, number, number, zone);
weakint_fun1_ = Type::Function(weakint, number, zone);
imul_fun_ = Type::Function(signed32, integral32, integral32, zone);
+ clz32_fun_ = Type::Function(
+ Type::Range(zero, f->NewNumber(32), zone), number, zone);
random_fun_ = Type::Function(Type::Union(
Type::UnsignedSmall(), Type::OtherNumber(), zone), zone);
@@ -1535,39 +1537,47 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
if (JSFunction::cast(*value)->shared()->HasBuiltinFunctionId()) {
switch (JSFunction::cast(*value)->shared()->builtin_function_id()) {
// TODO(rossberg): can't express overloading
rossberg 2014/10/15 12:32:08 This comment should stay with MathAbs
+ case kMathRandom:
+ return typer_->random_fun_;
+ case kMathFloor:
+ return typer_->weakint_fun1_;
+ case kMathRound:
+ return typer_->weakint_fun1_;
+ case kMathCeil:
+ return typer_->weakint_fun1_;
case kMathAbs:
return typer_->number_fun1_;
- case kMathAcos:
+ case kMathLog:
return typer_->number_fun1_;
- case kMathAsin:
+ case kMathExp:
return typer_->number_fun1_;
- case kMathAtan:
+ case kMathSqrt:
return typer_->number_fun1_;
- case kMathAtan2:
+ case kMathPow:
+ return typer_->number_fun2_;
+ case kMathMax:
+ return typer_->number_fun2_;
+ case kMathMin:
return typer_->number_fun2_;
- case kMathCeil:
- return typer_->weakint_fun1_;
case kMathCos:
return typer_->number_fun1_;
- case kMathExp:
+ case kMathSin:
return typer_->number_fun1_;
- case kMathFloor:
- return typer_->weakint_fun1_;
- case kMathImul:
- return typer_->imul_fun_;
- case kMathLog:
+ case kMathTan:
return typer_->number_fun1_;
- case kMathPow:
- return typer_->number_fun2_;
- case kMathRandom:
- return typer_->random_fun_;
- case kMathRound:
- return typer_->weakint_fun1_;
- case kMathSin:
+ case kMathAcos:
return typer_->number_fun1_;
- case kMathSqrt:
+ case kMathAsin:
return typer_->number_fun1_;
- case kMathTan:
+ case kMathAtan:
+ return typer_->number_fun1_;
+ case kMathAtan2:
+ return typer_->number_fun2_;
+ case kMathImul:
+ return typer_->imul_fun_;
+ case kMathClz32:
+ return typer_->clz32_fun_;
+ case kMathFround:
return typer_->number_fun1_;
default:
break;
« no previous file with comments | « src/compiler/typer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698