Revision: 22830
Author: verwa...@chromium.org
Date: Mon Aug 4 15:23:29 2014 UTC
Log: Also mark as prototype when passing in while creating a function.
BUG=
R=ish...@chromium.org
Review URL: https://codereview.chromium.org/422233010
http://code.google.com/p/v8/source/detail?r=22830
Modified:
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/objects.cc
=======================================
--- /branches/bleeding_edge/src/factory.cc Mon Aug 4 15:02:07 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Mon Aug 4 15:23:29 2014 UTC
@@ -1268,6 +1268,11 @@
? isolate()->sloppy_function_with_readonly_prototype_map()
: isolate()->sloppy_function_map();
Handle<JSFunction> result = NewFunction(map, name, code);
+ if (!prototype->IsTheHole()) {
+ Handle<JSObject> js_proto = Handle<JSObject>::cast(prototype);
+ Handle<Map> new_map = Map::CopyAsPrototypeMap(handle(js_proto->map()));
+ JSObject::MigrateToMap(js_proto, new_map);
+ }
result->set_prototype_or_initial_map(*prototype);
return result;
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Aug 4 15:12:01 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Mon Aug 4 15:23:29 2014 UTC
@@ -7288,6 +7288,7 @@
Handle<Map> Map::CopyAsPrototypeMap(Handle<Map> map) {
+ if (map->is_prototype_map()) return map;
Handle<Map> result = Copy(map);
result->mark_prototype_map();
return result;
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.