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

Side by Side Diff: src/jsregexp.cc

Issue 151603004: A64: Synchronize with r16587. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/json-stringifier.h ('k') | src/liveedit.cc » ('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 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 bit ^= 1; 1864 bit ^= 1;
1865 for (int i = start_index; i < end_index; i++) { 1865 for (int i = start_index; i < end_index; i++) {
1866 for (j = (ranges->at(i) & kMask); j < (ranges->at(i + 1) & kMask); j++) { 1866 for (j = (ranges->at(i) & kMask); j < (ranges->at(i + 1) & kMask); j++) {
1867 templ[j] = bit; 1867 templ[j] = bit;
1868 } 1868 }
1869 bit ^= 1; 1869 bit ^= 1;
1870 } 1870 }
1871 for (int i = j; i < kSize; i++) { 1871 for (int i = j; i < kSize; i++) {
1872 templ[i] = bit; 1872 templ[i] = bit;
1873 } 1873 }
1874 Factory* factory = Isolate::Current()->factory(); 1874 Factory* factory = masm->zone()->isolate()->factory();
1875 // TODO(erikcorry): Cache these. 1875 // TODO(erikcorry): Cache these.
1876 Handle<ByteArray> ba = factory->NewByteArray(kSize, TENURED); 1876 Handle<ByteArray> ba = factory->NewByteArray(kSize, TENURED);
1877 for (int i = 0; i < kSize; i++) { 1877 for (int i = 0; i < kSize; i++) {
1878 ba->set(i, templ[i]); 1878 ba->set(i, templ[i]);
1879 } 1879 }
1880 masm->CheckBitInTable(ba, on_bit_set); 1880 masm->CheckBitInTable(ba, on_bit_set);
1881 if (on_bit_clear != fall_through) masm->GoTo(on_bit_clear); 1881 if (on_bit_clear != fall_through) masm->GoTo(on_bit_clear);
1882 } 1882 }
1883 1883
1884 1884
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 // 2543 //
2544 // We iterate along the text object, building up for each character a 2544 // We iterate along the text object, building up for each character a
2545 // mask and value that can be used to test for a quick failure to match. 2545 // mask and value that can be used to test for a quick failure to match.
2546 // The masks and values for the positions will be combined into a single 2546 // The masks and values for the positions will be combined into a single
2547 // machine word for the current character width in order to be used in 2547 // machine word for the current character width in order to be used in
2548 // generating a quick check. 2548 // generating a quick check.
2549 void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, 2549 void TextNode::GetQuickCheckDetails(QuickCheckDetails* details,
2550 RegExpCompiler* compiler, 2550 RegExpCompiler* compiler,
2551 int characters_filled_in, 2551 int characters_filled_in,
2552 bool not_at_start) { 2552 bool not_at_start) {
2553 Isolate* isolate = Isolate::Current(); 2553 Isolate* isolate = compiler->macro_assembler()->zone()->isolate();
2554 ASSERT(characters_filled_in < details->characters()); 2554 ASSERT(characters_filled_in < details->characters());
2555 int characters = details->characters(); 2555 int characters = details->characters();
2556 int char_mask; 2556 int char_mask;
2557 if (compiler->ascii()) { 2557 if (compiler->ascii()) {
2558 char_mask = String::kMaxOneByteCharCode; 2558 char_mask = String::kMaxOneByteCharCode;
2559 } else { 2559 } else {
2560 char_mask = String::kMaxUtf16CodeUnit; 2560 char_mask = String::kMaxUtf16CodeUnit;
2561 } 2561 }
2562 for (int k = 0; k < elms_->length(); k++) { 2562 for (int k = 0; k < elms_->length(); k++) {
2563 TextElement elm = elms_->at(k); 2563 TextElement elm = elms_->at(k);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
3241 // loading characters, which means we do not need to recheck the bounds 3241 // loading characters, which means we do not need to recheck the bounds
3242 // up to the limit the quick check already checked. In addition the quick 3242 // up to the limit the quick check already checked. In addition the quick
3243 // check can have involved a mask and compare operation which may simplify 3243 // check can have involved a mask and compare operation which may simplify
3244 // or obviate the need for further checks at some character positions. 3244 // or obviate the need for further checks at some character positions.
3245 void TextNode::TextEmitPass(RegExpCompiler* compiler, 3245 void TextNode::TextEmitPass(RegExpCompiler* compiler,
3246 TextEmitPassType pass, 3246 TextEmitPassType pass,
3247 bool preloaded, 3247 bool preloaded,
3248 Trace* trace, 3248 Trace* trace,
3249 bool first_element_checked, 3249 bool first_element_checked,
3250 int* checked_up_to) { 3250 int* checked_up_to) {
3251 Isolate* isolate = Isolate::Current();
3252 RegExpMacroAssembler* assembler = compiler->macro_assembler(); 3251 RegExpMacroAssembler* assembler = compiler->macro_assembler();
3252 Isolate* isolate = assembler->zone()->isolate();
3253 bool ascii = compiler->ascii(); 3253 bool ascii = compiler->ascii();
3254 Label* backtrack = trace->backtrack(); 3254 Label* backtrack = trace->backtrack();
3255 QuickCheckDetails* quick_check = trace->quick_check_performed(); 3255 QuickCheckDetails* quick_check = trace->quick_check_performed();
3256 int element_count = elms_->length(); 3256 int element_count = elms_->length();
3257 for (int i = preloaded ? 0 : element_count - 1; i >= 0; i--) { 3257 for (int i = preloaded ? 0 : element_count - 1; i >= 0; i--) {
3258 TextElement elm = elms_->at(i); 3258 TextElement elm = elms_->at(i);
3259 int cp_offset = trace->cp_offset() + elm.cp_offset(); 3259 int cp_offset = trace->cp_offset() + elm.cp_offset();
3260 if (elm.text_type() == TextElement::ATOM) { 3260 if (elm.text_type() == TextElement::ATOM) {
3261 Vector<const uc16> quarks = elm.atom()->data(); 3261 Vector<const uc16> quarks = elm.atom()->data();
3262 for (int j = preloaded ? 0 : quarks.length() - 1; j >= 0; j--) { 3262 for (int j = preloaded ? 0 : quarks.length() - 1; j >= 0; j--) {
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
3815 &cont); 3815 &cont);
3816 } else { 3816 } else {
3817 masm->CheckCharacter(single_character, &cont); 3817 masm->CheckCharacter(single_character, &cont);
3818 } 3818 }
3819 masm->AdvanceCurrentPosition(lookahead_width); 3819 masm->AdvanceCurrentPosition(lookahead_width);
3820 masm->GoTo(&again); 3820 masm->GoTo(&again);
3821 masm->Bind(&cont); 3821 masm->Bind(&cont);
3822 return true; 3822 return true;
3823 } 3823 }
3824 3824
3825 Factory* factory = Isolate::Current()->factory(); 3825 Factory* factory = masm->zone()->isolate()->factory();
3826 Handle<ByteArray> boolean_skip_table = factory->NewByteArray(kSize, TENURED); 3826 Handle<ByteArray> boolean_skip_table = factory->NewByteArray(kSize, TENURED);
3827 int skip_distance = GetSkipTable( 3827 int skip_distance = GetSkipTable(
3828 min_lookahead, max_lookahead, boolean_skip_table); 3828 min_lookahead, max_lookahead, boolean_skip_table);
3829 ASSERT(skip_distance != 0); 3829 ASSERT(skip_distance != 0);
3830 3830
3831 Label cont, again; 3831 Label cont, again;
3832 masm->Bind(&again); 3832 masm->Bind(&again);
3833 masm->LoadCurrentCharacter(max_lookahead, &cont, true); 3833 masm->LoadCurrentCharacter(max_lookahead, &cont, true);
3834 masm->CheckBitInTable(boolean_skip_table, &cont); 3834 masm->CheckBitInTable(boolean_skip_table, &cont);
3835 masm->AdvanceCurrentPosition(skip_distance); 3835 masm->AdvanceCurrentPosition(skip_distance);
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after
5287 CharacterRangeSplitter::kInOverlay, zone); 5287 CharacterRangeSplitter::kInOverlay, zone);
5288 } 5288 }
5289 CharacterRangeSplitter callback(included, excluded, zone); 5289 CharacterRangeSplitter callback(included, excluded, zone);
5290 table.ForEach(&callback); 5290 table.ForEach(&callback);
5291 } 5291 }
5292 5292
5293 5293
5294 void CharacterRange::AddCaseEquivalents(ZoneList<CharacterRange>* ranges, 5294 void CharacterRange::AddCaseEquivalents(ZoneList<CharacterRange>* ranges,
5295 bool is_ascii, 5295 bool is_ascii,
5296 Zone* zone) { 5296 Zone* zone) {
5297 Isolate* isolate = Isolate::Current(); 5297 Isolate* isolate = zone->isolate();
5298 uc16 bottom = from(); 5298 uc16 bottom = from();
5299 uc16 top = to(); 5299 uc16 top = to();
5300 if (is_ascii && !RangeContainsLatin1Equivalents(*this)) { 5300 if (is_ascii && !RangeContainsLatin1Equivalents(*this)) {
5301 if (bottom > String::kMaxOneByteCharCode) return; 5301 if (bottom > String::kMaxOneByteCharCode) return;
5302 if (top > String::kMaxOneByteCharCode) top = String::kMaxOneByteCharCode; 5302 if (top > String::kMaxOneByteCharCode) top = String::kMaxOneByteCharCode;
5303 } 5303 }
5304 unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth]; 5304 unibrow::uchar chars[unibrow::Ecma262UnCanonicalize::kMaxWidth];
5305 if (top == bottom) { 5305 if (top == bottom) {
5306 // If this is a singleton we just expand the one character. 5306 // If this is a singleton we just expand the one character.
5307 int length = isolate->jsregexp_uncanonicalize()->get(bottom, '\0', chars); 5307 int length = isolate->jsregexp_uncanonicalize()->get(bottom, '\0', chars);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
5675 else 5675 else
5676 return empty(); 5676 return empty();
5677 } 5677 }
5678 5678
5679 5679
5680 // ------------------------------------------------------------------- 5680 // -------------------------------------------------------------------
5681 // Analysis 5681 // Analysis
5682 5682
5683 5683
5684 void Analysis::EnsureAnalyzed(RegExpNode* that) { 5684 void Analysis::EnsureAnalyzed(RegExpNode* that) {
5685 StackLimitCheck check(Isolate::Current()); 5685 StackLimitCheck check(that->zone()->isolate());
5686 if (check.HasOverflowed()) { 5686 if (check.HasOverflowed()) {
5687 fail("Stack overflow"); 5687 fail("Stack overflow");
5688 return; 5688 return;
5689 } 5689 }
5690 if (that->info()->been_analyzed || that->info()->being_analyzed) 5690 if (that->info()->been_analyzed || that->info()->being_analyzed)
5691 return; 5691 return;
5692 that->info()->being_analyzed = true; 5692 that->info()->being_analyzed = true;
5693 that->Accept(this); 5693 that->Accept(this);
5694 that->info()->being_analyzed = false; 5694 that->info()->being_analyzed = false;
5695 that->info()->been_analyzed = true; 5695 that->info()->been_analyzed = true;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
6118 } 6118 }
6119 6119
6120 return compiler.Assemble(&macro_assembler, 6120 return compiler.Assemble(&macro_assembler,
6121 node, 6121 node,
6122 data->capture_count, 6122 data->capture_count,
6123 pattern); 6123 pattern);
6124 } 6124 }
6125 6125
6126 6126
6127 }} // namespace v8::internal 6127 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698