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

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

Issue 2229343002: [turbofan] Improve typing for CheckBounds. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix redundancy check. Created 4 years, 4 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 | « src/compiler/simplified-lowering.cc ('k') | 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 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) { 1530 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) {
1531 // TODO(bmeurer): We could do better here based on inputs. 1531 // TODO(bmeurer): We could do better here based on inputs.
1532 return Type::Range(0, kMaxUInt16, zone()); 1532 return Type::Range(0, kMaxUInt16, zone());
1533 } 1533 }
1534 1534
1535 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { 1535 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) {
1536 return TypeUnaryOp(node, StringFromCharCodeTyper); 1536 return TypeUnaryOp(node, StringFromCharCodeTyper);
1537 } 1537 }
1538 1538
1539 Type* Typer::Visitor::TypeCheckBounds(Node* node) { 1539 Type* Typer::Visitor::TypeCheckBounds(Node* node) {
1540 // TODO(bmeurer): We could do better here based on the limit. 1540 Type* index = Operand(node, 0);
1541 return Type::Unsigned31(); 1541 Type* length = Operand(node, 1);
1542 index = Type::Intersect(index, Type::Integral32(), zone());
1543 if (!index->IsInhabited() || !length->IsInhabited()) return Type::None();
1544 double min = std::max(index->Min(), 0.0);
1545 double max = std::min(index->Max(), length->Min() - 1);
1546 if (max < min) return Type::None();
1547 return Type::Range(min, max, zone());
1542 } 1548 }
1543 1549
1544 Type* Typer::Visitor::TypeCheckMaps(Node* node) { 1550 Type* Typer::Visitor::TypeCheckMaps(Node* node) {
1545 UNREACHABLE(); 1551 UNREACHABLE();
1546 return nullptr; 1552 return nullptr;
1547 } 1553 }
1548 1554
1549 Type* Typer::Visitor::TypeCheckNumber(Node* node) { 1555 Type* Typer::Visitor::TypeCheckNumber(Node* node) {
1550 Type* arg = Operand(node, 0); 1556 Type* arg = Operand(node, 0);
1551 return Type::Intersect(arg, Type::Number(), zone()); 1557 return Type::Intersect(arg, Type::Number(), zone());
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 } 2330 }
2325 if (Type::IsInteger(*value)) { 2331 if (Type::IsInteger(*value)) {
2326 return Type::Range(value->Number(), value->Number(), zone()); 2332 return Type::Range(value->Number(), value->Number(), zone());
2327 } 2333 }
2328 return Type::Constant(value, zone()); 2334 return Type::Constant(value, zone());
2329 } 2335 }
2330 2336
2331 } // namespace compiler 2337 } // namespace compiler
2332 } // namespace internal 2338 } // namespace internal
2333 } // namespace v8 2339 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698