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

Side by Side Diff: src/regexp-macro-assembler-tracer.cc

Issue 3573005: New attempt to make the allocation routines 64 bit clean.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 2 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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 29 matching lines...) Expand all
40 ASSERT(type < 4); 40 ASSERT(type < 4);
41 const char* impl_names[4] = {"IA32", "ARM", "X64", "Bytecode"}; 41 const char* impl_names[4] = {"IA32", "ARM", "X64", "Bytecode"};
42 PrintF("RegExpMacroAssembler%s();\n", impl_names[type]); 42 PrintF("RegExpMacroAssembler%s();\n", impl_names[type]);
43 } 43 }
44 44
45 45
46 RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() { 46 RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() {
47 } 47 }
48 48
49 49
50 // This is used for printing out debugging information. It makes an integer
51 // that is closely related to the address of an object.
52 static int IntForLabel(Label* label) {
53 return static_cast<int>(reinterpret_cast<intptr_t>(label));
54 }
55
56
50 void RegExpMacroAssemblerTracer::Bind(Label* label) { 57 void RegExpMacroAssemblerTracer::Bind(Label* label) {
51 PrintF("label[%08x]: (Bind)\n", label, label); 58 PrintF("label[%08x]: (Bind)\n", IntForLabel(label));
Vyacheslav Egorov (Chromium) 2010/09/29 14:55:20 consider renaming it to LabelToInt.
Erik Corry 2010/09/30 07:09:38 Done.
52 assembler_->Bind(label); 59 assembler_->Bind(label);
53 } 60 }
54 61
55 62
56 void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) { 63 void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) {
57 PrintF(" AdvanceCurrentPosition(by=%d);\n", by); 64 PrintF(" AdvanceCurrentPosition(by=%d);\n", by);
58 assembler_->AdvanceCurrentPosition(by); 65 assembler_->AdvanceCurrentPosition(by);
59 } 66 }
60 67
61 68
62 void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) { 69 void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
63 PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label); 70 PrintF(" CheckGreedyLoop(label[%08x]);\n\n", IntForLabel(label));
64 assembler_->CheckGreedyLoop(label); 71 assembler_->CheckGreedyLoop(label);
65 } 72 }
66 73
67 74
68 void RegExpMacroAssemblerTracer::PopCurrentPosition() { 75 void RegExpMacroAssemblerTracer::PopCurrentPosition() {
69 PrintF(" PopCurrentPosition();\n"); 76 PrintF(" PopCurrentPosition();\n");
70 assembler_->PopCurrentPosition(); 77 assembler_->PopCurrentPosition();
71 } 78 }
72 79
73 80
74 void RegExpMacroAssemblerTracer::PushCurrentPosition() { 81 void RegExpMacroAssemblerTracer::PushCurrentPosition() {
75 PrintF(" PushCurrentPosition();\n"); 82 PrintF(" PushCurrentPosition();\n");
76 assembler_->PushCurrentPosition(); 83 assembler_->PushCurrentPosition();
77 } 84 }
78 85
79 86
80 void RegExpMacroAssemblerTracer::Backtrack() { 87 void RegExpMacroAssemblerTracer::Backtrack() {
81 PrintF(" Backtrack();\n"); 88 PrintF(" Backtrack();\n");
82 assembler_->Backtrack(); 89 assembler_->Backtrack();
83 } 90 }
84 91
85 92
86 void RegExpMacroAssemblerTracer::GoTo(Label* label) { 93 void RegExpMacroAssemblerTracer::GoTo(Label* label) {
87 PrintF(" GoTo(label[%08x]);\n\n", label); 94 PrintF(" GoTo(label[%08x]);\n\n", IntForLabel(label));
88 assembler_->GoTo(label); 95 assembler_->GoTo(label);
89 } 96 }
90 97
91 98
92 void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) { 99 void RegExpMacroAssemblerTracer::PushBacktrack(Label* label) {
93 PrintF(" PushBacktrack(label[%08x]);\n", 100 PrintF(" PushBacktrack(label[%08x]);\n", IntForLabel(label));
94 label);
95 assembler_->PushBacktrack(label); 101 assembler_->PushBacktrack(label);
96 } 102 }
97 103
98 104
99 void RegExpMacroAssemblerTracer::Succeed() { 105 void RegExpMacroAssemblerTracer::Succeed() {
100 PrintF(" Succeed();\n"); 106 PrintF(" Succeed();\n");
101 assembler_->Succeed(); 107 assembler_->Succeed();
102 } 108 }
103 109
104 110
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 175 }
170 176
171 177
172 void RegExpMacroAssemblerTracer::LoadCurrentCharacter(int cp_offset, 178 void RegExpMacroAssemblerTracer::LoadCurrentCharacter(int cp_offset,
173 Label* on_end_of_input, 179 Label* on_end_of_input,
174 bool check_bounds, 180 bool check_bounds,
175 int characters) { 181 int characters) {
176 const char* check_msg = check_bounds ? "" : " (unchecked)"; 182 const char* check_msg = check_bounds ? "" : " (unchecked)";
177 PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d chars));\n", 183 PrintF(" LoadCurrentCharacter(cp_offset=%d, label[%08x]%s (%d chars));\n",
178 cp_offset, 184 cp_offset,
179 on_end_of_input, 185 IntForLabel(on_end_of_input),
180 check_msg, 186 check_msg,
181 characters); 187 characters);
182 assembler_->LoadCurrentCharacter(cp_offset, 188 assembler_->LoadCurrentCharacter(cp_offset,
183 on_end_of_input, 189 on_end_of_input,
184 check_bounds, 190 check_bounds,
185 characters); 191 characters);
186 } 192 }
187 193
188 194
189 void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label* on_less) { 195 void RegExpMacroAssemblerTracer::CheckCharacterLT(uc16 limit, Label* on_less) {
190 PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n", limit, on_less); 196 PrintF(" CheckCharacterLT(c='u%04x', label[%08x]);\n",
197 limit, IntForLabel(on_less));
191 assembler_->CheckCharacterLT(limit, on_less); 198 assembler_->CheckCharacterLT(limit, on_less);
192 } 199 }
193 200
194 201
195 void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit, 202 void RegExpMacroAssemblerTracer::CheckCharacterGT(uc16 limit,
196 Label* on_greater) { 203 Label* on_greater) {
197 PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n", limit, on_greater); 204 PrintF(" CheckCharacterGT(c='u%04x', label[%08x]);\n",
205 limit, IntForLabel(on_greater));
198 assembler_->CheckCharacterGT(limit, on_greater); 206 assembler_->CheckCharacterGT(limit, on_greater);
199 } 207 }
200 208
201 209
202 void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label* on_equal) { 210 void RegExpMacroAssemblerTracer::CheckCharacter(uint32_t c, Label* on_equal) {
203 PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n", c, on_equal); 211 PrintF(" CheckCharacter(c='u%04x', label[%08x]);\n",
212 c, IntForLabel(on_equal));
204 assembler_->CheckCharacter(c, on_equal); 213 assembler_->CheckCharacter(c, on_equal);
205 } 214 }
206 215
207 216
208 void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) { 217 void RegExpMacroAssemblerTracer::CheckAtStart(Label* on_at_start) {
209 PrintF(" CheckAtStart(label[%08x]);\n", on_at_start); 218 PrintF(" CheckAtStart(label[%08x]);\n", IntForLabel(on_at_start));
210 assembler_->CheckAtStart(on_at_start); 219 assembler_->CheckAtStart(on_at_start);
211 } 220 }
212 221
213 222
214 void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) { 223 void RegExpMacroAssemblerTracer::CheckNotAtStart(Label* on_not_at_start) {
215 PrintF(" CheckNotAtStart(label[%08x]);\n", on_not_at_start); 224 PrintF(" CheckNotAtStart(label[%08x]);\n", IntForLabel(on_not_at_start));
216 assembler_->CheckNotAtStart(on_not_at_start); 225 assembler_->CheckNotAtStart(on_not_at_start);
217 } 226 }
218 227
219 228
220 void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c, 229 void RegExpMacroAssemblerTracer::CheckNotCharacter(uint32_t c,
221 Label* on_not_equal) { 230 Label* on_not_equal) {
222 PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n", c, on_not_equal); 231 PrintF(" CheckNotCharacter(c='u%04x', label[%08x]);\n",
232 c, IntForLabel(on_not_equal));
223 assembler_->CheckNotCharacter(c, on_not_equal); 233 assembler_->CheckNotCharacter(c, on_not_equal);
224 } 234 }
225 235
226 236
227 void RegExpMacroAssemblerTracer::CheckCharacterAfterAnd( 237 void RegExpMacroAssemblerTracer::CheckCharacterAfterAnd(
228 uint32_t c, 238 uint32_t c,
229 uint32_t mask, 239 uint32_t mask,
230 Label* on_equal) { 240 Label* on_equal) {
231 PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n", 241 PrintF(" CheckCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
232 c, 242 c,
233 mask, 243 mask,
234 on_equal); 244 IntForLabel(on_equal));
235 assembler_->CheckCharacterAfterAnd(c, mask, on_equal); 245 assembler_->CheckCharacterAfterAnd(c, mask, on_equal);
236 } 246 }
237 247
238 248
239 void RegExpMacroAssemblerTracer::CheckNotCharacterAfterAnd( 249 void RegExpMacroAssemblerTracer::CheckNotCharacterAfterAnd(
240 uint32_t c, 250 uint32_t c,
241 uint32_t mask, 251 uint32_t mask,
242 Label* on_not_equal) { 252 Label* on_not_equal) {
243 PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n", 253 PrintF(" CheckNotCharacterAfterAnd(c='u%04x', mask=0x%04x, label[%08x]);\n",
244 c, 254 c,
245 mask, 255 mask,
246 on_not_equal); 256 IntForLabel(on_not_equal));
247 assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal); 257 assembler_->CheckNotCharacterAfterAnd(c, mask, on_not_equal);
248 } 258 }
249 259
250 260
251 void RegExpMacroAssemblerTracer::CheckNotCharacterAfterMinusAnd( 261 void RegExpMacroAssemblerTracer::CheckNotCharacterAfterMinusAnd(
252 uc16 c, 262 uc16 c,
253 uc16 minus, 263 uc16 minus,
254 uc16 mask, 264 uc16 mask,
255 Label* on_not_equal) { 265 Label* on_not_equal) {
256 PrintF(" CheckNotCharacterAfterMinusAnd(c='u%04x', minus=%04x, mask=0x%04x, " 266 PrintF(" CheckNotCharacterAfterMinusAnd(c='u%04x', minus=%04x, mask=0x%04x, "
257 "label[%08x]);\n", 267 "label[%08x]);\n",
258 c, 268 c,
259 minus, 269 minus,
260 mask, 270 mask,
261 on_not_equal); 271 IntForLabel(on_not_equal));
262 assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal); 272 assembler_->CheckNotCharacterAfterMinusAnd(c, minus, mask, on_not_equal);
263 } 273 }
264 274
265 275
266 void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg, 276 void RegExpMacroAssemblerTracer::CheckNotBackReference(int start_reg,
267 Label* on_no_match) { 277 Label* on_no_match) {
268 PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg, 278 PrintF(" CheckNotBackReference(register=%d, label[%08x]);\n", start_reg,
269 on_no_match); 279 IntForLabel(on_no_match));
270 assembler_->CheckNotBackReference(start_reg, on_no_match); 280 assembler_->CheckNotBackReference(start_reg, on_no_match);
271 } 281 }
272 282
273 283
274 void RegExpMacroAssemblerTracer::CheckNotBackReferenceIgnoreCase( 284 void RegExpMacroAssemblerTracer::CheckNotBackReferenceIgnoreCase(
275 int start_reg, 285 int start_reg,
276 Label* on_no_match) { 286 Label* on_no_match) {
277 PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n", 287 PrintF(" CheckNotBackReferenceIgnoreCase(register=%d, label[%08x]);\n",
278 start_reg, on_no_match); 288 start_reg, IntForLabel(on_no_match));
279 assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match); 289 assembler_->CheckNotBackReferenceIgnoreCase(start_reg, on_no_match);
280 } 290 }
281 291
282 292
283 void RegExpMacroAssemblerTracer::CheckNotRegistersEqual(int reg1, 293 void RegExpMacroAssemblerTracer::CheckNotRegistersEqual(int reg1,
284 int reg2, 294 int reg2,
285 Label* on_not_equal) { 295 Label* on_not_equal) {
286 PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n", 296 PrintF(" CheckNotRegistersEqual(reg1=%d, reg2=%d, label[%08x]);\n",
287 reg1, 297 reg1,
288 reg2, 298 reg2,
289 on_not_equal); 299 IntForLabel(on_not_equal));
290 assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal); 300 assembler_->CheckNotRegistersEqual(reg1, reg2, on_not_equal);
291 } 301 }
292 302
293 303
294 void RegExpMacroAssemblerTracer::CheckCharacters(Vector<const uc16> str, 304 void RegExpMacroAssemblerTracer::CheckCharacters(Vector<const uc16> str,
295 int cp_offset, 305 int cp_offset,
296 Label* on_failure, 306 Label* on_failure,
297 bool check_end_of_string) { 307 bool check_end_of_string) {
298 PrintF(" %s(str=\"", 308 PrintF(" %s(str=\"",
299 check_end_of_string ? "CheckCharacters" : "CheckCharactersUnchecked"); 309 check_end_of_string ? "CheckCharacters" : "CheckCharactersUnchecked");
300 for (int i = 0; i < str.length(); i++) { 310 for (int i = 0; i < str.length(); i++) {
301 PrintF("u%04x", str[i]); 311 PrintF("u%04x", str[i]);
302 } 312 }
303 PrintF("\", cp_offset=%d, label[%08x])\n", cp_offset, on_failure); 313 PrintF("\", cp_offset=%d, label[%08x])\n",
314 cp_offset, IntForLabel(on_failure));
304 assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string); 315 assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string);
305 } 316 }
306 317
307 318
308 bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass( 319 bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass(
309 uc16 type, 320 uc16 type,
310 Label* on_no_match) { 321 Label* on_no_match) {
311 bool supported = assembler_->CheckSpecialCharacterClass(type, 322 bool supported = assembler_->CheckSpecialCharacterClass(type,
312 on_no_match); 323 on_no_match);
313 PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n", 324 PrintF(" CheckSpecialCharacterClass(type='%c', label[%08x]): %s;\n",
314 type, 325 type,
315 on_no_match, 326 IntForLabel(on_no_match),
316 supported ? "true" : "false"); 327 supported ? "true" : "false");
317 return supported; 328 return supported;
318 } 329 }
319 330
320 331
321 void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index, 332 void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
322 int comparand, Label* if_lt) { 333 int comparand, Label* if_lt) {
323 PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n", 334 PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n",
324 register_index, comparand, if_lt); 335 register_index, comparand, IntForLabel(if_lt));
325 assembler_->IfRegisterLT(register_index, comparand, if_lt); 336 assembler_->IfRegisterLT(register_index, comparand, if_lt);
326 } 337 }
327 338
328 339
329 void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index, 340 void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
330 Label* if_eq) { 341 Label* if_eq) {
331 PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n", 342 PrintF(" IfRegisterEqPos(register=%d, label[%08x]);\n",
332 register_index, if_eq); 343 register_index, IntForLabel(if_eq));
333 assembler_->IfRegisterEqPos(register_index, if_eq); 344 assembler_->IfRegisterEqPos(register_index, if_eq);
334 } 345 }
335 346
336 347
337 void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index, 348 void RegExpMacroAssemblerTracer::IfRegisterGE(int register_index,
338 int comparand, Label* if_ge) { 349 int comparand, Label* if_ge) {
339 PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n", 350 PrintF(" IfRegisterGE(register=%d, number=%d, label[%08x]);\n",
340 register_index, comparand, if_ge); 351 register_index, comparand, IntForLabel(if_ge));
341 assembler_->IfRegisterGE(register_index, comparand, if_ge); 352 assembler_->IfRegisterGE(register_index, comparand, if_ge);
342 } 353 }
343 354
344 355
345 RegExpMacroAssembler::IrregexpImplementation 356 RegExpMacroAssembler::IrregexpImplementation
346 RegExpMacroAssemblerTracer::Implementation() { 357 RegExpMacroAssemblerTracer::Implementation() {
347 return assembler_->Implementation(); 358 return assembler_->Implementation();
348 } 359 }
349 360
350 361
351 Handle<Object> RegExpMacroAssemblerTracer::GetCode(Handle<String> source) { 362 Handle<Object> RegExpMacroAssemblerTracer::GetCode(Handle<String> source) {
352 PrintF(" GetCode(%s);\n", *(source->ToCString())); 363 PrintF(" GetCode(%s);\n", *(source->ToCString()));
353 return assembler_->GetCode(source); 364 return assembler_->GetCode(source);
354 } 365 }
355 366
356 }} // namespace v8::internal 367 }} // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698