OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "lithium-allocator-inl.h" | 7 #include "lithium-allocator-inl.h" |
8 #include "arm64/lithium-arm64.h" | 8 #include "arm64/lithium-arm64.h" |
9 #include "arm64/lithium-codegen-arm64.h" | 9 #include "arm64/lithium-codegen-arm64.h" |
10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 int vreg = allocator_->GetVirtualRegister(); | 513 int vreg = allocator_->GetVirtualRegister(); |
514 if (!allocator_->AllocationOk()) { | 514 if (!allocator_->AllocationOk()) { |
515 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); | 515 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
516 vreg = 0; | 516 vreg = 0; |
517 } | 517 } |
518 operand->set_virtual_register(vreg); | 518 operand->set_virtual_register(vreg); |
519 return operand; | 519 return operand; |
520 } | 520 } |
521 | 521 |
522 | 522 |
| 523 LUnallocated* LChunkBuilder::TempDoubleRegister() { |
| 524 LUnallocated* operand = |
| 525 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_DOUBLE_REGISTER); |
| 526 int vreg = allocator_->GetVirtualRegister(); |
| 527 if (!allocator_->AllocationOk()) { |
| 528 Abort(kOutOfVirtualRegistersWhileTryingToAllocateTempRegister); |
| 529 vreg = 0; |
| 530 } |
| 531 operand->set_virtual_register(vreg); |
| 532 return operand; |
| 533 } |
| 534 |
| 535 |
523 int LPlatformChunk::GetNextSpillIndex() { | 536 int LPlatformChunk::GetNextSpillIndex() { |
524 return spill_slot_count_++; | 537 return spill_slot_count_++; |
525 } | 538 } |
526 | 539 |
527 | 540 |
528 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { | 541 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { |
529 int index = GetNextSpillIndex(); | 542 int index = GetNextSpillIndex(); |
530 if (kind == DOUBLE_REGISTERS) { | 543 if (kind == DOUBLE_REGISTERS) { |
531 return LDoubleStackSlot::Create(index, zone()); | 544 return LDoubleStackSlot::Create(index, zone()); |
532 } else { | 545 } else { |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 } | 1097 } |
1085 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1098 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
1086 } else { | 1099 } else { |
1087 ASSERT(to.IsInteger32()); | 1100 ASSERT(to.IsInteger32()); |
1088 if (val->type().IsSmi() || val->representation().IsSmi()) { | 1101 if (val->type().IsSmi() || val->representation().IsSmi()) { |
1089 LOperand* value = UseRegisterAtStart(val); | 1102 LOperand* value = UseRegisterAtStart(val); |
1090 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); | 1103 return DefineAsRegister(new(zone()) LSmiUntag(value, false)); |
1091 } else { | 1104 } else { |
1092 LOperand* value = UseRegister(val); | 1105 LOperand* value = UseRegister(val); |
1093 LOperand* temp1 = TempRegister(); | 1106 LOperand* temp1 = TempRegister(); |
1094 LOperand* temp2 = instr->CanTruncateToInt32() ? NULL : FixedTemp(d24); | 1107 LOperand* temp2 = instr->CanTruncateToInt32() |
| 1108 ? NULL : TempDoubleRegister(); |
1095 LInstruction* result = | 1109 LInstruction* result = |
1096 DefineAsRegister(new(zone()) LTaggedToI(value, temp1, temp2)); | 1110 DefineAsRegister(new(zone()) LTaggedToI(value, temp1, temp2)); |
1097 if (!val->representation().IsSmi()) result = AssignEnvironment(result); | 1111 if (!val->representation().IsSmi()) result = AssignEnvironment(result); |
1098 return result; | 1112 return result; |
1099 } | 1113 } |
1100 } | 1114 } |
1101 } else if (from.IsDouble()) { | 1115 } else if (from.IsDouble()) { |
1102 if (to.IsTagged()) { | 1116 if (to.IsTagged()) { |
1103 info()->MarkAsDeferredCalling(); | 1117 info()->MarkAsDeferredCalling(); |
1104 LOperand* value = UseRegister(val); | 1118 LOperand* value = UseRegister(val); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 LOperand* reg = UseRegister(value); | 1219 LOperand* reg = UseRegister(value); |
1206 if (input_rep.IsDouble()) { | 1220 if (input_rep.IsDouble()) { |
1207 return DefineAsRegister(new(zone()) LClampDToUint8(reg)); | 1221 return DefineAsRegister(new(zone()) LClampDToUint8(reg)); |
1208 } else if (input_rep.IsInteger32()) { | 1222 } else if (input_rep.IsInteger32()) { |
1209 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); | 1223 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); |
1210 } else { | 1224 } else { |
1211 ASSERT(input_rep.IsSmiOrTagged()); | 1225 ASSERT(input_rep.IsSmiOrTagged()); |
1212 return AssignEnvironment( | 1226 return AssignEnvironment( |
1213 DefineAsRegister(new(zone()) LClampTToUint8(reg, | 1227 DefineAsRegister(new(zone()) LClampTToUint8(reg, |
1214 TempRegister(), | 1228 TempRegister(), |
1215 FixedTemp(d24)))); | 1229 TempDoubleRegister()))); |
1216 } | 1230 } |
1217 } | 1231 } |
1218 | 1232 |
1219 | 1233 |
1220 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( | 1234 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( |
1221 HClassOfTestAndBranch* instr) { | 1235 HClassOfTestAndBranch* instr) { |
1222 ASSERT(instr->value()->representation().IsTagged()); | 1236 ASSERT(instr->value()->representation().IsTagged()); |
1223 LOperand* value = UseRegisterAtStart(instr->value()); | 1237 LOperand* value = UseRegisterAtStart(instr->value()); |
1224 return new(zone()) LClassOfTestAndBranch(value, | 1238 return new(zone()) LClassOfTestAndBranch(value, |
1225 TempRegister(), | 1239 TempRegister(), |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 LOperand* input = UseRegisterAtStart(instr->value()); | 2442 LOperand* input = UseRegisterAtStart(instr->value()); |
2429 LInstruction* result = DefineAsRegister(new(zone()) LMathAbs(input)); | 2443 LInstruction* result = DefineAsRegister(new(zone()) LMathAbs(input)); |
2430 if (!r.IsDouble()) result = AssignEnvironment(result); | 2444 if (!r.IsDouble()) result = AssignEnvironment(result); |
2431 return result; | 2445 return result; |
2432 } | 2446 } |
2433 } | 2447 } |
2434 case kMathExp: { | 2448 case kMathExp: { |
2435 ASSERT(instr->representation().IsDouble()); | 2449 ASSERT(instr->representation().IsDouble()); |
2436 ASSERT(instr->value()->representation().IsDouble()); | 2450 ASSERT(instr->value()->representation().IsDouble()); |
2437 LOperand* input = UseRegister(instr->value()); | 2451 LOperand* input = UseRegister(instr->value()); |
2438 // TODO(all): Implement TempFPRegister. | 2452 LOperand* double_temp1 = TempDoubleRegister(); |
2439 LOperand* double_temp1 = FixedTemp(d24); // This was chosen arbitrarily. | |
2440 LOperand* temp1 = TempRegister(); | 2453 LOperand* temp1 = TempRegister(); |
2441 LOperand* temp2 = TempRegister(); | 2454 LOperand* temp2 = TempRegister(); |
2442 LOperand* temp3 = TempRegister(); | 2455 LOperand* temp3 = TempRegister(); |
2443 LMathExp* result = new(zone()) LMathExp(input, double_temp1, | 2456 LMathExp* result = new(zone()) LMathExp(input, double_temp1, |
2444 temp1, temp2, temp3); | 2457 temp1, temp2, temp3); |
2445 return DefineAsRegister(result); | 2458 return DefineAsRegister(result); |
2446 } | 2459 } |
2447 case kMathFloor: { | 2460 case kMathFloor: { |
2448 ASSERT(instr->value()->representation().IsDouble()); | 2461 ASSERT(instr->value()->representation().IsDouble()); |
2449 LOperand* input = UseRegisterAtStart(instr->value()); | 2462 LOperand* input = UseRegisterAtStart(instr->value()); |
(...skipping 16 matching lines...) Expand all Loading... |
2466 case kMathPowHalf: { | 2479 case kMathPowHalf: { |
2467 ASSERT(instr->representation().IsDouble()); | 2480 ASSERT(instr->representation().IsDouble()); |
2468 ASSERT(instr->value()->representation().IsDouble()); | 2481 ASSERT(instr->value()->representation().IsDouble()); |
2469 LOperand* input = UseRegister(instr->value()); | 2482 LOperand* input = UseRegister(instr->value()); |
2470 return DefineAsRegister(new(zone()) LMathPowHalf(input)); | 2483 return DefineAsRegister(new(zone()) LMathPowHalf(input)); |
2471 } | 2484 } |
2472 case kMathRound: { | 2485 case kMathRound: { |
2473 ASSERT(instr->value()->representation().IsDouble()); | 2486 ASSERT(instr->value()->representation().IsDouble()); |
2474 LOperand* input = UseRegister(instr->value()); | 2487 LOperand* input = UseRegister(instr->value()); |
2475 if (instr->representation().IsInteger32()) { | 2488 if (instr->representation().IsInteger32()) { |
2476 LMathRoundI* result = new(zone()) LMathRoundI(input, FixedTemp(d24)); | 2489 LOperand* temp = TempDoubleRegister(); |
| 2490 LMathRoundI* result = new(zone()) LMathRoundI(input, temp); |
2477 return AssignEnvironment(DefineAsRegister(result)); | 2491 return AssignEnvironment(DefineAsRegister(result)); |
2478 } else { | 2492 } else { |
2479 ASSERT(instr->representation().IsDouble()); | 2493 ASSERT(instr->representation().IsDouble()); |
2480 LMathRoundD* result = new(zone()) LMathRoundD(input); | 2494 LMathRoundD* result = new(zone()) LMathRoundD(input); |
2481 return DefineAsRegister(result); | 2495 return DefineAsRegister(result); |
2482 } | 2496 } |
2483 } | 2497 } |
2484 case kMathSqrt: { | 2498 case kMathSqrt: { |
2485 ASSERT(instr->representation().IsDouble()); | 2499 ASSERT(instr->representation().IsDouble()); |
2486 ASSERT(instr->value()->representation().IsDouble()); | 2500 ASSERT(instr->value()->representation().IsDouble()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 | 2572 |
2559 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2573 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2560 LOperand* receiver = UseRegister(instr->receiver()); | 2574 LOperand* receiver = UseRegister(instr->receiver()); |
2561 LOperand* function = UseRegister(instr->function()); | 2575 LOperand* function = UseRegister(instr->function()); |
2562 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2576 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2563 return AssignEnvironment(DefineAsRegister(result)); | 2577 return AssignEnvironment(DefineAsRegister(result)); |
2564 } | 2578 } |
2565 | 2579 |
2566 | 2580 |
2567 } } // namespace v8::internal | 2581 } } // namespace v8::internal |
OLD | NEW |