| 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-generic-lowering.h" | 5 #include "src/compiler/js-generic-lowering.h" |
| 6 | 6 |
| 7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ReplaceWithStubCall(node, callable, flags); | 279 ReplaceWithStubCall(node, callable, flags); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void JSGenericLowering::LowerJSOrdinaryHasInstance(Node* node) { | 282 void JSGenericLowering::LowerJSOrdinaryHasInstance(Node* node) { |
| 283 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 283 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 284 Callable callable = CodeFactory::OrdinaryHasInstance(isolate()); | 284 Callable callable = CodeFactory::OrdinaryHasInstance(isolate()); |
| 285 ReplaceWithStubCall(node, callable, flags); | 285 ReplaceWithStubCall(node, callable, flags); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void JSGenericLowering::LowerJSLoadContext(Node* node) { | 288 void JSGenericLowering::LowerJSLoadContext(Node* node) { |
| 289 const ContextAccess& access = ContextAccessOf(node->op()); | 289 UNREACHABLE(); // Eliminated in typed lowering. |
| 290 for (size_t i = 0; i < access.depth(); ++i) { | |
| 291 node->ReplaceInput( | |
| 292 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), | |
| 293 NodeProperties::GetValueInput(node, 0), | |
| 294 jsgraph()->Int32Constant( | |
| 295 Context::SlotOffset(Context::PREVIOUS_INDEX)), | |
| 296 NodeProperties::GetEffectInput(node), | |
| 297 graph()->start())); | |
| 298 } | |
| 299 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | |
| 300 static_cast<int>(access.index())))); | |
| 301 node->AppendInput(zone(), graph()->start()); | |
| 302 NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged())); | |
| 303 } | 290 } |
| 304 | 291 |
| 305 | 292 |
| 306 void JSGenericLowering::LowerJSStoreContext(Node* node) { | 293 void JSGenericLowering::LowerJSStoreContext(Node* node) { |
| 307 const ContextAccess& access = ContextAccessOf(node->op()); | 294 UNREACHABLE(); // Eliminated in typed lowering. |
| 308 for (size_t i = 0; i < access.depth(); ++i) { | |
| 309 node->ReplaceInput( | |
| 310 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), | |
| 311 NodeProperties::GetValueInput(node, 0), | |
| 312 jsgraph()->Int32Constant( | |
| 313 Context::SlotOffset(Context::PREVIOUS_INDEX)), | |
| 314 NodeProperties::GetEffectInput(node), | |
| 315 graph()->start())); | |
| 316 } | |
| 317 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | |
| 318 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | |
| 319 static_cast<int>(access.index())))); | |
| 320 NodeProperties::ChangeOp( | |
| 321 node, machine()->Store(StoreRepresentation(MachineRepresentation::kTagged, | |
| 322 kFullWriteBarrier))); | |
| 323 } | 295 } |
| 324 | 296 |
| 325 | 297 |
| 326 void JSGenericLowering::LowerJSCreate(Node* node) { | 298 void JSGenericLowering::LowerJSCreate(Node* node) { |
| 327 CallDescriptor::Flags flags = FrameStateFlagForCall(node); | 299 CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
| 328 Callable callable = CodeFactory::FastNewObject(isolate()); | 300 Callable callable = CodeFactory::FastNewObject(isolate()); |
| 329 ReplaceWithStubCall(node, callable, flags); | 301 ReplaceWithStubCall(node, callable, flags); |
| 330 } | 302 } |
| 331 | 303 |
| 332 | 304 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 } | 610 } |
| 639 | 611 |
| 640 | 612 |
| 641 MachineOperatorBuilder* JSGenericLowering::machine() const { | 613 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 642 return jsgraph()->machine(); | 614 return jsgraph()->machine(); |
| 643 } | 615 } |
| 644 | 616 |
| 645 } // namespace compiler | 617 } // namespace compiler |
| 646 } // namespace internal | 618 } // namespace internal |
| 647 } // namespace v8 | 619 } // namespace v8 |
| OLD | NEW |