Commit 54f8947d authored by lrn@chromium.org's avatar lrn@chromium.org

Added possibility of miscompiled regexp to verfifier.

Review URL: http://codereview.chromium.org/188005


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2812 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c8d358aa
...@@ -769,11 +769,14 @@ void JSRegExp::JSRegExpVerify() { ...@@ -769,11 +769,14 @@ void JSRegExp::JSRegExpVerify() {
FixedArray* arr = FixedArray::cast(data()); FixedArray* arr = FixedArray::cast(data());
Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex); Object* ascii_data = arr->get(JSRegExp::kIrregexpASCIICodeIndex);
ASSERT(ascii_data->IsTheHole() // TheHole : Not compiled yet.
|| (is_native ? ascii_data->IsCode() : ascii_data->IsByteArray())); // 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); 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())); (is_native ? uc16_data->IsCode() : uc16_data->IsByteArray()));
ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi()); ASSERT(arr->get(JSRegExp::kIrregexpCaptureCountIndex)->IsSmi());
ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi()); ASSERT(arr->get(JSRegExp::kIrregexpMaxRegisterCountIndex)->IsSmi());
break; break;
......
...@@ -3528,9 +3528,13 @@ class JSRegExp: public JSObject { ...@@ -3528,9 +3528,13 @@ class JSRegExp: public JSObject {
static const int kAtomDataSize = kAtomPatternIndex + 1; 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; 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; static const int kIrregexpUC16CodeIndex = kDataIndex + 1;
// Maximal number of registers used by either ASCII or UC16. // Maximal number of registers used by either ASCII or UC16.
// Only used to check that there is enough stack space // Only used to check that there is enough stack space
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment