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

Side by Side Diff: src/jsregexp.cc

Issue 10419: * Fixed bug in calling native irregexp. (Closed)
Patch Set: Created 12 years 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
« no previous file with comments | « no previous file | 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 LOG(RegExpExecEvent(regexp, previous_index, two_byte_subject)); 501 LOG(RegExpExecEvent(regexp, previous_index, two_byte_subject));
502 502
503 FixedArray* irregexp = 503 FixedArray* irregexp =
504 FixedArray::cast(regexp->DataAt(JSRegExp::kIrregexpDataIndex)); 504 FixedArray::cast(regexp->DataAt(JSRegExp::kIrregexpDataIndex));
505 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value(); 505 int tag = Smi::cast(irregexp->get(kIrregexpImplementationIndex))->value();
506 506
507 switch (tag) { 507 switch (tag) {
508 case RegExpMacroAssembler::kIA32Implementation: { 508 case RegExpMacroAssembler::kIA32Implementation: {
509 Code* code = Code::cast(irregexp->get(kIrregexpCodeIndex)); 509 Code* code = Code::cast(irregexp->get(kIrregexpCodeIndex));
510 SmartPointer<int> captures(NewArray<int>((num_captures + 1) * 2));
511 Address start_addr = 510 Address start_addr =
512 Handle<SeqTwoByteString>::cast(two_byte_subject)->GetCharsAddress(); 511 Handle<SeqTwoByteString>::cast(two_byte_subject)->GetCharsAddress();
513 int start_offset = 512 int string_offset =
514 start_addr - reinterpret_cast<Address>(*two_byte_subject); 513 start_addr - reinterpret_cast<Address>(*two_byte_subject);
515 int end_offset = 514 int start_offset = string_offset + previous_index * 2;
516 start_offset + (two_byte_subject->length() - previous_index) * 2; 515 int end_offset = string_offset + two_byte_subject->length() * 2;
517 typedef bool testfunc(String**, int, int, int*); 516 typedef bool testfunc(String**, int, int, int*);
518 testfunc* test = FUNCTION_CAST<testfunc*>(code->entry()); 517 testfunc* test = FUNCTION_CAST<testfunc*>(code->entry());
519 rc = test(two_byte_subject.location(), 518 rc = test(two_byte_subject.location(),
520 start_offset, 519 start_offset,
521 end_offset, 520 end_offset,
522 *captures); 521 offsets_vector);
523 if (rc) { 522 if (rc) {
524 // Capture values are relative to start_offset only. 523 // Capture values are relative to start_offset only.
525 for (int i = 0; i < offsets_vector_length; i++) { 524 for (int i = 0; i < offsets_vector_length; i++) {
526 if (offsets_vector[i] >= 0) { 525 if (offsets_vector[i] >= 0) {
527 offsets_vector[i] += previous_index; 526 offsets_vector[i] += previous_index;
528 } 527 }
529 } 528 }
530 } 529 }
531 break; 530 break;
532 } 531 }
(...skipping 2153 matching lines...) Expand 10 before | Expand all | Expand 10 after
2686 byte codes[1024]; 2685 byte codes[1024];
2687 IrregexpAssembler assembler(Vector<byte>(codes, 1024)); 2686 IrregexpAssembler assembler(Vector<byte>(codes, 1024));
2688 RegExpMacroAssemblerIrregexp macro_assembler(&assembler); 2687 RegExpMacroAssemblerIrregexp macro_assembler(&assembler);
2689 return compiler.Assemble(&macro_assembler, 2688 return compiler.Assemble(&macro_assembler,
2690 node, 2689 node,
2691 input->capture_count); 2690 input->capture_count);
2692 } 2691 }
2693 2692
2694 2693
2695 }} // namespace v8::internal 2694 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698