| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 bool in_cache = !cached.is_null(); | 115 bool in_cache = !cached.is_null(); |
| 116 LOG(RegExpCompileEvent(re, in_cache)); | 116 LOG(RegExpCompileEvent(re, in_cache)); |
| 117 | 117 |
| 118 Handle<Object> result; | 118 Handle<Object> result; |
| 119 if (in_cache) { | 119 if (in_cache) { |
| 120 re->set_data(*cached); | 120 re->set_data(*cached); |
| 121 return re; | 121 return re; |
| 122 } | 122 } |
| 123 FlattenString(pattern); | 123 FlattenString(pattern); |
| 124 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 124 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
| 125 PostponeInterruptScope postpone; | 125 PostponeInterruptsScope postpone; |
| 126 RegExpCompileData parse_result; | 126 RegExpCompileData parse_result; |
| 127 FlatStringReader reader(pattern); | 127 FlatStringReader reader(pattern); |
| 128 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { | 128 if (!ParseRegExp(&reader, flags.is_multiline(), &parse_result)) { |
| 129 // Throw an exception if we fail to parse the pattern. | 129 // Throw an exception if we fail to parse the pattern. |
| 130 ThrowRegExpException(re, | 130 ThrowRegExpException(re, |
| 131 pattern, | 131 pattern, |
| 132 parse_result.error, | 132 parse_result.error, |
| 133 "malformed_regexp"); | 133 "malformed_regexp"); |
| 134 return Handle<Object>::null(); | 134 return Handle<Object>::null(); |
| 135 } | 135 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 #else // ! V8_NATIVE_REGEXP (RegExp interpreter code) | 241 #else // ! V8_NATIVE_REGEXP (RegExp interpreter code) |
| 242 if (compiled_code->IsByteArray()) return true; | 242 if (compiled_code->IsByteArray()) return true; |
| 243 #endif | 243 #endif |
| 244 return CompileIrregexp(re, is_ascii); | 244 return CompileIrregexp(re, is_ascii); |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, bool is_ascii) { | 248 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, bool is_ascii) { |
| 249 // Compile the RegExp. | 249 // Compile the RegExp. |
| 250 CompilationZoneScope zone_scope(DELETE_ON_EXIT); | 250 CompilationZoneScope zone_scope(DELETE_ON_EXIT); |
| 251 PostponeInterruptScope postpone; | 251 PostponeInterruptsScope postpone; |
| 252 Object* entry = re->DataAt(JSRegExp::code_index(is_ascii)); | 252 Object* entry = re->DataAt(JSRegExp::code_index(is_ascii)); |
| 253 if (entry->IsJSObject()) { | 253 if (entry->IsJSObject()) { |
| 254 // If it's a JSObject, a previous compilation failed and threw this object. | 254 // If it's a JSObject, a previous compilation failed and threw this object. |
| 255 // Re-throw the object without trying again. | 255 // Re-throw the object without trying again. |
| 256 Top::Throw(entry); | 256 Top::Throw(entry); |
| 257 return false; | 257 return false; |
| 258 } | 258 } |
| 259 ASSERT(entry->IsTheHole()); | 259 ASSERT(entry->IsTheHole()); |
| 260 | 260 |
| 261 JSRegExp::Flags flags = re->GetFlags(); | 261 JSRegExp::Flags flags = re->GetFlags(); |
| (...skipping 4995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5257 node, | 5257 node, |
| 5258 data->capture_count, | 5258 data->capture_count, |
| 5259 pattern); | 5259 pattern); |
| 5260 } | 5260 } |
| 5261 | 5261 |
| 5262 | 5262 |
| 5263 int OffsetsVector::static_offsets_vector_[ | 5263 int OffsetsVector::static_offsets_vector_[ |
| 5264 OffsetsVector::kStaticOffsetsVectorSize]; | 5264 OffsetsVector::kStaticOffsetsVectorSize]; |
| 5265 | 5265 |
| 5266 }} // namespace v8::internal | 5266 }} // namespace v8::internal |
| OLD | NEW |