Index: src/heap.cc |
=================================================================== |
--- src/heap.cc (revision 7800) |
+++ src/heap.cc (working copy) |
@@ -3211,6 +3211,25 @@ |
} |
+MaybeObject* Heap::AllocateJSProxy(Object* handler, Object* prototype) { |
+ // Allocate map. |
+ Object* map_obj; |
+ MaybeObject* maybe_map_obj = AllocateMap(JS_PROXY_TYPE, JSProxy::kSize); |
+ if (!maybe_map_obj->ToObject(&map_obj)) return maybe_map_obj; |
+ Map* map = Map::cast(map_obj); |
+ map->set_prototype(prototype); |
+ map->set_pre_allocated_property_fields(1); |
+ map->set_inobject_properties(1); |
+ |
+ // Allocate the proxy object. |
+ Object* result; |
+ MaybeObject* maybe_result = Allocate(map, NEW_SPACE); |
+ if (!maybe_result->ToObject(&result)) return maybe_result; |
+ JSProxy::cast(result)->set_handler(handler); |
+ return result; |
+} |
+ |
+ |
MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) { |
ASSERT(constructor->has_initial_map()); |
Map* map = constructor->initial_map(); |