| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 return JSRegExp::Flags(flags); | 92 return JSRegExp::Flags(flags); |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 static inline void ThrowRegExpException(Handle<JSRegExp> re, | 96 static inline void ThrowRegExpException(Handle<JSRegExp> re, |
| 97 Handle<String> pattern, | 97 Handle<String> pattern, |
| 98 Handle<String> error_text, | 98 Handle<String> error_text, |
| 99 const char* message) { | 99 const char* message) { |
| 100 Handle<JSArray> array = Factory::NewJSArray(2); | 100 Handle<JSArray> array = Factory::NewJSArray(2); |
| 101 SetElement(array, 0, pattern); | 101 SetElement(array, 0, pattern, kNonStrictMode); |
| 102 SetElement(array, 1, error_text); | 102 SetElement(array, 1, error_text, kNonStrictMode); |
| 103 Handle<Object> regexp_err = Factory::NewSyntaxError(message, array); | 103 Handle<Object> regexp_err = Factory::NewSyntaxError(message, array); |
| 104 Top::Throw(*regexp_err); | 104 Top::Throw(*regexp_err); |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 // Generic RegExp methods. Dispatches to implementation specific methods. | 108 // Generic RegExp methods. Dispatches to implementation specific methods. |
| 109 | 109 |
| 110 | 110 |
| 111 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, | 111 Handle<Object> RegExpImpl::Compile(Handle<JSRegExp> re, |
| 112 Handle<String> pattern, | 112 Handle<String> pattern, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 319 } |
| 320 RegExpEngine::CompilationResult result = | 320 RegExpEngine::CompilationResult result = |
| 321 RegExpEngine::Compile(&compile_data, | 321 RegExpEngine::Compile(&compile_data, |
| 322 flags.is_ignore_case(), | 322 flags.is_ignore_case(), |
| 323 flags.is_multiline(), | 323 flags.is_multiline(), |
| 324 pattern, | 324 pattern, |
| 325 is_ascii); | 325 is_ascii); |
| 326 if (result.error_message != NULL) { | 326 if (result.error_message != NULL) { |
| 327 // Unable to compile regexp. | 327 // Unable to compile regexp. |
| 328 Handle<JSArray> array = Factory::NewJSArray(2); | 328 Handle<JSArray> array = Factory::NewJSArray(2); |
| 329 SetElement(array, 0, pattern); | 329 SetElement(array, 0, pattern, kNonStrictMode); |
| 330 SetElement(array, | 330 SetElement(array, |
| 331 1, | 331 1, |
| 332 Factory::NewStringFromUtf8(CStrVector(result.error_message))); | 332 Factory::NewStringFromUtf8(CStrVector(result.error_message)), |
| 333 kNonStrictMode); |
| 333 Handle<Object> regexp_err = | 334 Handle<Object> regexp_err = |
| 334 Factory::NewSyntaxError("malformed_regexp", array); | 335 Factory::NewSyntaxError("malformed_regexp", array); |
| 335 Top::Throw(*regexp_err); | 336 Top::Throw(*regexp_err); |
| 336 re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err); | 337 re->SetDataAt(JSRegExp::code_index(is_ascii), *regexp_err); |
| 337 return false; | 338 return false; |
| 338 } | 339 } |
| 339 | 340 |
| 340 Handle<FixedArray> data = Handle<FixedArray>(FixedArray::cast(re->data())); | 341 Handle<FixedArray> data = Handle<FixedArray>(FixedArray::cast(re->data())); |
| 341 data->set(JSRegExp::code_index(is_ascii), result.code); | 342 data->set(JSRegExp::code_index(is_ascii), result.code); |
| 342 int register_max = IrregexpMaxRegisterCount(*data); | 343 int register_max = IrregexpMaxRegisterCount(*data); |
| (...skipping 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5331 node, | 5332 node, |
| 5332 data->capture_count, | 5333 data->capture_count, |
| 5333 pattern); | 5334 pattern); |
| 5334 } | 5335 } |
| 5335 | 5336 |
| 5336 | 5337 |
| 5337 int OffsetsVector::static_offsets_vector_[ | 5338 int OffsetsVector::static_offsets_vector_[ |
| 5338 OffsetsVector::kStaticOffsetsVectorSize]; | 5339 OffsetsVector::kStaticOffsetsVectorSize]; |
| 5339 | 5340 |
| 5340 }} // namespace v8::internal | 5341 }} // namespace v8::internal |
| OLD | NEW |