| 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/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/linkage.h" | 8 #include "src/compiler/linkage.h" |
| 9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 | 32 |
| 33 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, | 33 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
| 34 InstructionSequence* code, CompilationInfo* info) | 34 InstructionSequence* code, CompilationInfo* info) |
| 35 : frame_(frame), | 35 : frame_(frame), |
| 36 linkage_(linkage), | 36 linkage_(linkage), |
| 37 code_(code), | 37 code_(code), |
| 38 info_(info), | 38 info_(info), |
| 39 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), | 39 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), |
| 40 current_block_(RpoNumber::Invalid()), | 40 current_block_(RpoNumber::Invalid()), |
| 41 current_source_position_(SourcePosition::Invalid()), | 41 current_source_position_(SourcePosition::Unknown()), |
| 42 masm_(info->isolate(), NULL, 0), | 42 masm_(info->isolate(), NULL, 0), |
| 43 resolver_(this), | 43 resolver_(this), |
| 44 safepoints_(code->zone()), | 44 safepoints_(code->zone()), |
| 45 handlers_(code->zone()), | 45 handlers_(code->zone()), |
| 46 deoptimization_states_(code->zone()), | 46 deoptimization_states_(code->zone()), |
| 47 deoptimization_literals_(code->zone()), | 47 deoptimization_literals_(code->zone()), |
| 48 translations_(code->zone()), | 48 translations_(code->zone()), |
| 49 last_lazy_deopt_pc_(0), | 49 last_lazy_deopt_pc_(0), |
| 50 jump_tables_(nullptr), | 50 jump_tables_(nullptr), |
| 51 ools_(nullptr), | 51 ools_(nullptr), |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // Assemble a boolean materialization after this instruction. | 249 // Assemble a boolean materialization after this instruction. |
| 250 AssembleArchBoolean(instr, condition); | 250 AssembleArchBoolean(instr, condition); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 | 254 |
| 255 void CodeGenerator::AssembleSourcePosition(Instruction* instr) { | 255 void CodeGenerator::AssembleSourcePosition(Instruction* instr) { |
| 256 SourcePosition source_position; | 256 SourcePosition source_position; |
| 257 if (!code()->GetSourcePosition(instr, &source_position)) return; | 257 if (!code()->GetSourcePosition(instr, &source_position)) return; |
| 258 if (source_position == current_source_position_) return; | 258 if (source_position == current_source_position_) return; |
| 259 DCHECK(!source_position.IsInvalid()); | |
| 260 current_source_position_ = source_position; | 259 current_source_position_ = source_position; |
| 261 if (source_position.IsUnknown()) return; | 260 if (source_position.IsUnknown()) return; |
| 262 int code_pos = source_position.raw(); | 261 int code_pos = source_position.raw(); |
| 263 masm()->positions_recorder()->RecordPosition(source_position.raw()); | 262 masm()->positions_recorder()->RecordPosition(code_pos); |
| 264 masm()->positions_recorder()->WriteRecordedPositions(); | 263 masm()->positions_recorder()->WriteRecordedPositions(); |
| 265 if (FLAG_code_comments) { | 264 if (FLAG_code_comments) { |
| 266 Vector<char> buffer = Vector<char>::New(256); | 265 Vector<char> buffer = Vector<char>::New(256); |
| 267 CompilationInfo* info = this->info(); | 266 CompilationInfo* info = this->info(); |
| 268 int ln = Script::GetLineNumber(info->script(), code_pos); | 267 int ln = Script::GetLineNumber(info->script(), code_pos); |
| 269 int cn = Script::GetColumnNumber(info->script(), code_pos); | 268 int cn = Script::GetColumnNumber(info->script(), code_pos); |
| 270 if (info->script()->name()->IsString()) { | 269 if (info->script()->name()->IsString()) { |
| 271 Handle<String> file(String::cast(info->script()->name())); | 270 Handle<String> file(String::cast(info->script()->name())); |
| 272 base::OS::SNPrintF(buffer.start(), buffer.length(), "-- %s:%d:%d --", | 271 base::OS::SNPrintF(buffer.start(), buffer.length(), "-- %s:%d:%d --", |
| 273 file->ToCString().get(), ln, cn); | 272 file->ToCString().get(), ln, cn); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 : masm_(gen->masm()), next_(gen->ools_) { | 661 : masm_(gen->masm()), next_(gen->ools_) { |
| 663 gen->ools_ = this; | 662 gen->ools_ = this; |
| 664 } | 663 } |
| 665 | 664 |
| 666 | 665 |
| 667 OutOfLineCode::~OutOfLineCode() {} | 666 OutOfLineCode::~OutOfLineCode() {} |
| 668 | 667 |
| 669 } // namespace compiler | 668 } // namespace compiler |
| 670 } // namespace internal | 669 } // namespace internal |
| 671 } // namespace v8 | 670 } // namespace v8 |
| OLD | NEW |