Give each function prototype a fresh copy of the object function map.
This avoid unwanted sharing between different function prototypes and in general should help inlining because constant function properties on one prototype don't affect other prototypes anymore. BUG=v8:1716 Review URL: http://codereview.chromium.org/7994001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9393 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
f48c9f6557
commit
c6a3422c04
12
src/heap.cc
12
src/heap.cc
@ -3265,8 +3265,18 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) {
|
||||
// different context.
|
||||
JSFunction* object_function =
|
||||
function->context()->global_context()->object_function();
|
||||
|
||||
// Each function prototype gets a copy of the object function map.
|
||||
// This avoid unwanted sharing of maps between prototypes of different
|
||||
// constructors.
|
||||
Map* new_map;
|
||||
ASSERT(object_function->has_initial_map());
|
||||
{ MaybeObject* maybe_map =
|
||||
object_function->initial_map()->CopyDropTransitions();
|
||||
if (!maybe_map->To<Map>(&new_map)) return maybe_map;
|
||||
}
|
||||
Object* prototype;
|
||||
{ MaybeObject* maybe_prototype = AllocateJSObject(object_function);
|
||||
{ MaybeObject* maybe_prototype = AllocateJSObjectFromMap(new_map);
|
||||
if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype;
|
||||
}
|
||||
// When creating the prototype for the function we must set its
|
||||
|
@ -1070,7 +1070,6 @@ void JSObject::JSObjectShortPrint(StringStream* accumulator) {
|
||||
|
||||
|
||||
void HeapObject::HeapObjectShortPrint(StringStream* accumulator) {
|
||||
// if (!HEAP->InNewSpace(this)) PrintF("*", this);
|
||||
Heap* heap = GetHeap();
|
||||
if (!heap->Contains(this)) {
|
||||
accumulator->Add("!!!INVALID POINTER!!!");
|
||||
|
Loading…
Reference in New Issue
Block a user