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

Side by Side Diff: src/factory.cc

Issue 28311: Flattened the representation of compiled RegExp data. (Closed)
Patch Set: ... and it lints. Created 11 years, 9 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/factory.h ('k') | src/jsregexp.h » ('j') | src/jsregexp.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 if (result->IsMap()) return Handle<Map>::cast(result); 819 if (result->IsMap()) return Handle<Map>::cast(result);
820 // Create a new map and add it to the cache. 820 // Create a new map and add it to the cache.
821 Handle<Map> map = 821 Handle<Map> map =
822 CopyMap(Handle<Map>(context->object_function()->initial_map()), 822 CopyMap(Handle<Map>(context->object_function()->initial_map()),
823 keys->length()); 823 keys->length());
824 AddToMapCache(context, keys, map); 824 AddToMapCache(context, keys, map);
825 return Handle<Map>(map); 825 return Handle<Map>(map);
826 } 826 }
827 827
828 828
829 void Factory::SetRegExpData(Handle<JSRegExp> regexp, 829 void Factory::SetRegExpAtomData(Handle<JSRegExp> regexp,
830 JSRegExp::Type type, 830 JSRegExp::Type type,
831 Handle<String> source, 831 Handle<String> source,
832 JSRegExp::Flags flags, 832 JSRegExp::Flags flags,
833 Handle<Object> data) { 833 Handle<Object> data) {
834 Handle<FixedArray> store = NewFixedArray(JSRegExp::kDataSize); 834 Handle<FixedArray> store = NewFixedArray(JSRegExp::kAtomDataSize);
835
835 store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); 836 store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
836 store->set(JSRegExp::kSourceIndex, *source); 837 store->set(JSRegExp::kSourceIndex, *source);
837 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); 838 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
838 store->set(JSRegExp::kAtomPatternIndex, *data); 839 store->set(JSRegExp::kAtomPatternIndex, *data);
839 regexp->set_data(*store); 840 regexp->set_data(*store);
840 } 841 }
841 842
843 void Factory::SetRegExpIrregexpData(Handle<JSRegExp> regexp,
844 JSRegExp::Type type,
845 Handle<String> source,
846 JSRegExp::Flags flags,
847 int capture_count) {
848 Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize);
849
850 store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
851 store->set(JSRegExp::kSourceIndex, *source);
852 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
853 store->set(JSRegExp::kIrregexpASCIICodeIndex, Heap::the_hole_value());
854 store->set(JSRegExp::kIrregexpUC16CodeIndex, Heap::the_hole_value());
855 store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0));
856 store->set(JSRegExp::kIrregexpCaptureCountIndex,
857 Smi::FromInt(capture_count));
858 regexp->set_data(*store);
859 }
860
842 861
862
843 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, 863 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc,
844 Handle<JSObject> instance, 864 Handle<JSObject> instance,
845 bool* pending_exception) { 865 bool* pending_exception) {
846 // Configure the instance by adding the properties specified by the 866 // Configure the instance by adding the properties specified by the
847 // instance template. 867 // instance template.
848 Handle<Object> instance_template = Handle<Object>(desc->instance_template()); 868 Handle<Object> instance_template = Handle<Object>(desc->instance_template());
849 if (!instance_template->IsUndefined()) { 869 if (!instance_template->IsUndefined()) {
850 Execution::ConfigureInstance(instance, 870 Execution::ConfigureInstance(instance,
851 instance_template, 871 instance_template,
852 pending_exception); 872 pending_exception);
853 } else { 873 } else {
854 *pending_exception = false; 874 *pending_exception = false;
855 } 875 }
856 } 876 }
857 877
858 878
859 } } // namespace v8::internal 879 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/jsregexp.h » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698