OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/crankshaft/x87/lithium-x87.h" | 5 #include "src/crankshaft/x87/lithium-x87.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
10 | 10 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 length()->PrintTo(stream); | 348 length()->PrintTo(stream); |
349 | 349 |
350 stream->Add(" index "); | 350 stream->Add(" index "); |
351 index()->PrintTo(stream); | 351 index()->PrintTo(stream); |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { | 355 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { |
356 // Skip a slot if for a double-width slot. | 356 // Skip a slot if for a double-width slot. |
357 if (kind == DOUBLE_REGISTERS) { | 357 if (kind == DOUBLE_REGISTERS) { |
358 spill_slot_count_++; | 358 current_frame_slots_++; |
359 spill_slot_count_ |= 1; | 359 current_frame_slots_ |= 1; |
360 num_double_slots_++; | 360 num_double_slots_++; |
361 } | 361 } |
362 return spill_slot_count_++; | 362 return current_frame_slots_++; |
363 } | 363 } |
364 | 364 |
365 | 365 |
366 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { | 366 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { |
367 int index = GetNextSpillIndex(kind); | 367 int index = GetNextSpillIndex(kind); |
368 if (kind == DOUBLE_REGISTERS) { | 368 if (kind == DOUBLE_REGISTERS) { |
369 return LDoubleStackSlot::Create(index, zone()); | 369 return LDoubleStackSlot::Create(index, zone()); |
370 } else { | 370 } else { |
371 DCHECK(kind == GENERAL_REGISTERS); | 371 DCHECK(kind == GENERAL_REGISTERS); |
372 return LStackSlot::Create(index, zone()); | 372 return LStackSlot::Create(index, zone()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 LPlatformChunk* LChunkBuilder::Build() { | 442 LPlatformChunk* LChunkBuilder::Build() { |
443 DCHECK(is_unused()); | 443 DCHECK(is_unused()); |
444 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 444 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
445 LPhase phase("L_Building chunk", chunk_); | 445 LPhase phase("L_Building chunk", chunk_); |
446 status_ = BUILDING; | 446 status_ = BUILDING; |
447 | 447 |
448 // Reserve the first spill slot for the state of dynamic alignment. | 448 // Reserve the first spill slot for the state of dynamic alignment. |
449 if (info()->IsOptimizing()) { | 449 if (info()->IsOptimizing()) { |
450 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 450 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
451 DCHECK_EQ(alignment_state_index, 0); | 451 DCHECK_EQ(alignment_state_index, 4); |
452 USE(alignment_state_index); | 452 USE(alignment_state_index); |
453 } | 453 } |
454 | 454 |
455 // If compiling for OSR, reserve space for the unoptimized frame, | 455 // If compiling for OSR, reserve space for the unoptimized frame, |
456 // which will be subsumed into this frame. | 456 // which will be subsumed into this frame. |
457 if (graph()->has_osr()) { | 457 if (graph()->has_osr()) { |
458 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 458 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
459 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 459 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
460 } | 460 } |
461 } | 461 } |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 spill_index = env_index - instr->environment()->first_local_index(); | 2510 spill_index = env_index - instr->environment()->first_local_index(); |
2511 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2511 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2512 Retry(kNotEnoughSpillSlotsForOsr); | 2512 Retry(kNotEnoughSpillSlotsForOsr); |
2513 spill_index = 0; | 2513 spill_index = 0; |
2514 } | 2514 } |
2515 if (spill_index == 0) { | 2515 if (spill_index == 0) { |
2516 // The dynamic frame alignment state overwrites the first local. | 2516 // The dynamic frame alignment state overwrites the first local. |
2517 // The first local is saved at the end of the unoptimized frame. | 2517 // The first local is saved at the end of the unoptimized frame. |
2518 spill_index = graph()->osr()->UnoptimizedFrameSlots(); | 2518 spill_index = graph()->osr()->UnoptimizedFrameSlots(); |
2519 } | 2519 } |
| 2520 spill_index += StandardFrameConstants::kFixedSlotCount; |
2520 } | 2521 } |
2521 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2522 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2522 } | 2523 } |
2523 | 2524 |
2524 | 2525 |
2525 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2526 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
2526 // There are no real uses of the arguments object. | 2527 // There are no real uses of the arguments object. |
2527 // arguments.length and element access are supported directly on | 2528 // arguments.length and element access are supported directly on |
2528 // stack arguments, and any real arguments object use causes a bailout. | 2529 // stack arguments, and any real arguments object use causes a bailout. |
2529 // So this value is never used. | 2530 // So this value is never used. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2669 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2669 LOperand* context = UseRegisterAtStart(instr->context()); | 2670 LOperand* context = UseRegisterAtStart(instr->context()); |
2670 return new(zone()) LStoreFrameContext(context); | 2671 return new(zone()) LStoreFrameContext(context); |
2671 } | 2672 } |
2672 | 2673 |
2673 | 2674 |
2674 } // namespace internal | 2675 } // namespace internal |
2675 } // namespace v8 | 2676 } // namespace v8 |
2676 | 2677 |
2677 #endif // V8_TARGET_ARCH_X87 | 2678 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |