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

Side by Side Diff: src/arm/lithium-codegen-arm.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 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 !is_aborted() && current_instruction_ < instructions_->length(); 260 !is_aborted() && current_instruction_ < instructions_->length();
261 current_instruction_++) { 261 current_instruction_++) {
262 LInstruction* instr = instructions_->at(current_instruction_); 262 LInstruction* instr = instructions_->at(current_instruction_);
263 263
264 // Don't emit code for basic blocks with a replacement. 264 // Don't emit code for basic blocks with a replacement.
265 if (instr->IsLabel()) { 265 if (instr->IsLabel()) {
266 emit_instructions = !LLabel::cast(instr)->HasReplacement(); 266 emit_instructions = !LLabel::cast(instr)->HasReplacement();
267 } 267 }
268 if (!emit_instructions) continue; 268 if (!emit_instructions) continue;
269 269
270 if (FLAG_code_comments && instr->HasInterestingComment(this)) { 270 if (instr->hydrogen_value()->block()->IsReachable()) {
271 Comment(";;; <@%d,#%d> %s", 271 if (FLAG_code_comments && instr->HasInterestingComment(this)) {
272 current_instruction_, 272 Comment(";;; <@%d,#%d> %s",
273 instr->hydrogen_value()->id(), 273 current_instruction_,
274 instr->Mnemonic()); 274 instr->hydrogen_value()->id(),
275 instr->Mnemonic());
276 }
277
278 RecordAndUpdatePosition(instr->position());
279
280 instr->CompileToNative(this);
281 } else {
282 if (FLAG_code_comments && instr->IsLabel()) {
283 Comment(
284 ";;; <@%d,#%d> -------------------- B%d (unreachable/elided) "
285 "--------------------",
286 current_instruction_,
287 instr->hydrogen_value()->id(),
288 instr->hydrogen_value()->block()->block_id());
289 }
275 } 290 }
276
277 RecordAndUpdatePosition(instr->position());
278
279 instr->CompileToNative(this);
280 } 291 }
281 EnsureSpaceForLazyDeopt(); 292 EnsureSpaceForLazyDeopt();
282 last_lazy_deopt_pc_ = masm()->pc_offset(); 293 last_lazy_deopt_pc_ = masm()->pc_offset();
283 return !is_aborted(); 294 return !is_aborted();
284 } 295 }
285 296
286 297
287 bool LCodeGen::GenerateDeferredCode() { 298 bool LCodeGen::GenerateDeferredCode() {
288 ASSERT(is_generating()); 299 ASSERT(is_generating());
289 if (deferred_.length() > 0) { 300 if (deferred_.length() > 0) {
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 // Block literal pool emission to ensure nop indicating no inlined smi code 2150 // Block literal pool emission to ensure nop indicating no inlined smi code
2140 // is in the correct position. 2151 // is in the correct position.
2141 Assembler::BlockConstPoolScope block_const_pool(masm()); 2152 Assembler::BlockConstPoolScope block_const_pool(masm());
2142 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 2153 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2143 __ nop(); // Signals no inlined code. 2154 __ nop(); // Signals no inlined code.
2144 } 2155 }
2145 2156
2146 2157
2147 int LCodeGen::GetNextEmittedBlock() const { 2158 int LCodeGen::GetNextEmittedBlock() const {
2148 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 2159 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2160 if (!graph()->blocks()->at(i)->IsReachable()) continue;
2149 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 2161 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2150 } 2162 }
2151 return -1; 2163 return -1;
2152 } 2164 }
2153 2165
2154 template<class InstrType> 2166 template<class InstrType>
2155 void LCodeGen::EmitBranch(InstrType instr, Condition condition) { 2167 void LCodeGen::EmitBranch(InstrType instr, Condition condition) {
2156 int left_block = instr->TrueDestination(chunk_); 2168 int left_block = instr->TrueDestination(chunk_);
2157 int right_block = instr->FalseDestination(chunk_); 2169 int right_block = instr->FalseDestination(chunk_);
2158 2170
(...skipping 3616 matching lines...) Expand 10 before | Expand all | Expand 10 after
5775 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5787 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5776 __ ldr(result, FieldMemOperand(scratch, 5788 __ ldr(result, FieldMemOperand(scratch,
5777 FixedArray::kHeaderSize - kPointerSize)); 5789 FixedArray::kHeaderSize - kPointerSize));
5778 __ bind(&done); 5790 __ bind(&done);
5779 } 5791 }
5780 5792
5781 5793
5782 #undef __ 5794 #undef __
5783 5795
5784 } } // namespace v8::internal 5796 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen.h » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698