| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 366 } |
| 367 | 367 |
| 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 LInstruction* l_instr; |
| 377 if (value->IsConstant() && |
| 378 (l_instr = CachedLInstructionFor(HConstant::cast(value), |
| 379 current_block_))) { |
| 380 operand->set_parent_linstr(l_instr); |
| 381 } else if (value->EmitAtUses()) { |
| 377 HInstruction* instr = HInstruction::cast(value); | 382 HInstruction* instr = HInstruction::cast(value); |
| 378 if (value->IsConstant() && IsCachedConstant(HConstant::cast(value), | 383 VisitInstruction(instr); |
| 379 current_block_)) { | |
| 380 // We will reuse the cached value. | |
| 381 } else { | |
| 382 VisitInstruction(instr); | |
| 383 } | |
| 384 } | 384 } |
| 385 operand->set_virtual_register(value->id()); | 385 operand->set_virtual_register(value->id()); |
| 386 return operand; | 386 return operand; |
| 387 } | 387 } |
| 388 | 388 |
| 389 | 389 |
| 390 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { | 390 LOperand* LChunkBuilder::UseFixed(HValue* value, Register fixed_register) { |
| 391 return Use(value, ToUnallocated(fixed_register)); | 391 return Use(value, ToUnallocated(fixed_register)); |
| 392 } | 392 } |
| 393 | 393 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 432 |
| 433 LOperand* LChunkBuilder::UseAny(HValue* value) { | 433 LOperand* LChunkBuilder::UseAny(HValue* value) { |
| 434 return value->IsConstant() | 434 return value->IsConstant() |
| 435 ? UseConstant(value) | 435 ? UseConstant(value) |
| 436 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); | 436 : Use(value, new(zone()) LUnallocated(LUnallocated::ANY)); |
| 437 } | 437 } |
| 438 | 438 |
| 439 | 439 |
| 440 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, | 440 LInstruction* LChunkBuilder::Define(LTemplateResultInstruction<1>* instr, |
| 441 LUnallocated* result) { | 441 LUnallocated* result) { |
| 442 result->set_parent_linstr(instr); |
| 442 result->set_virtual_register(current_instruction_->id()); | 443 result->set_virtual_register(current_instruction_->id()); |
| 443 instr->set_result(result); | 444 instr->set_result(result); |
| 444 return instr; | 445 return instr; |
| 445 } | 446 } |
| 446 | 447 |
| 447 | 448 |
| 448 LInstruction* LChunkBuilder::DefineAsRegister( | 449 LInstruction* LChunkBuilder::DefineAsRegister( |
| 449 LTemplateResultInstruction<1>* instr) { | 450 LTemplateResultInstruction<1>* instr) { |
| 450 return Define(instr, | 451 return Define(instr, |
| 451 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); | 452 new(zone()) LUnallocated(LUnallocated::MUST_HAVE_REGISTER)); |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 | 1333 |
| 1333 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { | 1334 LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { |
| 1334 ASSERT(instr->value()->representation().IsTagged()); | 1335 ASSERT(instr->value()->representation().IsTagged()); |
| 1335 LOperand* value = UseRegisterAtStart(instr->value()); | 1336 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1336 LOperand* temp = TempRegister(); | 1337 LOperand* temp = TempRegister(); |
| 1337 return new(zone()) LCmpMapAndBranch(value, temp); | 1338 return new(zone()) LCmpMapAndBranch(value, temp); |
| 1338 } | 1339 } |
| 1339 | 1340 |
| 1340 | 1341 |
| 1341 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { | 1342 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { |
| 1342 CacheConstant(instr, current_block_); | 1343 LInstruction* res; |
| 1343 Representation r = instr->representation(); | 1344 Representation r = instr->representation(); |
| 1344 if (r.IsSmi()) { | 1345 if (r.IsSmi()) { |
| 1345 return DefineAsRegister(new(zone()) LConstantS); | 1346 res = DefineAsRegister(new(zone()) LConstantS); |
| 1346 } else if (r.IsInteger32()) { | 1347 } else if (r.IsInteger32()) { |
| 1347 return DefineAsRegister(new(zone()) LConstantI); | 1348 res = DefineAsRegister(new(zone()) LConstantI); |
| 1348 } else if (r.IsDouble()) { | 1349 } else if (r.IsDouble()) { |
| 1349 return DefineAsRegister(new(zone()) LConstantD); | 1350 res = DefineAsRegister(new(zone()) LConstantD); |
| 1350 } else if (r.IsExternal()) { | 1351 } else if (r.IsExternal()) { |
| 1351 return DefineAsRegister(new(zone()) LConstantE); | 1352 res = DefineAsRegister(new(zone()) LConstantE); |
| 1352 } else if (r.IsTagged()) { | 1353 } else if (r.IsTagged()) { |
| 1353 return DefineAsRegister(new(zone()) LConstantT); | 1354 res = DefineAsRegister(new(zone()) LConstantT); |
| 1354 } else { | 1355 } else { |
| 1355 UNREACHABLE(); | 1356 UNREACHABLE(); |
| 1356 return NULL; | 1357 res = NULL; |
| 1357 } | 1358 } |
| 1359 CacheConstant(instr, res, current_block_); |
| 1360 return res; |
| 1358 } | 1361 } |
| 1359 | 1362 |
| 1360 | 1363 |
| 1361 LInstruction* LChunkBuilder::DoContext(HContext* instr) { | 1364 LInstruction* LChunkBuilder::DoContext(HContext* instr) { |
| 1362 if (instr->HasNoUses()) return NULL; | 1365 if (instr->HasNoUses()) return NULL; |
| 1363 | 1366 |
| 1364 if (info()->IsStub()) { | 1367 if (info()->IsStub()) { |
| 1365 return DefineFixed(new(zone()) LContext, cp); | 1368 return DefineFixed(new(zone()) LContext, cp); |
| 1366 } | 1369 } |
| 1367 | 1370 |
| (...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2712 | 2715 |
| 2713 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2716 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2714 LOperand* receiver = UseRegister(instr->receiver()); | 2717 LOperand* receiver = UseRegister(instr->receiver()); |
| 2715 LOperand* function = UseRegister(instr->function()); | 2718 LOperand* function = UseRegister(instr->function()); |
| 2716 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2719 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
| 2717 return AssignEnvironment(DefineAsRegister(result)); | 2720 return AssignEnvironment(DefineAsRegister(result)); |
| 2718 } | 2721 } |
| 2719 | 2722 |
| 2720 | 2723 |
| 2721 } } // namespace v8::internal | 2724 } } // namespace v8::internal |
| OLD | NEW |