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

Unified Diff: src/compiler/operation-typer.h

Issue 1921563002: [turbofan] Initial version of number type feedback. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/operation-typer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/operation-typer.h
diff --git a/src/compiler/operation-typer.h b/src/compiler/operation-typer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c62ad481900a282ba98725fc86d25be7937d1f90
--- /dev/null
+++ b/src/compiler/operation-typer.h
@@ -0,0 +1,79 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_COMPILER_OPERATION_TYPER_H_
+#define V8_COMPILER_OPERATION_TYPER_H_
+
+#include "src/base/flags.h"
+#include "src/compiler/opcodes.h"
+
+namespace v8 {
+namespace internal {
+
+class Isolate;
+class RangeType;
+class Type;
+class TypeCache;
+class Zone;
+
+namespace compiler {
+
+class OperationTyper {
+ public:
+ OperationTyper(Isolate* isolate, Zone* zone);
+
+ // Typing Phi.
+ Type* Merge(Type* left, Type* right);
+
+ Type* ToPrimitive(Type* type);
+
+ // Helpers for number operation typing.
+ Type* ToNumber(Type* type);
+ Type* WeakenRange(Type* current_range, Type* previous_range);
+
+ Type* NumericAdd(Type* lhs, Type* rhs);
+ Type* NumericSubtract(Type* lhs, Type* rhs);
+
+ enum ComparisonOutcomeFlags {
+ kComparisonTrue = 1,
+ kComparisonFalse = 2,
+ kComparisonUndefined = 4
+ };
+
+// Javascript binop typers.
+#define DECLARE_CASE(x) Type* Type##x(Type* lhs, Type* rhs);
+ JS_SIMPLE_BINOP_LIST(DECLARE_CASE)
+#undef DECLARE_CASE
+
+ Type* singleton_false() { return singleton_false_; }
+ Type* singleton_true() { return singleton_true_; }
+ Type* singleton_the_hole() { return singleton_the_hole_; }
+
+ private:
+ typedef base::Flags<ComparisonOutcomeFlags> ComparisonOutcome;
+
+ ComparisonOutcome Invert(ComparisonOutcome);
+ Type* Invert(Type*);
+ Type* FalsifyUndefined(ComparisonOutcome);
+
+ Type* Rangify(Type*);
+ Type* AddRanger(RangeType* lhs, RangeType* rhs);
+ Type* SubtractRanger(RangeType* lhs, RangeType* rhs);
+ Type* ModulusRanger(RangeType* lhs, RangeType* rhs);
+
+ Zone* zone() { return zone_; }
+
+ Zone* zone_;
+ TypeCache const& cache_;
+
+ Type* singleton_false_;
+ Type* singleton_true_;
+ Type* singleton_the_hole_;
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_OPERATION_TYPER_H_
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/operation-typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698