| 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/crankshaft/lithium-codegen.h" | 5 #include "src/crankshaft/lithium-codegen.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
| 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT | 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #endif | 38 #endif |
| 39 | 39 |
| 40 namespace v8 { | 40 namespace v8 { |
| 41 namespace internal { | 41 namespace internal { |
| 42 | 42 |
| 43 | 43 |
| 44 HGraph* LCodeGenBase::graph() const { | 44 HGraph* LCodeGenBase::graph() const { |
| 45 return chunk()->graph(); | 45 return chunk()->graph(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 | |
| 49 LCodeGenBase::LCodeGenBase(LChunk* chunk, MacroAssembler* assembler, | 48 LCodeGenBase::LCodeGenBase(LChunk* chunk, MacroAssembler* assembler, |
| 50 CompilationInfo* info) | 49 CompilationInfo* info) |
| 51 : chunk_(static_cast<LPlatformChunk*>(chunk)), | 50 : chunk_(static_cast<LPlatformChunk*>(chunk)), |
| 52 masm_(assembler), | 51 masm_(assembler), |
| 53 info_(info), | 52 info_(info), |
| 54 zone_(info->zone()), | 53 zone_(info->zone()), |
| 55 status_(UNUSED), | 54 status_(UNUSED), |
| 56 current_block_(-1), | 55 current_block_(-1), |
| 57 current_instruction_(-1), | 56 current_instruction_(-1), |
| 58 instructions_(chunk->instructions()), | 57 instructions_(chunk->instructions()), |
| 59 deoptimizations_(4, info->zone()), | 58 deoptimizations_(4, info->zone()), |
| 60 deoptimization_literals_(8, info->zone()), | 59 deoptimization_literals_(8, info->zone()), |
| 61 translations_(info->zone()), | 60 translations_(info->zone()), |
| 62 inlined_function_count_(0), | 61 inlined_function_count_(0), |
| 63 last_lazy_deopt_pc_(0), | 62 last_lazy_deopt_pc_(0), |
| 64 osr_pc_offset_(-1) {} | 63 osr_pc_offset_(-1), |
| 65 | 64 source_position_table_builder_(info->isolate(), info->zone()) {} |
| 66 | 65 |
| 67 bool LCodeGenBase::GenerateBody() { | 66 bool LCodeGenBase::GenerateBody() { |
| 68 DCHECK(is_generating()); | 67 DCHECK(is_generating()); |
| 69 bool emit_instructions = true; | 68 bool emit_instructions = true; |
| 70 LCodeGen* codegen = static_cast<LCodeGen*>(this); | 69 LCodeGen* codegen = static_cast<LCodeGen*>(this); |
| 71 for (current_instruction_ = 0; | 70 for (current_instruction_ = 0; |
| 72 !is_aborted() && current_instruction_ < instructions_->length(); | 71 !is_aborted() && current_instruction_ < instructions_->length(); |
| 73 current_instruction_++) { | 72 current_instruction_++) { |
| 74 LInstruction* instr = instructions_->at(current_instruction_); | 73 LInstruction* instr = instructions_->at(current_instruction_); |
| 75 | 74 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 129 } |
| 131 | 130 |
| 132 if (instr->HasEnvironment() && !instr->environment()->has_been_used()) { | 131 if (instr->HasEnvironment() && !instr->environment()->has_been_used()) { |
| 133 V8_Fatal(__FILE__, __LINE__, "unused environment for %s (%s)", | 132 V8_Fatal(__FILE__, __LINE__, "unused environment for %s (%s)", |
| 134 hinstr->Mnemonic(), instr->Mnemonic()); | 133 hinstr->Mnemonic(), instr->Mnemonic()); |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 #endif | 136 #endif |
| 138 } | 137 } |
| 139 | 138 |
| 139 void LCodeGenBase::RecordAndWritePosition(int pos) { |
| 140 if (pos == RelocInfo::kNoPosition) return; |
| 141 source_position_table_builder_.AddPosition(masm_->pc_offset(), pos, false); |
| 142 } |
| 140 | 143 |
| 141 void LCodeGenBase::Comment(const char* format, ...) { | 144 void LCodeGenBase::Comment(const char* format, ...) { |
| 142 if (!FLAG_code_comments) return; | 145 if (!FLAG_code_comments) return; |
| 143 char buffer[4 * KB]; | 146 char buffer[4 * KB]; |
| 144 StringBuilder builder(buffer, arraysize(buffer)); | 147 StringBuilder builder(buffer, arraysize(buffer)); |
| 145 va_list arguments; | 148 va_list arguments; |
| 146 va_start(arguments, format); | 149 va_start(arguments, format); |
| 147 builder.AddFormattedList(format, arguments); | 150 builder.AddFormattedList(format, arguments); |
| 148 va_end(arguments); | 151 va_end(arguments); |
| 149 | 152 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 DefineDeoptimizationLiteral(handle(function->code())); | 367 DefineDeoptimizationLiteral(handle(function->code())); |
| 365 } | 368 } |
| 366 } | 369 } |
| 367 | 370 |
| 368 Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo( | 371 Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo( |
| 369 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason, int deopt_id) { | 372 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason, int deopt_id) { |
| 370 Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(), | 373 Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(), |
| 371 deopt_reason, deopt_id); | 374 deopt_reason, deopt_id); |
| 372 return deopt_info; | 375 return deopt_info; |
| 373 } | 376 } |
| 377 |
| 374 } // namespace internal | 378 } // namespace internal |
| 375 } // namespace v8 | 379 } // namespace v8 |
| OLD | NEW |