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

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

Issue 2402313003: [turbofan] Quit storing strings in types. (Closed)
Patch Set: Removed StringFromCharCodeTyper optimization. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/types.cc » ('j') | 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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 1520
1521 Type* Typer::Visitor::TypeStringEqual(Node* node) { return Type::Boolean(); } 1521 Type* Typer::Visitor::TypeStringEqual(Node* node) { return Type::Boolean(); }
1522 1522
1523 Type* Typer::Visitor::TypeStringLessThan(Node* node) { return Type::Boolean(); } 1523 Type* Typer::Visitor::TypeStringLessThan(Node* node) { return Type::Boolean(); }
1524 1524
1525 Type* Typer::Visitor::TypeStringLessThanOrEqual(Node* node) { 1525 Type* Typer::Visitor::TypeStringLessThanOrEqual(Node* node) {
1526 return Type::Boolean(); 1526 return Type::Boolean();
1527 } 1527 }
1528 1528
1529 Type* Typer::Visitor::StringFromCharCodeTyper(Type* type, Typer* t) { 1529 Type* Typer::Visitor::StringFromCharCodeTyper(Type* type, Typer* t) {
1530 type = NumberToUint32(ToNumber(type, t), t);
1531 Factory* f = t->isolate()->factory();
1532 double min = type->Min();
1533 double max = type->Max();
1534 if (min == max) {
1535 uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU;
1536 Handle<String> string = f->LookupSingleCharacterStringFromCode(code);
1537 return Type::HeapConstant(string, t->zone());
1538 }
1539 return Type::String(); 1530 return Type::String();
1540 } 1531 }
1541 1532
1542 Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) { 1533 Type* Typer::Visitor::StringFromCodePointTyper(Type* type, Typer* t) {
1543 type = NumberToUint32(ToNumber(type, t), t);
1544 Factory* f = t->isolate()->factory();
1545 double min = type->Min();
1546 double max = type->Max();
1547 if (min == max) {
1548 uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU;
1549 Handle<String> string = f->LookupSingleCharacterStringFromCode(code);
1550 return Type::HeapConstant(string, t->zone());
1551 }
1552 return Type::String(); 1534 return Type::String();
1553 } 1535 }
1554 1536
1555 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) { 1537 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) {
1556 // TODO(bmeurer): We could do better here based on inputs. 1538 // TODO(bmeurer): We could do better here based on inputs.
1557 return Type::Range(0, kMaxUInt16, zone()); 1539 return Type::Range(0, kMaxUInt16, zone());
1558 } 1540 }
1559 1541
1560 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { 1542 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) {
1561 return TypeUnaryOp(node, StringFromCharCodeTyper); 1543 return TypeUnaryOp(node, StringFromCharCodeTyper);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1703 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1722 if (Type::IsInteger(*value)) { 1704 if (Type::IsInteger(*value)) {
1723 return Type::Range(value->Number(), value->Number(), zone()); 1705 return Type::Range(value->Number(), value->Number(), zone());
1724 } 1706 }
1725 return Type::NewConstant(value, zone()); 1707 return Type::NewConstant(value, zone());
1726 } 1708 }
1727 1709
1728 } // namespace compiler 1710 } // namespace compiler
1729 } // namespace internal 1711 } // namespace internal
1730 } // namespace v8 1712 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698