Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 if (FLAG_trace && info()->IsOptimizing()) { | 249 if (FLAG_trace && info()->IsOptimizing()) { |
| 250 __ CallRuntime(Runtime::kTraceEnter, 0); | 250 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 251 } | 251 } |
| 252 return !is_aborted(); | 252 return !is_aborted(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 | 255 |
| 256 bool LCodeGen::GenerateBody() { | 256 bool LCodeGen::GenerateBody() { |
| 257 ASSERT(is_generating()); | 257 ASSERT(is_generating()); |
| 258 bool emit_instructions = true; | 258 bool emit_instructions = true; |
| 259 int old_position = RelocInfo::kNoPosition; | |
| 259 for (current_instruction_ = 0; | 260 for (current_instruction_ = 0; |
| 260 !is_aborted() && current_instruction_ < instructions_->length(); | 261 !is_aborted() && current_instruction_ < instructions_->length(); |
| 261 current_instruction_++) { | 262 current_instruction_++) { |
| 262 LInstruction* instr = instructions_->at(current_instruction_); | 263 LInstruction* instr = instructions_->at(current_instruction_); |
| 263 | 264 |
| 264 // Don't emit code for basic blocks with a replacement. | 265 // Don't emit code for basic blocks with a replacement. |
| 265 if (instr->IsLabel()) { | 266 if (instr->IsLabel()) { |
| 266 emit_instructions = !LLabel::cast(instr)->HasReplacement(); | 267 emit_instructions = !LLabel::cast(instr)->HasReplacement(); |
| 267 } | 268 } |
| 268 if (!emit_instructions) continue; | 269 if (!emit_instructions) continue; |
| 269 | 270 |
| 270 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 271 if (FLAG_code_comments && instr->HasInterestingComment(this)) { |
| 271 Comment(";;; <@%d,#%d> %s", | 272 Comment(";;; <@%d,#%d> %s", |
| 272 current_instruction_, | 273 current_instruction_, |
| 273 instr->hydrogen_value()->id(), | 274 instr->hydrogen_value()->id(), |
| 274 instr->Mnemonic()); | 275 instr->Mnemonic()); |
| 275 } | 276 } |
| 276 | 277 |
| 278 int pos = instr->position(); | |
| 279 if (pos >= 0 && pos != old_position) { | |
| 280 RecordPosition(pos); | |
| 281 old_position = pos; | |
| 282 } | |
| 283 | |
| 277 instr->CompileToNative(this); | 284 instr->CompileToNative(this); |
| 278 } | 285 } |
| 279 EnsureSpaceForLazyDeopt(); | 286 EnsureSpaceForLazyDeopt(); |
| 280 last_lazy_deopt_pc_ = masm()->pc_offset(); | 287 last_lazy_deopt_pc_ = masm()->pc_offset(); |
| 281 return !is_aborted(); | 288 return !is_aborted(); |
| 282 } | 289 } |
| 283 | 290 |
| 284 | 291 |
| 285 bool LCodeGen::GenerateDeferredCode() { | 292 bool LCodeGen::GenerateDeferredCode() { |
| 286 ASSERT(is_generating()); | 293 ASSERT(is_generating()); |
| 287 if (deferred_.length() > 0) { | 294 if (deferred_.length() > 0) { |
| 288 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 295 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
| 289 LDeferredCode* code = deferred_[i]; | 296 LDeferredCode* code = deferred_[i]; |
| 297 | |
| 298 int pos = instructions_->at(code->instruction_index())->position(); | |
| 299 if (pos >=0) RecordPosition(pos); | |
|
danno
2013/08/02 10:53:16
Since code is ouput linearly, I think it makes sen
| |
| 300 | |
| 290 Comment(";;; <@%d,#%d> " | 301 Comment(";;; <@%d,#%d> " |
| 291 "-------------------- Deferred %s --------------------", | 302 "-------------------- Deferred %s --------------------", |
| 292 code->instruction_index(), | 303 code->instruction_index(), |
| 293 code->instr()->hydrogen_value()->id(), | 304 code->instr()->hydrogen_value()->id(), |
| 294 code->instr()->Mnemonic()); | 305 code->instr()->Mnemonic()); |
| 295 __ bind(code->entry()); | 306 __ bind(code->entry()); |
| 296 if (NeedsDeferredFrame()) { | 307 if (NeedsDeferredFrame()) { |
| 297 Comment(";;; Build frame"); | 308 Comment(";;; Build frame"); |
| 298 ASSERT(!frame_is_built_); | 309 ASSERT(!frame_is_built_); |
| 299 ASSERT(info()->IsStub()); | 310 ASSERT(info()->IsStub()); |
| (...skipping 5531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5831 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); | 5842 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); |
| 5832 __ ldr(result, FieldMemOperand(scratch, | 5843 __ ldr(result, FieldMemOperand(scratch, |
| 5833 FixedArray::kHeaderSize - kPointerSize)); | 5844 FixedArray::kHeaderSize - kPointerSize)); |
| 5834 __ bind(&done); | 5845 __ bind(&done); |
| 5835 } | 5846 } |
| 5836 | 5847 |
| 5837 | 5848 |
| 5838 #undef __ | 5849 #undef __ |
| 5839 | 5850 |
| 5840 } } // namespace v8::internal | 5851 } } // namespace v8::internal |
| OLD | NEW |