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/x64/lithium-x64.h" | 5 #include "src/crankshaft/x64/lithium-x64.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_X64 | 9 #if V8_TARGET_ARCH_X64 |
10 | 10 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 length()->PrintTo(stream); | 327 length()->PrintTo(stream); |
328 | 328 |
329 stream->Add(" index "); | 329 stream->Add(" index "); |
330 index()->PrintTo(stream); | 330 index()->PrintTo(stream); |
331 } | 331 } |
332 | 332 |
333 | 333 |
334 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { | 334 int LPlatformChunk::GetNextSpillIndex(RegisterKind kind) { |
335 if (kind == DOUBLE_REGISTERS && kDoubleSize == 2 * kPointerSize) { | 335 if (kind == DOUBLE_REGISTERS && kDoubleSize == 2 * kPointerSize) { |
336 // Skip a slot if for a double-width slot for x32 port. | 336 // Skip a slot if for a double-width slot for x32 port. |
337 current_frame_slots_++; | 337 spill_slot_count_++; |
338 // The spill slot's address is at rbp - (index + 1) * kPointerSize - | 338 // The spill slot's address is at rbp - (index + 1) * kPointerSize - |
339 // StandardFrameConstants::kFixedFrameSizeFromFp. kFixedFrameSizeFromFp is | 339 // StandardFrameConstants::kFixedFrameSizeFromFp. kFixedFrameSizeFromFp is |
340 // 2 * kPointerSize, if rbp is aligned at 8-byte boundary, the below "|= 1" | 340 // 2 * kPointerSize, if rbp is aligned at 8-byte boundary, the below "|= 1" |
341 // will make sure the spilled doubles are aligned at 8-byte boundary. | 341 // will make sure the spilled doubles are aligned at 8-byte boundary. |
342 // TODO(haitao): make sure rbp is aligned at 8-byte boundary for x32 port. | 342 // TODO(haitao): make sure rbp is aligned at 8-byte boundary for x32 port. |
343 current_frame_slots_ |= 1; | 343 spill_slot_count_ |= 1; |
344 } | 344 } |
345 return current_frame_slots_++; | 345 return spill_slot_count_++; |
346 } | 346 } |
347 | 347 |
348 | 348 |
349 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { | 349 LOperand* LPlatformChunk::GetNextSpillSlot(RegisterKind kind) { |
350 // All stack slots are Double stack slots on x64. | 350 // All stack slots are Double stack slots on x64. |
351 // Alternatively, at some point, start using half-size | 351 // Alternatively, at some point, start using half-size |
352 // stack slots for int32 values. | 352 // stack slots for int32 values. |
353 int index = GetNextSpillIndex(kind); | 353 int index = GetNextSpillIndex(kind); |
354 if (kind == DOUBLE_REGISTERS) { | 354 if (kind == DOUBLE_REGISTERS) { |
355 return LDoubleStackSlot::Create(index, zone()); | 355 return LDoubleStackSlot::Create(index, zone()); |
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 int env_index = instr->index(); | 2494 int env_index = instr->index(); |
2495 int spill_index = 0; | 2495 int spill_index = 0; |
2496 if (instr->environment()->is_parameter_index(env_index)) { | 2496 if (instr->environment()->is_parameter_index(env_index)) { |
2497 spill_index = chunk()->GetParameterStackSlot(env_index); | 2497 spill_index = chunk()->GetParameterStackSlot(env_index); |
2498 } else { | 2498 } else { |
2499 spill_index = env_index - instr->environment()->first_local_index(); | 2499 spill_index = env_index - instr->environment()->first_local_index(); |
2500 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { | 2500 if (spill_index > LUnallocated::kMaxFixedSlotIndex) { |
2501 Retry(kTooManySpillSlotsNeededForOSR); | 2501 Retry(kTooManySpillSlotsNeededForOSR); |
2502 spill_index = 0; | 2502 spill_index = 0; |
2503 } | 2503 } |
2504 spill_index += StandardFrameConstants::kFixedSlotCount; | |
2505 } | 2504 } |
2506 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); | 2505 return DefineAsSpilled(new(zone()) LUnknownOSRValue, spill_index); |
2507 } | 2506 } |
2508 | 2507 |
2509 | 2508 |
2510 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { | 2509 LInstruction* LChunkBuilder::DoCallStub(HCallStub* instr) { |
2511 LOperand* context = UseFixed(instr->context(), rsi); | 2510 LOperand* context = UseFixed(instr->context(), rsi); |
2512 LCallStub* result = new(zone()) LCallStub(context); | 2511 LCallStub* result = new(zone()) LCallStub(context); |
2513 return MarkAsCall(DefineFixed(result, rax), instr); | 2512 return MarkAsCall(DefineFixed(result, rax), instr); |
2514 } | 2513 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2671 LAllocateBlockContext* result = | 2670 LAllocateBlockContext* result = |
2672 new(zone()) LAllocateBlockContext(context, function); | 2671 new(zone()) LAllocateBlockContext(context, function); |
2673 return MarkAsCall(DefineFixed(result, rsi), instr); | 2672 return MarkAsCall(DefineFixed(result, rsi), instr); |
2674 } | 2673 } |
2675 | 2674 |
2676 | 2675 |
2677 } // namespace internal | 2676 } // namespace internal |
2678 } // namespace v8 | 2677 } // namespace v8 |
2679 | 2678 |
2680 #endif // V8_TARGET_ARCH_X64 | 2679 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |