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

Unified Diff: src/factory.cc

Issue 218633014: Replace CopyMap(constructor->initial_map()) by Map::Create(constructor) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/factory.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 86b72f645697f8f144406d420cd30127a1d624a3..52a194180be30b9c675b83ef45d7ce06f137f45e 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -813,38 +813,6 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
}
-Handle<Map> Factory::CopyWithPreallocatedFieldDescriptors(Handle<Map> src) {
- CALL_HEAP_FUNCTION(
- isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map);
-}
-
-
-Handle<Map> Factory::CopyMap(Handle<Map> src,
- int extra_inobject_properties) {
- Handle<Map> copy = CopyWithPreallocatedFieldDescriptors(src);
- // Check that we do not overflow the instance size when adding the
- // extra inobject properties.
- int instance_size_delta = extra_inobject_properties * kPointerSize;
- int max_instance_size_delta =
- JSObject::kMaxInstanceSize - copy->instance_size();
- int max_extra_properties = max_instance_size_delta >> kPointerSizeLog2;
- if (extra_inobject_properties > max_extra_properties) {
- // If the instance size overflows, we allocate as many properties
- // as we can as inobject properties.
- instance_size_delta = max_instance_size_delta;
- extra_inobject_properties = max_extra_properties;
- }
- // Adjust the map with the extra inobject properties.
- int inobject_properties =
- copy->inobject_properties() + extra_inobject_properties;
- copy->set_inobject_properties(inobject_properties);
- copy->set_unused_property_fields(inobject_properties);
- copy->set_instance_size(copy->instance_size() + instance_size_delta);
- copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
- return copy;
-}
-
-
Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) {
CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray);
}
@@ -1911,11 +1879,10 @@ Handle<Map> Factory::ObjectLiteralMapFromCache(Handle<Context> context,
Handle<Object> result = Handle<Object>(cache->Lookup(*keys), isolate());
if (result->IsMap()) return Handle<Map>::cast(result);
// Create a new map and add it to the cache.
- Handle<Map> map =
- CopyMap(Handle<Map>(context->object_function()->initial_map()),
- keys->length());
+ Handle<Map> map = Map::Create(
+ handle(context->object_function()), keys->length());
AddToMapCache(context, keys, map);
- return Handle<Map>(map);
+ return map;
}
« no previous file with comments | « src/factory.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698