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

Unified Diff: src/compiler/typer.cc

Issue 953563002: Implement experimental exponentiation operator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add more tests and fix some bugs Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/typer.cc
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
index 9af65597bf5527e9d60ca3c67b38300726cfe1bb..2f01e14243e95776467dee26dcae281a99456459 100644
--- a/src/compiler/typer.cc
+++ b/src/compiler/typer.cc
@@ -350,6 +350,7 @@ class Typer::Visitor : public Reducer {
static Type* JSMultiplyRanger(Type::RangeType*, Type::RangeType*, Typer*);
static Type* JSDivideRanger(Type::RangeType*, Type::RangeType*, Typer*);
static Type* JSModulusRanger(Type::RangeType*, Type::RangeType*, Typer*);
+ static Type* JSExponentiateRanger(Type::RangeType*, Type::RangeType*, Typer*);
static ComparisonOutcome JSCompareTyper(Type*, Type*, Typer*);
@@ -1223,6 +1224,18 @@ Type* Typer::Visitor::JSModulusTyper(Type* lhs, Type* rhs, Typer* t) {
}
+Type* Typer::Visitor::JSExponentiateRanger(Type::RangeType* lhs,
+ Type::RangeType* rhs, Typer* t) {
+ return Type::Range(-V8_INFINITY, +V8_INFINITY, t->zone());
Michael Starzinger 2015/02/24 14:09:03 This is a pretty broad range. :)
caitp (gmail) 2015/02/24 14:56:12 I have some ideas for how to make it a bit more na
+}
+
+
+Type* Typer::Visitor::JSExponentiateTyper(Type* lhs, Type* rhs, Typer* t) {
+ if (lhs->Is(Type::NaN()) || rhs->Is(Type::NaN())) return Type::NaN();
Michael Starzinger 2015/02/24 14:09:03 Isn't the exponentiation supposed to perform an im
caitp (gmail) 2015/02/24 14:56:12 I might be misunderstanding what the typer is doin
+ return Type::Number();
+}
+
+
// JS unary operators.
@@ -1576,6 +1589,11 @@ Bounds Typer::Visitor::TypeNumberModulus(Node* node) {
}
+Bounds Typer::Visitor::TypeNumberExponentiate(Node* node) {
+ return Bounds(Type::None(zone()), Type::Number(zone()));
+}
+
+
Bounds Typer::Visitor::TypeNumberToInt32(Node* node) {
return TypeUnaryOp(node, NumberToInt32);
}
« src/compiler/opcodes.h ('K') | « src/compiler/opcodes.h ('k') | src/compiler/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698