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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 13649003: Fix worst-case behavior of MergeRemovableSimulates(). (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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/mjsunit.status » ('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 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 678
679 void HValue::Kill() { 679 void HValue::Kill() {
680 // Instead of going through the entire use list of each operand, we only 680 // Instead of going through the entire use list of each operand, we only
681 // check the first item in each use list and rely on the tail() method to 681 // check the first item in each use list and rely on the tail() method to
682 // skip dead items, removing them lazily next time we traverse the list. 682 // skip dead items, removing them lazily next time we traverse the list.
683 SetFlag(kIsDead); 683 SetFlag(kIsDead);
684 for (int i = 0; i < OperandCount(); ++i) { 684 for (int i = 0; i < OperandCount(); ++i) {
685 HValue* operand = OperandAt(i); 685 HValue* operand = OperandAt(i);
686 if (operand == NULL) continue; 686 if (operand == NULL) continue;
687 HUseListNode* first = operand->use_list_; 687 HUseListNode* first = operand->use_list_;
688 if (first != NULL && first->value() == this && first->index() == i) { 688 if (first != NULL && first->value()->CheckFlag(kIsDead)) {
689 operand->use_list_ = first->tail(); 689 operand->use_list_ = first->tail();
690 } 690 }
691 } 691 }
692 } 692 }
693 693
694 694
695 void HValue::SetBlock(HBasicBlock* block) { 695 void HValue::SetBlock(HBasicBlock* block) {
696 ASSERT(block_ == NULL || block == NULL); 696 ASSERT(block_ == NULL || block == NULL);
697 block_ = block; 697 block_ = block;
698 if (id_ == kNoNumber && block != NULL) { 698 if (id_ == kNoNumber && block != NULL) {
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 } 1973 }
1974 1974
1975 1975
1976 void HPhi::AddIndirectUsesTo(int* dest) { 1976 void HPhi::AddIndirectUsesTo(int* dest) {
1977 for (int i = 0; i < Representation::kNumRepresentations; i++) { 1977 for (int i = 0; i < Representation::kNumRepresentations; i++) {
1978 dest[i] += indirect_uses_[i]; 1978 dest[i] += indirect_uses_[i];
1979 } 1979 }
1980 } 1980 }
1981 1981
1982 1982
1983 void HSimulate::MergeInto(HSimulate* other) { 1983 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) {
1984 for (int i = 0; i < values_.length(); ++i) { 1984 if (list->is_empty()) return;
1985 HValue* value = values_[i]; 1985 for (int j = list->length() - 1; j >= 0; --j) {
1986 if (HasAssignedIndexAt(i)) { 1986 HSimulate* from = list->at(j);
1987 other->AddAssignedValue(GetAssignedIndexAt(i), value); 1987 ZoneList<HValue*>* from_values = &from->values_;
1988 } else { 1988 for (int i = 0; i < from_values->length(); ++i) {
1989 if (other->pop_count_ > 0) { 1989 if (from->HasAssignedIndexAt(i)) {
1990 other->pop_count_--; 1990 AddAssignedValue(from->GetAssignedIndexAt(i),
1991 from_values->at(i));
1991 } else { 1992 } else {
1992 other->AddPushedValue(value); 1993 if (pop_count_ > 0) {
1994 pop_count_--;
1995 } else {
1996 AddPushedValue(from_values->at(i));
1997 }
1993 } 1998 }
1994 } 1999 }
2000 pop_count_ += from->pop_count_;
2001 list->at(j)->DeleteAndReplaceWith(NULL);
Jakob Kummerow 2013/04/04 17:12:22 nit: s/list->at(j)/from/
1995 } 2002 }
1996 other->pop_count_ += pop_count(); 2003 list->Clear();
1997 } 2004 }
1998 2005
1999 2006
2000 void HSimulate::PrintDataTo(StringStream* stream) { 2007 void HSimulate::PrintDataTo(StringStream* stream) {
2001 stream->Add("id=%d", ast_id().ToInt()); 2008 stream->Add("id=%d", ast_id().ToInt());
2002 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); 2009 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_);
2003 if (values_.length() > 0) { 2010 if (values_.length() > 0) {
2004 if (pop_count_ > 0) stream->Add(" /"); 2011 if (pop_count_ > 0) stream->Add(" /");
2005 for (int i = values_.length() - 1; i >= 0; --i) { 2012 for (int i = values_.length() - 1; i >= 0; --i) {
2006 if (i > 0) stream->Add(","); 2013 if (i > 0) stream->Add(",");
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3531 3538
3532 3539
3533 void HCheckFunction::Verify() { 3540 void HCheckFunction::Verify() {
3534 HInstruction::Verify(); 3541 HInstruction::Verify();
3535 ASSERT(HasNoUses()); 3542 ASSERT(HasNoUses());
3536 } 3543 }
3537 3544
3538 #endif 3545 #endif
3539 3546
3540 } } // namespace v8::internal 3547 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698