| OLD | NEW | 
|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/operation-typer.h" | 5 #include "src/compiler/operation-typer.h" | 
| 6 | 6 | 
| 7 #include "src/factory.h" | 7 #include "src/factory.h" | 
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" | 
| 9 #include "src/type-cache.h" | 9 #include "src/type-cache.h" | 
| 10 #include "src/types.h" | 10 #include "src/types.h" | 
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 292   if (!lhs->IsInhabited() || !rhs->IsInhabited()) { | 292   if (!lhs->IsInhabited() || !rhs->IsInhabited()) { | 
| 293     return Type::None(); | 293     return Type::None(); | 
| 294   } | 294   } | 
| 295 | 295 | 
| 296   // We can give more precise types for integers. | 296   // We can give more precise types for integers. | 
| 297   if (!lhs->Is(cache_.kIntegerOrMinusZeroOrNaN) || | 297   if (!lhs->Is(cache_.kIntegerOrMinusZeroOrNaN) || | 
| 298       !rhs->Is(cache_.kIntegerOrMinusZeroOrNaN)) { | 298       !rhs->Is(cache_.kIntegerOrMinusZeroOrNaN)) { | 
| 299     return Type::Number(); | 299     return Type::Number(); | 
| 300   } | 300   } | 
| 301   Type* int_lhs = Type::Intersect(lhs, cache_.kInteger, zone()); | 301   Type* int_lhs = Type::Intersect(lhs, cache_.kInteger, zone()); | 
|  | 302   if (lhs->Maybe(Type::MinusZero())) { | 
|  | 303     int_lhs = Type::Union(int_lhs, cache_.kSingletonZero, zone()); | 
|  | 304   } | 
| 302   Type* int_rhs = Type::Intersect(rhs, cache_.kInteger, zone()); | 305   Type* int_rhs = Type::Intersect(rhs, cache_.kInteger, zone()); | 
|  | 306   if (rhs->Maybe(Type::MinusZero())) { | 
|  | 307     int_rhs = Type::Union(int_rhs, cache_.kSingletonZero, zone()); | 
|  | 308   } | 
| 303   Type* result = | 309   Type* result = | 
| 304       AddRanger(int_lhs->Min(), int_lhs->Max(), int_rhs->Min(), int_rhs->Max()); | 310       AddRanger(int_lhs->Min(), int_lhs->Max(), int_rhs->Min(), int_rhs->Max()); | 
| 305   if (lhs->Maybe(Type::NaN()) || rhs->Maybe(Type::NaN())) { | 311   if (lhs->Maybe(Type::NaN()) || rhs->Maybe(Type::NaN())) { | 
| 306     result = Type::Union(result, Type::NaN(), zone()); | 312     result = Type::Union(result, Type::NaN(), zone()); | 
| 307   } | 313   } | 
| 308   if (lhs->Maybe(Type::MinusZero()) && rhs->Maybe(Type::MinusZero())) { | 314   if (lhs->Maybe(Type::MinusZero()) && rhs->Maybe(Type::MinusZero())) { | 
| 309     result = Type::Union(result, Type::MinusZero(), zone()); | 315     result = Type::Union(result, Type::MinusZero(), zone()); | 
| 310   } | 316   } | 
| 311   return result; | 317   return result; | 
| 312 } | 318 } | 
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 470   return NumberAdd(lhs, rhs); | 476   return NumberAdd(lhs, rhs); | 
| 471 } | 477 } | 
| 472 | 478 | 
| 473 Type* OperationTyper::TypeJSSubtract(Type* lhs, Type* rhs) { | 479 Type* OperationTyper::TypeJSSubtract(Type* lhs, Type* rhs) { | 
| 474   return NumberSubtract(ToNumber(lhs), ToNumber(rhs)); | 480   return NumberSubtract(ToNumber(lhs), ToNumber(rhs)); | 
| 475 } | 481 } | 
| 476 | 482 | 
| 477 }  // namespace compiler | 483 }  // namespace compiler | 
| 478 }  // namespace internal | 484 }  // namespace internal | 
| 479 }  // namespace v8 | 485 }  // namespace v8 | 
| OLD | NEW | 
|---|