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

Unified Diff: src/heap.cc

Issue 151146: Treat the builtins object like other global objects (with... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 6 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/heap.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 2317)
+++ src/heap.cc (working copy)
@@ -1558,7 +1558,7 @@
Object* Heap::AllocateSharedFunctionInfo(Object* name) {
- Object* result = Allocate(shared_function_info_map(), NEW_SPACE);
+ Object* result = Allocate(shared_function_info_map(), OLD_POINTER_SPACE);
if (result->IsFailure()) return result;
SharedFunctionInfo* share = SharedFunctionInfo::cast(result);
@@ -2050,7 +2050,7 @@
// Allocate the backing storage for the properties.
int prop_size = map->unused_property_fields() - map->inobject_properties();
- Object* properties = AllocateFixedArray(prop_size);
+ Object* properties = AllocateFixedArray(prop_size, pretenure);
if (properties->IsFailure()) return properties;
// Allocate the JSObject.
@@ -2080,19 +2080,24 @@
// Allocate the object based on the constructors initial map.
Object* result =
AllocateJSObjectFromMap(constructor->initial_map(), pretenure);
- // Make sure result is NOT a JS global object if valid.
- ASSERT(result->IsFailure() || !result->IsJSGlobalObject());
+ // Make sure result is NOT a global object if valid.
+ ASSERT(result->IsFailure() || !result->IsGlobalObject());
return result;
}
-Object* Heap::AllocateJSGlobalObject(JSFunction* constructor) {
+Object* Heap::AllocateGlobalObject(JSFunction* constructor) {
ASSERT(constructor->has_initial_map());
// Make sure no field properties are described in the initial map.
// This guarantees us that normalizing the properties does not
// require us to change property values to JSGlobalPropertyCells.
ASSERT(constructor->initial_map()->NextFreePropertyIndex() == 0);
+ // Make sure we don't have a ton of pre-allocated slots in the
+ // global objects. They will be unused once we normalize the object.
+ ASSERT(constructor->initial_map()->unused_property_fields() == 0);
+ ASSERT(constructor->initial_map()->inobject_properties() == 0);
+
// Allocate the object based on the constructors initial map.
Object* result = AllocateJSObjectFromMap(constructor->initial_map(), TENURED);
if (result->IsFailure()) return result;
@@ -2102,8 +2107,8 @@
result = global->NormalizeProperties(CLEAR_INOBJECT_PROPERTIES);
if (result->IsFailure()) return result;
- // Make sure result is a JS global object with properties in dictionary.
- ASSERT(global->IsJSGlobalObject());
+ // Make sure result is a global object with properties in dictionary.
+ ASSERT(global->IsGlobalObject());
ASSERT(!global->HasFastProperties());
return global;
}
@@ -2182,7 +2187,7 @@
// Allocate the backing storage for the properties.
int prop_size = map->unused_property_fields() - map->inobject_properties();
- Object* properties = AllocateFixedArray(prop_size);
+ Object* properties = AllocateFixedArray(prop_size, TENURED);
if (properties->IsFailure()) return properties;
// Reset the map for the object.
« no previous file with comments | « src/heap.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698