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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 // incoming context. | 328 // incoming context. |
| 329 __ CallRuntime(Runtime::kTraceEnter, 0); | 329 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 330 } | 330 } |
| 331 return !is_aborted(); | 331 return !is_aborted(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 | 334 |
| 335 bool LCodeGen::GenerateBody() { | 335 bool LCodeGen::GenerateBody() { |
| 336 ASSERT(is_generating()); | 336 ASSERT(is_generating()); |
| 337 bool emit_instructions = true; | 337 bool emit_instructions = true; |
| 338 | |
|
danno
2013/08/05 16:59:17
nit: please remove extraneous whitespace change.
| |
| 338 for (current_instruction_ = 0; | 339 for (current_instruction_ = 0; |
| 339 !is_aborted() && current_instruction_ < instructions_->length(); | 340 !is_aborted() && current_instruction_ < instructions_->length(); |
| 340 current_instruction_++) { | 341 current_instruction_++) { |
| 341 LInstruction* instr = instructions_->at(current_instruction_); | 342 LInstruction* instr = instructions_->at(current_instruction_); |
| 342 | 343 |
| 343 // Don't emit code for basic blocks with a replacement. | 344 // Don't emit code for basic blocks with a replacement. |
| 344 if (instr->IsLabel()) { | 345 if (instr->IsLabel()) { |
| 345 emit_instructions = !LLabel::cast(instr)->HasReplacement(); | 346 emit_instructions = !LLabel::cast(instr)->HasReplacement(); |
| 346 } | 347 } |
| 347 if (!emit_instructions) continue; | 348 if (!emit_instructions) continue; |
| 348 | 349 |
| 349 if (FLAG_code_comments && instr->HasInterestingComment(this)) { | 350 if (FLAG_code_comments && instr->HasInterestingComment(this)) { |
| 350 Comment(";;; <@%d,#%d> %s", | 351 Comment(";;; <@%d,#%d> %s", |
| 351 current_instruction_, | 352 current_instruction_, |
| 352 instr->hydrogen_value()->id(), | 353 instr->hydrogen_value()->id(), |
| 353 instr->Mnemonic()); | 354 instr->Mnemonic()); |
| 354 } | 355 } |
| 355 | 356 |
| 356 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); | 357 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); |
| 357 | 358 |
| 359 RecordAndUpdatePosition(instr->position()); | |
| 360 | |
| 358 instr->CompileToNative(this); | 361 instr->CompileToNative(this); |
| 359 | 362 |
| 360 if (!CpuFeatures::IsSupported(SSE2)) { | 363 if (!CpuFeatures::IsSupported(SSE2)) { |
| 361 if (FLAG_debug_code && FLAG_enable_slow_asserts) { | 364 if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
| 362 __ VerifyX87StackDepth(x87_stack_depth_); | 365 __ VerifyX87StackDepth(x87_stack_depth_); |
| 363 } | 366 } |
| 364 } | 367 } |
| 365 } | 368 } |
| 366 EnsureSpaceForLazyDeopt(); | 369 EnsureSpaceForLazyDeopt(); |
| 367 return !is_aborted(); | 370 return !is_aborted(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 } | 418 } |
| 416 return !is_aborted(); | 419 return !is_aborted(); |
| 417 } | 420 } |
| 418 | 421 |
| 419 | 422 |
| 420 bool LCodeGen::GenerateDeferredCode() { | 423 bool LCodeGen::GenerateDeferredCode() { |
| 421 ASSERT(is_generating()); | 424 ASSERT(is_generating()); |
| 422 if (deferred_.length() > 0) { | 425 if (deferred_.length() > 0) { |
| 423 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { | 426 for (int i = 0; !is_aborted() && i < deferred_.length(); i++) { |
| 424 LDeferredCode* code = deferred_[i]; | 427 LDeferredCode* code = deferred_[i]; |
| 428 | |
| 429 int pos = instructions_->at(code->instruction_index())->position(); | |
| 430 RecordAndUpdatePosition(pos); | |
| 431 | |
| 425 Comment(";;; <@%d,#%d> " | 432 Comment(";;; <@%d,#%d> " |
| 426 "-------------------- Deferred %s --------------------", | 433 "-------------------- Deferred %s --------------------", |
| 427 code->instruction_index(), | 434 code->instruction_index(), |
| 428 code->instr()->hydrogen_value()->id(), | 435 code->instr()->hydrogen_value()->id(), |
| 429 code->instr()->Mnemonic()); | 436 code->instr()->Mnemonic()); |
| 430 __ bind(code->entry()); | 437 __ bind(code->entry()); |
| 431 if (NeedsDeferredFrame()) { | 438 if (NeedsDeferredFrame()) { |
| 432 Comment(";;; Build frame"); | 439 Comment(";;; Build frame"); |
| 433 ASSERT(!frame_is_built_); | 440 ASSERT(!frame_is_built_); |
| 434 ASSERT(info()->IsStub()); | 441 ASSERT(info()->IsStub()); |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1161 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments, mode); | 1168 RecordSafepoint(pointers, Safepoint::kWithRegisters, arguments, mode); |
| 1162 } | 1169 } |
| 1163 | 1170 |
| 1164 | 1171 |
| 1165 void LCodeGen::RecordPosition(int position) { | 1172 void LCodeGen::RecordPosition(int position) { |
| 1166 if (position == RelocInfo::kNoPosition) return; | 1173 if (position == RelocInfo::kNoPosition) return; |
| 1167 masm()->positions_recorder()->RecordPosition(position); | 1174 masm()->positions_recorder()->RecordPosition(position); |
| 1168 } | 1175 } |
| 1169 | 1176 |
| 1170 | 1177 |
| 1178 void LCodeGen::RecordAndUpdatePosition(int position) { | |
|
danno
2013/08/05 16:59:17
Don't you need this in the ARM implementation, too
| |
| 1179 if (position >= 0 && position != old_position_) { | |
| 1180 masm()->positions_recorder()->RecordPosition(position); | |
| 1181 old_position_ = position; | |
| 1182 } | |
| 1183 } | |
| 1184 | |
| 1185 | |
| 1171 static const char* LabelType(LLabel* label) { | 1186 static const char* LabelType(LLabel* label) { |
| 1172 if (label->is_loop_header()) return " (loop header)"; | 1187 if (label->is_loop_header()) return " (loop header)"; |
| 1173 if (label->is_osr_entry()) return " (OSR entry)"; | 1188 if (label->is_osr_entry()) return " (OSR entry)"; |
| 1174 return ""; | 1189 return ""; |
| 1175 } | 1190 } |
| 1176 | 1191 |
| 1177 | 1192 |
| 1178 void LCodeGen::DoLabel(LLabel* label) { | 1193 void LCodeGen::DoLabel(LLabel* label) { |
| 1179 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", | 1194 Comment(";;; <@%d,#%d> -------------------- B%d%s --------------------", |
| 1180 current_instruction_, | 1195 current_instruction_, |
| (...skipping 5330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6511 FixedArray::kHeaderSize - kPointerSize)); | 6526 FixedArray::kHeaderSize - kPointerSize)); |
| 6512 __ bind(&done); | 6527 __ bind(&done); |
| 6513 } | 6528 } |
| 6514 | 6529 |
| 6515 | 6530 |
| 6516 #undef __ | 6531 #undef __ |
| 6517 | 6532 |
| 6518 } } // namespace v8::internal | 6533 } } // namespace v8::internal |
| 6519 | 6534 |
| 6520 #endif // V8_TARGET_ARCH_IA32 | 6535 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |