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

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

Issue 165443: X64: Implement RegExp natively. (Closed)
Patch Set: Addressed review comments. Created 11 years, 4 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() { 46 RegExpMacroAssemblerTracer::~RegExpMacroAssemblerTracer() {
47 } 47 }
48 48
49 49
50 void RegExpMacroAssemblerTracer::Bind(Label* label) { 50 void RegExpMacroAssemblerTracer::Bind(Label* label) {
51 PrintF("label[%08x]: (Bind)\n", label, label); 51 PrintF("label[%08x]: (Bind)\n", label, label);
52 assembler_->Bind(label); 52 assembler_->Bind(label);
53 } 53 }
54 54
55 55
56 void RegExpMacroAssemblerTracer::EmitOrLink(Label* label) {
57 PrintF(" EmitOrLink(label[%08x]);\n", label);
58 assembler_->EmitOrLink(label);
59 }
60
61
62 void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) { 56 void RegExpMacroAssemblerTracer::AdvanceCurrentPosition(int by) {
63 PrintF(" AdvanceCurrentPosition(by=%d);\n", by); 57 PrintF(" AdvanceCurrentPosition(by=%d);\n", by);
64 assembler_->AdvanceCurrentPosition(by); 58 assembler_->AdvanceCurrentPosition(by);
65 } 59 }
66 60
67 61
68 void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) { 62 void RegExpMacroAssemblerTracer::CheckGreedyLoop(Label* label) {
69 PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label); 63 PrintF(" CheckGreedyLoop(label[%08x]);\n\n", label);
70 assembler_->CheckGreedyLoop(label); 64 assembler_->CheckGreedyLoop(label);
71 } 65 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 PrintF(" %s(str=\"", 298 PrintF(" %s(str=\"",
305 check_end_of_string ? "CheckCharacters" : "CheckCharactersUnchecked"); 299 check_end_of_string ? "CheckCharacters" : "CheckCharactersUnchecked");
306 for (int i = 0; i < str.length(); i++) { 300 for (int i = 0; i < str.length(); i++) {
307 PrintF("u%04x", str[i]); 301 PrintF("u%04x", str[i]);
308 } 302 }
309 PrintF("\", cp_offset=%d, label[%08x])\n", cp_offset, on_failure); 303 PrintF("\", cp_offset=%d, label[%08x])\n", cp_offset, on_failure);
310 assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string); 304 assembler_->CheckCharacters(str, cp_offset, on_failure, check_end_of_string);
311 } 305 }
312 306
313 307
314 void RegExpMacroAssemblerTracer::CheckBitmap(uc16 start, Label* bitmap,
315 Label* on_zero) {
316 PrintF(" CheckBitmap(start=u%04x, <bitmap>, label[%08x]);\n", start, on_zero);
317 assembler_->CheckBitmap(start, bitmap, on_zero);
318 }
319
320
321 bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass( 308 bool RegExpMacroAssemblerTracer::CheckSpecialCharacterClass(
322 uc16 type, 309 uc16 type,
323 int cp_offset, 310 int cp_offset,
324 bool check_offset, 311 bool check_offset,
325 Label* on_no_match) { 312 Label* on_no_match) {
326 bool supported = assembler_->CheckSpecialCharacterClass(type, 313 bool supported = assembler_->CheckSpecialCharacterClass(type,
327 cp_offset, 314 cp_offset,
328 check_offset, 315 check_offset,
329 on_no_match); 316 on_no_match);
330 PrintF(" CheckSpecialCharacterClass(type='%c', offset=%d, " 317 PrintF(" CheckSpecialCharacterClass(type='%c', offset=%d, "
331 "check_offset=%s, label[%08x]): %s;\n", 318 "check_offset=%s, label[%08x]): %s;\n",
332 type, 319 type,
333 cp_offset, 320 cp_offset,
334 check_offset ? "true" : "false", 321 check_offset ? "true" : "false",
335 on_no_match, 322 on_no_match,
336 supported ? "true" : "false"); 323 supported ? "true" : "false");
337 return supported; 324 return supported;
338 } 325 }
339 326
340 327
341 void RegExpMacroAssemblerTracer::DispatchHalfNibbleMap(
342 uc16 start,
343 Label* half_nibble_map,
344 const Vector<Label*>& destinations) {
345 PrintF(" DispatchHalfNibbleMap(start=u%04x, <half_nibble_map>, [", start);
346 for (int i = 0; i < destinations.length(); i++) {
347 if (i > 0)
348 PrintF(", ");
349 PrintF("label[%08x]", destinations[i]);
350 }
351 PrintF(");\n");
352 assembler_->DispatchHalfNibbleMap(start, half_nibble_map, destinations);
353 }
354
355
356 void RegExpMacroAssemblerTracer::DispatchByteMap(
357 uc16 start,
358 Label* byte_map,
359 const Vector<Label*>& destinations) {
360 PrintF(" DispatchByteMap(start=u%04x, <byte_map>, [", start);
361 for (int i = 0; i < destinations.length(); i++) {
362 if (i > 0)
363 PrintF(", ");
364 PrintF("label[%08x]", destinations[i]);
365 }
366 PrintF(");\n");
367 assembler_->DispatchByteMap(start, byte_map, destinations);
368 }
369
370
371 void RegExpMacroAssemblerTracer::DispatchHighByteMap(
372 byte start,
373 Label* byte_map,
374 const Vector<Label*>& destinations) {
375 PrintF(" DispatchHighByteMap(start=u%04x, <byte_map>, [", start);
376 for (int i = 0; i < destinations.length(); i++) {
377 if (i > 0)
378 PrintF(", ");
379 PrintF("label[%08x]", destinations[i]);
380 }
381 PrintF(");\n");
382 assembler_->DispatchHighByteMap(start, byte_map, destinations);
383 }
384
385
386 void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index, 328 void RegExpMacroAssemblerTracer::IfRegisterLT(int register_index,
387 int comparand, Label* if_lt) { 329 int comparand, Label* if_lt) {
388 PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n", 330 PrintF(" IfRegisterLT(register=%d, number=%d, label[%08x]);\n",
389 register_index, comparand, if_lt); 331 register_index, comparand, if_lt);
390 assembler_->IfRegisterLT(register_index, comparand, if_lt); 332 assembler_->IfRegisterLT(register_index, comparand, if_lt);
391 } 333 }
392 334
393 335
394 void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index, 336 void RegExpMacroAssemblerTracer::IfRegisterEqPos(int register_index,
395 Label* if_eq) { 337 Label* if_eq) {
(...skipping 16 matching lines...) Expand all
412 return assembler_->Implementation(); 354 return assembler_->Implementation();
413 } 355 }
414 356
415 357
416 Handle<Object> RegExpMacroAssemblerTracer::GetCode(Handle<String> source) { 358 Handle<Object> RegExpMacroAssemblerTracer::GetCode(Handle<String> source) {
417 PrintF(" GetCode(%s);\n", *(source->ToCString())); 359 PrintF(" GetCode(%s);\n", *(source->ToCString()));
418 return assembler_->GetCode(source); 360 return assembler_->GetCode(source);
419 } 361 }
420 362
421 }} // namespace v8::internal 363 }} // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698