Index: src/bootstrapper.cc |
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc |
index 762c4f9962716b477224c59e76418d7e3db7132f..5892e3bad7034263cfcae1f5ea49a6b36f836d82 100644 |
--- a/src/bootstrapper.cc |
+++ b/src/bootstrapper.cc |
@@ -478,10 +478,26 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) { |
native_context()->set_object_function(*object_fun); |
// Allocate a new prototype for the object function. |
- Handle<JSObject> prototype = factory->NewJSObject( |
- isolate->object_function(), |
- TENURED); |
+ Handle<Map> object_prototype_map = |
+ factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); |
+ Handle<DescriptorArray> prototype_descriptors( |
+ factory->NewDescriptorArray(0, 1)); |
+ DescriptorArray::WhitenessWitness witness(*prototype_descriptors); |
+ Handle<Foreign> object_prototype( |
+ factory->NewForeign(&Accessors::ObjectPrototype)); |
+ PropertyAttributes attribs = static_cast<PropertyAttributes>( |
+ DONT_ENUM | DONT_DELETE); |
+ object_prototype_map->set_instance_descriptors(*prototype_descriptors); |
+ |
+ { // Add __proto__. |
+ CallbacksDescriptor d(heap->Proto_symbol(), *object_prototype, attribs); |
+ object_prototype_map->AppendDescriptor(&d, witness); |
+ } |
+ |
+ Handle<JSObject> prototype = factory->NewJSObjectFromMap( |
+ object_prototype_map, |
+ TENURED); |
native_context()->set_initial_object_prototype(*prototype); |
SetPrototype(object_fun, prototype); |
} |