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

Side by Side Diff: src/hydrogen.cc

Issue 14046017: Abcd for performance check. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 430 }
431 #endif 431 #endif
432 432
433 433
434 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) { 434 void HLoopInformation::RegisterBackEdge(HBasicBlock* block) {
435 this->back_edges_.Add(block, block->zone()); 435 this->back_edges_.Add(block, block->zone());
436 AddBlock(block); 436 AddBlock(block);
437 } 437 }
438 438
439 439
440 void HLoopInformation::ProcessEdge(HBasicBlock* destination) {
441 HLoopInformation* target_loop = destination->current_loop();
442 if (IsInThisLoop(target_loop)) return;
443
444 HLoopInformation* current_loop = this;
445 while (current_loop != NULL) {
446 if (target_loop == current_loop) return;
447 current_loop->exits_count_++;
448 current_loop = current_loop->parent_loop();
449 }
450 }
451
452
453 void HLoopInformation::ProcessThrow() {
454 HLoopInformation* current_loop = this;
455 while (current_loop != NULL) {
Jakob Kummerow 2013/04/17 11:34:15 Please add a comment saying that when we support t
Massi 2013/05/07 11:32:03 Done.
456 current_loop->exits_count_++;
457 current_loop = current_loop->parent_loop();
458 }
459 }
460
461
440 HBasicBlock* HLoopInformation::GetLastBackEdge() const { 462 HBasicBlock* HLoopInformation::GetLastBackEdge() const {
441 int max_id = -1; 463 int max_id = -1;
442 HBasicBlock* result = NULL; 464 HBasicBlock* result = NULL;
443 for (int i = 0; i < back_edges_.length(); ++i) { 465 for (int i = 0; i < back_edges_.length(); ++i) {
444 HBasicBlock* cur = back_edges_[i]; 466 HBasicBlock* cur = back_edges_[i];
445 if (cur->block_id() > max_id) { 467 if (cur->block_id() > max_id) {
446 max_id = cur->block_id(); 468 max_id = cur->block_id();
447 result = cur; 469 result = cur;
448 } 470 }
449 } 471 }
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 PostorderProcessor::CreateEntryProcessor(zone(), start, &visited); 2032 PostorderProcessor::CreateEntryProcessor(zone(), start, &visited);
2011 while (postorder != NULL) { 2033 while (postorder != NULL) {
2012 postorder = postorder->PerformStep(zone(), &visited, &reverse_result); 2034 postorder = postorder->PerformStep(zone(), &visited, &reverse_result);
2013 } 2035 }
2014 blocks_.Rewind(0); 2036 blocks_.Rewind(0);
2015 int index = 0; 2037 int index = 0;
2016 for (int i = reverse_result.length() - 1; i >= 0; --i) { 2038 for (int i = reverse_result.length() - 1; i >= 0; --i) {
2017 HBasicBlock* b = reverse_result[i]; 2039 HBasicBlock* b = reverse_result[i];
2018 blocks_.Add(b, zone()); 2040 blocks_.Add(b, zone());
2019 b->set_block_id(index++); 2041 b->set_block_id(index++);
2042
2043 HLoopInformation* loop = b->current_loop();
2044 if (loop != NULL) {
2045 for (int i = 0; i < b->end()->SuccessorCount(); i++) {
2046 HBasicBlock* successor = b->end()->SuccessorAt(i);
2047 loop->ProcessEdge(successor);
2048 }
2049 }
2020 } 2050 }
2021 } 2051 }
2022 2052
2023 2053
2024 void HGraph::AssignDominators() { 2054 void HGraph::AssignDominators() {
2025 HPhase phase("H_Assign dominators", this); 2055 HPhase phase("H_Assign dominators", this);
2026 for (int i = 0; i < blocks_.length(); ++i) { 2056 for (int i = 0; i < blocks_.length(); ++i) {
2027 HBasicBlock* block = blocks_[i]; 2057 HBasicBlock* block = blocks_[i];
2028 if (block->IsLoopHeader()) { 2058 if (block->IsLoopHeader()) {
2029 // Only the first predecessor of a loop header is from outside the loop. 2059 // Only the first predecessor of a loop header is from outside the loop.
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 if (phi->representation().IsNone()) { 3436 if (phi->representation().IsNone()) {
3407 phi->ChangeRepresentation(Representation::Tagged()); 3437 phi->ChangeRepresentation(Representation::Tagged());
3408 } 3438 }
3409 } 3439 }
3410 for (HInstruction* current = block->first(); 3440 for (HInstruction* current = block->first();
3411 current != NULL; current = current->next()) { 3441 current != NULL; current = current->next()) {
3412 if (current->representation().IsNone() && 3442 if (current->representation().IsNone() &&
3413 current->CheckFlag(HInstruction::kFlexibleRepresentation)) { 3443 current->CheckFlag(HInstruction::kFlexibleRepresentation)) {
3414 current->ChangeRepresentation(Representation::Tagged()); 3444 current->ChangeRepresentation(Representation::Tagged());
3415 } 3445 }
3446
3447 if (current->IsThrow()) {
Jakob Kummerow 2013/04/17 11:34:15 Let's move this into the block ordering phase wher
Massi 2013/05/07 11:32:03 Done.
3448 if (block->current_loop() != NULL) {
3449 block->current_loop()->ProcessThrow();
3450 }
3451 }
3416 } 3452 }
3417 } 3453 }
3418 } 3454 }
3419 3455
3420 3456
3421 void HGraph::MergeRemovableSimulates() { 3457 void HGraph::MergeRemovableSimulates() {
3422 ZoneList<HSimulate*> mergelist(2, zone()); 3458 ZoneList<HSimulate*> mergelist(2, zone());
3423 for (int i = 0; i < blocks()->length(); ++i) { 3459 for (int i = 0; i < blocks()->length(); ++i) {
3424 HBasicBlock* block = blocks()->at(i); 3460 HBasicBlock* block = blocks()->at(i);
3425 // Make sure the merge list is empty at the start of a block. 3461 // Make sure the merge list is empty at the start of a block.
(...skipping 8240 matching lines...) Expand 10 before | Expand all | Expand 10 after
11666 } 11702 }
11667 } 11703 }
11668 11704
11669 #ifdef DEBUG 11705 #ifdef DEBUG
11670 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11706 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11671 if (allocator_ != NULL) allocator_->Verify(); 11707 if (allocator_ != NULL) allocator_->Verify();
11672 #endif 11708 #endif
11673 } 11709 }
11674 11710
11675 } } // namespace v8::internal 11711 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698