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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 !is_aborted() && current_instruction_ < instructions_->length(); 339 !is_aborted() && current_instruction_ < instructions_->length();
340 current_instruction_++) { 340 current_instruction_++) {
341 LInstruction* instr = instructions_->at(current_instruction_); 341 LInstruction* instr = instructions_->at(current_instruction_);
342 342
343 // Don't emit code for basic blocks with a replacement. 343 // Don't emit code for basic blocks with a replacement.
344 if (instr->IsLabel()) { 344 if (instr->IsLabel()) {
345 emit_instructions = !LLabel::cast(instr)->HasReplacement(); 345 emit_instructions = !LLabel::cast(instr)->HasReplacement();
346 } 346 }
347 if (!emit_instructions) continue; 347 if (!emit_instructions) continue;
348 348
349 if (FLAG_code_comments && instr->HasInterestingComment(this)) { 349 if (instr->hydrogen_value()->block()->IsReachable()) {
350 Comment(";;; <@%d,#%d> %s", 350 if (FLAG_code_comments && instr->HasInterestingComment(this)) {
351 current_instruction_, 351 Comment(";;; <@%d,#%d> %s",
352 instr->hydrogen_value()->id(), 352 current_instruction_,
353 instr->Mnemonic()); 353 instr->hydrogen_value()->id(),
354 } 354 instr->Mnemonic());
355 }
355 356
356 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); 357 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr);
357 358
358 RecordAndUpdatePosition(instr->position()); 359 RecordAndUpdatePosition(instr->position());
359 360
360 instr->CompileToNative(this); 361 instr->CompileToNative(this);
361 362
362 if (!CpuFeatures::IsSupported(SSE2)) { 363 if (!CpuFeatures::IsSupported(SSE2)) {
363 if (FLAG_debug_code && FLAG_enable_slow_asserts) { 364 if (FLAG_debug_code && FLAG_enable_slow_asserts) {
364 __ VerifyX87StackDepth(x87_stack_depth_); 365 __ VerifyX87StackDepth(x87_stack_depth_);
366 }
367 }
368 } else {
369 if (FLAG_code_comments && instr->IsLabel()) {
370 Comment(
371 ";;; <@%d,#%d> -------------------- B%d (unreachable/elided) "
372 "--------------------",
373 current_instruction_,
374 instr->hydrogen_value()->id(),
375 instr->hydrogen_value()->block()->block_id());
365 } 376 }
366 } 377 }
367 } 378 }
368 EnsureSpaceForLazyDeopt(); 379 EnsureSpaceForLazyDeopt();
369 return !is_aborted(); 380 return !is_aborted();
370 } 381 }
371 382
372 383
373 bool LCodeGen::GenerateJumpTable() { 384 bool LCodeGen::GenerateJumpTable() {
374 Label needs_frame; 385 Label needs_frame;
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 ASSERT(ToRegister(instr->result()).is(eax)); 2211 ASSERT(ToRegister(instr->result()).is(eax));
2201 2212
2202 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 2213 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
2203 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 2214 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2204 __ nop(); // Signals no inlined code. 2215 __ nop(); // Signals no inlined code.
2205 } 2216 }
2206 2217
2207 2218
2208 int LCodeGen::GetNextEmittedBlock() const { 2219 int LCodeGen::GetNextEmittedBlock() const {
2209 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 2220 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2221 if (!graph()->blocks()->at(i)->IsReachable()) continue;
2210 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 2222 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2211 } 2223 }
2212 return -1; 2224 return -1;
2213 } 2225 }
2214 2226
2215 2227
2216 template<class InstrType> 2228 template<class InstrType>
2217 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 2229 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
2218 int left_block = instr->TrueDestination(chunk_); 2230 int left_block = instr->TrueDestination(chunk_);
2219 int right_block = instr->FalseDestination(chunk_); 2231 int right_block = instr->FalseDestination(chunk_);
(...skipping 4224 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 FixedArray::kHeaderSize - kPointerSize)); 6456 FixedArray::kHeaderSize - kPointerSize));
6445 __ bind(&done); 6457 __ bind(&done);
6446 } 6458 }
6447 6459
6448 6460
6449 #undef __ 6461 #undef __
6450 6462
6451 } } // namespace v8::internal 6463 } } // namespace v8::internal
6452 6464
6453 #endif // V8_TARGET_ARCH_IA32 6465 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698