| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return AssembleArchBranch(instr, condition); | 129 return AssembleArchBranch(instr, condition); |
| 130 } | 130 } |
| 131 UNREACHABLE(); | 131 UNREACHABLE(); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 | 135 |
| 136 void CodeGenerator::AssembleSourcePosition(SourcePositionInstruction* instr) { | 136 void CodeGenerator::AssembleSourcePosition(SourcePositionInstruction* instr) { |
| 137 SourcePosition source_position = instr->source_position(); | 137 SourcePosition source_position = instr->source_position(); |
| 138 if (source_position == current_source_position_) return; | 138 if (source_position == current_source_position_) return; |
| 139 ASSERT(!source_position.IsInvalid()); | 139 DCHECK(!source_position.IsInvalid()); |
| 140 if (!source_position.IsUnknown()) { | 140 if (!source_position.IsUnknown()) { |
| 141 int code_pos = source_position.raw(); | 141 int code_pos = source_position.raw(); |
| 142 masm()->positions_recorder()->RecordPosition(source_position.raw()); | 142 masm()->positions_recorder()->RecordPosition(source_position.raw()); |
| 143 masm()->positions_recorder()->WriteRecordedPositions(); | 143 masm()->positions_recorder()->WriteRecordedPositions(); |
| 144 if (FLAG_code_comments) { | 144 if (FLAG_code_comments) { |
| 145 Vector<char> buffer = Vector<char>::New(256); | 145 Vector<char> buffer = Vector<char>::New(256); |
| 146 CompilationInfo* info = linkage()->info(); | 146 CompilationInfo* info = linkage()->info(); |
| 147 int ln = Script::GetLineNumber(info->script(), code_pos); | 147 int ln = Script::GetLineNumber(info->script(), code_pos); |
| 148 int cn = Script::GetColumnNumber(info->script(), code_pos); | 148 int cn = Script::GetColumnNumber(info->script(), code_pos); |
| 149 if (info->script()->name()->IsString()) { | 149 if (info->script()->name()->IsString()) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 FrameStateDescriptor descriptor = code()->GetDeoptimizationEntry(i); | 216 FrameStateDescriptor descriptor = code()->GetDeoptimizationEntry(i); |
| 217 data->SetAstId(i, descriptor.bailout_id()); | 217 data->SetAstId(i, descriptor.bailout_id()); |
| 218 data->SetTranslationIndex(i, Smi::FromInt(0)); | 218 data->SetTranslationIndex(i, Smi::FromInt(0)); |
| 219 data->SetArgumentsStackHeight(i, Smi::FromInt(0)); | 219 data->SetArgumentsStackHeight(i, Smi::FromInt(0)); |
| 220 data->SetPc(i, Smi::FromInt(-1)); | 220 data->SetPc(i, Smi::FromInt(-1)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Populate the return address patcher entries. | 223 // Populate the return address patcher entries. |
| 224 for (int i = 0; i < patch_count; ++i) { | 224 for (int i = 0; i < patch_count; ++i) { |
| 225 LazyDeoptimizationEntry entry = lazy_deoptimization_entries_[i]; | 225 LazyDeoptimizationEntry entry = lazy_deoptimization_entries_[i]; |
| 226 ASSERT(entry.position_after_call() == entry.continuation()->pos() || | 226 DCHECK(entry.position_after_call() == entry.continuation()->pos() || |
| 227 IsNopForSmiCodeInlining(code_object, entry.position_after_call(), | 227 IsNopForSmiCodeInlining(code_object, entry.position_after_call(), |
| 228 entry.continuation()->pos())); | 228 entry.continuation()->pos())); |
| 229 data->SetReturnAddressPc(i, Smi::FromInt(entry.position_after_call())); | 229 data->SetReturnAddressPc(i, Smi::FromInt(entry.position_after_call())); |
| 230 data->SetPatchedAddressPc(i, Smi::FromInt(entry.deoptimization()->pos())); | 230 data->SetPatchedAddressPc(i, Smi::FromInt(entry.deoptimization()->pos())); |
| 231 } | 231 } |
| 232 | 232 |
| 233 code_object->set_deoptimization_data(*data); | 233 code_object->set_deoptimization_data(*data); |
| 234 } | 234 } |
| 235 | 235 |
| 236 | 236 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 260 if (deoptimization_literals_[i].is_identical_to(literal)) return i; | 260 if (deoptimization_literals_[i].is_identical_to(literal)) return i; |
| 261 } | 261 } |
| 262 deoptimization_literals_.push_back(literal); | 262 deoptimization_literals_.push_back(literal); |
| 263 return result; | 263 return result; |
| 264 } | 264 } |
| 265 | 265 |
| 266 | 266 |
| 267 void CodeGenerator::BuildTranslation(Instruction* instr, | 267 void CodeGenerator::BuildTranslation(Instruction* instr, |
| 268 int deoptimization_id) { | 268 int deoptimization_id) { |
| 269 // We should build translation only once. | 269 // We should build translation only once. |
| 270 ASSERT_EQ(NULL, deoptimization_states_[deoptimization_id]); | 270 DCHECK_EQ(NULL, deoptimization_states_[deoptimization_id]); |
| 271 | 271 |
| 272 // TODO(jarin) This should build translation codes from the instruction inputs | 272 // TODO(jarin) This should build translation codes from the instruction inputs |
| 273 // and from the framestate descriptor. At the moment, we only create a dummy | 273 // and from the framestate descriptor. At the moment, we only create a dummy |
| 274 // translation. | 274 // translation. |
| 275 | 275 |
| 276 FrameStateDescriptor descriptor = | 276 FrameStateDescriptor descriptor = |
| 277 code()->GetDeoptimizationEntry(deoptimization_id); | 277 code()->GetDeoptimizationEntry(deoptimization_id); |
| 278 Translation translation(&translations_, 1, 1, zone()); | 278 Translation translation(&translations_, 1, 1, zone()); |
| 279 translation.BeginJSFrame(descriptor.bailout_id(), Translation::kSelfLiteralId, | 279 translation.BeginJSFrame(descriptor.bailout_id(), Translation::kSelfLiteralId, |
| 280 0); | 280 0); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 return false; | 333 return false; |
| 334 } | 334 } |
| 335 #endif | 335 #endif |
| 336 | 336 |
| 337 #endif | 337 #endif |
| 338 | 338 |
| 339 | 339 |
| 340 } // namespace compiler | 340 } // namespace compiler |
| 341 } // namespace internal | 341 } // namespace internal |
| 342 } // namespace v8 | 342 } // namespace v8 |
| OLD | NEW |