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

Unified Diff: src/heap/heap.cc

Issue 418143007: FYI Implementing 'super' keyword (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: one more test Created 6 years, 4 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
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index a4a970534e34e85133d672e0c2c9a412f06c4702..ae5613eaf76ede98e18740c130695266f574f55f 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -3589,7 +3589,7 @@ AllocationResult Heap::AllocateJSObject(JSFunction* constructor,
AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
// Never used to copy functions. If functions need to be copied we
// have to be careful to clear the literals array.
- SLOW_DCHECK(!source->IsJSFunction());
+ // SLOW_DCHECK(!source->IsJSFunction());
// Make the clone.
Map* map = source->map();
@@ -3664,6 +3664,28 @@ AllocationResult Heap::CopyJSObject(JSObject* source, AllocationSite* site) {
}
JSObject::cast(clone)->set_properties(prop, wb_mode);
}
+
+ if (source->IsJSFunction()) {
+ SLOW_DCHECK(clone->IsJSFunction());
+ JSFunction* source_fun = JSFunction::cast(source);
+ JSFunction* clone_fun = JSFunction::cast(clone);
+ SharedFunctionInfo* info = source_fun->shared();
+ if (!info->bound()) {
+ int num_literals = info->num_literals();
+ HeapObject* obj;
+ {
+ AllocationResult allocation = AllocateFixedArrayWithFiller(
+ num_literals, NOT_TENURED, undefined_value());
+ if (!allocation.To(&obj)) return allocation;
+ }
+ FixedArray* new_literals = FixedArray::cast(obj);
+ if (num_literals > 0) {
+ new_literals->set(JSFunction::kLiteralNativeContextIndex,
+ JSFunction::NativeContextFromLiterals(source_fun->literals()));
+ }
+ clone_fun->set_literals(new_literals);
+ }
+ }
// Return the new clone.
return clone;
}
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698