| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 194 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
| 195 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 195 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
| 196 node->ReplaceInput(3, vector); | 196 node->ReplaceInput(3, vector); |
| 197 node->ReplaceInput(6, effect); | 197 node->ReplaceInput(6, effect); |
| 198 ReplaceWithStubCall(node, callable, flags); | 198 ReplaceWithStubCall(node, callable, flags); |
| 199 } | 199 } |
| 200 | 200 |
| 201 | 201 |
| 202 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 202 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
| 203 Node* closure = NodeProperties::GetValueInput(node, 0); | 203 Node* closure = NodeProperties::GetValueInput(node, 0); |
| 204 Node* context = NodeProperties::GetContextInput(node); | |
| 205 Node* effect = NodeProperties::GetEffectInput(node); | 204 Node* effect = NodeProperties::GetEffectInput(node); |
| 206 Node* control = NodeProperties::GetControlInput(node); | 205 Node* control = NodeProperties::GetControlInput(node); |
| 207 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 206 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 208 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 207 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
| 209 Callable callable = | 208 Callable callable = |
| 210 CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode()); | 209 CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode()); |
| 211 // Load the type feedback vector from the closure. | 210 // Load the type feedback vector from the closure. |
| 212 Node* literals = effect = graph()->NewNode( | 211 Node* literals = effect = graph()->NewNode( |
| 213 machine()->Load(MachineType::AnyTagged()), closure, | 212 machine()->Load(MachineType::AnyTagged()), closure, |
| 214 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), | 213 jsgraph()->IntPtrConstant(JSFunction::kLiteralsOffset - kHeapObjectTag), |
| 215 effect, control); | 214 effect, control); |
| 216 Node* vector = effect = graph()->NewNode( | 215 Node* vector = effect = graph()->NewNode( |
| 217 machine()->Load(MachineType::AnyTagged()), literals, | 216 machine()->Load(MachineType::AnyTagged()), literals, |
| 218 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - | 217 jsgraph()->IntPtrConstant(LiteralsArray::kFeedbackVectorOffset - |
| 219 kHeapObjectTag), | 218 kHeapObjectTag), |
| 220 effect, control); | 219 effect, control); |
| 221 // Load global object from the context. | 220 node->InsertInput(zone(), 0, jsgraph()->SmiConstant(p.feedback().index())); |
| 222 Node* native_context = effect = | 221 node->ReplaceInput(1, vector); |
| 223 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, | 222 node->ReplaceInput(4, effect); |
| 224 jsgraph()->IntPtrConstant( | |
| 225 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | |
| 226 effect, control); | |
| 227 Node* global = effect = graph()->NewNode( | |
| 228 machine()->Load(MachineType::AnyTagged()), native_context, | |
| 229 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | |
| 230 effect, control); | |
| 231 node->InsertInput(zone(), 0, global); | |
| 232 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | |
| 233 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | |
| 234 node->ReplaceInput(3, vector); | |
| 235 node->ReplaceInput(6, effect); | |
| 236 ReplaceWithStubCall(node, callable, flags); | 223 ReplaceWithStubCall(node, callable, flags); |
| 237 } | 224 } |
| 238 | 225 |
| 239 | 226 |
| 240 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 227 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
| 241 Node* closure = NodeProperties::GetValueInput(node, 3); | 228 Node* closure = NodeProperties::GetValueInput(node, 3); |
| 242 Node* effect = NodeProperties::GetEffectInput(node); | 229 Node* effect = NodeProperties::GetEffectInput(node); |
| 243 Node* control = NodeProperties::GetControlInput(node); | 230 Node* control = NodeProperties::GetControlInput(node); |
| 244 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 231 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 245 PropertyAccess const& p = PropertyAccessOf(node->op()); | 232 PropertyAccess const& p = PropertyAccessOf(node->op()); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 726 } |
| 740 | 727 |
| 741 | 728 |
| 742 MachineOperatorBuilder* JSGenericLowering::machine() const { | 729 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 743 return jsgraph()->machine(); | 730 return jsgraph()->machine(); |
| 744 } | 731 } |
| 745 | 732 |
| 746 } // namespace compiler | 733 } // namespace compiler |
| 747 } // namespace internal | 734 } // namespace internal |
| 748 } // namespace v8 | 735 } // namespace v8 |
| OLD | NEW |