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

Unified Diff: src/bootstrapper.cc

Issue 12212011: Make __proto__ a foreign callback on Object.prototype. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added regression test for issue 2441. Created 7 years, 10 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 | « no previous file | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698