OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/interpreter/bytecode-register-optimizer.h" | 5 #include "src/interpreter/bytecode-register-optimizer.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 flush_required_ = false; | 305 flush_required_ = false; |
306 } | 306 } |
307 | 307 |
308 void BytecodeRegisterOptimizer::WriteToNextStage(BytecodeNode* node) const { | 308 void BytecodeRegisterOptimizer::WriteToNextStage(BytecodeNode* node) const { |
309 next_stage_->Write(node); | 309 next_stage_->Write(node); |
310 } | 310 } |
311 | 311 |
312 void BytecodeRegisterOptimizer::WriteToNextStage( | 312 void BytecodeRegisterOptimizer::WriteToNextStage( |
313 BytecodeNode* node, const BytecodeSourceInfo& source_info) const { | 313 BytecodeNode* node, const BytecodeSourceInfo& source_info) const { |
314 node->source_info().Update(source_info); | 314 if (source_info.is_valid()) { |
| 315 node->source_info().MakeInvalidEqualTo(source_info); |
| 316 } |
315 next_stage_->Write(node); | 317 next_stage_->Write(node); |
316 } | 318 } |
317 | 319 |
318 void BytecodeRegisterOptimizer::OutputRegisterTransfer( | 320 void BytecodeRegisterOptimizer::OutputRegisterTransfer( |
319 RegisterInfo* input_info, RegisterInfo* output_info, | 321 RegisterInfo* input_info, RegisterInfo* output_info, |
320 const BytecodeSourceInfo& source_info) { | 322 const BytecodeSourceInfo& source_info) { |
321 Register input = input_info->register_value(); | 323 Register input = input_info->register_value(); |
322 Register output = output_info->register_value(); | 324 Register output = output_info->register_value(); |
323 DCHECK_NE(input.index(), output.index()); | 325 DCHECK_NE(input.index(), output.index()); |
324 | 326 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 RegisterInfo* materialized_info = input_info->GetMaterializedEquivalent(); | 408 RegisterInfo* materialized_info = input_info->GetMaterializedEquivalent(); |
407 OutputRegisterTransfer(materialized_info, output_info, source_info); | 409 OutputRegisterTransfer(materialized_info, output_info, source_info); |
408 } else if (source_info.is_valid()) { | 410 } else if (source_info.is_valid()) { |
409 // Emit a placeholder nop to maintain source position info. | 411 // Emit a placeholder nop to maintain source position info. |
410 EmitNopForSourceInfo(source_info); | 412 EmitNopForSourceInfo(source_info); |
411 } | 413 } |
412 } | 414 } |
413 | 415 |
414 void BytecodeRegisterOptimizer::EmitNopForSourceInfo( | 416 void BytecodeRegisterOptimizer::EmitNopForSourceInfo( |
415 const BytecodeSourceInfo& source_info) const { | 417 const BytecodeSourceInfo& source_info) const { |
| 418 DCHECK(source_info.is_valid()); |
416 BytecodeNode nop(Bytecode::kNop); | 419 BytecodeNode nop(Bytecode::kNop); |
417 nop.source_info().Update(source_info); | 420 nop.source_info().MakeInvalidEqualTo(source_info); |
418 WriteToNextStage(&nop); | 421 WriteToNextStage(&nop); |
419 } | 422 } |
420 | 423 |
421 void BytecodeRegisterOptimizer::DoLdar(const BytecodeNode* const node) { | 424 void BytecodeRegisterOptimizer::DoLdar(const BytecodeNode* const node) { |
422 Register input = GetRegisterInputOperand( | 425 Register input = GetRegisterInputOperand( |
423 0, node->bytecode(), node->operands(), node->operand_count()); | 426 0, node->bytecode(), node->operands(), node->operand_count()); |
424 RegisterInfo* input_info = GetRegisterInfo(input); | 427 RegisterInfo* input_info = GetRegisterInfo(input); |
425 RegisterTransfer(input_info, accumulator_info_, node->source_info()); | 428 RegisterTransfer(input_info, accumulator_info_, node->source_info()); |
426 } | 429 } |
427 | 430 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 if (info->materialized()) { | 620 if (info->materialized()) { |
618 CreateMaterializedEquivalent(info); | 621 CreateMaterializedEquivalent(info); |
619 } | 622 } |
620 info->MoveToNewEquivalenceSet(kInvalidEquivalenceId, false); | 623 info->MoveToNewEquivalenceSet(kInvalidEquivalenceId, false); |
621 } | 624 } |
622 } | 625 } |
623 | 626 |
624 } // namespace interpreter | 627 } // namespace interpreter |
625 } // namespace internal | 628 } // namespace internal |
626 } // namespace v8 | 629 } // namespace v8 |
OLD | NEW |