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

Side by Side Diff: src/factory.cc

Issue 8104: Regexp caching (Closed)
Patch Set: Created 12 years, 2 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
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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 Handle<Object> result = Handle<Object>(cache->Lookup(*keys)); 801 Handle<Object> result = Handle<Object>(cache->Lookup(*keys));
802 if (result->IsMap()) return Handle<Map>::cast(result); 802 if (result->IsMap()) return Handle<Map>::cast(result);
803 // Create a new map and add it to the cache. 803 // Create a new map and add it to the cache.
804 Handle<Map> map = 804 Handle<Map> map =
805 CopyMap(Handle<Map>(context->object_function()->initial_map())); 805 CopyMap(Handle<Map>(context->object_function()->initial_map()));
806 AddToMapCache(context, keys, map); 806 AddToMapCache(context, keys, map);
807 return Handle<Map>(map); 807 return Handle<Map>(map);
808 } 808 }
809 809
810 810
811 void Factory::SetRegExpData(Handle<JSRegExp> regexp,
812 JSRegExp::Type type,
813 Handle<String> source,
814 int flags,
815 Handle<Object> data) {
816 Handle<FixedArray> store = NewFixedArray(JSRegExp::kDataSize);
817 store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
818 store->set(JSRegExp::kSourceIndex, *source);
819 store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags));
820 store->set(JSRegExp::kAtomPatternIndex, *data);
821 regexp->set_data(*store);
822 }
823
824
811 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc, 825 void Factory::ConfigureInstance(Handle<FunctionTemplateInfo> desc,
812 Handle<JSObject> instance, 826 Handle<JSObject> instance,
813 bool* pending_exception) { 827 bool* pending_exception) {
814 // Configure the instance by adding the properties specified by the 828 // Configure the instance by adding the properties specified by the
815 // instance template. 829 // instance template.
816 Handle<Object> instance_template = Handle<Object>(desc->instance_template()); 830 Handle<Object> instance_template = Handle<Object>(desc->instance_template());
817 if (!instance_template->IsUndefined()) { 831 if (!instance_template->IsUndefined()) {
818 Execution::ConfigureInstance(instance, 832 Execution::ConfigureInstance(instance,
819 instance_template, 833 instance_template,
820 pending_exception); 834 pending_exception);
821 } else { 835 } else {
822 *pending_exception = false; 836 *pending_exception = false;
823 } 837 }
824 } 838 }
825 839
826 840
827 } } // namespace v8::internal 841 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698