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

Side by Side Diff: src/jsregexp.cc

Issue 10905239: Correctly initialize regexp global cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | test/mjsunit/regress/regress-148378.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 SetLastCaptureCount(array, capture_register_count); 699 SetLastCaptureCount(array, capture_register_count);
700 SetLastSubject(array, *subject); 700 SetLastSubject(array, *subject);
701 SetLastInput(array, *subject); 701 SetLastInput(array, *subject);
702 return last_match_info; 702 return last_match_info;
703 } 703 }
704 704
705 705
706 RegExpImpl::GlobalCache::GlobalCache(Handle<JSRegExp> regexp, 706 RegExpImpl::GlobalCache::GlobalCache(Handle<JSRegExp> regexp,
707 Handle<String> subject, 707 Handle<String> subject,
708 bool is_global, 708 bool is_global,
709 Isolate* isolate) { 709 Isolate* isolate)
710 : register_array_(NULL),
711 register_array_size_(0),
712 regexp_(regexp),
713 subject_(subject) {
710 #ifdef V8_INTERPRETED_REGEXP 714 #ifdef V8_INTERPRETED_REGEXP
711 bool interpreted = true; 715 bool interpreted = true;
712 #else 716 #else
713 bool interpreted = false; 717 bool interpreted = false;
714 #endif // V8_INTERPRETED_REGEXP 718 #endif // V8_INTERPRETED_REGEXP
715 719
716 regexp_ = regexp;
717 subject_ = subject;
718
719 if (regexp_->TypeTag() == JSRegExp::ATOM) { 720 if (regexp_->TypeTag() == JSRegExp::ATOM) {
720 static const int kAtomRegistersPerMatch = 2; 721 static const int kAtomRegistersPerMatch = 2;
721 registers_per_match_ = kAtomRegistersPerMatch; 722 registers_per_match_ = kAtomRegistersPerMatch;
722 // There is no distinction between interpreted and native for atom regexps. 723 // There is no distinction between interpreted and native for atom regexps.
723 interpreted = false; 724 interpreted = false;
724 } else { 725 } else {
725 registers_per_match_ = RegExpImpl::IrregexpPrepare(regexp_, subject_); 726 registers_per_match_ = RegExpImpl::IrregexpPrepare(regexp_, subject_);
726 if (registers_per_match_ < 0) { 727 if (registers_per_match_ < 0) {
727 num_matches_ = -1; // Signal exception. 728 num_matches_ = -1; // Signal exception.
728 return; 729 return;
(...skipping 5429 matching lines...) Expand 10 before | Expand all | Expand 10 after
6158 } 6159 }
6159 6160
6160 return compiler.Assemble(&macro_assembler, 6161 return compiler.Assemble(&macro_assembler,
6161 node, 6162 node,
6162 data->capture_count, 6163 data->capture_count,
6163 pattern); 6164 pattern);
6164 } 6165 }
6165 6166
6166 6167
6167 }} // namespace v8::internal 6168 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-148378.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698