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

Side by Side Diff: src/hydrogen-check-elimination.cc

Issue 150663005: Optimize redundant HCompareMap instructions with known successors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // If the instruction changes maps, it should be handled above. 334 // If the instruction changes maps, it should be handled above.
335 CHECK(!instr->CheckGVNFlag(kChangesMaps)); 335 CHECK(!instr->CheckGVNFlag(kChangesMaps));
336 } 336 }
337 } 337 }
338 338
339 void ReduceCompareMap(HCompareMap* instr) { 339 void ReduceCompareMap(HCompareMap* instr) {
340 MapSet maps = FindMaps(instr->value()->ActualValue()); 340 MapSet maps = FindMaps(instr->value()->ActualValue());
341 if (maps == NULL) return; 341 if (maps == NULL) return;
342 if (maps->Contains(instr->map())) { 342 if (maps->Contains(instr->map())) {
343 if (maps->size() == 1) { 343 if (maps->size() == 1) {
344 // TODO(titzer): replace with goto true branch 344 TRACE(("Marking redundant CompareMap #%d at B%d as true\n",
345 instr->id(), instr->block()->block_id()));
346 instr->set_known_successor_index(0);
345 INC_STAT(compares_true_); 347 INC_STAT(compares_true_);
346 } 348 }
347 } else { 349 } else {
348 // TODO(titzer): replace with goto false branch 350 TRACE(("Marking redundant CompareMap #%d at B%d as false\n",
351 instr->id(), instr->block()->block_id()));
352 instr->set_known_successor_index(1);
349 INC_STAT(compares_false_); 353 INC_STAT(compares_false_);
350 } 354 }
351 } 355 }
352 356
353 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { 357 void ReduceTransitionElementsKind(HTransitionElementsKind* instr) {
354 MapSet maps = FindMaps(instr->object()->ActualValue()); 358 MapSet maps = FindMaps(instr->object()->ActualValue());
355 // Can only learn more about an object that already has a known set of maps. 359 // Can only learn more about an object that already has a known set of maps.
356 if (maps == NULL) return; 360 if (maps == NULL) return;
357 if (maps->Contains(instr->original_map())) { 361 if (maps->Contains(instr->original_map())) {
358 // If the object has the original map, it will be transitioned. 362 // If the object has the original map, it will be transitioned.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 PRINT_STAT(removed_cho); 584 PRINT_STAT(removed_cho);
581 PRINT_STAT(narrowed); 585 PRINT_STAT(narrowed);
582 PRINT_STAT(loads); 586 PRINT_STAT(loads);
583 PRINT_STAT(empty); 587 PRINT_STAT(empty);
584 PRINT_STAT(compares_true); 588 PRINT_STAT(compares_true);
585 PRINT_STAT(compares_false); 589 PRINT_STAT(compares_false);
586 PRINT_STAT(transitions); 590 PRINT_STAT(transitions);
587 } 591 }
588 592
589 } } // namespace v8::internal 593 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698