| 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 "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/address-map.h" | 7 #include "src/address-map.h" |
| 8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
| 9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
| 10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (adjust_stack) AssembleTailCallBeforeGap(instr, first_unused_stack_slot); | 410 if (adjust_stack) AssembleTailCallBeforeGap(instr, first_unused_stack_slot); |
| 411 AssembleGaps(instr); | 411 AssembleGaps(instr); |
| 412 if (adjust_stack) AssembleTailCallAfterGap(instr, first_unused_stack_slot); | 412 if (adjust_stack) AssembleTailCallAfterGap(instr, first_unused_stack_slot); |
| 413 DCHECK_IMPLIES( | 413 DCHECK_IMPLIES( |
| 414 block->must_deconstruct_frame(), | 414 block->must_deconstruct_frame(), |
| 415 instr != code()->InstructionAt(block->last_instruction_index()) || | 415 instr != code()->InstructionAt(block->last_instruction_index()) || |
| 416 instr->IsRet() || instr->IsJump()); | 416 instr->IsRet() || instr->IsJump()); |
| 417 if (instr->IsJump() && block->must_deconstruct_frame()) { | 417 if (instr->IsJump() && block->must_deconstruct_frame()) { |
| 418 AssembleDeconstructFrame(); | 418 AssembleDeconstructFrame(); |
| 419 } | 419 } |
| 420 AssembleSourcePosition(instr); | 420 FlagsMode mode = FlagsModeField::decode(instr->opcode()); |
| 421 if (mode != kFlags_trap) { |
| 422 AssembleSourcePosition(instr); |
| 423 } |
| 421 // Assemble architecture-specific code for the instruction. | 424 // Assemble architecture-specific code for the instruction. |
| 422 CodeGenResult result = AssembleArchInstruction(instr); | 425 CodeGenResult result = AssembleArchInstruction(instr); |
| 423 if (result != kSuccess) return result; | 426 if (result != kSuccess) return result; |
| 424 | 427 |
| 425 FlagsMode mode = FlagsModeField::decode(instr->opcode()); | |
| 426 FlagsCondition condition = FlagsConditionField::decode(instr->opcode()); | 428 FlagsCondition condition = FlagsConditionField::decode(instr->opcode()); |
| 427 switch (mode) { | 429 switch (mode) { |
| 428 case kFlags_branch: { | 430 case kFlags_branch: { |
| 429 // Assemble a branch after this instruction. | 431 // Assemble a branch after this instruction. |
| 430 InstructionOperandConverter i(this, instr); | 432 InstructionOperandConverter i(this, instr); |
| 431 RpoNumber true_rpo = i.InputRpo(instr->InputCount() - 2); | 433 RpoNumber true_rpo = i.InputRpo(instr->InputCount() - 2); |
| 432 RpoNumber false_rpo = i.InputRpo(instr->InputCount() - 1); | 434 RpoNumber false_rpo = i.InputRpo(instr->InputCount() - 1); |
| 433 | 435 |
| 434 if (true_rpo == false_rpo) { | 436 if (true_rpo == false_rpo) { |
| 435 // redundant branch. | 437 // redundant branch. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // Assemble architecture-specific branch. | 469 // Assemble architecture-specific branch. |
| 468 AssembleArchBranch(instr, &branch); | 470 AssembleArchBranch(instr, &branch); |
| 469 masm()->bind(&continue_label); | 471 masm()->bind(&continue_label); |
| 470 break; | 472 break; |
| 471 } | 473 } |
| 472 case kFlags_set: { | 474 case kFlags_set: { |
| 473 // Assemble a boolean materialization after this instruction. | 475 // Assemble a boolean materialization after this instruction. |
| 474 AssembleArchBoolean(instr, condition); | 476 AssembleArchBoolean(instr, condition); |
| 475 break; | 477 break; |
| 476 } | 478 } |
| 479 case kFlags_trap: { |
| 480 AssembleArchTrap(instr, condition); |
| 481 break; |
| 482 } |
| 477 case kFlags_none: { | 483 case kFlags_none: { |
| 478 break; | 484 break; |
| 479 } | 485 } |
| 480 } | 486 } |
| 481 return kSuccess; | 487 return kSuccess; |
| 482 } | 488 } |
| 483 | 489 |
| 484 | 490 |
| 485 void CodeGenerator::AssembleSourcePosition(Instruction* instr) { | 491 void CodeGenerator::AssembleSourcePosition(Instruction* instr) { |
| 486 SourcePosition source_position = SourcePosition::Unknown(); | 492 SourcePosition source_position = SourcePosition::Unknown(); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 986 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
| 981 gen->ools_ = this; | 987 gen->ools_ = this; |
| 982 } | 988 } |
| 983 | 989 |
| 984 | 990 |
| 985 OutOfLineCode::~OutOfLineCode() {} | 991 OutOfLineCode::~OutOfLineCode() {} |
| 986 | 992 |
| 987 } // namespace compiler | 993 } // namespace compiler |
| 988 } // namespace internal | 994 } // namespace internal |
| 989 } // namespace v8 | 995 } // namespace v8 |
| OLD | NEW |