Chromium Code Reviews| Index: src/runtime/runtime-regexp.cc |
| diff --git a/src/runtime/runtime-regexp.cc b/src/runtime/runtime-regexp.cc |
| index be9adfff41e5ac6794a7f704ede272ba88506f58..277bedf69b1e7987d2250a108d884f436a9708f2 100644 |
| --- a/src/runtime/runtime-regexp.cc |
| +++ b/src/runtime/runtime-regexp.cc |
| @@ -805,7 +805,7 @@ static JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags, |
| uint32_t value = JSRegExp::NONE; |
| int length = flags->length(); |
| // A longer flags string cannot be valid. |
| - if (length > 4) return JSRegExp::Flags(0); |
| + if (length > 5) return JSRegExp::Flags(0); |
| for (int i = 0; i < length; i++) { |
| uint32_t flag = JSRegExp::NONE; |
| switch (flags->Get(i)) { |
| @@ -822,6 +822,10 @@ static JSRegExp::Flags RegExpFlagsFromString(Handle<String> flags, |
| if (!FLAG_harmony_regexps) return JSRegExp::Flags(0); |
| flag = JSRegExp::STICKY; |
| break; |
| + case 'u': |
|
rossberg
2015/01/08 12:47:45
Nit: sort cases alphabetically
marja
2015/01/08 13:42:18
Done.
|
| + if (!FLAG_harmony_unicode) return JSRegExp::Flags(0); |
| + flag = JSRegExp::UNICODE_ESCAPES; |
| + break; |
| default: |
| return JSRegExp::Flags(0); |
| } |
| @@ -859,10 +863,12 @@ RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) { |
| Handle<Object> ignore_case = factory->ToBoolean(flags.is_ignore_case()); |
| Handle<Object> multiline = factory->ToBoolean(flags.is_multiline()); |
| Handle<Object> sticky = factory->ToBoolean(flags.is_sticky()); |
| + Handle<Object> unicode = factory->ToBoolean(flags.is_unicode()); |
| Map* map = regexp->map(); |
| Object* constructor = map->constructor(); |
| - if (!FLAG_harmony_regexps && constructor->IsJSFunction() && |
| + if (!FLAG_harmony_regexps && !FLAG_harmony_unicode && |
| + constructor->IsJSFunction() && |
| JSFunction::cast(constructor)->initial_map() == map) { |
| // If we still have the original map, set in-object properties directly. |
| // Both true and false are immovable immortal objects so no need for write |
| @@ -896,6 +902,10 @@ RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) { |
| JSObject::SetOwnPropertyIgnoreAttributes(regexp, factory->sticky_string(), |
| sticky, final).Check(); |
| } |
| + if (FLAG_harmony_unicode) { |
| + JSObject::SetOwnPropertyIgnoreAttributes( |
| + regexp, factory->unicode_string(), unicode, final).Check(); |
| + } |
| JSObject::SetOwnPropertyIgnoreAttributes( |
| regexp, factory->last_index_string(), zero, writable).Check(); |
| } |