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/base/bits.h" | 5 #include "src/base/bits.h" |
6 #include "src/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 inputs[input_count++] = g.Label(cont->false_block()); | 265 inputs[input_count++] = g.Label(cont->false_block()); |
266 } | 266 } |
267 | 267 |
268 outputs[output_count++] = g.DefineAsRegister(node); | 268 outputs[output_count++] = g.DefineAsRegister(node); |
269 if (cont->IsSet()) { | 269 if (cont->IsSet()) { |
270 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 270 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
271 } | 271 } |
272 | 272 |
273 DCHECK_NE(0, input_count); | 273 DCHECK_NE(0, input_count); |
274 DCHECK_NE(0, output_count); | 274 DCHECK_NE(0, output_count); |
275 DCHECK_GE(ARRAY_SIZE(inputs), input_count); | 275 DCHECK_GE(arraysize(inputs), input_count); |
276 DCHECK_GE(ARRAY_SIZE(outputs), output_count); | 276 DCHECK_GE(arraysize(outputs), output_count); |
277 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 277 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
278 | 278 |
279 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 279 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
280 outputs, input_count, inputs); | 280 outputs, input_count, inputs); |
281 if (cont->IsBranch()) instr->MarkAsControl(); | 281 if (cont->IsBranch()) instr->MarkAsControl(); |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 static void VisitBinop(InstructionSelector* selector, Node* node, | 285 static void VisitBinop(InstructionSelector* selector, Node* node, |
286 InstructionCode opcode, InstructionCode reverse_opcode) { | 286 InstructionCode opcode, InstructionCode reverse_opcode) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); | 339 StoreRepresentation store_rep = OpParameter<StoreRepresentation>(node); |
340 MachineType rep = RepresentationOf(store_rep.machine_type); | 340 MachineType rep = RepresentationOf(store_rep.machine_type); |
341 if (store_rep.write_barrier_kind == kFullWriteBarrier) { | 341 if (store_rep.write_barrier_kind == kFullWriteBarrier) { |
342 DCHECK(rep == kRepTagged); | 342 DCHECK(rep == kRepTagged); |
343 // TODO(dcarney): refactor RecordWrite function to take temp registers | 343 // TODO(dcarney): refactor RecordWrite function to take temp registers |
344 // and pass them here instead of using fixed regs | 344 // and pass them here instead of using fixed regs |
345 // TODO(dcarney): handle immediate indices. | 345 // TODO(dcarney): handle immediate indices. |
346 InstructionOperand* temps[] = {g.TempRegister(r5), g.TempRegister(r6)}; | 346 InstructionOperand* temps[] = {g.TempRegister(r5), g.TempRegister(r6)}; |
347 Emit(kArmStoreWriteBarrier, NULL, g.UseFixed(base, r4), | 347 Emit(kArmStoreWriteBarrier, NULL, g.UseFixed(base, r4), |
348 g.UseFixed(index, r5), g.UseFixed(value, r6), ARRAY_SIZE(temps), | 348 g.UseFixed(index, r5), g.UseFixed(value, r6), arraysize(temps), |
349 temps); | 349 temps); |
350 return; | 350 return; |
351 } | 351 } |
352 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); | 352 DCHECK_EQ(kNoWriteBarrier, store_rep.write_barrier_kind); |
353 | 353 |
354 ArchOpcode opcode; | 354 ArchOpcode opcode; |
355 switch (rep) { | 355 switch (rep) { |
356 case kRepFloat32: | 356 case kRepFloat32: |
357 opcode = kArmVstr32; | 357 opcode = kArmVstr32; |
358 break; | 358 break; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 inputs[input_count++] = g.Label(cont->false_block()); | 495 inputs[input_count++] = g.Label(cont->false_block()); |
496 } | 496 } |
497 | 497 |
498 outputs[output_count++] = g.DefineAsRegister(node); | 498 outputs[output_count++] = g.DefineAsRegister(node); |
499 if (cont->IsSet()) { | 499 if (cont->IsSet()) { |
500 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 500 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
501 } | 501 } |
502 | 502 |
503 DCHECK_NE(0, input_count); | 503 DCHECK_NE(0, input_count); |
504 DCHECK_NE(0, output_count); | 504 DCHECK_NE(0, output_count); |
505 DCHECK_GE(ARRAY_SIZE(inputs), input_count); | 505 DCHECK_GE(arraysize(inputs), input_count); |
506 DCHECK_GE(ARRAY_SIZE(outputs), output_count); | 506 DCHECK_GE(arraysize(outputs), output_count); |
507 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); | 507 DCHECK_NE(kMode_None, AddressingModeField::decode(opcode)); |
508 | 508 |
509 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 509 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
510 outputs, input_count, inputs); | 510 outputs, input_count, inputs); |
511 if (cont->IsBranch()) instr->MarkAsControl(); | 511 if (cont->IsBranch()) instr->MarkAsControl(); |
512 } | 512 } |
513 | 513 |
514 | 514 |
515 template <typename TryMatchShift> | 515 template <typename TryMatchShift> |
516 static inline void VisitShift(InstructionSelector* selector, Node* node, | 516 static inline void VisitShift(InstructionSelector* selector, Node* node, |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
883 | 883 |
884 if (cont->IsBranch()) { | 884 if (cont->IsBranch()) { |
885 inputs[input_count++] = g.Label(cont->true_block()); | 885 inputs[input_count++] = g.Label(cont->true_block()); |
886 inputs[input_count++] = g.Label(cont->false_block()); | 886 inputs[input_count++] = g.Label(cont->false_block()); |
887 } else { | 887 } else { |
888 DCHECK(cont->IsSet()); | 888 DCHECK(cont->IsSet()); |
889 outputs[output_count++] = g.DefineAsRegister(cont->result()); | 889 outputs[output_count++] = g.DefineAsRegister(cont->result()); |
890 } | 890 } |
891 | 891 |
892 DCHECK_NE(0, input_count); | 892 DCHECK_NE(0, input_count); |
893 DCHECK_GE(ARRAY_SIZE(inputs), input_count); | 893 DCHECK_GE(arraysize(inputs), input_count); |
894 DCHECK_GE(ARRAY_SIZE(outputs), output_count); | 894 DCHECK_GE(arraysize(outputs), output_count); |
895 | 895 |
896 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, | 896 Instruction* instr = selector->Emit(cont->Encode(opcode), output_count, |
897 outputs, input_count, inputs); | 897 outputs, input_count, inputs); |
898 if (cont->IsBranch()) instr->MarkAsControl(); | 898 if (cont->IsBranch()) instr->MarkAsControl(); |
899 } | 899 } |
900 | 900 |
901 | 901 |
902 void InstructionSelector::VisitWord32Test(Node* node, FlagsContinuation* cont) { | 902 void InstructionSelector::VisitWord32Test(Node* node, FlagsContinuation* cont) { |
903 switch (node->opcode()) { | 903 switch (node->opcode()) { |
904 case IrOpcode::kInt32Add: | 904 case IrOpcode::kInt32Add: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 } else { | 954 } else { |
955 DCHECK(cont->IsSet()); | 955 DCHECK(cont->IsSet()); |
956 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), | 956 Emit(cont->Encode(kArmVcmpF64), g.DefineAsRegister(cont->result()), |
957 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); | 957 g.UseRegister(m.left().node()), g.UseRegister(m.right().node())); |
958 } | 958 } |
959 } | 959 } |
960 | 960 |
961 } // namespace compiler | 961 } // namespace compiler |
962 } // namespace internal | 962 } // namespace internal |
963 } // namespace v8 | 963 } // namespace v8 |
OLD | NEW |