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/ia32/lithium-ia32.h" | 5 #include "src/crankshaft/ia32/lithium-ia32.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 | 10 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 length()->PrintTo(stream); | 337 length()->PrintTo(stream); |
338 | 338 |
339 stream->Add(" index "); | 339 stream->Add(" index "); |
340 index()->PrintTo(stream); | 340 index()->PrintTo(stream); |
341 } | 341 } |
342 | 342 |
343 | 343 |
344 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { | 344 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { |
345 // Skip a slot if for a double-width slot. | 345 // Skip a slot if for a double-width slot. |
346 if (kind == DOUBLE_REGISTERS) { | 346 if (kind == DOUBLE_REGISTERS) { |
347 current_frame_slots_++; | 347 spill_slot_count_++; |
348 current_frame_slots_ |= 1; | 348 spill_slot_count_ |= 1; |
349 num_double_slots_++; | 349 num_double_slots_++; |
350 } | 350 } |
351 return current_frame_slots_++; | 351 return spill_slot_count_++; |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { | 355 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { |
356 int index = GetNextSpillIndex(kind); | 356 int index = GetNextSpillIndex(kind); |
357 if (kind == DOUBLE_REGISTERS) { | 357 if (kind == DOUBLE_REGISTERS) { |
358 return LDoubleStackSlot::Create(index, zone()); | 358 return LDoubleStackSlot::Create(index, zone()); |
359 } else { | 359 } else { |
360 DCHECK(kind == GENERAL_REGISTERS); | 360 DCHECK(kind == GENERAL_REGISTERS); |
361 return LStackSlot::Create(index, zone()); | 361 return LStackSlot::Create(index, zone()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 | 430 |
431 LPlatformChunk* LChunkBuilder::Build() { | 431 LPlatformChunk* LChunkBuilder::Build() { |
432 DCHECK(is_unused()); | 432 DCHECK(is_unused()); |
433 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 433 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
434 LPhase phase("L_Building chunk", chunk_); | 434 LPhase phase("L_Building chunk", chunk_); |
435 status_ = BUILDING; | 435 status_ = BUILDING; |
436 | 436 |
437 // Reserve the first spill slot for the state of dynamic alignment. | 437 // Reserve the first spill slot for the state of dynamic alignment. |
438 if (info()->IsOptimizing()) { | 438 if (info()->IsOptimizing()) { |
439 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 439 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
440 DCHECK_EQ(alignment_state_index, 4); | 440 DCHECK_EQ(alignment_state_index, 0); |
441 USE(alignment_state_index); | 441 USE(alignment_state_index); |
442 } | 442 } |
443 | 443 |
444 // If compiling for OSR, reserve space for the unoptimized frame, | 444 // If compiling for OSR, reserve space for the unoptimized frame, |
445 // which will be subsumed into this frame. | 445 // which will be subsumed into this frame. |
446 if (graph()->has_osr()) { | 446 if (graph()->has_osr()) { |
447 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 447 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
448 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 448 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
449 } | 449 } |
450 } | 450 } |
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 spill_index = env_index - instr->environment()->first_local_index(); | 2505 spill_index = env_index - instr->environment()->first_local_index(); |
2506 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2506 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2507 Retry(kNotEnoughSpillSlotsForOsr); | 2507 Retry(kNotEnoughSpillSlotsForOsr); |
2508 spill_index = 0; | 2508 spill_index = 0; |
2509 } | 2509 } |
2510 if (spill_index == 0) { | 2510 if (spill_index == 0) { |
2511 // The dynamic frame alignment state overwrites the first local. | 2511 // The dynamic frame alignment state overwrites the first local. |
2512 // The first local is saved at the end of the unoptimized frame. | 2512 // The first local is saved at the end of the unoptimized frame. |
2513 spill_index = graph()->osr()->UnoptimizedFrameSlots(); | 2513 spill_index = graph()->osr()->UnoptimizedFrameSlots(); |
2514 } | 2514 } |
2515 spill_index += StandardFrameConstants::kFixedSlotCount; | |
2516 } | 2515 } |
2517 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2516 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2518 } | 2517 } |
2519 | 2518 |
2520 | 2519 |
2521 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2520 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2522 LOperand* context = UseFixed(instr->context(), esi); | 2521 LOperand* context = UseFixed(instr->context(), esi); |
2523 LCallStub* result = new(zone()) LCallStub(context); | 2522 LCallStub* result = new(zone()) LCallStub(context); |
2524 return MarkAsCall(DefineFixed(result, eax), instr); | 2523 return MarkAsCall(DefineFixed(result, eax), instr); |
2525 } | 2524 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2681 LAllocateBlockContext* result = | 2680 LAllocateBlockContext* result = |
2682 new(zone()) LAllocateBlockContext(context, function); | 2681 new(zone()) LAllocateBlockContext(context, function); |
2683 return MarkAsCall(DefineFixed(result, esi), instr); | 2682 return MarkAsCall(DefineFixed(result, esi), instr); |
2684 } | 2683 } |
2685 | 2684 |
2686 | 2685 |
2687 } // namespace internal | 2686 } // namespace internal |
2688 } // namespace v8 | 2687 } // namespace v8 |
2689 | 2688 |
2690 #endif // V8_TARGET_ARCH_IA32 | 2689 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |