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

Unified Diff: src/compiler/machine-operator-reducer.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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/machine-operator-reducer.h
diff --git a/src/compiler/machine-operator-reducer.h b/src/compiler/machine-operator-reducer.h
new file mode 100644
index 0000000000000000000000000000000000000000..52eefd84e7ccbd2963dd8e593dae67a661bf1bc1
--- /dev/null
+++ b/src/compiler/machine-operator-reducer.h
@@ -0,0 +1,53 @@
+// Copyright 2014 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_MACHINE_OPERATOR_REDUCER_H_
+#define V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_
+
+#include "src/compiler/common-operator.h"
+#include "src/compiler/graph-reducer.h"
+#include "src/compiler/machine-operator.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// Forward declarations.
+class CommonNodeCache;
+
+// Performs constant folding and strength reduction on nodes that have
+// machine operators.
+class MachineOperatorReducer : public Reducer {
+ public:
+ explicit MachineOperatorReducer(Graph* graph);
+
+ MachineOperatorReducer(Graph* graph, CommonNodeCache* cache);
+
+ virtual Reduction Reduce(Node* node);
+
+ private:
+ Graph* graph_;
+ CommonNodeCache* cache_;
+ CommonOperatorBuilder common_;
+ MachineOperatorBuilder machine_;
+
+ Node* Int32Constant(int32_t value);
+ Node* Float64Constant(volatile double value);
+
+ Reduction ReplaceBool(bool value) {
+ return ReplaceInt32(value ? 1 : 0);
+ }
+
+ Reduction ReplaceInt32(int32_t value) {
+ return Replace(Int32Constant(value));
+ }
+
+ Reduction ReplaceFloat64(volatile double value) {
+ return Replace(Float64Constant(value));
+ }
+};
+
+} } } // namespace v8::internal::compiler
+
+#endif // V8_COMPILER_MACHINE_OPERATOR_REDUCER_H_

Powered by Google App Engine
This is Rietveld 408576698