| 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 | |
| 263 LChunk::LChunk(CompilationInfo* info, HGraph* graph) | 249 LChunk::LChunk(CompilationInfo* info, HGraph* graph) |
| 264 : spill_slot_count_(0), | 250 : base_frame_slots_(StandardFrameConstants::kFixedFrameSize / kPointerSize), |
| 251 current_frame_slots_(base_frame_slots_), |
| 265 info_(info), | 252 info_(info), |
| 266 graph_(graph), | 253 graph_(graph), |
| 267 instructions_(32, info->zone()), | 254 instructions_(32, info->zone()), |
| 268 pointer_maps_(8, info->zone()), | 255 pointer_maps_(8, info->zone()), |
| 269 inlined_functions_(1, info->zone()), | 256 inlined_functions_(1, info->zone()), |
| 270 deprecation_dependencies_(32, info->zone()), | 257 deprecation_dependencies_(32, info->zone()), |
| 271 stability_dependencies_(8, info->zone()) {} | 258 stability_dependencies_(8, info->zone()) {} |
| 272 | 259 |
| 273 | |
| 274 LLabel* LChunk::GetLabel(int block_id) const { | 260 LLabel* LChunk::GetLabel(int block_id) const { |
| 275 HBasicBlock* block = graph_->blocks()->at(block_id); | 261 HBasicBlock* block = graph_->blocks()->at(block_id); |
| 276 int first_instruction = block->first_instruction_index(); | 262 int first_instruction = block->first_instruction_index(); |
| 277 return LLabel::cast(instructions_[first_instruction]); | 263 return LLabel::cast(instructions_[first_instruction]); |
| 278 } | 264 } |
| 279 | 265 |
| 280 | 266 |
| 281 int LChunk::LookupDestination(int block_id) const { | 267 int LChunk::LookupDestination(int block_id) const { |
| 282 LLabel* cur = GetLabel(block_id); | 268 LLabel* cur = GetLabel(block_id); |
| 283 while (cur->replacement() != NULL) { | 269 while (cur->replacement() != NULL) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 474 } |
| 489 | 475 |
| 490 | 476 |
| 491 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { | 477 void LChunk::set_allocated_double_registers(BitVector* allocated_registers) { |
| 492 allocated_double_registers_ = allocated_registers; | 478 allocated_double_registers_ = allocated_registers; |
| 493 BitVector* doubles = allocated_double_registers(); | 479 BitVector* doubles = allocated_double_registers(); |
| 494 BitVector::Iterator iterator(doubles); | 480 BitVector::Iterator iterator(doubles); |
| 495 while (!iterator.Done()) { | 481 while (!iterator.Done()) { |
| 496 if (info()->saves_caller_doubles()) { | 482 if (info()->saves_caller_doubles()) { |
| 497 if (kDoubleSize == kPointerSize * 2) { | 483 if (kDoubleSize == kPointerSize * 2) { |
| 498 spill_slot_count_ += 2; | 484 current_frame_slots_ += 2; |
| 499 } else { | 485 } else { |
| 500 spill_slot_count_++; | 486 current_frame_slots_++; |
| 501 } | 487 } |
| 502 } | 488 } |
| 503 iterator.Advance(); | 489 iterator.Advance(); |
| 504 } | 490 } |
| 505 } | 491 } |
| 506 | 492 |
| 507 | 493 |
| 508 void LChunkBuilderBase::Abort(BailoutReason reason) { | 494 void LChunkBuilderBase::Abort(BailoutReason reason) { |
| 509 info()->AbortOptimization(reason); | 495 info()->AbortOptimization(reason); |
| 510 status_ = ABORTED; | 496 status_ = ABORTED; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 | 643 |
| 658 LPhase::~LPhase() { | 644 LPhase::~LPhase() { |
| 659 if (ShouldProduceTraceOutput()) { | 645 if (ShouldProduceTraceOutput()) { |
| 660 isolate()->GetHTracer()->TraceLithium(name(), chunk_); | 646 isolate()->GetHTracer()->TraceLithium(name(), chunk_); |
| 661 } | 647 } |
| 662 } | 648 } |
| 663 | 649 |
| 664 | 650 |
| 665 } // namespace internal | 651 } // namespace internal |
| 666 } // namespace v8 | 652 } // namespace v8 |
| OLD | NEW |