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

Unified Diff: src/compiler/js-context-relaxation.cc

Issue 1220823004: [turbofan]: Add a context relaxation Reducer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 6 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/js-context-relaxation.cc
diff --git a/src/compiler/js-context-relaxation.cc b/src/compiler/js-context-relaxation.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4f19de88a187ce1ec372677e2cc46b3f5f2b8284
--- /dev/null
+++ b/src/compiler/js-context-relaxation.cc
@@ -0,0 +1,45 @@
+// 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.
+
+#include "src/compiler/js-context-relaxation.h"
+#include "src/compiler/js-operator.h"
+#include "src/compiler/node.h"
+#include "src/compiler/node-properties.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+Reduction JSContextRelaxation::Reduce(Node* node) {
+ switch (node->opcode()) {
+ case IrOpcode::kJSCallRuntime:
+ switch (OpParameter<CallRuntimeParameters>(node->op()).id()) {
+ case Runtime::kInlineMathClz32:
+ case Runtime::kInlineMathFloor:
+ case Runtime::kInlineMathSqrt:
+ break;
+ default:
+ return NoChange();
+ }
+ // Fall through...
+ case IrOpcode::kJSCallFunction:
+ case IrOpcode::kJSToNumber:
+ if (!context_is_wired_) {
+ if (relaxed_context_->IsDead()) {
+ relaxed_context_->ReplaceInput(0, start_);
+ }
+ context_is_wired_ = true;
+ }
+ NodeProperties::ReplaceContextInput(node, relaxed_context_);
+ return Changed(node);
+ break;
+ default:
+ break;
+ }
+ return NoChange();
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698