Index: src/js/v8natives.js |
diff --git a/src/js/v8natives.js b/src/js/v8natives.js |
index 3c1e175a9e7f4f1bd8b23678b85c6722ea1d9f9a..d830ba5aca6c5f343ed4ee9e6c4c009e475b643b 100644 |
--- a/src/js/v8natives.js |
+++ b/src/js/v8natives.js |
@@ -1797,9 +1797,11 @@ function FunctionConstructor(arg1) { // length == 1 |
var global_proxy = %GlobalProxy(FunctionConstructor); |
// Compile the string in the constructor and not a helper so that errors |
// appear to come from here. |
- var f = %_CallFunction(global_proxy, %CompileString(source, true)); |
- %FunctionMarkNameShouldPrintAsAnonymous(f); |
- return f; |
+ var func = %_CallFunction(global_proxy, %CompileString(source, true)); |
+ // Set name-should-print-as-anonymous flag on the ShareFunctionInfo and |
+ // ensure that |func| uses correct initial map from |new.target| if |
+ // it's available. |
+ return %CompleteFunctionConstruction(func, GlobalFunction, new.target); |
} |