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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 ? NodeProperties::GetEffectInput(node) | 152 ? NodeProperties::GetEffectInput(node) |
153 : graph()->start(); | 153 : graph()->start(); |
154 inputs.push_back(effect); | 154 inputs.push_back(effect); |
155 Node* control = (node->op()->ControlInputCount() > 0) | 155 Node* control = (node->op()->ControlInputCount() > 0) |
156 ? NodeProperties::GetControlInput(node) | 156 ? NodeProperties::GetControlInput(node) |
157 : graph()->start(); | 157 : graph()->start(); |
158 inputs.push_back(control); | 158 inputs.push_back(control); |
159 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( | 159 CallDescriptor* desc_compare = Linkage::GetStubCallDescriptor( |
160 isolate(), zone(), callable.descriptor(), 0, | 160 isolate(), zone(), callable.descriptor(), 0, |
161 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node), | 161 CallDescriptor::kPatchableCallSiteWithNop | FlagsForNode(node), |
162 Operator::kNoProperties, kMachIntPtr); | 162 Operator::kNoProperties, MachineType::IntPtr()); |
163 Node* compare = | 163 Node* compare = |
164 graph()->NewNode(common()->Call(desc_compare), | 164 graph()->NewNode(common()->Call(desc_compare), |
165 static_cast<int>(inputs.size()), &inputs.front()); | 165 static_cast<int>(inputs.size()), &inputs.front()); |
166 | 166 |
167 // Decide how the return value from the above CompareIC can be converted into | 167 // Decide how the return value from the above CompareIC can be converted into |
168 // a JavaScript boolean oddball depending on the given token. | 168 // a JavaScript boolean oddball depending on the given token. |
169 Node* false_value = jsgraph()->FalseConstant(); | 169 Node* false_value = jsgraph()->FalseConstant(); |
170 Node* true_value = jsgraph()->TrueConstant(); | 170 Node* true_value = jsgraph()->TrueConstant(); |
171 const Operator* op = nullptr; | 171 const Operator* op = nullptr; |
172 switch (token) { | 172 switch (token) { |
(...skipping 24 matching lines...) Expand all Loading... |
197 UNREACHABLE(); | 197 UNREACHABLE(); |
198 } | 198 } |
199 Node* booleanize = graph()->NewNode(op, compare, jsgraph()->ZeroConstant()); | 199 Node* booleanize = graph()->NewNode(op, compare, jsgraph()->ZeroConstant()); |
200 | 200 |
201 // Finally patch the original node to select a boolean. | 201 // Finally patch the original node to select a boolean. |
202 NodeProperties::ReplaceUses(node, node, compare, compare, compare); | 202 NodeProperties::ReplaceUses(node, node, compare, compare, compare); |
203 node->TrimInputCount(3); | 203 node->TrimInputCount(3); |
204 node->ReplaceInput(0, booleanize); | 204 node->ReplaceInput(0, booleanize); |
205 node->ReplaceInput(1, true_value); | 205 node->ReplaceInput(1, true_value); |
206 node->ReplaceInput(2, false_value); | 206 node->ReplaceInput(2, false_value); |
207 NodeProperties::ChangeOp(node, common()->Select(kMachAnyTagged)); | 207 NodeProperties::ChangeOp(node, |
| 208 common()->Select(MachineRepresentation::kTagged)); |
208 } | 209 } |
209 | 210 |
210 | 211 |
211 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, | 212 void JSGenericLowering::ReplaceWithStubCall(Node* node, Callable callable, |
212 CallDescriptor::Flags flags) { | 213 CallDescriptor::Flags flags) { |
213 Operator::Properties properties = node->op()->properties(); | 214 Operator::Properties properties = node->op()->properties(); |
214 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 215 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
215 isolate(), zone(), callable.descriptor(), 0, flags, properties); | 216 isolate(), zone(), callable.descriptor(), 0, flags, properties); |
216 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 217 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
217 node->InsertInput(zone(), 0, stub_code); | 218 node->InsertInput(zone(), 0, stub_code); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 301 |
301 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { | 302 void JSGenericLowering::LowerJSLoadGlobal(Node* node) { |
302 Node* context = NodeProperties::GetContextInput(node); | 303 Node* context = NodeProperties::GetContextInput(node); |
303 Node* effect = NodeProperties::GetEffectInput(node); | 304 Node* effect = NodeProperties::GetEffectInput(node); |
304 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 305 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
305 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); | 306 const LoadGlobalParameters& p = LoadGlobalParametersOf(node->op()); |
306 Callable callable = CodeFactory::LoadICInOptimizedCode( | 307 Callable callable = CodeFactory::LoadICInOptimizedCode( |
307 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); | 308 isolate(), p.typeof_mode(), SLOPPY, UNINITIALIZED); |
308 // Load global object from the context. | 309 // Load global object from the context. |
309 Node* native_context = | 310 Node* native_context = |
310 graph()->NewNode(machine()->Load(kMachAnyTagged), context, | 311 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, |
311 jsgraph()->IntPtrConstant( | 312 jsgraph()->IntPtrConstant( |
312 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | 313 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), |
313 effect, graph()->start()); | 314 effect, graph()->start()); |
314 Node* global = graph()->NewNode( | 315 Node* global = graph()->NewNode( |
315 machine()->Load(kMachAnyTagged), native_context, | 316 machine()->Load(MachineType::AnyTagged()), native_context, |
316 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | 317 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), |
317 effect, graph()->start()); | 318 effect, graph()->start()); |
318 node->InsertInput(zone(), 0, global); | 319 node->InsertInput(zone(), 0, global); |
319 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 320 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
320 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); | 321 node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index())); |
321 ReplaceWithStubCall(node, callable, flags); | 322 ReplaceWithStubCall(node, callable, flags); |
322 } | 323 } |
323 | 324 |
324 | 325 |
325 void JSGenericLowering::LowerJSStoreProperty(Node* node) { | 326 void JSGenericLowering::LowerJSStoreProperty(Node* node) { |
(...skipping 24 matching lines...) Expand all Loading... |
350 | 351 |
351 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { | 352 void JSGenericLowering::LowerJSStoreGlobal(Node* node) { |
352 Node* context = NodeProperties::GetContextInput(node); | 353 Node* context = NodeProperties::GetContextInput(node); |
353 Node* effect = NodeProperties::GetEffectInput(node); | 354 Node* effect = NodeProperties::GetEffectInput(node); |
354 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 355 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
355 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); | 356 const StoreGlobalParameters& p = StoreGlobalParametersOf(node->op()); |
356 Callable callable = CodeFactory::StoreICInOptimizedCode( | 357 Callable callable = CodeFactory::StoreICInOptimizedCode( |
357 isolate(), p.language_mode(), UNINITIALIZED); | 358 isolate(), p.language_mode(), UNINITIALIZED); |
358 // Load global object from the context. | 359 // Load global object from the context. |
359 Node* native_context = | 360 Node* native_context = |
360 graph()->NewNode(machine()->Load(kMachAnyTagged), context, | 361 graph()->NewNode(machine()->Load(MachineType::AnyTagged()), context, |
361 jsgraph()->IntPtrConstant( | 362 jsgraph()->IntPtrConstant( |
362 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), | 363 Context::SlotOffset(Context::NATIVE_CONTEXT_INDEX)), |
363 effect, graph()->start()); | 364 effect, graph()->start()); |
364 Node* global = graph()->NewNode( | 365 Node* global = graph()->NewNode( |
365 machine()->Load(kMachAnyTagged), native_context, | 366 machine()->Load(MachineType::AnyTagged()), native_context, |
366 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), | 367 jsgraph()->IntPtrConstant(Context::SlotOffset(Context::EXTENSION_INDEX)), |
367 effect, graph()->start()); | 368 effect, graph()->start()); |
368 node->InsertInput(zone(), 0, global); | 369 node->InsertInput(zone(), 0, global); |
369 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); | 370 node->InsertInput(zone(), 1, jsgraph()->HeapConstant(p.name())); |
370 DCHECK(p.feedback().index() != -1); | 371 DCHECK(p.feedback().index() != -1); |
371 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); | 372 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index())); |
372 ReplaceWithStubCall(node, callable, | 373 ReplaceWithStubCall(node, callable, |
373 CallDescriptor::kPatchableCallSite | flags); | 374 CallDescriptor::kPatchableCallSite | flags); |
374 } | 375 } |
375 | 376 |
(...skipping 15 matching lines...) Expand all Loading... |
391 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 392 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
392 Callable callable = CodeFactory::InstanceOf(isolate()); | 393 Callable callable = CodeFactory::InstanceOf(isolate()); |
393 ReplaceWithStubCall(node, callable, flags); | 394 ReplaceWithStubCall(node, callable, flags); |
394 } | 395 } |
395 | 396 |
396 | 397 |
397 void JSGenericLowering::LowerJSLoadContext(Node* node) { | 398 void JSGenericLowering::LowerJSLoadContext(Node* node) { |
398 const ContextAccess& access = ContextAccessOf(node->op()); | 399 const ContextAccess& access = ContextAccessOf(node->op()); |
399 for (size_t i = 0; i < access.depth(); ++i) { | 400 for (size_t i = 0; i < access.depth(); ++i) { |
400 node->ReplaceInput( | 401 node->ReplaceInput( |
401 0, graph()->NewNode(machine()->Load(kMachAnyTagged), | 402 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), |
402 NodeProperties::GetValueInput(node, 0), | 403 NodeProperties::GetValueInput(node, 0), |
403 jsgraph()->Int32Constant( | 404 jsgraph()->Int32Constant( |
404 Context::SlotOffset(Context::PREVIOUS_INDEX)), | 405 Context::SlotOffset(Context::PREVIOUS_INDEX)), |
405 NodeProperties::GetEffectInput(node), | 406 NodeProperties::GetEffectInput(node), |
406 graph()->start())); | 407 graph()->start())); |
407 } | 408 } |
408 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | 409 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( |
409 static_cast<int>(access.index())))); | 410 static_cast<int>(access.index())))); |
410 node->AppendInput(zone(), graph()->start()); | 411 node->AppendInput(zone(), graph()->start()); |
411 NodeProperties::ChangeOp(node, machine()->Load(kMachAnyTagged)); | 412 NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged())); |
412 } | 413 } |
413 | 414 |
414 | 415 |
415 void JSGenericLowering::LowerJSStoreContext(Node* node) { | 416 void JSGenericLowering::LowerJSStoreContext(Node* node) { |
416 const ContextAccess& access = ContextAccessOf(node->op()); | 417 const ContextAccess& access = ContextAccessOf(node->op()); |
417 for (size_t i = 0; i < access.depth(); ++i) { | 418 for (size_t i = 0; i < access.depth(); ++i) { |
418 node->ReplaceInput( | 419 node->ReplaceInput( |
419 0, graph()->NewNode(machine()->Load(kMachAnyTagged), | 420 0, graph()->NewNode(machine()->Load(MachineType::AnyTagged()), |
420 NodeProperties::GetValueInput(node, 0), | 421 NodeProperties::GetValueInput(node, 0), |
421 jsgraph()->Int32Constant( | 422 jsgraph()->Int32Constant( |
422 Context::SlotOffset(Context::PREVIOUS_INDEX)), | 423 Context::SlotOffset(Context::PREVIOUS_INDEX)), |
423 NodeProperties::GetEffectInput(node), | 424 NodeProperties::GetEffectInput(node), |
424 graph()->start())); | 425 graph()->start())); |
425 } | 426 } |
426 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); | 427 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); |
427 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( | 428 node->ReplaceInput(1, jsgraph()->Int32Constant(Context::SlotOffset( |
428 static_cast<int>(access.index())))); | 429 static_cast<int>(access.index())))); |
429 NodeProperties::ChangeOp(node, machine()->Store(StoreRepresentation( | 430 NodeProperties::ChangeOp( |
430 kMachAnyTagged, kFullWriteBarrier))); | 431 node, machine()->Store(StoreRepresentation(MachineType::AnyTagged(), |
| 432 kFullWriteBarrier))); |
431 } | 433 } |
432 | 434 |
433 | 435 |
434 void JSGenericLowering::LowerJSLoadDynamic(Node* node) { | 436 void JSGenericLowering::LowerJSLoadDynamic(Node* node) { |
435 const DynamicAccess& access = DynamicAccessOf(node->op()); | 437 const DynamicAccess& access = DynamicAccessOf(node->op()); |
436 Runtime::FunctionId function_id = | 438 Runtime::FunctionId function_id = |
437 (access.typeof_mode() == NOT_INSIDE_TYPEOF) | 439 (access.typeof_mode() == NOT_INSIDE_TYPEOF) |
438 ? Runtime::kLoadLookupSlot | 440 ? Runtime::kLoadLookupSlot |
439 : Runtime::kLoadLookupSlotNoReferenceError; | 441 : Runtime::kLoadLookupSlotNoReferenceError; |
440 Node* projection = graph()->NewNode(common()->Projection(0), node); | 442 Node* projection = graph()->NewNode(common()->Projection(0), node); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 zone(), function->function_id, 1, Operator::kNoProperties, | 621 zone(), function->function_id, 1, Operator::kNoProperties, |
620 CallDescriptor::kNeedsFrameState); | 622 CallDescriptor::kNeedsFrameState); |
621 Node* cache_type = effect = graph()->NewNode( | 623 Node* cache_type = effect = graph()->NewNode( |
622 common()->Call(descriptor), | 624 common()->Call(descriptor), |
623 jsgraph()->CEntryStubConstant(function->result_size), object, | 625 jsgraph()->CEntryStubConstant(function->result_size), object, |
624 jsgraph()->ExternalConstant(function->function_id), | 626 jsgraph()->ExternalConstant(function->function_id), |
625 jsgraph()->Int32Constant(1), context, frame_state, effect, control); | 627 jsgraph()->Int32Constant(1), context, frame_state, effect, control); |
626 control = graph()->NewNode(common()->IfSuccess(), cache_type); | 628 control = graph()->NewNode(common()->IfSuccess(), cache_type); |
627 | 629 |
628 Node* object_map = effect = graph()->NewNode( | 630 Node* object_map = effect = graph()->NewNode( |
629 machine()->Load(kMachAnyTagged), object, | 631 machine()->Load(MachineType::AnyTagged()), object, |
630 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), | 632 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), |
631 effect, control); | 633 effect, control); |
632 Node* cache_type_map = effect = graph()->NewNode( | 634 Node* cache_type_map = effect = graph()->NewNode( |
633 machine()->Load(kMachAnyTagged), cache_type, | 635 machine()->Load(MachineType::AnyTagged()), cache_type, |
634 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), | 636 jsgraph()->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag), |
635 effect, control); | 637 effect, control); |
636 Node* meta_map = jsgraph()->HeapConstant(isolate()->factory()->meta_map()); | 638 Node* meta_map = jsgraph()->HeapConstant(isolate()->factory()->meta_map()); |
637 | 639 |
638 // If we got a map from the GetPropertyNamesFast runtime call, we can do a | 640 // If we got a map from the GetPropertyNamesFast runtime call, we can do a |
639 // fast modification check. Otherwise, we got a fixed array, and we have to | 641 // fast modification check. Otherwise, we got a fixed array, and we have to |
640 // perform a slow check on every iteration. | 642 // perform a slow check on every iteration. |
641 Node* check0 = | 643 Node* check0 = |
642 graph()->NewNode(machine()->WordEqual(), cache_type_map, meta_map); | 644 graph()->NewNode(machine()->WordEqual(), cache_type_map, meta_map); |
643 Node* branch0 = | 645 Node* branch0 = |
644 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); | 646 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); |
645 | 647 |
646 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); | 648 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); |
647 Node* cache_array_true0; | 649 Node* cache_array_true0; |
648 Node* cache_length_true0; | 650 Node* cache_length_true0; |
649 Node* cache_type_true0; | 651 Node* cache_type_true0; |
650 Node* etrue0; | 652 Node* etrue0; |
651 { | 653 { |
652 // Enum cache case. | 654 // Enum cache case. |
653 Node* cache_type_enum_length = etrue0 = graph()->NewNode( | 655 Node* cache_type_enum_length = etrue0 = graph()->NewNode( |
654 machine()->Load(kMachUint32), cache_type, | 656 machine()->Load(MachineType::Uint32()), cache_type, |
655 jsgraph()->IntPtrConstant(Map::kBitField3Offset - kHeapObjectTag), | 657 jsgraph()->IntPtrConstant(Map::kBitField3Offset - kHeapObjectTag), |
656 effect, if_true0); | 658 effect, if_true0); |
657 cache_type_enum_length = | 659 cache_type_enum_length = |
658 graph()->NewNode(machine()->Word32And(), cache_type_enum_length, | 660 graph()->NewNode(machine()->Word32And(), cache_type_enum_length, |
659 jsgraph()->Uint32Constant(Map::EnumLengthBits::kMask)); | 661 jsgraph()->Uint32Constant(Map::EnumLengthBits::kMask)); |
660 | 662 |
661 Node* check1 = | 663 Node* check1 = |
662 graph()->NewNode(machine()->Word32Equal(), cache_type_enum_length, | 664 graph()->NewNode(machine()->Word32Equal(), cache_type_enum_length, |
663 jsgraph()->Int32Constant(0)); | 665 jsgraph()->Int32Constant(0)); |
664 Node* branch1 = | 666 Node* branch1 = |
665 graph()->NewNode(common()->Branch(BranchHint::kTrue), check1, if_true0); | 667 graph()->NewNode(common()->Branch(BranchHint::kTrue), check1, if_true0); |
666 | 668 |
667 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 669 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
668 Node* cache_array_true1; | 670 Node* cache_array_true1; |
669 Node* etrue1; | 671 Node* etrue1; |
670 { | 672 { |
671 // No properties to enumerate. | 673 // No properties to enumerate. |
672 cache_array_true1 = | 674 cache_array_true1 = |
673 jsgraph()->HeapConstant(isolate()->factory()->empty_fixed_array()); | 675 jsgraph()->HeapConstant(isolate()->factory()->empty_fixed_array()); |
674 etrue1 = etrue0; | 676 etrue1 = etrue0; |
675 } | 677 } |
676 | 678 |
677 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); | 679 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); |
678 Node* cache_array_false1; | 680 Node* cache_array_false1; |
679 Node* efalse1; | 681 Node* efalse1; |
680 { | 682 { |
681 // Load the enumeration cache from the instance descriptors of {object}. | 683 // Load the enumeration cache from the instance descriptors of {object}. |
682 Node* object_map_descriptors = efalse1 = graph()->NewNode( | 684 Node* object_map_descriptors = efalse1 = graph()->NewNode( |
683 machine()->Load(kMachAnyTagged), object_map, | 685 machine()->Load(MachineType::AnyTagged()), object_map, |
684 jsgraph()->IntPtrConstant(Map::kDescriptorsOffset - kHeapObjectTag), | 686 jsgraph()->IntPtrConstant(Map::kDescriptorsOffset - kHeapObjectTag), |
685 etrue0, if_false1); | 687 etrue0, if_false1); |
686 Node* object_map_enum_cache = efalse1 = graph()->NewNode( | 688 Node* object_map_enum_cache = efalse1 = graph()->NewNode( |
687 machine()->Load(kMachAnyTagged), object_map_descriptors, | 689 machine()->Load(MachineType::AnyTagged()), object_map_descriptors, |
688 jsgraph()->IntPtrConstant(DescriptorArray::kEnumCacheOffset - | 690 jsgraph()->IntPtrConstant(DescriptorArray::kEnumCacheOffset - |
689 kHeapObjectTag), | 691 kHeapObjectTag), |
690 efalse1, if_false1); | 692 efalse1, if_false1); |
691 cache_array_false1 = efalse1 = graph()->NewNode( | 693 cache_array_false1 = efalse1 = graph()->NewNode( |
692 machine()->Load(kMachAnyTagged), object_map_enum_cache, | 694 machine()->Load(MachineType::AnyTagged()), object_map_enum_cache, |
693 jsgraph()->IntPtrConstant( | 695 jsgraph()->IntPtrConstant( |
694 DescriptorArray::kEnumCacheBridgeCacheOffset - kHeapObjectTag), | 696 DescriptorArray::kEnumCacheBridgeCacheOffset - kHeapObjectTag), |
695 efalse1, if_false1); | 697 efalse1, if_false1); |
696 } | 698 } |
697 | 699 |
698 if_true0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 700 if_true0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
699 etrue0 = | 701 etrue0 = |
700 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0); | 702 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_true0); |
701 cache_array_true0 = | 703 cache_array_true0 = |
702 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true1, | 704 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
703 cache_array_false1, if_true0); | 705 cache_array_true1, cache_array_false1, if_true0); |
704 | 706 |
705 cache_length_true0 = graph()->NewNode( | 707 cache_length_true0 = graph()->NewNode( |
706 machine()->WordShl(), | 708 machine()->WordShl(), |
707 machine()->Is64() | 709 machine()->Is64() |
708 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), | 710 ? graph()->NewNode(machine()->ChangeUint32ToUint64(), |
709 cache_type_enum_length) | 711 cache_type_enum_length) |
710 : cache_type_enum_length, | 712 : cache_type_enum_length, |
711 jsgraph()->Int32Constant(kSmiShiftSize + kSmiTagSize)); | 713 jsgraph()->Int32Constant(kSmiShiftSize + kSmiTagSize)); |
712 cache_type_true0 = cache_type; | 714 cache_type_true0 = cache_type; |
713 } | 715 } |
714 | 716 |
715 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); | 717 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); |
716 Node* cache_array_false0; | 718 Node* cache_array_false0; |
717 Node* cache_length_false0; | 719 Node* cache_length_false0; |
718 Node* cache_type_false0; | 720 Node* cache_type_false0; |
719 Node* efalse0; | 721 Node* efalse0; |
720 { | 722 { |
721 // FixedArray case. | 723 // FixedArray case. |
722 Node* object_instance_type = efalse0 = graph()->NewNode( | 724 Node* object_instance_type = efalse0 = graph()->NewNode( |
723 machine()->Load(kMachUint8), object_map, | 725 machine()->Load(MachineType::Uint8()), object_map, |
724 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag), | 726 jsgraph()->IntPtrConstant(Map::kInstanceTypeOffset - kHeapObjectTag), |
725 effect, if_false0); | 727 effect, if_false0); |
726 | 728 |
727 Node* check1 = | 729 Node* check1 = |
728 graph()->NewNode(machine()->Word32Equal(), object_instance_type, | 730 graph()->NewNode(machine()->Word32Equal(), object_instance_type, |
729 jsgraph()->Uint32Constant(JS_PROXY_TYPE)); | 731 jsgraph()->Uint32Constant(JS_PROXY_TYPE)); |
730 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), | 732 Node* branch1 = graph()->NewNode(common()->Branch(BranchHint::kFalse), |
731 check1, if_false0); | 733 check1, if_false0); |
732 | 734 |
733 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); | 735 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); |
734 Node* cache_type_true1 = jsgraph()->ZeroConstant(); // Zero indicates proxy | 736 Node* cache_type_true1 = jsgraph()->ZeroConstant(); // Zero indicates proxy |
735 | 737 |
736 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); | 738 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); |
737 Node* cache_type_false1 = jsgraph()->OneConstant(); // One means slow check | 739 Node* cache_type_false1 = jsgraph()->OneConstant(); // One means slow check |
738 | 740 |
739 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 741 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
740 cache_type_false0 = | 742 cache_type_false0 = |
741 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_type_true1, | 743 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
742 cache_type_false1, if_false0); | 744 cache_type_true1, cache_type_false1, if_false0); |
743 | 745 |
744 cache_array_false0 = cache_type; | 746 cache_array_false0 = cache_type; |
745 cache_length_false0 = efalse0 = graph()->NewNode( | 747 cache_length_false0 = efalse0 = graph()->NewNode( |
746 machine()->Load(kMachAnyTagged), cache_array_false0, | 748 machine()->Load(MachineType::AnyTagged()), cache_array_false0, |
747 jsgraph()->IntPtrConstant(FixedArray::kLengthOffset - kHeapObjectTag), | 749 jsgraph()->IntPtrConstant(FixedArray::kLengthOffset - kHeapObjectTag), |
748 efalse0, if_false0); | 750 efalse0, if_false0); |
749 } | 751 } |
750 | 752 |
751 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 753 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
752 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 754 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
753 Node* cache_array = | 755 Node* cache_array = |
754 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_array_true0, | 756 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
755 cache_array_false0, control); | 757 cache_array_true0, cache_array_false0, control); |
756 Node* cache_length = | 758 Node* cache_length = |
757 graph()->NewNode(common()->Phi(kMachAnyTagged, 2), cache_length_true0, | 759 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
758 cache_length_false0, control); | 760 cache_length_true0, cache_length_false0, control); |
759 cache_type = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), | 761 cache_type = |
760 cache_type_true0, cache_type_false0, control); | 762 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2), |
| 763 cache_type_true0, cache_type_false0, control); |
761 | 764 |
762 for (auto edge : node->use_edges()) { | 765 for (auto edge : node->use_edges()) { |
763 if (NodeProperties::IsEffectEdge(edge)) { | 766 if (NodeProperties::IsEffectEdge(edge)) { |
764 edge.UpdateTo(effect); | 767 edge.UpdateTo(effect); |
765 } else if (NodeProperties::IsControlEdge(edge)) { | 768 } else if (NodeProperties::IsControlEdge(edge)) { |
766 Node* const use = edge.from(); | 769 Node* const use = edge.from(); |
767 if (use->opcode() == IrOpcode::kIfSuccess) { | 770 if (use->opcode() == IrOpcode::kIfSuccess) { |
768 use->ReplaceUses(control); | 771 use->ReplaceUses(control); |
769 use->Kill(); | 772 use->Kill(); |
770 } else if (use->opcode() == IrOpcode::kIfException) { | 773 } else if (use->opcode() == IrOpcode::kIfException) { |
(...skipping 29 matching lines...) Expand all Loading... |
800 ReplaceWithRuntimeCall(node, Runtime::kForInStep); | 803 ReplaceWithRuntimeCall(node, Runtime::kForInStep); |
801 } | 804 } |
802 | 805 |
803 | 806 |
804 void JSGenericLowering::LowerJSLoadMessage(Node* node) { | 807 void JSGenericLowering::LowerJSLoadMessage(Node* node) { |
805 ExternalReference message_address = | 808 ExternalReference message_address = |
806 ExternalReference::address_of_pending_message_obj(isolate()); | 809 ExternalReference::address_of_pending_message_obj(isolate()); |
807 node->RemoveInput(NodeProperties::FirstContextIndex(node)); | 810 node->RemoveInput(NodeProperties::FirstContextIndex(node)); |
808 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); | 811 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); |
809 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); | 812 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); |
810 NodeProperties::ChangeOp(node, machine()->Load(kMachAnyTagged)); | 813 NodeProperties::ChangeOp(node, machine()->Load(MachineType::AnyTagged())); |
811 } | 814 } |
812 | 815 |
813 | 816 |
814 void JSGenericLowering::LowerJSStoreMessage(Node* node) { | 817 void JSGenericLowering::LowerJSStoreMessage(Node* node) { |
815 ExternalReference message_address = | 818 ExternalReference message_address = |
816 ExternalReference::address_of_pending_message_obj(isolate()); | 819 ExternalReference::address_of_pending_message_obj(isolate()); |
817 node->RemoveInput(NodeProperties::FirstContextIndex(node)); | 820 node->RemoveInput(NodeProperties::FirstContextIndex(node)); |
818 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); | 821 node->InsertInput(zone(), 0, jsgraph()->ExternalConstant(message_address)); |
819 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); | 822 node->InsertInput(zone(), 1, jsgraph()->IntPtrConstant(0)); |
820 StoreRepresentation representation(kMachAnyTagged, kNoWriteBarrier); | 823 StoreRepresentation representation(MachineType::AnyTagged(), kNoWriteBarrier); |
821 NodeProperties::ChangeOp(node, machine()->Store(representation)); | 824 NodeProperties::ChangeOp(node, machine()->Store(representation)); |
822 } | 825 } |
823 | 826 |
824 | 827 |
825 void JSGenericLowering::LowerJSYield(Node* node) { UNIMPLEMENTED(); } | 828 void JSGenericLowering::LowerJSYield(Node* node) { UNIMPLEMENTED(); } |
826 | 829 |
827 | 830 |
828 void JSGenericLowering::LowerJSStackCheck(Node* node) { | 831 void JSGenericLowering::LowerJSStackCheck(Node* node) { |
829 Node* effect = NodeProperties::GetEffectInput(node); | 832 Node* effect = NodeProperties::GetEffectInput(node); |
830 Node* control = NodeProperties::GetControlInput(node); | 833 Node* control = NodeProperties::GetControlInput(node); |
831 | 834 |
832 Node* limit = graph()->NewNode( | 835 Node* limit = graph()->NewNode( |
833 machine()->Load(kMachPtr), | 836 machine()->Load(MachineType::Pointer()), |
834 jsgraph()->ExternalConstant( | 837 jsgraph()->ExternalConstant( |
835 ExternalReference::address_of_stack_limit(isolate())), | 838 ExternalReference::address_of_stack_limit(isolate())), |
836 jsgraph()->IntPtrConstant(0), effect, control); | 839 jsgraph()->IntPtrConstant(0), effect, control); |
837 Node* pointer = graph()->NewNode(machine()->LoadStackPointer()); | 840 Node* pointer = graph()->NewNode(machine()->LoadStackPointer()); |
838 | 841 |
839 Node* check = graph()->NewNode(machine()->UintLessThan(), limit, pointer); | 842 Node* check = graph()->NewNode(machine()->UintLessThan(), limit, pointer); |
840 Node* branch = | 843 Node* branch = |
841 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); | 844 graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control); |
842 | 845 |
843 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 846 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 } | 885 } |
883 | 886 |
884 | 887 |
885 MachineOperatorBuilder* JSGenericLowering::machine() const { | 888 MachineOperatorBuilder* JSGenericLowering::machine() const { |
886 return jsgraph()->machine(); | 889 return jsgraph()->machine(); |
887 } | 890 } |
888 | 891 |
889 } // namespace compiler | 892 } // namespace compiler |
890 } // namespace internal | 893 } // namespace internal |
891 } // namespace v8 | 894 } // namespace v8 |
OLD | NEW |