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

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

Issue 2180373005: [turbofan] Add support for String.prototype.charCodeAt/charAt. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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-operator.cc ('k') | src/compiler/verifier.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 "src/base/flags.h" 7 #include "src/base/flags.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/common-operator.h" 10 #include "src/compiler/common-operator.h"
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 double min = type->Min(); 1876 double min = type->Min();
1877 double max = type->Max(); 1877 double max = type->Max();
1878 if (min == max) { 1878 if (min == max) {
1879 uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU; 1879 uint32_t code = static_cast<uint32_t>(min) & String::kMaxUtf16CodeUnitU;
1880 Handle<String> string = f->LookupSingleCharacterStringFromCode(code); 1880 Handle<String> string = f->LookupSingleCharacterStringFromCode(code);
1881 return Type::Constant(string, t->zone()); 1881 return Type::Constant(string, t->zone());
1882 } 1882 }
1883 return Type::String(); 1883 return Type::String();
1884 } 1884 }
1885 1885
1886 Type* Typer::Visitor::TypeStringCharCodeAt(Node* node) {
1887 // TODO(bmeurer): We could do better here based on inputs.
1888 return Type::Range(0, kMaxUInt16, zone());
1889 }
1890
1886 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) { 1891 Type* Typer::Visitor::TypeStringFromCharCode(Node* node) {
1887 return TypeUnaryOp(node, StringFromCharCodeTyper); 1892 return TypeUnaryOp(node, StringFromCharCodeTyper);
1888 } 1893 }
1889 1894
1890 Type* Typer::Visitor::TypeCheckBounds(Node* node) { 1895 Type* Typer::Visitor::TypeCheckBounds(Node* node) {
1891 // TODO(bmeurer): We could do better here based on the limit. 1896 // TODO(bmeurer): We could do better here based on the limit.
1892 return Type::Unsigned31(); 1897 return Type::Unsigned31();
1893 } 1898 }
1894 1899
1895 Type* Typer::Visitor::TypeCheckNumber(Node* node) { 1900 Type* Typer::Visitor::TypeCheckNumber(Node* node) {
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 } 2705 }
2701 if (Type::IsInteger(*value)) { 2706 if (Type::IsInteger(*value)) {
2702 return Type::Range(value->Number(), value->Number(), zone()); 2707 return Type::Range(value->Number(), value->Number(), zone());
2703 } 2708 }
2704 return Type::Constant(value, zone()); 2709 return Type::Constant(value, zone());
2705 } 2710 }
2706 2711
2707 } // namespace compiler 2712 } // namespace compiler
2708 } // namespace internal 2713 } // namespace internal
2709 } // namespace v8 2714 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/simplified-operator.cc ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698