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

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

Issue 15660003: Avoid creating duplicate entries for a value when merging HSimulates (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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') | no next file » | 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 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 } 2009 }
2010 } 2010 }
2011 2011
2012 2012
2013 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) { 2013 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) {
2014 while (!list->is_empty()) { 2014 while (!list->is_empty()) {
2015 HSimulate* from = list->RemoveLast(); 2015 HSimulate* from = list->RemoveLast();
2016 ZoneList<HValue*>* from_values = &from->values_; 2016 ZoneList<HValue*>* from_values = &from->values_;
2017 for (int i = 0; i < from_values->length(); ++i) { 2017 for (int i = 0; i < from_values->length(); ++i) {
2018 if (from->HasAssignedIndexAt(i)) { 2018 if (from->HasAssignedIndexAt(i)) {
2019 AddAssignedValue(from->GetAssignedIndexAt(i), 2019 int index = from->GetAssignedIndexAt(i);
2020 from_values->at(i)); 2020 if (HasValueForIndex(index)) continue;
2021 AddAssignedValue(index, from_values->at(i));
2021 } else { 2022 } else {
2022 if (pop_count_ > 0) { 2023 if (pop_count_ > 0) {
2023 pop_count_--; 2024 pop_count_--;
2024 } else { 2025 } else {
2025 AddPushedValue(from_values->at(i)); 2026 AddPushedValue(from_values->at(i));
2026 } 2027 }
2027 } 2028 }
2028 } 2029 }
2029 pop_count_ += from->pop_count_; 2030 pop_count_ += from->pop_count_;
2030 from->DeleteAndReplaceWith(NULL); 2031 from->DeleteAndReplaceWith(NULL);
2031 } 2032 }
2032 } 2033 }
2033 2034
2034 2035
2035 void HSimulate::PrintDataTo(StringStream* stream) { 2036 void HSimulate::PrintDataTo(StringStream* stream) {
2036 stream->Add("id=%d", ast_id().ToInt()); 2037 stream->Add("id=%d", ast_id().ToInt());
2037 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_); 2038 if (pop_count_ > 0) stream->Add(" pop %d", pop_count_);
2038 if (values_.length() > 0) { 2039 if (values_.length() > 0) {
2039 if (pop_count_ > 0) stream->Add(" /"); 2040 if (pop_count_ > 0) stream->Add(" /");
2040 for (int i = values_.length() - 1; i >= 0; --i) { 2041 for (int i = values_.length() - 1; i >= 0; --i) {
2041 if (i > 0) stream->Add(",");
2042 if (HasAssignedIndexAt(i)) { 2042 if (HasAssignedIndexAt(i)) {
2043 stream->Add(" var[%d] = ", GetAssignedIndexAt(i)); 2043 stream->Add(" var[%d] = ", GetAssignedIndexAt(i));
2044 } else { 2044 } else {
2045 stream->Add(" push "); 2045 stream->Add(" push ");
2046 } 2046 }
2047 values_[i]->PrintNameTo(stream); 2047 values_[i]->PrintNameTo(stream);
2048 if (i > 0) stream->Add(",");
2048 } 2049 }
2049 } 2050 }
2050 } 2051 }
2051 2052
2052 2053
2053 void HDeoptimize::PrintDataTo(StringStream* stream) { 2054 void HDeoptimize::PrintDataTo(StringStream* stream) {
2054 if (OperandCount() == 0) return; 2055 if (OperandCount() == 0) return;
2055 OperandAt(0)->PrintNameTo(stream); 2056 OperandAt(0)->PrintNameTo(stream);
2056 for (int i = 1; i < OperandCount(); ++i) { 2057 for (int i = 1; i < OperandCount(); ++i) {
2057 stream->Add(" "); 2058 stream->Add(" ");
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 3663
3663 3664
3664 void HCheckFunction::Verify() { 3665 void HCheckFunction::Verify() {
3665 HInstruction::Verify(); 3666 HInstruction::Verify();
3666 ASSERT(HasNoUses()); 3667 ASSERT(HasNoUses());
3667 } 3668 }
3668 3669
3669 #endif 3670 #endif
3670 3671
3671 } } // namespace v8::internal 3672 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698