| Index: src/compiler/code-generator.cc
|
| diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
|
| index d1faeb07f65a02330a614070c224aa8f0250e003..7ca27ce7596e90326b26bf574a4798ac8ca8bc9e 100644
|
| --- a/src/compiler/code-generator.cc
|
| +++ b/src/compiler/code-generator.cc
|
| @@ -12,8 +12,12 @@ namespace v8 {
|
| namespace internal {
|
| namespace compiler {
|
|
|
| -CodeGenerator::CodeGenerator(InstructionSequence* code)
|
| - : code_(code),
|
| +CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
|
| + InstructionSequence* code, CompilationInfo* info)
|
| + : frame_(frame),
|
| + linkage_(linkage),
|
| + code_(code),
|
| + info_(info),
|
| current_block_(BasicBlock::RpoNumber::Invalid()),
|
| current_source_position_(SourcePosition::Invalid()),
|
| masm_(code->zone()->isolate(), NULL, 0),
|
| @@ -26,7 +30,7 @@ CodeGenerator::CodeGenerator(InstructionSequence* code)
|
|
|
|
|
| Handle<Code> CodeGenerator::GenerateCode() {
|
| - CompilationInfo* info = linkage()->info();
|
| + CompilationInfo* info = this->info();
|
|
|
| // Emit a code line info recording start event.
|
| PositionsRecorder* recorder = masm()->positions_recorder();
|
| @@ -41,10 +45,20 @@ Handle<Code> CodeGenerator::GenerateCode() {
|
| info->set_prologue_offset(masm()->pc_offset());
|
| AssemblePrologue();
|
|
|
| - // Assemble all instructions.
|
| - for (InstructionSequence::const_iterator i = code()->begin();
|
| - i != code()->end(); ++i) {
|
| - AssembleInstruction(*i);
|
| + // Assemble all non-deferred instructions.
|
| + for (auto const block : code()->instruction_blocks()) {
|
| + if (block->IsDeferred()) continue;
|
| + for (int i = block->code_start(); i < block->code_end(); ++i) {
|
| + AssembleInstruction(code()->InstructionAt(i));
|
| + }
|
| + }
|
| +
|
| + // Assemble all deferred instructions.
|
| + for (auto const block : code()->instruction_blocks()) {
|
| + if (!block->IsDeferred()) continue;
|
| + for (int i = block->code_start(); i < block->code_end(); ++i) {
|
| + AssembleInstruction(code()->InstructionAt(i));
|
| + }
|
| }
|
|
|
| FinishCode(masm());
|
| @@ -80,6 +94,12 @@ Handle<Code> CodeGenerator::GenerateCode() {
|
| }
|
|
|
|
|
| +bool CodeGenerator::IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const {
|
| + return code()->InstructionBlockAt(current_block_)->ao_number().IsNext(
|
| + code()->InstructionBlockAt(block)->ao_number());
|
| +}
|
| +
|
| +
|
| void CodeGenerator::RecordSafepoint(PointerMap* pointers, Safepoint::Kind kind,
|
| int arguments,
|
| Safepoint::DeoptMode deopt_mode) {
|
| @@ -147,7 +167,7 @@ void CodeGenerator::AssembleSourcePosition(SourcePositionInstruction* instr) {
|
| masm()->positions_recorder()->WriteRecordedPositions();
|
| if (FLAG_code_comments) {
|
| Vector<char> buffer = Vector<char>::New(256);
|
| - CompilationInfo* info = linkage()->info();
|
| + CompilationInfo* info = this->info();
|
| int ln = Script::GetLineNumber(info->script(), code_pos);
|
| int cn = Script::GetColumnNumber(info->script(), code_pos);
|
| if (info->script()->name()->IsString()) {
|
| @@ -177,7 +197,7 @@ void CodeGenerator::AssembleGap(GapInstruction* instr) {
|
|
|
|
|
| void CodeGenerator::PopulateDeoptimizationData(Handle<Code> code_object) {
|
| - CompilationInfo* info = linkage()->info();
|
| + CompilationInfo* info = this->info();
|
| int deopt_count = static_cast<int>(deoptimization_states_.size());
|
| if (deopt_count == 0) return;
|
| Handle<DeoptimizationInputData> data =
|
|
|