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