| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); | 417 stream->Add(" %p -> %p", *original_map(), *transitioned_map()); |
| 418 } | 418 } |
| 419 | 419 |
| 420 | 420 |
| 421 LPlatformChunk* LChunkBuilder::Build() { | 421 LPlatformChunk* LChunkBuilder::Build() { |
| 422 DCHECK(is_unused()); | 422 DCHECK(is_unused()); |
| 423 chunk_ = new(zone()) LPlatformChunk(info(), graph()); | 423 chunk_ = new(zone()) LPlatformChunk(info(), graph()); |
| 424 LPhase phase("L_Building chunk", chunk_); | 424 LPhase phase("L_Building chunk", chunk_); |
| 425 status_ = BUILDING; | 425 status_ = BUILDING; |
| 426 | 426 |
| 427 // Reserve the first spill slot for the state of dynamic alignment. | |
| 428 if (info()->IsOptimizing()) { | |
| 429 int alignment_state_index = chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | |
| 430 DCHECK_EQ(alignment_state_index, 4); | |
| 431 USE(alignment_state_index); | |
| 432 } | |
| 433 | |
| 434 // If compiling for OSR, reserve space for the unoptimized frame, | 427 // If compiling for OSR, reserve space for the unoptimized frame, |
| 435 // which will be subsumed into this frame. | 428 // which will be subsumed into this frame. |
| 436 if (graph()->has_osr()) { | 429 if (graph()->has_osr()) { |
| 437 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { | 430 for (int i = graph()->osr()->UnoptimizedFrameSlots(); i > 0; i--) { |
| 438 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); | 431 chunk_->GetNextSpillIndex(GENERAL_REGISTERS); |
| 439 } | 432 } |
| 440 } | 433 } |
| 441 | 434 |
| 442 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); | 435 const ZoneList<HBasicBlock*>* blocks = graph()->blocks(); |
| 443 for (int i = 0; i < blocks->length(); i++) { | 436 for (int i = 0; i < blocks->length(); i++) { |
| (...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2458 int env_index = instr->index(); | 2451 int env_index = instr->index(); |
| 2459 int spill_index = 0; | 2452 int spill_index = 0; |
| 2460 if (instr->environment()->is_parameter_index(env_index)) { | 2453 if (instr->environment()->is_parameter_index(env_index)) { |
| 2461 spill_index = chunk()->GetParameterStackSlot(env_index); | 2454 spill_index = chunk()->GetParameterStackSlot(env_index); |
| 2462 } else { | 2455 } else { |
| 2463 spill_index = env_index - instr->environment()->first_local_index(); | 2456 spill_index = env_index - instr->environment()->first_local_index(); |
| 2464 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2457 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
| 2465 Retry(kNotEnoughSpillSlotsForOsr); | 2458 Retry(kNotEnoughSpillSlotsForOsr); |
| 2466 spill_index = 0; | 2459 spill_index = 0; |
| 2467 } | 2460 } |
| 2468 if (spill_index == 0) { | |
| 2469 // The dynamic frame alignment state overwrites the first local. | |
| 2470 // The first local is saved at the end of the unoptimized frame. | |
| 2471 spill_index = graph()->osr()->UnoptimizedFrameSlots(); | |
| 2472 } | |
| 2473 spill_index += StandardFrameConstants::kFixedSlotCount; | 2461 spill_index += StandardFrameConstants::kFixedSlotCount; |
| 2474 } | 2462 } |
| 2475 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2463 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
| 2476 } | 2464 } |
| 2477 | 2465 |
| 2478 | 2466 |
| 2479 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { | 2467 LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { |
| 2480 // There are no real uses of the arguments object. | 2468 // There are no real uses of the arguments object. |
| 2481 // arguments.length and element access are supported directly on | 2469 // arguments.length and element access are supported directly on |
| 2482 // stack arguments, and any real arguments object use causes a bailout. | 2470 // stack arguments, and any real arguments object use causes a bailout. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { | 2610 LInstruction* LChunkBuilder::DoStoreFrameContext(HStoreFrameContext* instr) { |
| 2623 LOperand* context = UseRegisterAtStart(instr->context()); | 2611 LOperand* context = UseRegisterAtStart(instr->context()); |
| 2624 return new(zone()) LStoreFrameContext(context); | 2612 return new(zone()) LStoreFrameContext(context); |
| 2625 } | 2613 } |
| 2626 | 2614 |
| 2627 | 2615 |
| 2628 } // namespace internal | 2616 } // namespace internal |
| 2629 } // namespace v8 | 2617 } // namespace v8 |
| 2630 | 2618 |
| 2631 #endif // V8_TARGET_ARCH_X87 | 2619 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |