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

Side by Side Diff: src/jsregexp.cc

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

Powered by Google App Engine
This is Rietveld 408576698