| 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/lithium.h" | 5 #include "src/crankshaft/lithium.h" |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
| 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT | 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 void LPointerMap::PrintTo(StringStream* stream) { | 240 void LPointerMap::PrintTo(StringStream* stream) { |
| 241 stream->Add("{"); | 241 stream->Add("{"); |
| 242 for (int i = 0; i < pointer_operands_.length(); ++i) { | 242 for (int i = 0; i < pointer_operands_.length(); ++i) { |
| 243 if (i != 0) stream->Add(";"); | 243 if (i != 0) stream->Add(";"); |
| 244 pointer_operands_[i]->PrintTo(stream); | 244 pointer_operands_[i]->PrintTo(stream); |
| 245 } | 245 } |
| 246 stream->Add("}"); | 246 stream->Add("}"); |
| 247 } | 247 } |
| 248 | 248 |
| 249 |
| 250 int StackSlotOffset(int index) { |
| 251 if (index >= 0) { |
| 252 // Local or spill slot. Skip the frame pointer, function, and |
| 253 // context in the fixed part of the frame. |
| 254 return -(index + 1) * kPointerSize - |
| 255 StandardFrameConstants::kFixedFrameSizeFromFp; |
| 256 } else { |
| 257 // Incoming parameter. Skip the return address. |
| 258 return -(index + 1) * kPointerSize + kFPOnStackSize + kPCOnStackSize; |
| 259 } |
| 260 } |
| 261 |
| 262 |
| 249 LChunk::LChunk(CompilationInfo* info, HGraph* graph) | 263 LChunk::LChunk(CompilationInfo* info, HGraph* graph) |
| 250 : base_frame_slots_(StandardFrameConstants::kFixedFrameSize / kPointerSize), | 264 : spill_slot_count_(0), |
| 251 current_frame_slots_(base_frame_slots_), | |
| 252 info_(info), | 265 info_(info), |
| 253 graph_(graph), | 266 graph_(graph), |
| 254 instructions_(32, info->zone()), | 267 instructions_(32, info->zone()), |
| 255 pointer_maps_(8, info->zone()), | 268 pointer_maps_(8, info->zone()), |
| 256 inlined_functions_(1, info->zone()), | 269 inlined_functions_(1, info->zone()), |
| 257 deprecation_dependencies_(32, info->zone()), | 270 deprecation_dependencies_(32, info->zone()), |
| 258 stability_dependencies_(8, info->zone()) {} | 271 stability_dependencies_(8, info->zone()) {} |
| 259 | 272 |
| 273 |
| 260 LLabel* LChunk::GetLabel(int block_id) const { | 274 LLabel* LChunk::GetLabel(int block_id) const { |
| 261 HBasicBlock* block = graph_->blocks()->at(block_id); | 275 HBasicBlock* block = graph_->blocks()->at(block_id); |
| 262 int first_instruction = block->first_instruction_index(); | 276 int first_instruction = block->first_instruction_index(); |
| 263 return LLabel::cast(instructions_[first_instruction]); | 277 return LLabel::cast(instructions_[first_instruction]); |
| 264 } | 278 } |
| 265 | 279 |
| 266 | 280 |
| 267 int LChunk::LookupDestination(int block_id) const { | 281 int LChunk::LookupDestination(int block_id) const { |
| 268 LLabel* cur = GetLabel(block_id); | 282 LLabel* cur = GetLabel(block_id); |
| 269 while (cur->replacement() != NULL) { | 283 while (cur->replacement() != NULL) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 } | 488 } |
| 475 | 489 |
| 476 | 490 |
| 477 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { | 491 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { |
| 478 allocated_double_registers_ = allocated_registers; | 492 allocated_double_registers_ = allocated_registers; |
| 479 BitVector* doubles = allocated_double_registers(); | 493 BitVector* doubles = allocated_double_registers(); |
| 480 BitVector::Iterator iterator(doubles); | 494 BitVector::Iterator iterator(doubles); |
| 481 while (!iterator.Done()) { | 495 while (!iterator.Done()) { |
| 482 if (info()->saves_caller_doubles()) { | 496 if (info()->saves_caller_doubles()) { |
| 483 if (kDoubleSize == kPointerSize * 2) { | 497 if (kDoubleSize == kPointerSize * 2) { |
| 484 current_frame_slots_ += 2; | 498 spill_slot_count_ += 2; |
| 485 } else { | 499 } else { |
| 486 current_frame_slots_++; | 500 spill_slot_count_++; |
| 487 } | 501 } |
| 488 } | 502 } |
| 489 iterator.Advance(); | 503 iterator.Advance(); |
| 490 } | 504 } |
| 491 } | 505 } |
| 492 | 506 |
| 493 | 507 |
| 494 void LChunkBuilderBase::Abort(BailoutReason reason) { | 508 void LChunkBuilderBase::Abort(BailoutReason reason) { |
| 495 info()->AbortOptimization(reason); | 509 info()->AbortOptimization(reason); |
| 496 status_ = ABORTED; | 510 status_ = ABORTED; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 657 |
| 644 LPhase::~LPhase() { | 658 LPhase::~LPhase() { |
| 645 if (ShouldProduceTraceOutput()) { | 659 if (ShouldProduceTraceOutput()) { |
| 646 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 660 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
| 647 } | 661 } |
| 648 } | 662 } |
| 649 | 663 |
| 650 | 664 |
| 651 } // namespace internal | 665 } // namespace internal |
| 652 } // namespace v8 | 666 } // namespace v8 |
| OLD | NEW |