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

Side by Side Diff: src/safepoint-table.cc

Issue 7374002: Refactor allocation policies. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 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/safepoint-table.h ('k') | src/scopeinfo.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 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); 114 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1');
115 } 115 }
116 } 116 }
117 117
118 118
119 void Safepoint::DefinePointerRegister(Register reg) { 119 void Safepoint::DefinePointerRegister(Register reg) {
120 registers_->Add(reg.code()); 120 registers_->Add(reg.code());
121 } 121 }
122 122
123 123
124 SafepointTableBuilder::SafepointTableBuilder() : deoptimization_info_(ZONE, 32),
125 indexes_(ZONE, 32),
126 registers_(ZONE, 32),
127 emitted_(false) { }
128
129
124 Safepoint SafepointTableBuilder::DefineSafepoint( 130 Safepoint SafepointTableBuilder::DefineSafepoint(
125 Assembler* assembler, Safepoint::Kind kind, int arguments, 131 Assembler* assembler, Safepoint::Kind kind, int arguments,
126 int deoptimization_index) { 132 int deoptimization_index) {
127 ASSERT(deoptimization_index != -1); 133 ASSERT(deoptimization_index != -1);
128 ASSERT(arguments >= 0); 134 ASSERT(arguments >= 0);
129 DeoptimizationInfo pc_and_deoptimization_index; 135 DeoptimizationInfo pc_and_deoptimization_index;
130 pc_and_deoptimization_index.pc = assembler->pc_offset(); 136 pc_and_deoptimization_index.pc = assembler->pc_offset();
131 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; 137 pc_and_deoptimization_index.deoptimization_index = deoptimization_index;
132 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); 138 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset();
133 pc_and_deoptimization_index.arguments = arguments; 139 pc_and_deoptimization_index.arguments = arguments;
134 pc_and_deoptimization_index.has_doubles = (kind & Safepoint::kWithDoubles); 140 pc_and_deoptimization_index.has_doubles = (kind & Safepoint::kWithDoubles);
135 deoptimization_info_.Add(pc_and_deoptimization_index); 141 deoptimization_info_.Add(pc_and_deoptimization_index);
136 indexes_.Add(new ZoneList<int>(8)); 142 indexes_.Add(ZoneList<int>::New(ZONE, 8));
137 registers_.Add((kind & Safepoint::kWithRegisters) 143 registers_.Add((kind & Safepoint::kWithRegisters)
138 ? new ZoneList<int>(4) 144 ? ZoneList<int>::New(ZONE, 4)
139 : NULL); 145 : NULL);
140 return Safepoint(indexes_.last(), registers_.last()); 146 return Safepoint(indexes_.last(), registers_.last());
141 } 147 }
142 148
143 149
144 unsigned SafepointTableBuilder::GetCodeOffset() const { 150 unsigned SafepointTableBuilder::GetCodeOffset() const {
145 ASSERT(emitted_); 151 ASSERT(emitted_);
146 return offset_; 152 return offset_;
147 } 153 }
148 154
149 155
(...skipping 24 matching lines...) Expand all
174 assembler->dd(bytes_per_entry); 180 assembler->dd(bytes_per_entry);
175 181
176 // Emit sorted table of pc offsets together with deoptimization indexes and 182 // Emit sorted table of pc offsets together with deoptimization indexes and
177 // pc after gap information. 183 // pc after gap information.
178 for (int i = 0; i < length; i++) { 184 for (int i = 0; i < length; i++) {
179 assembler->dd(deoptimization_info_[i].pc); 185 assembler->dd(deoptimization_info_[i].pc);
180 assembler->dd(EncodeExceptPC(deoptimization_info_[i])); 186 assembler->dd(EncodeExceptPC(deoptimization_info_[i]));
181 } 187 }
182 188
183 // Emit table of bitmaps. 189 // Emit table of bitmaps.
184 ZoneList<uint8_t> bits(bytes_per_entry); 190 ZoneList<uint8_t> bits(ZONE, bytes_per_entry);
185 for (int i = 0; i < length; i++) { 191 for (int i = 0; i < length; i++) {
186 ZoneList<int>* indexes = indexes_[i]; 192 ZoneList<int>* indexes = indexes_[i];
187 ZoneList<int>* registers = registers_[i]; 193 ZoneList<int>* registers = registers_[i];
188 bits.Clear(); 194 bits.Clear();
189 bits.AddBlock(0, bytes_per_entry); 195 bits.AddBlock(0, bytes_per_entry);
190 196
191 // Run through the registers (if any). 197 // Run through the registers (if any).
192 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte)); 198 ASSERT(IsAligned(kNumSafepointRegisters, kBitsPerByte));
193 if (registers == NULL) { 199 if (registers == NULL) {
194 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2; 200 const int num_reg_bytes = kNumSafepointRegisters >> kBitsPerByteLog2;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 previous_gap_end = info.pc_after_gap; 253 previous_gap_end = info.pc_after_gap;
248 } 254 }
249 } 255 }
250 } 256 }
251 return result; 257 return result;
252 } 258 }
253 259
254 260
255 261
256 } } // namespace v8::internal 262 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/safepoint-table.h ('k') | src/scopeinfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698