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

Side by Side Diff: src/lithium.cc

Issue 9860028: Valgrind cleanliness, part 2: Delete lithium operand caches on exit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review comments addressed Created 8 years, 9 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/lithium.h ('k') | src/v8.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 case DOUBLE_REGISTER: 88 case DOUBLE_REGISTER:
89 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index())); 89 stream->Add("[%s|R]", DoubleRegister::AllocationIndexToString(index()));
90 break; 90 break;
91 case ARGUMENT: 91 case ARGUMENT:
92 stream->Add("[arg:%d]", index()); 92 stream->Add("[arg:%d]", index());
93 break; 93 break;
94 } 94 }
95 } 95 }
96 96
97 #define DEFINE_OPERAND_CACHE(name, type) \ 97 #define DEFINE_OPERAND_CACHE(name, type) \
98 name* name::cache = NULL; \ 98 L##name* L##name::cache = NULL; \
99 void name::SetUpCache() { \ 99 \
100 void L##name::SetUpCache() { \
100 if (cache) return; \ 101 if (cache) return; \
101 cache = new name[kNumCachedOperands]; \ 102 cache = new L##name[kNumCachedOperands]; \
102 for (int i = 0; i < kNumCachedOperands; i++) { \ 103 for (int i = 0; i < kNumCachedOperands; i++) { \
103 cache[i].ConvertTo(type, i); \ 104 cache[i].ConvertTo(type, i); \
104 } \ 105 } \
105 } \ 106 } \
107 \
108 void L##name::TearDownCache() { \
109 delete[] cache; \
110 }
106 111
107 DEFINE_OPERAND_CACHE(LConstantOperand, CONSTANT_OPERAND) 112 LITHIUM_OPERAND_LIST(DEFINE_OPERAND_CACHE)
108 DEFINE_OPERAND_CACHE(LStackSlot, STACK_SLOT)
109 DEFINE_OPERAND_CACHE(LDoubleStackSlot, DOUBLE_STACK_SLOT)
110 DEFINE_OPERAND_CACHE(LRegister, REGISTER)
111 DEFINE_OPERAND_CACHE(LDoubleRegister, DOUBLE_REGISTER)
112
113 #undef DEFINE_OPERAND_CACHE 113 #undef DEFINE_OPERAND_CACHE
114 114
115 void LOperand::SetUpCaches() { 115 void LOperand::SetUpCaches() {
116 LConstantOperand::SetUpCache(); 116 #define LITHIUM_OPERAND_SETUP(name, type) L##name::SetUpCache();
117 LStackSlot::SetUpCache(); 117 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_SETUP)
118 LDoubleStackSlot::SetUpCache(); 118 #undef LITHIUM_OPERAND_SETUP
119 LRegister::SetUpCache();
120 LDoubleRegister::SetUpCache();
121 } 119 }
122 120
121
122 void LOperand::TearDownCaches() {
123 #define LITHIUM_OPERAND_TEARDOWN(name, type) L##name::TearDownCache();
124 LITHIUM_OPERAND_LIST(LITHIUM_OPERAND_TEARDOWN)
125 #undef LITHIUM_OPERAND_TEARDOWN
126 }
127
128
123 bool LParallelMove::IsRedundant() const { 129 bool LParallelMove::IsRedundant() const {
124 for (int i = 0; i < move_operands_.length(); ++i) { 130 for (int i = 0; i < move_operands_.length(); ++i) {
125 if (!move_operands_[i].IsRedundant()) return false; 131 if (!move_operands_[i].IsRedundant()) return false;
126 } 132 }
127 return true; 133 return true;
128 } 134 }
129 135
130 136
131 void LParallelMove::PrintDataTo(StringStream* stream) const { 137 void LParallelMove::PrintDataTo(StringStream* stream) const {
132 bool first = true; 138 bool first = true;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case DICTIONARY_ELEMENTS: 231 case DICTIONARY_ELEMENTS:
226 case NON_STRICT_ARGUMENTS_ELEMENTS: 232 case NON_STRICT_ARGUMENTS_ELEMENTS:
227 return kPointerSizeLog2; 233 return kPointerSizeLog2;
228 } 234 }
229 UNREACHABLE(); 235 UNREACHABLE();
230 return 0; 236 return 0;
231 } 237 }
232 238
233 239
234 } } // namespace v8::internal 240 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lithium.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698