| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009, 2011 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 // machine word for the current character width in order to be used in | 1951 // machine word for the current character width in order to be used in |
| 1952 // generating a quick check. | 1952 // generating a quick check. |
| 1953 void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, | 1953 void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, |
| 1954 RegExpCompiler* compiler, | 1954 RegExpCompiler* compiler, |
| 1955 int characters_filled_in, | 1955 int characters_filled_in, |
| 1956 bool not_at_start) { | 1956 bool not_at_start) { |
| 1957 Isolate* isolate = Isolate::Current(); | 1957 Isolate* isolate = Isolate::Current(); |
| 1958 ASSERT(characters_filled_in < details->characters()); | 1958 ASSERT(characters_filled_in < details->characters()); |
| 1959 int characters = details->characters(); | 1959 int characters = details->characters(); |
| 1960 int char_mask; | 1960 int char_mask; |
| 1961 int char_shift; | |
| 1962 if (compiler->ascii()) { | 1961 if (compiler->ascii()) { |
| 1963 char_mask = String::kMaxAsciiCharCode; | 1962 char_mask = String::kMaxAsciiCharCode; |
| 1964 char_shift = 8; | |
| 1965 } else { | 1963 } else { |
| 1966 char_mask = String::kMaxUC16CharCode; | 1964 char_mask = String::kMaxUC16CharCode; |
| 1967 char_shift = 16; | |
| 1968 } | 1965 } |
| 1969 for (int k = 0; k < elms_->length(); k++) { | 1966 for (int k = 0; k < elms_->length(); k++) { |
| 1970 TextElement elm = elms_->at(k); | 1967 TextElement elm = elms_->at(k); |
| 1971 if (elm.type == TextElement::ATOM) { | 1968 if (elm.type == TextElement::ATOM) { |
| 1972 Vector<const uc16> quarks = elm.data.u_atom->data(); | 1969 Vector<const uc16> quarks = elm.data.u_atom->data(); |
| 1973 for (int i = 0; i < characters && i < quarks.length(); i++) { | 1970 for (int i = 0; i < characters && i < quarks.length(); i++) { |
| 1974 QuickCheckDetails::Position* pos = | 1971 QuickCheckDetails::Position* pos = |
| 1975 details->positions(characters_filled_in); | 1972 details->positions(characters_filled_in); |
| 1976 uc16 c = quarks[i]; | 1973 uc16 c = quarks[i]; |
| 1977 if (c > char_mask) { | 1974 if (c > char_mask) { |
| (...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4881 // Set up the offsets of the elements relative to the start. This is a fixed | 4878 // Set up the offsets of the elements relative to the start. This is a fixed |
| 4882 // quantity since a TextNode can only contain fixed-width things. | 4879 // quantity since a TextNode can only contain fixed-width things. |
| 4883 int cp_offset = 0; | 4880 int cp_offset = 0; |
| 4884 for (int i = 0; i < element_count; i++) { | 4881 for (int i = 0; i < element_count; i++) { |
| 4885 TextElement& elm = elements()->at(i); | 4882 TextElement& elm = elements()->at(i); |
| 4886 elm.cp_offset = cp_offset; | 4883 elm.cp_offset = cp_offset; |
| 4887 if (elm.type == TextElement::ATOM) { | 4884 if (elm.type == TextElement::ATOM) { |
| 4888 cp_offset += elm.data.u_atom->data().length(); | 4885 cp_offset += elm.data.u_atom->data().length(); |
| 4889 } else { | 4886 } else { |
| 4890 cp_offset++; | 4887 cp_offset++; |
| 4891 Vector<const uc16> quarks = elm.data.u_atom->data(); | |
| 4892 } | 4888 } |
| 4893 } | 4889 } |
| 4894 } | 4890 } |
| 4895 | 4891 |
| 4896 | 4892 |
| 4897 void Analysis::VisitText(TextNode* that) { | 4893 void Analysis::VisitText(TextNode* that) { |
| 4898 if (ignore_case_) { | 4894 if (ignore_case_) { |
| 4899 that->MakeCaseIndependent(is_ascii_); | 4895 that->MakeCaseIndependent(is_ascii_); |
| 4900 } | 4896 } |
| 4901 EnsureAnalyzed(that->on_success()); | 4897 EnsureAnalyzed(that->on_success()); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5320 } | 5316 } |
| 5321 } | 5317 } |
| 5322 data->node = node; | 5318 data->node = node; |
| 5323 Analysis analysis(ignore_case, is_ascii); | 5319 Analysis analysis(ignore_case, is_ascii); |
| 5324 analysis.EnsureAnalyzed(node); | 5320 analysis.EnsureAnalyzed(node); |
| 5325 if (analysis.has_failed()) { | 5321 if (analysis.has_failed()) { |
| 5326 const char* error_message = analysis.error_message(); | 5322 const char* error_message = analysis.error_message(); |
| 5327 return CompilationResult(error_message); | 5323 return CompilationResult(error_message); |
| 5328 } | 5324 } |
| 5329 | 5325 |
| 5330 NodeInfo info = *node->info(); | |
| 5331 | |
| 5332 // Create the correct assembler for the architecture. | 5326 // Create the correct assembler for the architecture. |
| 5333 #ifndef V8_INTERPRETED_REGEXP | 5327 #ifndef V8_INTERPRETED_REGEXP |
| 5334 // Native regexp implementation. | 5328 // Native regexp implementation. |
| 5335 | 5329 |
| 5336 NativeRegExpMacroAssembler::Mode mode = | 5330 NativeRegExpMacroAssembler::Mode mode = |
| 5337 is_ascii ? NativeRegExpMacroAssembler::ASCII | 5331 is_ascii ? NativeRegExpMacroAssembler::ASCII |
| 5338 : NativeRegExpMacroAssembler::UC16; | 5332 : NativeRegExpMacroAssembler::UC16; |
| 5339 | 5333 |
| 5340 #if V8_TARGET_ARCH_IA32 | 5334 #if V8_TARGET_ARCH_IA32 |
| 5341 RegExpMacroAssemblerIA32 macro_assembler(mode, (data->capture_count + 1) * 2); | 5335 RegExpMacroAssemblerIA32 macro_assembler(mode, (data->capture_count + 1) * 2); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 5363 } | 5357 } |
| 5364 | 5358 |
| 5365 return compiler.Assemble(¯o_assembler, | 5359 return compiler.Assemble(¯o_assembler, |
| 5366 node, | 5360 node, |
| 5367 data->capture_count, | 5361 data->capture_count, |
| 5368 pattern); | 5362 pattern); |
| 5369 } | 5363 } |
| 5370 | 5364 |
| 5371 | 5365 |
| 5372 }} // namespace v8::internal | 5366 }} // namespace v8::internal |
| OLD | NEW |