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

Unified Diff: src/compiler/common-node-cache.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" 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
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/common-node-cache.h
diff --git a/src/compiler/common-node-cache.h b/src/compiler/common-node-cache.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b0ac0b6e2bf9e218dc421efcdca83c234891319
--- /dev/null
+++ b/src/compiler/common-node-cache.h
@@ -0,0 +1,51 @@
+// 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_COMMON_NODE_CACHE_H_
+#define V8_COMPILER_COMMON_NODE_CACHE_H_
+
+#include "src/assembler.h"
+#include "src/compiler/node-cache.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// Bundles various caches for common nodes.
+class CommonNodeCache V8_FINAL : public ZoneObject {
+ public:
+ explicit CommonNodeCache(Zone* zone) : zone_(zone) {}
+
+ Node** FindInt32Constant(int32_t value) {
+ return int32_constants_.Find(zone_, value);
+ }
+
+ Node** FindFloat64Constant(double value) {
+ // We canonicalize double constants at the bit representation level.
+ return float64_constants_.Find(zone_, BitCast<int64_t>(value));
+ }
+
+ Node** FindExternalConstant(ExternalReference reference) {
+ return external_constants_.Find(zone_, reference.address());
+ }
+
+ Node** FindNumberConstant(double value) {
+ // We canonicalize double constants at the bit representation level.
+ return number_constants_.Find(zone_, BitCast<int64_t>(value));
+ }
+
+ Zone* zone() const { return zone_; }
+
+ private:
+ Int32NodeCache int32_constants_;
+ Int64NodeCache float64_constants_;
+ PtrNodeCache external_constants_;
+ Int64NodeCache number_constants_;
+ Zone* zone_;
+};
+}
+}
+} // namespace v8::internal::compiler
+
+#endif // V8_COMPILER_COMMON_NODE_CACHE_H_
« no previous file with comments | « src/compiler/code-generator-impl.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698