Reviewers: Mads Ager, Message: QUick review.
Description: Added possibility of miscompiled regexp to verfifier. Please review this at http://codereview.chromium.org/188005 Affected files: M src/objects-debug.cc M src/objects.h Index: src/objects-debug.cc diff --git a/src/objects-debug.cc b/src/objects-debug.cc index ef4aae531155ed0d621d73c8359e0fdcf5473d9b..922dd9a90fb0ff5e1c24bde8e8cac2c27596b731 100644 --- a/src/objects-debug.cc +++ b/src/objects-debug.cc @@ -769,10 +769,13 @@ void JSRegExp::JSRegExpVerify() { FixedArray* arr = FixedArray::cast(data()); Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); - ASSERT(ascii_data->IsTheHole() + // TheHole : Not compiled yet. + // JSObject: Compilation error. + // Code/ByteArray: Compiled code. + ASSERT(ascii_data->IsTheHole() || ascii_data->IsJSObject() || (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); Object* uc16_data = arr->get(JSRegExp::kIrregexpUC16CodeIndex); - ASSERT(uc16_data->IsTheHole() + ASSERT(uc16_data->IsTheHole() || ascii_data->IsJSObject() || (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray())); ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); Index: src/objects.h diff --git a/src/objects.h b/src/objects.h index 3f6f5fff52b720190cf24e52d5ac5b8628eca495..5c2488d185a3922695149791820fd40b05739df8 100644 --- a/src/objects.h +++ b/src/objects.h @@ -3528,9 +3528,13 @@ class JSRegExp: public JSObject { static const int kAtomDataSize = kAtomPatternIndex + 1; - // Irregexp compiled code or bytecode for ASCII. + // Irregexp compiled code or bytecode for ASCII. If compilation + // fails, this fields hold an exception object that should be + // thrown if the regexp is used again. static const int kIrregexpASCIICodeIndex = kDataIndex; - // Irregexp compiled code or bytecode for UC16. + // Irregexp compiled code or bytecode for UC16. If compilation + // fails, this fields hold an exception object that should be + // thrown if the regexp is used again. static const int kIrregexpUC16CodeIndex = kDataIndex + 1; // Maximal number of registers used by either ASCII or UC16. // Only used to check that there is enough stack space --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
