| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "lithium-allocator-inl.h" | 7 #include "lithium-allocator-inl.h" |
| 8 #include "arm64/lithium-arm64.h" | 8 #include "arm64/lithium-arm64.h" |
| 9 #include "arm64/lithium-codegen-arm64.h" | 9 #include "arm64/lithium-codegen-arm64.h" |
| 10 #include "hydrogen-osr.h" | 10 #include "hydrogen-osr.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 LUnallocated* LChunkBuilder::ToUnallocated(DoubleRegister reg) { | 369 LUnallocated* LChunkBuilder::ToUnallocated(DoubleRegister reg) { |
| 370 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, | 370 return new(zone()) LUnallocated(LUnallocated::FIXED_DOUBLE_REGISTER, |
| 371 DoubleRegister::ToAllocationIndex(reg)); | 371 DoubleRegister::ToAllocationIndex(reg)); |
| 372 } | 372 } |
| 373 | 373 |
| 374 | 374 |
| 375 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { | 375 LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { |
| 376 if (value->EmitAtUses()) { | 376 if (value->EmitAtUses()) { |
| 377 HInstruction* instr = HInstruction::cast(value); | 377 HInstruction* instr = HInstruction::cast(value); |
| 378 VisitInstruction(instr); | 378 if (value->IsConstant() && IsCachedConstant(HConstant::cast(value), |
| 379 current_block_)) { |
| 380 // We will reuse the cached value. |
| 381 } else { |
| 382 VisitInstruction(instr); |
| 383 } |
| 379 } | 384 } |
| 380 operand->set_virtual_register(value->id()); | 385 operand->set_virtual_register(value->id()); |
| 381 return operand; | 386 return operand; |
| 382 } | 387 } |
| 383 | 388 |
| 384 | 389 |
| 385 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { | 390 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { |
| 386 return Use(value, ToUnallocated(fixed_register)); | 391 return Use(value, ToUnallocated(fixed_register)); |
| 387 } | 392 } |
| 388 | 393 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 } | 584 } |
| 580 status_ = DONE; | 585 status_ = DONE; |
| 581 return chunk_; | 586 return chunk_; |
| 582 } | 587 } |
| 583 | 588 |
| 584 | 589 |
| 585 void LChunkBuilder::DoBasicBlock(HBasicBlock* block) { | 590 void LChunkBuilder::DoBasicBlock(HBasicBlock* block) { |
| 586 ASSERT(is_building()); | 591 ASSERT(is_building()); |
| 587 current_block_ = block; | 592 current_block_ = block; |
| 588 | 593 |
| 594 if (graph()->has_osr() && |
| 595 (block == graph()->osr()->osr_entry())) { |
| 596 constant_cache_.Clear(); |
| 597 } |
| 598 |
| 589 if (block->IsStartBlock()) { | 599 if (block->IsStartBlock()) { |
| 600 constant_cache_.Clear(); |
| 590 block->UpdateEnvironment(graph_->start_environment()); | 601 block->UpdateEnvironment(graph_->start_environment()); |
| 591 argument_count_ = 0; | 602 argument_count_ = 0; |
| 592 } else if (block->predecessors()->length() == 1) { | 603 } else if (block->predecessors()->length() == 1) { |
| 593 // We have a single predecessor => copy environment and outgoing | 604 // We have a single predecessor => copy environment and outgoing |
| 594 // argument count from the predecessor. | 605 // argument count from the predecessor. |
| 595 ASSERT(block->phis()->length() == 0); | 606 ASSERT(block->phis()->length() == 0); |
| 596 HBasicBlock* pred = block->predecessors()->at(0); | 607 HBasicBlock* pred = block->predecessors()->at(0); |
| 597 HEnvironment* last_environment = pred->last_environment(); | 608 HEnvironment* last_environment = pred->last_environment(); |
| 598 ASSERT(last_environment != NULL); | 609 ASSERT(last_environment != NULL); |
| 599 | 610 |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 | 1332 |
| 1322 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1333 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1323 ASSERT(instr->value()->representation().IsTagged()); | 1334 ASSERT(instr->value()->representation().IsTagged()); |
| 1324 LOperand* value = UseRegisterAtStart(instr->value()); | 1335 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1325 LOperand* temp = TempRegister(); | 1336 LOperand* temp = TempRegister(); |
| 1326 return new(zone()) LCmpMapAndBranch(value, temp); | 1337 return new(zone()) LCmpMapAndBranch(value, temp); |
| 1327 } | 1338 } |
| 1328 | 1339 |
| 1329 | 1340 |
| 1330 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1341 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1342 CacheConstant(instr, current_block_); |
| 1331 Representation r = instr->representation(); | 1343 Representation r = instr->representation(); |
| 1332 if (r.IsSmi()) { | 1344 if (r.IsSmi()) { |
| 1333 return DefineAsRegister(new(zone()) LConstantS); | 1345 return DefineAsRegister(new(zone()) LConstantS); |
| 1334 } else if (r.IsInteger32()) { | 1346 } else if (r.IsInteger32()) { |
| 1335 return DefineAsRegister(new(zone()) LConstantI); | 1347 return DefineAsRegister(new(zone()) LConstantI); |
| 1336 } else if (r.IsDouble()) { | 1348 } else if (r.IsDouble()) { |
| 1337 return DefineAsRegister(new(zone()) LConstantD); | 1349 return DefineAsRegister(new(zone()) LConstantD); |
| 1338 } else if (r.IsExternal()) { | 1350 } else if (r.IsExternal()) { |
| 1339 return DefineAsRegister(new(zone()) LConstantE); | 1351 return DefineAsRegister(new(zone()) LConstantE); |
| 1340 } else if (r.IsTagged()) { | 1352 } else if (r.IsTagged()) { |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 | 2712 |
| 2701 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2713 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2702 LOperand* receiver = UseRegister(instr->receiver()); | 2714 LOperand* receiver = UseRegister(instr->receiver()); |
| 2703 LOperand* function = UseRegister(instr->function()); | 2715 LOperand* function = UseRegister(instr->function()); |
| 2704 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2716 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2705 return AssignEnvironment(DefineAsRegister(result)); | 2717 return AssignEnvironment(DefineAsRegister(result)); |
| 2706 } | 2718 } |
| 2707 | 2719 |
| 2708 | 2720 |
| 2709 } } // namespace v8::internal | 2721 } } // namespace v8::internal |
| OLD | NEW |