Chromium Code Reviews| Index: src/compiler/context-relaxation.cc |
| diff --git a/src/compiler/context-relaxation.cc b/src/compiler/context-relaxation.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3e25dae88bf35d4e63368860a53627a0b16a9555 |
| --- /dev/null |
| +++ b/src/compiler/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/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 ContextRelaxation::Reduce(Node* node) { |
|
Michael Starzinger
2015/07/02 10:29:26
I think it would make sense to rename this class t
|
| + 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_) { |
|
danno
2015/07/01 09:11:48
This is a bit weird, any better ideas?
Michael Starzinger
2015/07/02 10:29:26
As discussed offline: We could move the parameter
|
| + if (relaxed_context_->InputAt(0) == nullptr) { |
|
Michael Starzinger
2015/07/02 10:29:26
Can we please use relaxed_context_->IsDead() inste
|
| + 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 |