| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 &code); | 375 &code); |
| 376 | 376 |
| 377 if (code == NULL) { | 377 if (code == NULL) { |
| 378 // Throw an exception. | 378 // Throw an exception. |
| 379 Handle<JSArray> array = Factory::NewJSArray(2); | 379 Handle<JSArray> array = Factory::NewJSArray(2); |
| 380 SetElement(array, 0, pattern); | 380 SetElement(array, 0, pattern); |
| 381 SetElement(array, 1, Factory::NewStringFromUtf8(CStrVector( | 381 SetElement(array, 1, Factory::NewStringFromUtf8(CStrVector( |
| 382 (error_message == NULL) ? "Unknown regexp error" : error_message))); | 382 (error_message == NULL) ? "Unknown regexp error" : error_message))); |
| 383 Handle<Object> regexp_err = | 383 Handle<Object> regexp_err = |
| 384 Factory::NewSyntaxError("malformed_regexp", array); | 384 Factory::NewSyntaxError("malformed_regexp", array); |
| 385 return Handle<Object>(Top::Throw(*regexp_err)); | 385 Top::Throw(*regexp_err); |
| 386 return Handle<Object>(); |
| 386 } | 387 } |
| 387 | 388 |
| 388 // Convert the return address to a ByteArray pointer. | 389 // Convert the return address to a ByteArray pointer. |
| 389 Handle<ByteArray> internal( | 390 Handle<ByteArray> internal( |
| 390 ByteArray::FromDataStartAddress(reinterpret_cast<Address>(code))); | 391 ByteArray::FromDataStartAddress(reinterpret_cast<Address>(code))); |
| 391 | 392 |
| 392 Handle<FixedArray> value = Factory::NewFixedArray(2); | 393 Handle<FixedArray> value = Factory::NewFixedArray(2); |
| 393 value->set(CAPTURE_INDEX, Smi::FromInt(number_of_captures)); | 394 value->set(CAPTURE_INDEX, Smi::FromInt(number_of_captures)); |
| 394 value->set(INTERNAL_INDEX, *internal); | 395 value->set(INTERNAL_INDEX, *internal); |
| 395 Factory::SetRegExpData(re, JSRegExp::JSCRE, pattern, flags, value); | 396 Factory::SetRegExpData(re, JSRegExp::JSCRE, pattern, flags, value); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 return Smi::cast(value->get(CAPTURE_INDEX))->value(); | 566 return Smi::cast(value->get(CAPTURE_INDEX))->value(); |
| 566 } | 567 } |
| 567 | 568 |
| 568 | 569 |
| 569 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { | 570 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { |
| 570 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex)); | 571 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex)); |
| 571 return ByteArray::cast(value->get(INTERNAL_INDEX)); | 572 return ByteArray::cast(value->get(INTERNAL_INDEX)); |
| 572 } | 573 } |
| 573 | 574 |
| 574 }} // namespace v8::internal | 575 }} // namespace v8::internal |
| OLD | NEW |