| 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/generic-node-inl.h" | 6 #include "src/compiler/generic-node-inl.h" |
| 7 #include "src/compiler/js-context-specialization.h" | 7 #include "src/compiler/js-context-specialization.h" |
| 8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
| 9 #include "src/compiler/node-aux-data-inl.h" | 9 #include "src/compiler/node-aux-data-inl.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (r.Changed() && r.replacement() != use) { | 43 if (r.Changed() && r.replacement() != use) { |
| 44 ReplaceEffectfulWithValue(use, r.replacement()); | 44 ReplaceEffectfulWithValue(use, r.replacement()); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 ++iter; | 47 ++iter; |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 | 50 |
| 51 | 51 |
| 52 Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { | 52 Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { |
| 53 ASSERT_EQ(IrOpcode::kJSLoadContext, node->opcode()); | 53 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); |
| 54 | 54 |
| 55 ContextAccess access = | 55 ContextAccess access = |
| 56 static_cast<Operator1<ContextAccess>*>(node->op())->parameter(); | 56 static_cast<Operator1<ContextAccess>*>(node->op())->parameter(); |
| 57 | 57 |
| 58 // Find the right parent context. | 58 // Find the right parent context. |
| 59 Context* context = *info_->context(); | 59 Context* context = *info_->context(); |
| 60 for (int i = access.depth(); i > 0; --i) { | 60 for (int i = access.depth(); i > 0; --i) { |
| 61 context = context->previous(); | 61 context = context->previous(); |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 if (value->IsUndefined() || value->IsTheHole()) return Reducer::NoChange(); | 84 if (value->IsUndefined() || value->IsTheHole()) return Reducer::NoChange(); |
| 85 | 85 |
| 86 // Success. The context load can be replaced with the constant. | 86 // Success. The context load can be replaced with the constant. |
| 87 // TODO(titzer): record the specialization for sharing code across multiple | 87 // TODO(titzer): record the specialization for sharing code across multiple |
| 88 // contexts that have the same value in the corresponding context slot. | 88 // contexts that have the same value in the corresponding context slot. |
| 89 return Reducer::Replace(jsgraph_->Constant(value)); | 89 return Reducer::Replace(jsgraph_->Constant(value)); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } // namespace v8::internal::compiler | 93 } // namespace v8::internal::compiler |
| OLD | NEW |