| 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/instruction-selector.h" | 5 #include "src/compiler/instruction-selector.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
| 10 #include "src/compiler/instruction-selector-impl.h" | 10 #include "src/compiler/instruction-selector-impl.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 | 235 |
| 236 void InstructionSelector::MarkAsUsed(Node* node) { | 236 void InstructionSelector::MarkAsUsed(Node* node) { |
| 237 DCHECK_NOT_NULL(node); | 237 DCHECK_NOT_NULL(node); |
| 238 size_t const id = node->id(); | 238 size_t const id = node->id(); |
| 239 DCHECK_LT(id, used_.size()); | 239 DCHECK_LT(id, used_.size()); |
| 240 used_[id] = true; | 240 used_[id] = true; |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 void InstructionSelector::MarkAsRepresentation(MachineType rep, | 244 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep, |
| 245 const InstructionOperand& op) { | 245 const InstructionOperand& op) { |
| 246 UnallocatedOperand unalloc = UnallocatedOperand::cast(op); | 246 UnallocatedOperand unalloc = UnallocatedOperand::cast(op); |
| 247 rep = RepresentationOf(rep); | |
| 248 sequence()->MarkAsRepresentation(rep, unalloc.virtual_register()); | 247 sequence()->MarkAsRepresentation(rep, unalloc.virtual_register()); |
| 249 } | 248 } |
| 250 | 249 |
| 251 | 250 |
| 252 void InstructionSelector::MarkAsRepresentation(MachineType rep, Node* node) { | 251 void InstructionSelector::MarkAsRepresentation(MachineRepresentation rep, |
| 253 rep = RepresentationOf(rep); | 252 Node* node) { |
| 254 sequence()->MarkAsRepresentation(rep, GetVirtualRegister(node)); | 253 sequence()->MarkAsRepresentation(rep, GetVirtualRegister(node)); |
| 255 } | 254 } |
| 256 | 255 |
| 257 | 256 |
| 258 namespace { | 257 namespace { |
| 259 | 258 |
| 260 enum class FrameStateInputKind { kAny, kStackSlot }; | 259 enum class FrameStateInputKind { kAny, kStackSlot }; |
| 261 | 260 |
| 262 | 261 |
| 263 InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input, | 262 InstructionOperand OperandForDeopt(OperandGenerator* g, Node* input, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 StateValuesAccess(parameters).size()); | 302 StateValuesAccess(parameters).size()); |
| 304 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size()); | 303 DCHECK_EQ(descriptor->locals_count(), StateValuesAccess(locals).size()); |
| 305 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size()); | 304 DCHECK_EQ(descriptor->stack_count(), StateValuesAccess(stack).size()); |
| 306 | 305 |
| 307 ZoneVector<MachineType> types(zone); | 306 ZoneVector<MachineType> types(zone); |
| 308 types.reserve(descriptor->GetSize()); | 307 types.reserve(descriptor->GetSize()); |
| 309 | 308 |
| 310 size_t value_index = 0; | 309 size_t value_index = 0; |
| 311 inputs->push_back( | 310 inputs->push_back( |
| 312 OperandForDeopt(g, function, FrameStateInputKind::kStackSlot)); | 311 OperandForDeopt(g, function, FrameStateInputKind::kStackSlot)); |
| 313 descriptor->SetType(value_index++, kMachAnyTagged); | 312 descriptor->SetType(value_index++, MachineType::AnyTagged()); |
| 314 for (StateValuesAccess::TypedNode input_node : | 313 for (StateValuesAccess::TypedNode input_node : |
| 315 StateValuesAccess(parameters)) { | 314 StateValuesAccess(parameters)) { |
| 316 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); | 315 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); |
| 317 descriptor->SetType(value_index++, input_node.type); | 316 descriptor->SetType(value_index++, input_node.type); |
| 318 } | 317 } |
| 319 if (descriptor->HasContext()) { | 318 if (descriptor->HasContext()) { |
| 320 inputs->push_back( | 319 inputs->push_back( |
| 321 OperandForDeopt(g, context, FrameStateInputKind::kStackSlot)); | 320 OperandForDeopt(g, context, FrameStateInputKind::kStackSlot)); |
| 322 descriptor->SetType(value_index++, kMachAnyTagged); | 321 descriptor->SetType(value_index++, MachineType::AnyTagged()); |
| 323 } | 322 } |
| 324 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { | 323 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(locals)) { |
| 325 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); | 324 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); |
| 326 descriptor->SetType(value_index++, input_node.type); | 325 descriptor->SetType(value_index++, input_node.type); |
| 327 } | 326 } |
| 328 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) { | 327 for (StateValuesAccess::TypedNode input_node : StateValuesAccess(stack)) { |
| 329 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); | 328 inputs->push_back(OperandForDeopt(g, input_node.node, kind)); |
| 330 descriptor->SetType(value_index++, input_node.type); | 329 descriptor->SetType(value_index++, input_node.type); |
| 331 } | 330 } |
| 332 DCHECK(value_index == descriptor->GetSize()); | 331 DCHECK(value_index == descriptor->GetSize()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 bool output_is_live = | 410 bool output_is_live = |
| 412 buffer->output_nodes[i] != NULL || i < outputs_needed_by_framestate; | 411 buffer->output_nodes[i] != NULL || i < outputs_needed_by_framestate; |
| 413 if (output_is_live) { | 412 if (output_is_live) { |
| 414 MachineType type = | 413 MachineType type = |
| 415 buffer->descriptor->GetReturnType(static_cast<int>(i)); | 414 buffer->descriptor->GetReturnType(static_cast<int>(i)); |
| 416 LinkageLocation location = | 415 LinkageLocation location = |
| 417 buffer->descriptor->GetReturnLocation(static_cast<int>(i)); | 416 buffer->descriptor->GetReturnLocation(static_cast<int>(i)); |
| 418 | 417 |
| 419 Node* output = buffer->output_nodes[i]; | 418 Node* output = buffer->output_nodes[i]; |
| 420 InstructionOperand op = | 419 InstructionOperand op = |
| 421 output == NULL ? g.TempLocation(location, type) | 420 output == NULL |
| 422 : g.DefineAsLocation(output, location, type); | 421 ? g.TempLocation(location, type.representation()) |
| 423 MarkAsRepresentation(type, op); | 422 : g.DefineAsLocation(output, location, type.representation()); |
| 423 MarkAsRepresentation(type.representation(), op); |
| 424 | 424 |
| 425 buffer->outputs.push_back(op); | 425 buffer->outputs.push_back(op); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 // The first argument is always the callee code. | 430 // The first argument is always the callee code. |
| 431 Node* callee = call->InputAt(0); | 431 Node* callee = call->InputAt(0); |
| 432 bool call_code_immediate = (flags & kCallCodeImmediate) != 0; | 432 bool call_code_immediate = (flags & kCallCodeImmediate) != 0; |
| 433 bool call_address_immediate = (flags & kCallAddressImmediate) != 0; | 433 bool call_address_immediate = (flags & kCallAddressImmediate) != 0; |
| 434 switch (buffer->descriptor->kind()) { | 434 switch (buffer->descriptor->kind()) { |
| 435 case CallDescriptor::kCallCodeObject: | 435 case CallDescriptor::kCallCodeObject: |
| 436 buffer->instruction_args.push_back( | 436 buffer->instruction_args.push_back( |
| 437 (call_code_immediate && callee->opcode() == IrOpcode::kHeapConstant) | 437 (call_code_immediate && callee->opcode() == IrOpcode::kHeapConstant) |
| 438 ? g.UseImmediate(callee) | 438 ? g.UseImmediate(callee) |
| 439 : g.UseRegister(callee)); | 439 : g.UseRegister(callee)); |
| 440 break; | 440 break; |
| 441 case CallDescriptor::kCallAddress: | 441 case CallDescriptor::kCallAddress: |
| 442 buffer->instruction_args.push_back( | 442 buffer->instruction_args.push_back( |
| 443 (call_address_immediate && | 443 (call_address_immediate && |
| 444 callee->opcode() == IrOpcode::kExternalConstant) | 444 callee->opcode() == IrOpcode::kExternalConstant) |
| 445 ? g.UseImmediate(callee) | 445 ? g.UseImmediate(callee) |
| 446 : g.UseRegister(callee)); | 446 : g.UseRegister(callee)); |
| 447 break; | 447 break; |
| 448 case CallDescriptor::kCallJSFunction: | 448 case CallDescriptor::kCallJSFunction: |
| 449 buffer->instruction_args.push_back( | 449 buffer->instruction_args.push_back( |
| 450 g.UseLocation(callee, buffer->descriptor->GetInputLocation(0), | 450 g.UseLocation(callee, buffer->descriptor->GetInputLocation(0), |
| 451 buffer->descriptor->GetInputType(0))); | 451 buffer->descriptor->GetInputType(0).representation())); |
| 452 break; | 452 break; |
| 453 case CallDescriptor::kLazyBailout: | 453 case CallDescriptor::kLazyBailout: |
| 454 // The target is ignored, but we still need to pass a value here. | 454 // The target is ignored, but we still need to pass a value here. |
| 455 buffer->instruction_args.push_back(g.UseImmediate(callee)); | 455 buffer->instruction_args.push_back(g.UseImmediate(callee)); |
| 456 break; | 456 break; |
| 457 } | 457 } |
| 458 DCHECK_EQ(1u, buffer->instruction_args.size()); | 458 DCHECK_EQ(1u, buffer->instruction_args.size()); |
| 459 | 459 |
| 460 // If the call needs a frame state, we insert the state information as | 460 // If the call needs a frame state, we insert the state information as |
| 461 // follows (n is the number of value inputs to the frame state): | 461 // follows (n is the number of value inputs to the frame state): |
| (...skipping 26 matching lines...) Expand all Loading... |
| 488 DCHECK(iter != call->inputs().end()); | 488 DCHECK(iter != call->inputs().end()); |
| 489 DCHECK((*iter)->op()->opcode() != IrOpcode::kFrameState); | 489 DCHECK((*iter)->op()->opcode() != IrOpcode::kFrameState); |
| 490 if (index == 0) continue; // The first argument (callee) is already done. | 490 if (index == 0) continue; // The first argument (callee) is already done. |
| 491 | 491 |
| 492 LinkageLocation location = buffer->descriptor->GetInputLocation(index); | 492 LinkageLocation location = buffer->descriptor->GetInputLocation(index); |
| 493 if (call_tail) { | 493 if (call_tail) { |
| 494 location = LinkageLocation::ConvertToTailCallerLocation( | 494 location = LinkageLocation::ConvertToTailCallerLocation( |
| 495 location, stack_param_delta); | 495 location, stack_param_delta); |
| 496 } | 496 } |
| 497 InstructionOperand op = | 497 InstructionOperand op = |
| 498 g.UseLocation(*iter, location, buffer->descriptor->GetInputType(index)); | 498 g.UseLocation(*iter, location, |
| 499 buffer->descriptor->GetInputType(index).representation()); |
| 499 if (UnallocatedOperand::cast(op).HasFixedSlotPolicy() && !call_tail) { | 500 if (UnallocatedOperand::cast(op).HasFixedSlotPolicy() && !call_tail) { |
| 500 int stack_index = -UnallocatedOperand::cast(op).fixed_slot_index() - 1; | 501 int stack_index = -UnallocatedOperand::cast(op).fixed_slot_index() - 1; |
| 501 if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) { | 502 if (static_cast<size_t>(stack_index) >= buffer->pushed_nodes.size()) { |
| 502 buffer->pushed_nodes.resize(stack_index + 1, NULL); | 503 buffer->pushed_nodes.resize(stack_index + 1, NULL); |
| 503 } | 504 } |
| 504 DCHECK(!buffer->pushed_nodes[stack_index]); | 505 DCHECK(!buffer->pushed_nodes[stack_index]); |
| 505 buffer->pushed_nodes[stack_index] = *iter; | 506 buffer->pushed_nodes[stack_index] = *iter; |
| 506 pushed_count++; | 507 pushed_count++; |
| 507 } else { | 508 } else { |
| 508 buffer->instruction_args.push_back(op); | 509 buffer->instruction_args.push_back(op); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 return; | 675 return; |
| 675 case IrOpcode::kIfException: | 676 case IrOpcode::kIfException: |
| 676 return MarkAsReference(node), VisitIfException(node); | 677 return MarkAsReference(node), VisitIfException(node); |
| 677 case IrOpcode::kFinishRegion: | 678 case IrOpcode::kFinishRegion: |
| 678 return MarkAsReference(node), VisitFinishRegion(node); | 679 return MarkAsReference(node), VisitFinishRegion(node); |
| 679 case IrOpcode::kGuard: | 680 case IrOpcode::kGuard: |
| 680 return MarkAsReference(node), VisitGuard(node); | 681 return MarkAsReference(node), VisitGuard(node); |
| 681 case IrOpcode::kParameter: { | 682 case IrOpcode::kParameter: { |
| 682 MachineType type = | 683 MachineType type = |
| 683 linkage()->GetParameterType(ParameterIndexOf(node->op())); | 684 linkage()->GetParameterType(ParameterIndexOf(node->op())); |
| 684 MarkAsRepresentation(type, node); | 685 MarkAsRepresentation(type.representation(), node); |
| 685 return VisitParameter(node); | 686 return VisitParameter(node); |
| 686 } | 687 } |
| 687 case IrOpcode::kOsrValue: | 688 case IrOpcode::kOsrValue: |
| 688 return MarkAsReference(node), VisitOsrValue(node); | 689 return MarkAsReference(node), VisitOsrValue(node); |
| 689 case IrOpcode::kPhi: { | 690 case IrOpcode::kPhi: { |
| 690 MachineType type = OpParameter<MachineType>(node); | 691 MachineRepresentation rep = PhiRepresentationOf(node->op()); |
| 691 MarkAsRepresentation(type, node); | 692 MarkAsRepresentation(rep, node); |
| 692 return VisitPhi(node); | 693 return VisitPhi(node); |
| 693 } | 694 } |
| 694 case IrOpcode::kProjection: | 695 case IrOpcode::kProjection: |
| 695 return VisitProjection(node); | 696 return VisitProjection(node); |
| 696 case IrOpcode::kInt32Constant: | 697 case IrOpcode::kInt32Constant: |
| 697 case IrOpcode::kInt64Constant: | 698 case IrOpcode::kInt64Constant: |
| 698 case IrOpcode::kExternalConstant: | 699 case IrOpcode::kExternalConstant: |
| 699 return VisitConstant(node); | 700 return VisitConstant(node); |
| 700 case IrOpcode::kFloat32Constant: | 701 case IrOpcode::kFloat32Constant: |
| 701 return MarkAsFloat32(node), VisitConstant(node); | 702 return MarkAsFloat32(node), VisitConstant(node); |
| 702 case IrOpcode::kFloat64Constant: | 703 case IrOpcode::kFloat64Constant: |
| 703 return MarkAsFloat64(node), VisitConstant(node); | 704 return MarkAsFloat64(node), VisitConstant(node); |
| 704 case IrOpcode::kHeapConstant: | 705 case IrOpcode::kHeapConstant: |
| 705 return MarkAsReference(node), VisitConstant(node); | 706 return MarkAsReference(node), VisitConstant(node); |
| 706 case IrOpcode::kNumberConstant: { | 707 case IrOpcode::kNumberConstant: { |
| 707 double value = OpParameter<double>(node); | 708 double value = OpParameter<double>(node); |
| 708 if (!IsSmiDouble(value)) MarkAsReference(node); | 709 if (!IsSmiDouble(value)) MarkAsReference(node); |
| 709 return VisitConstant(node); | 710 return VisitConstant(node); |
| 710 } | 711 } |
| 711 case IrOpcode::kCall: | 712 case IrOpcode::kCall: |
| 712 return VisitCall(node); | 713 return VisitCall(node); |
| 713 case IrOpcode::kFrameState: | 714 case IrOpcode::kFrameState: |
| 714 case IrOpcode::kStateValues: | 715 case IrOpcode::kStateValues: |
| 715 return; | 716 return; |
| 716 case IrOpcode::kLoad: { | 717 case IrOpcode::kLoad: { |
| 717 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); | 718 LoadRepresentation type = LoadRepresentationOf(node->op()); |
| 718 MarkAsRepresentation(rep, node); | 719 MarkAsRepresentation(type.representation(), node); |
| 719 return VisitLoad(node); | 720 return VisitLoad(node); |
| 720 } | 721 } |
| 721 case IrOpcode::kStore: | 722 case IrOpcode::kStore: |
| 722 return VisitStore(node); | 723 return VisitStore(node); |
| 723 case IrOpcode::kWord32And: | 724 case IrOpcode::kWord32And: |
| 724 return MarkAsWord32(node), VisitWord32And(node); | 725 return MarkAsWord32(node), VisitWord32And(node); |
| 725 case IrOpcode::kWord32Or: | 726 case IrOpcode::kWord32Or: |
| 726 return MarkAsWord32(node), VisitWord32Or(node); | 727 return MarkAsWord32(node), VisitWord32Or(node); |
| 727 case IrOpcode::kWord32Xor: | 728 case IrOpcode::kWord32Xor: |
| 728 return MarkAsWord32(node), VisitWord32Xor(node); | 729 return MarkAsWord32(node), VisitWord32Xor(node); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 return MarkAsWord32(node), VisitFloat64ExtractHighWord32(node); | 931 return MarkAsWord32(node), VisitFloat64ExtractHighWord32(node); |
| 931 case IrOpcode::kFloat64InsertLowWord32: | 932 case IrOpcode::kFloat64InsertLowWord32: |
| 932 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node); | 933 return MarkAsFloat64(node), VisitFloat64InsertLowWord32(node); |
| 933 case IrOpcode::kFloat64InsertHighWord32: | 934 case IrOpcode::kFloat64InsertHighWord32: |
| 934 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node); | 935 return MarkAsFloat64(node), VisitFloat64InsertHighWord32(node); |
| 935 case IrOpcode::kLoadStackPointer: | 936 case IrOpcode::kLoadStackPointer: |
| 936 return VisitLoadStackPointer(node); | 937 return VisitLoadStackPointer(node); |
| 937 case IrOpcode::kLoadFramePointer: | 938 case IrOpcode::kLoadFramePointer: |
| 938 return VisitLoadFramePointer(node); | 939 return VisitLoadFramePointer(node); |
| 939 case IrOpcode::kCheckedLoad: { | 940 case IrOpcode::kCheckedLoad: { |
| 940 MachineType rep = OpParameter<MachineType>(node); | 941 MachineRepresentation rep = |
| 942 CheckedLoadRepresentationOf(node->op()).representation(); |
| 941 MarkAsRepresentation(rep, node); | 943 MarkAsRepresentation(rep, node); |
| 942 return VisitCheckedLoad(node); | 944 return VisitCheckedLoad(node); |
| 943 } | 945 } |
| 944 case IrOpcode::kCheckedStore: | 946 case IrOpcode::kCheckedStore: |
| 945 return VisitCheckedStore(node); | 947 return VisitCheckedStore(node); |
| 946 default: | 948 default: |
| 947 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", | 949 V8_Fatal(__FILE__, __LINE__, "Unexpected operator #%d:%s @ node #%d", |
| 948 node->opcode(), node->op()->mnemonic(), node->id()); | 950 node->opcode(), node->op()->mnemonic(), node->id()); |
| 949 break; | 951 break; |
| 950 } | 952 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1156 |
| 1155 | 1157 |
| 1156 void InstructionSelector::VisitParameter(Node* node) { | 1158 void InstructionSelector::VisitParameter(Node* node) { |
| 1157 OperandGenerator g(this); | 1159 OperandGenerator g(this); |
| 1158 int index = ParameterIndexOf(node->op()); | 1160 int index = ParameterIndexOf(node->op()); |
| 1159 InstructionOperand op = | 1161 InstructionOperand op = |
| 1160 linkage()->ParameterHasSecondaryLocation(index) | 1162 linkage()->ParameterHasSecondaryLocation(index) |
| 1161 ? g.DefineAsDualLocation( | 1163 ? g.DefineAsDualLocation( |
| 1162 node, linkage()->GetParameterLocation(index), | 1164 node, linkage()->GetParameterLocation(index), |
| 1163 linkage()->GetParameterSecondaryLocation(index)) | 1165 linkage()->GetParameterSecondaryLocation(index)) |
| 1164 : g.DefineAsLocation(node, linkage()->GetParameterLocation(index), | 1166 : g.DefineAsLocation( |
| 1165 linkage()->GetParameterType(index)); | 1167 node, linkage()->GetParameterLocation(index), |
| 1168 linkage()->GetParameterType(index).representation()); |
| 1166 | 1169 |
| 1167 Emit(kArchNop, op); | 1170 Emit(kArchNop, op); |
| 1168 } | 1171 } |
| 1169 | 1172 |
| 1170 | 1173 |
| 1171 void InstructionSelector::VisitIfException(Node* node) { | 1174 void InstructionSelector::VisitIfException(Node* node) { |
| 1172 OperandGenerator g(this); | 1175 OperandGenerator g(this); |
| 1173 Node* call = node->InputAt(1); | 1176 Node* call = node->InputAt(1); |
| 1174 DCHECK_EQ(IrOpcode::kCall, call->opcode()); | 1177 DCHECK_EQ(IrOpcode::kCall, call->opcode()); |
| 1175 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(call); | 1178 const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(call); |
| 1176 Emit(kArchNop, g.DefineAsLocation(node, descriptor->GetReturnLocation(0), | 1179 Emit(kArchNop, |
| 1177 descriptor->GetReturnType(0))); | 1180 g.DefineAsLocation(node, descriptor->GetReturnLocation(0), |
| 1181 descriptor->GetReturnType(0).representation())); |
| 1178 } | 1182 } |
| 1179 | 1183 |
| 1180 | 1184 |
| 1181 void InstructionSelector::VisitOsrValue(Node* node) { | 1185 void InstructionSelector::VisitOsrValue(Node* node) { |
| 1182 OperandGenerator g(this); | 1186 OperandGenerator g(this); |
| 1183 int index = OpParameter<int>(node); | 1187 int index = OpParameter<int>(node); |
| 1184 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index), | 1188 Emit(kArchNop, g.DefineAsLocation(node, linkage()->GetOsrValueLocation(index), |
| 1185 kMachAnyTagged)); | 1189 MachineRepresentation::kTagged)); |
| 1186 } | 1190 } |
| 1187 | 1191 |
| 1188 | 1192 |
| 1189 void InstructionSelector::VisitPhi(Node* node) { | 1193 void InstructionSelector::VisitPhi(Node* node) { |
| 1190 const int input_count = node->op()->ValueInputCount(); | 1194 const int input_count = node->op()->ValueInputCount(); |
| 1191 PhiInstruction* phi = new (instruction_zone()) | 1195 PhiInstruction* phi = new (instruction_zone()) |
| 1192 PhiInstruction(instruction_zone(), GetVirtualRegister(node), | 1196 PhiInstruction(instruction_zone(), GetVirtualRegister(node), |
| 1193 static_cast<size_t>(input_count)); | 1197 static_cast<size_t>(input_count)); |
| 1194 sequence() | 1198 sequence() |
| 1195 ->InstructionBlockAt(RpoNumber::FromInt(current_block_->rpo_number())) | 1199 ->InstructionBlockAt(RpoNumber::FromInt(current_block_->rpo_number())) |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1392 void InstructionSelector::VisitReturn(Node* ret) { | 1396 void InstructionSelector::VisitReturn(Node* ret) { |
| 1393 OperandGenerator g(this); | 1397 OperandGenerator g(this); |
| 1394 if (linkage()->GetIncomingDescriptor()->ReturnCount() == 0) { | 1398 if (linkage()->GetIncomingDescriptor()->ReturnCount() == 0) { |
| 1395 Emit(kArchRet, g.NoOutput()); | 1399 Emit(kArchRet, g.NoOutput()); |
| 1396 } else { | 1400 } else { |
| 1397 const int ret_count = ret->op()->ValueInputCount(); | 1401 const int ret_count = ret->op()->ValueInputCount(); |
| 1398 auto value_locations = zone()->NewArray<InstructionOperand>(ret_count); | 1402 auto value_locations = zone()->NewArray<InstructionOperand>(ret_count); |
| 1399 for (int i = 0; i < ret_count; ++i) { | 1403 for (int i = 0; i < ret_count; ++i) { |
| 1400 value_locations[i] = | 1404 value_locations[i] = |
| 1401 g.UseLocation(ret->InputAt(i), linkage()->GetReturnLocation(i), | 1405 g.UseLocation(ret->InputAt(i), linkage()->GetReturnLocation(i), |
| 1402 linkage()->GetReturnType(i)); | 1406 linkage()->GetReturnType(i).representation()); |
| 1403 } | 1407 } |
| 1404 Emit(kArchRet, 0, nullptr, ret_count, value_locations); | 1408 Emit(kArchRet, 0, nullptr, ret_count, value_locations); |
| 1405 } | 1409 } |
| 1406 } | 1410 } |
| 1407 | 1411 |
| 1408 | 1412 |
| 1409 void InstructionSelector::VisitDeoptimize(DeoptimizeKind kind, Node* value) { | 1413 void InstructionSelector::VisitDeoptimize(DeoptimizeKind kind, Node* value) { |
| 1410 OperandGenerator g(this); | 1414 OperandGenerator g(this); |
| 1411 | 1415 |
| 1412 FrameStateDescriptor* desc = GetFrameStateDescriptor(value); | 1416 FrameStateDescriptor* desc = GetFrameStateDescriptor(value); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1468 return new (instruction_zone()) FrameStateDescriptor( | 1472 return new (instruction_zone()) FrameStateDescriptor( |
| 1469 instruction_zone(), state_info.type(), state_info.bailout_id(), | 1473 instruction_zone(), state_info.type(), state_info.bailout_id(), |
| 1470 state_info.state_combine(), parameters, locals, stack, | 1474 state_info.state_combine(), parameters, locals, stack, |
| 1471 state_info.shared_info(), outer_state); | 1475 state_info.shared_info(), outer_state); |
| 1472 } | 1476 } |
| 1473 | 1477 |
| 1474 | 1478 |
| 1475 } // namespace compiler | 1479 } // namespace compiler |
| 1476 } // namespace internal | 1480 } // namespace internal |
| 1477 } // namespace v8 | 1481 } // namespace v8 |
| OLD | NEW |