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