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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); | 413 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); |
414 } | 414 } |
415 | 415 |
416 | 416 |
417 LPlatformChunk* LChunkBuilder::Build() { | 417 LPlatformChunk* LChunkBuilder::Build() { |
418 DCHECK(is_unused()); | 418 DCHECK(is_unused()); |
419 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 419 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
420 LPhase phase("L_Building chunk", chunk_); | 420 LPhase phase("L_Building chunk", chunk_); |
421 status_ = BUILDING; | 421 status_ = BUILDING; |
422 | 422 |
423 // Reserve the first spill slot for the state of dynamic alignment. | |
424 if (info()->IsOptimizing()) { | |
425 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | |
426 DCHECK_EQ(alignment_state_index, 4); | |
427 USE(alignment_state_index); | |
428 } | |
429 | |
430 // If compiling for OSR, reserve space for the unoptimized frame, | 423 // If compiling for OSR, reserve space for the unoptimized frame, |
431 // which will be subsumed into this frame. | 424 // which will be subsumed into this frame. |
432 if (graph()->has_osr()) { | 425 if (graph()->has_osr()) { |
433 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 426 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
434 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 427 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
435 } | 428 } |
436 } | 429 } |
437 | 430 |
438 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 431 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); |
439 for (int i = 0; i < blocks->length(); i++) { | 432 for (int i = 0; i < blocks->length(); i++) { |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2470 int env_index = instr->index(); | 2463 int env_index = instr->index(); |
2471 int spill_index = 0; | 2464 int spill_index = 0; |
2472 if (instr->environment()->is_parameter_index(env_index)) { | 2465 if (instr->environment()->is_parameter_index(env_index)) { |
2473 spill_index = chunk()->GetParameterStackSlot(env_index); | 2466 spill_index = chunk()->GetParameterStackSlot(env_index); |
2474 } else { | 2467 } else { |
2475 spill_index = env_index - instr->environment()->first_local_index(); | 2468 spill_index = env_index - instr->environment()->first_local_index(); |
2476 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2469 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2477 Retry(kNotEnoughSpillSlotsForOsr); | 2470 Retry(kNotEnoughSpillSlotsForOsr); |
2478 spill_index = 0; | 2471 spill_index = 0; |
2479 } | 2472 } |
2480 if (spill_index == 0) { | |
2481 // The dynamic frame alignment state overwrites the first local. | |
2482 // The first local is saved at the end of the unoptimized frame. | |
2483 spill_index = graph()->osr()->UnoptimizedFrameSlots(); | |
2484 } | |
2485 spill_index += StandardFrameConstants::kFixedSlotCount; | 2473 spill_index += StandardFrameConstants::kFixedSlotCount; |
2486 } | 2474 } |
2487 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2475 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2488 } | 2476 } |
2489 | 2477 |
2490 | 2478 |
2491 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2479 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
2492 // There are no real uses of the arguments object. | 2480 // There are no real uses of the arguments object. |
2493 // arguments.length and element access are supported directly on | 2481 // arguments.length and element access are supported directly on |
2494 // stack arguments, and any real arguments object use causes a bailout. | 2482 // stack arguments, and any real arguments object use causes a bailout. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2622 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
2635 LOperand* context = UseRegisterAtStart(instr->context()); | 2623 LOperand* context = UseRegisterAtStart(instr->context()); |
2636 return new(zone()) LStoreFrameContext(context); | 2624 return new(zone()) LStoreFrameContext(context); |
2637 } | 2625 } |
2638 | 2626 |
2639 | 2627 |
2640 } // namespace internal | 2628 } // namespace internal |
2641 } // namespace v8 | 2629 } // namespace v8 |
2642 | 2630 |
2643 #endif // V8_TARGET_ARCH_IA32 | 2631 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |