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

Side by Side Diff: src/hydrogen.cc

Issue 130613003: Eliminatable CheckMaps replaced with if(true) or if(false). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 Isolate* HBasicBlock::isolate() const { 106 Isolate* HBasicBlock::isolate() const {
107 return graph_->isolate(); 107 return graph_->isolate();
108 } 108 }
109 109
110 110
111 void HBasicBlock::MarkUnreachable() { 111 void HBasicBlock::MarkUnreachable() {
112 is_reachable_ = false; 112 is_reachable_ = false;
113 } 113 }
114 114
115 115
116 void HBasicBlock::MarkSuccEdgeUnreachable(int succ) {
117 ASSERT(IsFinished());
118 HBasicBlock* succ_block = end()->SuccessorAt(succ);
119
120 ASSERT(succ_block->predecessors()->length() == 1);
121 succ_block->MarkUnreachable();
122 }
123
124
116 void HBasicBlock::AttachLoopInformation() { 125 void HBasicBlock::AttachLoopInformation() {
117 ASSERT(!IsLoopHeader()); 126 ASSERT(!IsLoopHeader());
118 loop_information_ = new(zone()) HLoopInformation(this, zone()); 127 loop_information_ = new(zone()) HLoopInformation(this, zone());
119 } 128 }
120 129
121 130
122 void HBasicBlock::DetachLoopInformation() { 131 void HBasicBlock::DetachLoopInformation() {
123 ASSERT(IsLoopHeader()); 132 ASSERT(IsLoopHeader());
124 loop_information_ = NULL; 133 loop_information_ = NULL;
125 } 134 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 const HBasicBlock* current = this; 315 const HBasicBlock* current = this;
307 int result = (current->IsLoopHeader()) ? 1 : 0; 316 int result = (current->IsLoopHeader()) ? 1 : 0;
308 while (current->parent_loop_header() != NULL) { 317 while (current->parent_loop_header() != NULL) {
309 current = current->parent_loop_header(); 318 current = current->parent_loop_header();
310 result++; 319 result++;
311 } 320 }
312 return result; 321 return result;
313 } 322 }
314 323
315 324
325 void HBasicBlock::ReplaceControlWithGotoSuccessor(int succ) {
326 ASSERT(IsFinished());
titzer 2014/01/13 17:26:56 I think you should go ahead and implement the gene
Igor Sheludko 2014/01/14 10:41:36 It seems that there are no instructions with more
327 ASSERT(end()->SuccessorCount() == 2); // Only this case is supported yet.
328 ASSERT(succ < end()->SuccessorCount());
329
330 // Replace control instruction with if(true) or if(false).
331 HConstant* value = (succ == 0)
332 ? graph()->GetConstantTrue()
333 : graph()->GetConstantFalse();
334
335 HBranch* new_branch = HBranch::New(
336 zone(),
337 NULL,
338 value,
339 ToBooleanStub::Types(ToBooleanStub::BOOLEAN),
340 end()->SuccessorAt(0),
341 end()->SuccessorAt(1));
342
343 int unreachable_succ = 1 - succ;
344
345 MarkSuccEdgeUnreachable(unreachable_succ);
titzer 2014/01/13 17:26:56 You should go through all the "other" successors,
Igor Sheludko 2014/01/14 10:41:36 Normally they
346
347 end()->DeleteAndReplaceWith(end()->ActualValue());
348 new_branch->InsertAfter(last());
349 end_ = new_branch;
350 }
351
352
316 void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) { 353 void HBasicBlock::PostProcessLoopHeader(IterationStatement* stmt) {
317 ASSERT(IsLoopHeader()); 354 ASSERT(IsLoopHeader());
318 355
319 SetJoinId(stmt->EntryId()); 356 SetJoinId(stmt->EntryId());
320 if (predecessors()->length() == 1) { 357 if (predecessors()->length() == 1) {
321 // This is a degenerated loop. 358 // This is a degenerated loop.
322 DetachLoopInformation(); 359 DetachLoopInformation();
323 return; 360 return;
324 } 361 }
325 362
(...skipping 10646 matching lines...) Expand 10 before | Expand all | Expand 10 after
10972 if (ShouldProduceTraceOutput()) { 11009 if (ShouldProduceTraceOutput()) {
10973 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11010 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10974 } 11011 }
10975 11012
10976 #ifdef DEBUG 11013 #ifdef DEBUG
10977 graph_->Verify(false); // No full verify. 11014 graph_->Verify(false); // No full verify.
10978 #endif 11015 #endif
10979 } 11016 }
10980 11017
10981 } } // namespace v8::internal 11018 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698