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

Side by Side Diff: src/compiler/typer.cc

Issue 2312693002: [turbofan] Math.random never produces -0. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698