| 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-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 MaybeHandle<Context> JSContextSpecialization::GetSpecializationContext( | 31 MaybeHandle<Context> JSContextSpecialization::GetSpecializationContext( |
| 32 Node* node) { | 32 Node* node) { |
| 33 DCHECK(node->opcode() == IrOpcode::kJSLoadContext || | 33 DCHECK(node->opcode() == IrOpcode::kJSLoadContext || |
| 34 node->opcode() == IrOpcode::kJSStoreContext); | 34 node->opcode() == IrOpcode::kJSStoreContext); |
| 35 Node* const object = NodeProperties::GetValueInput(node, 0); | 35 Node* const object = NodeProperties::GetValueInput(node, 0); |
| 36 switch (object->opcode()) { | 36 switch (object->opcode()) { |
| 37 case IrOpcode::kHeapConstant: | 37 case IrOpcode::kHeapConstant: |
| 38 return Handle<Context>::cast( | 38 return Handle<Context>::cast(OpParameter<Handle<HeapObject>>(object)); |
| 39 OpParameter<Unique<HeapObject>>(object).handle()); | |
| 40 case IrOpcode::kParameter: { | 39 case IrOpcode::kParameter: { |
| 41 Node* const start = NodeProperties::GetValueInput(object, 0); | 40 Node* const start = NodeProperties::GetValueInput(object, 0); |
| 42 DCHECK_EQ(IrOpcode::kStart, start->opcode()); | 41 DCHECK_EQ(IrOpcode::kStart, start->opcode()); |
| 43 int const index = ParameterIndexOf(object->op()); | 42 int const index = ParameterIndexOf(object->op()); |
| 44 // The context is always the last parameter to a JavaScript function, and | 43 // The context is always the last parameter to a JavaScript function, and |
| 45 // {Parameter} indices start at -1, so value outputs of {Start} look like | 44 // {Parameter} indices start at -1, so value outputs of {Start} look like |
| 46 // this: closure, receiver, param0, ..., paramN, context. | 45 // this: closure, receiver, param0, ..., paramN, context. |
| 47 if (index == start->op()->ValueOutputCount() - 2) { | 46 if (index == start->op()->ValueOutputCount() - 2) { |
| 48 return context(); | 47 return context(); |
| 49 } | 48 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 129 } |
| 131 | 130 |
| 132 | 131 |
| 133 JSOperatorBuilder* JSContextSpecialization::javascript() const { | 132 JSOperatorBuilder* JSContextSpecialization::javascript() const { |
| 134 return jsgraph()->javascript(); | 133 return jsgraph()->javascript(); |
| 135 } | 134 } |
| 136 | 135 |
| 137 } // namespace compiler | 136 } // namespace compiler |
| 138 } // namespace internal | 137 } // namespace internal |
| 139 } // namespace v8 | 138 } // namespace v8 |
| OLD | NEW |