| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 } | 104 } |
| 105 | 105 |
| 106 | 106 |
| 107 // Generic RegExp methods. Dispatches to implementation specific methods. | 107 // Generic RegExp methods. Dispatches to implementation specific methods. |
| 108 | 108 |
| 109 | 109 |
| 110 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, | 110 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, |
| 111 Handle<String> pattern, | 111 Handle<String> pattern, |
| 112 Handle<String> flag_str) { | 112 Handle<String> flag_str) { |
| 113 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str); | 113 JSRegExp::Flags flags = RegExpFlagsFromString(flag_str); |
| 114 Handle<FixedArray> cached = CompilationCache::LookupRegExp(pattern, flags); | 114 CompilationCache* compilation_cache = Isolate::Current()->compilation_cache(); |
| 115 Handle<FixedArray> cached = compilation_cache->LookupRegExp(pattern, flags); |
| 115 bool in_cache = !cached.is_null(); | 116 bool in_cache = !cached.is_null(); |
| 116 LOG(RegExpCompileEvent(re, in_cache)); | 117 LOG(RegExpCompileEvent(re, in_cache)); |
| 117 | 118 |
| 118 Handle<Object> result; | 119 Handle<Object> result; |
| 119 if (in_cache) { | 120 if (in_cache) { |
| 120 re->set_data(*cached); | 121 re->set_data(*cached); |
| 121 return re; | 122 return re; |
| 122 } | 123 } |
| 123 FlattenString(pattern); | 124 FlattenString(pattern); |
| 124 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 125 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 144 Vector<const uc16> atom_pattern = atom->data(); | 145 Vector<const uc16> atom_pattern = atom->data(); |
| 145 Handle<String> atom_string = Factory::NewStringFromTwoByte(atom_pattern); | 146 Handle<String> atom_string = Factory::NewStringFromTwoByte(atom_pattern); |
| 146 AtomCompile(re, pattern, flags, atom_string); | 147 AtomCompile(re, pattern, flags, atom_string); |
| 147 } else { | 148 } else { |
| 148 IrregexpInitialize(re, pattern, flags, parse_result.capture_count); | 149 IrregexpInitialize(re, pattern, flags, parse_result.capture_count); |
| 149 } | 150 } |
| 150 ASSERT(re->data()->IsFixedArray()); | 151 ASSERT(re->data()->IsFixedArray()); |
| 151 // Compilation succeeded so the data is set on the regexp | 152 // Compilation succeeded so the data is set on the regexp |
| 152 // and we can store it in the cache. | 153 // and we can store it in the cache. |
| 153 Handle<FixedArray> data(FixedArray::cast(re->data())); | 154 Handle<FixedArray> data(FixedArray::cast(re->data())); |
| 154 CompilationCache::PutRegExp(pattern, flags, data); | 155 compilation_cache->PutRegExp(pattern, flags, data); |
| 155 | 156 |
| 156 return re; | 157 return re; |
| 157 } | 158 } |
| 158 | 159 |
| 159 | 160 |
| 160 Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp, | 161 Handle<Object> RegExpImpl::Exec(Handle<JSRegExp> regexp, |
| 161 Handle<String> subject, | 162 Handle<String> subject, |
| 162 int index, | 163 int index, |
| 163 Handle<JSArray> last_match_info) { | 164 Handle<JSArray> last_match_info) { |
| 164 switch (regexp->TypeTag()) { | 165 switch (regexp->TypeTag()) { |
| (...skipping 5093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5258 node, | 5259 node, |
| 5259 data->capture_count, | 5260 data->capture_count, |
| 5260 pattern); | 5261 pattern); |
| 5261 } | 5262 } |
| 5262 | 5263 |
| 5263 | 5264 |
| 5264 int OffsetsVector::static_offsets_vector_[ | 5265 int OffsetsVector::static_offsets_vector_[ |
| 5265 OffsetsVector::kStaticOffsetsVectorSize]; | 5266 OffsetsVector::kStaticOffsetsVectorSize]; |
| 5266 | 5267 |
| 5267 }} // namespace v8::internal | 5268 }} // namespace v8::internal |
| OLD | NEW |