OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/js-context-specialization.h" | 5 #include "src/compiler/js-context-specialization.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 namespace compiler { | 14 namespace compiler { |
15 | 15 |
16 Reduction JSContextSpecializer::Reduce(Node* node) { | 16 Reduction JSContextSpecializer::Reduce(Node* node) { |
17 if (node == context_) { | |
18 Node* constant = jsgraph_->Constant(ctx_); | |
19 NodeProperties::ReplaceWithValue(node, constant); | |
20 return Replace(constant); | |
21 } | |
22 if (node->opcode() == IrOpcode::kJSLoadContext) { | 17 if (node->opcode() == IrOpcode::kJSLoadContext) { |
23 return ReduceJSLoadContext(node); | 18 return ReduceJSLoadContext(node); |
24 } | 19 } |
25 if (node->opcode() == IrOpcode::kJSStoreContext) { | 20 if (node->opcode() == IrOpcode::kJSStoreContext) { |
26 return ReduceJSStoreContext(node); | 21 return ReduceJSStoreContext(node); |
27 } | 22 } |
28 return NoChange(); | 23 return NoChange(); |
29 } | 24 } |
30 | 25 |
31 | 26 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Handle<Object> new_context_handle = | 102 Handle<Object> new_context_handle = |
108 Handle<Object>(context, jsgraph_->isolate()); | 103 Handle<Object>(context, jsgraph_->isolate()); |
109 node->ReplaceInput(0, jsgraph_->Constant(new_context_handle)); | 104 node->ReplaceInput(0, jsgraph_->Constant(new_context_handle)); |
110 | 105 |
111 return Changed(node); | 106 return Changed(node); |
112 } | 107 } |
113 | 108 |
114 } // namespace compiler | 109 } // namespace compiler |
115 } // namespace internal | 110 } // namespace internal |
116 } // namespace v8 | 111 } // namespace v8 |
OLD | NEW |