Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime/runtime-regexp.cc

Issue 903703002: Split --harmony-unicode and --harmony-unicode-regexps. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/regexp.js ('k') | test/mjsunit/harmony/regexp-flags.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/jsregexp-inl.h" 8 #include "src/jsregexp-inl.h"
9 #include "src/jsregexp.h" 9 #include "src/jsregexp.h"
10 #include "src/runtime/runtime-utils.h" 10 #include "src/runtime/runtime-utils.h"
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 case 'g': 812 case 'g':
813 flag = JSRegExp::GLOBAL; 813 flag = JSRegExp::GLOBAL;
814 break; 814 break;
815 case 'i': 815 case 'i':
816 flag = JSRegExp::IGNORE_CASE; 816 flag = JSRegExp::IGNORE_CASE;
817 break; 817 break;
818 case 'm': 818 case 'm':
819 flag = JSRegExp::MULTILINE; 819 flag = JSRegExp::MULTILINE;
820 break; 820 break;
821 case 'u': 821 case 'u':
822 if (!FLAG_harmony_unicode) return JSRegExp::Flags(0); 822 if (!FLAG_harmony_unicode_regexps) return JSRegExp::Flags(0);
823 flag = JSRegExp::UNICODE_ESCAPES; 823 flag = JSRegExp::UNICODE_ESCAPES;
824 break; 824 break;
825 case 'y': 825 case 'y':
826 if (!FLAG_harmony_regexps) return JSRegExp::Flags(0); 826 if (!FLAG_harmony_regexps) return JSRegExp::Flags(0);
827 flag = JSRegExp::STICKY; 827 flag = JSRegExp::STICKY;
828 break; 828 break;
829 default: 829 default:
830 return JSRegExp::Flags(0); 830 return JSRegExp::Flags(0);
831 } 831 }
832 // Duplicate flag. 832 // Duplicate flag.
(...skipping 27 matching lines...) Expand all
860 } 860 }
861 861
862 Handle<Object> global = factory->ToBoolean(flags.is_global()); 862 Handle<Object> global = factory->ToBoolean(flags.is_global());
863 Handle<Object> ignore_case = factory->ToBoolean(flags.is_ignore_case()); 863 Handle<Object> ignore_case = factory->ToBoolean(flags.is_ignore_case());
864 Handle<Object> multiline = factory->ToBoolean(flags.is_multiline()); 864 Handle<Object> multiline = factory->ToBoolean(flags.is_multiline());
865 Handle<Object> sticky = factory->ToBoolean(flags.is_sticky()); 865 Handle<Object> sticky = factory->ToBoolean(flags.is_sticky());
866 Handle<Object> unicode = factory->ToBoolean(flags.is_unicode()); 866 Handle<Object> unicode = factory->ToBoolean(flags.is_unicode());
867 867
868 Map* map = regexp->map(); 868 Map* map = regexp->map();
869 Object* constructor = map->constructor(); 869 Object* constructor = map->constructor();
870 if (!FLAG_harmony_regexps && !FLAG_harmony_unicode && 870 if (!FLAG_harmony_regexps && !FLAG_harmony_unicode_regexps &&
871 constructor->IsJSFunction() && 871 constructor->IsJSFunction() &&
872 JSFunction::cast(constructor)->initial_map() == map) { 872 JSFunction::cast(constructor)->initial_map() == map) {
873 // If we still have the original map, set in-object properties directly. 873 // If we still have the original map, set in-object properties directly.
874 // Both true and false are immovable immortal objects so no need for write 874 // Both true and false are immovable immortal objects so no need for write
875 // barrier. 875 // barrier.
876 regexp->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, *global, 876 regexp->InObjectPropertyAtPut(JSRegExp::kGlobalFieldIndex, *global,
877 SKIP_WRITE_BARRIER); 877 SKIP_WRITE_BARRIER);
878 regexp->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, *ignore_case, 878 regexp->InObjectPropertyAtPut(JSRegExp::kIgnoreCaseFieldIndex, *ignore_case,
879 SKIP_WRITE_BARRIER); 879 SKIP_WRITE_BARRIER);
880 regexp->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, *multiline, 880 regexp->InObjectPropertyAtPut(JSRegExp::kMultilineFieldIndex, *multiline,
(...skipping 14 matching lines...) Expand all
895 JSObject::SetOwnPropertyIgnoreAttributes(regexp, factory->global_string(), 895 JSObject::SetOwnPropertyIgnoreAttributes(regexp, factory->global_string(),
896 global, final).Check(); 896 global, final).Check();
897 JSObject::SetOwnPropertyIgnoreAttributes( 897 JSObject::SetOwnPropertyIgnoreAttributes(
898 regexp, factory->ignore_case_string(), ignore_case, final).Check(); 898 regexp, factory->ignore_case_string(), ignore_case, final).Check();
899 JSObject::SetOwnPropertyIgnoreAttributes( 899 JSObject::SetOwnPropertyIgnoreAttributes(
900 regexp, factory->multiline_string(), multiline, final).Check(); 900 regexp, factory->multiline_string(), multiline, final).Check();
901 if (FLAG_harmony_regexps) { 901 if (FLAG_harmony_regexps) {
902 JSObject::SetOwnPropertyIgnoreAttributes(regexp, factory->sticky_string(), 902 JSObject::SetOwnPropertyIgnoreAttributes(regexp, factory->sticky_string(),
903 sticky, final).Check(); 903 sticky, final).Check();
904 } 904 }
905 if (FLAG_harmony_unicode) { 905 if (FLAG_harmony_unicode_regexps) {
906 JSObject::SetOwnPropertyIgnoreAttributes( 906 JSObject::SetOwnPropertyIgnoreAttributes(
907 regexp, factory->unicode_string(), unicode, final).Check(); 907 regexp, factory->unicode_string(), unicode, final).Check();
908 } 908 }
909 JSObject::SetOwnPropertyIgnoreAttributes( 909 JSObject::SetOwnPropertyIgnoreAttributes(
910 regexp, factory->last_index_string(), zero, writable).Check(); 910 regexp, factory->last_index_string(), zero, writable).Check();
911 } 911 }
912 912
913 Handle<Object> result; 913 Handle<Object> result;
914 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 914 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
915 isolate, result, RegExpImpl::Compile(regexp, source, flags)); 915 isolate, result, RegExpImpl::Compile(regexp, source, flags));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 1123
1124 1124
1125 RUNTIME_FUNCTION(RuntimeReference_IsRegExp) { 1125 RUNTIME_FUNCTION(RuntimeReference_IsRegExp) {
1126 SealHandleScope shs(isolate); 1126 SealHandleScope shs(isolate);
1127 DCHECK(args.length() == 1); 1127 DCHECK(args.length() == 1);
1128 CONVERT_ARG_CHECKED(Object, obj, 0); 1128 CONVERT_ARG_CHECKED(Object, obj, 0);
1129 return isolate->heap()->ToBoolean(obj->IsJSRegExp()); 1129 return isolate->heap()->ToBoolean(obj->IsJSRegExp());
1130 } 1130 }
1131 } 1131 }
1132 } // namespace v8::internal 1132 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/regexp.js ('k') | test/mjsunit/harmony/regexp-flags.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698