Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: src/x64/lithium-codegen-x64.cc

Issue 22876009: Improve and simplify removal of unreachable code (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix ia32 Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 !is_aborted() && current_instruction_ < instructions_->length(); 264 !is_aborted() && current_instruction_ < instructions_->length();
265 current_instruction_++) { 265 current_instruction_++) {
266 LInstruction* instr = instructions_->at(current_instruction_); 266 LInstruction* instr = instructions_->at(current_instruction_);
267 267
268 // Don't emit code for basic blocks with a replacement. 268 // Don't emit code for basic blocks with a replacement.
269 if (instr->IsLabel()) { 269 if (instr->IsLabel()) {
270 emit_instructions = !LLabel::cast(instr)->HasReplacement(); 270 emit_instructions = !LLabel::cast(instr)->HasReplacement();
271 } 271 }
272 if (!emit_instructions) continue; 272 if (!emit_instructions) continue;
273 273
274 if (FLAG_code_comments && instr->HasInterestingComment(this)) { 274 if (instr->hydrogen_value()->block()->IsReachable()) {
275 Comment(";;; <@%d,#%d> %s", 275 if (FLAG_code_comments && instr->HasInterestingComment(this)) {
276 current_instruction_, 276 Comment(";;; <@%d,#%d> %s",
277 instr->hydrogen_value()->id(), 277 current_instruction_,
278 instr->Mnemonic()); 278 instr->hydrogen_value()->id(),
279 instr->Mnemonic());
280 }
281
282 RecordAndUpdatePosition(instr->position());
283
284 instr->CompileToNative(this);
285 } else {
286 if (FLAG_code_comments && instr->IsLabel()) {
287 Comment(
288 ";;; <@%d,#%d> -------------------- B%d (unreachable/elided) "
289 "--------------------",
290 current_instruction_,
291 instr->hydrogen_value()->id(),
292 instr->hydrogen_value()->block()->block_id());
293 }
279 } 294 }
280
281 RecordAndUpdatePosition(instr->position());
282
283 instr->CompileToNative(this);
284 } 295 }
285 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); 296 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size());
286 return !is_aborted(); 297 return !is_aborted();
287 } 298 }
288 299
289 300
290 bool LCodeGen::GenerateJumpTable() { 301 bool LCodeGen::GenerateJumpTable() {
291 Label needs_frame; 302 Label needs_frame;
292 if (jump_table_.length() > 0) { 303 if (jump_table_.length() > 0) {
293 Comment(";;; -------------------- Jump table --------------------"); 304 Comment(";;; -------------------- Jump table --------------------");
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 ASSERT(ToRegister(instr->result()).is(rax)); 1876 ASSERT(ToRegister(instr->result()).is(rax));
1866 1877
1867 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 1878 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
1868 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 1879 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
1869 __ nop(); // Signals no inlined code. 1880 __ nop(); // Signals no inlined code.
1870 } 1881 }
1871 1882
1872 1883
1873 int LCodeGen::GetNextEmittedBlock() const { 1884 int LCodeGen::GetNextEmittedBlock() const {
1874 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 1885 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
1886 if (!graph()->blocks()->at(i)->IsReachable()) continue;
1875 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 1887 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
1876 } 1888 }
1877 return -1; 1889 return -1;
1878 } 1890 }
1879 1891
1880 1892
1881 template<class InstrType> 1893 template<class InstrType>
1882 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 1894 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
1883 int left_block = instr->TrueDestination(chunk_); 1895 int left_block = instr->TrueDestination(chunk_);
1884 int right_block = instr->FalseDestination(chunk_); 1896 int right_block = instr->FalseDestination(chunk_);
(...skipping 3625 matching lines...) Expand 10 before | Expand all | Expand 10 after
5510 FixedArray::kHeaderSize - kPointerSize)); 5522 FixedArray::kHeaderSize - kPointerSize));
5511 __ bind(&done); 5523 __ bind(&done);
5512 } 5524 }
5513 5525
5514 5526
5515 #undef __ 5527 #undef __
5516 5528
5517 } } // namespace v8::internal 5529 } } // namespace v8::internal
5518 5530
5519 #endif // V8_TARGET_ARCH_X64 5531 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/lithium.cc ('K') | « src/lithium.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698