| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function(global, utils) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 %CheckIsBootstrapping(); | 7 %CheckIsBootstrapping(); |
| 8 | 8 |
| 9 // ---------------------------------------------------------------------------- | 9 // ---------------------------------------------------------------------------- |
| 10 // Imports | 10 // Imports |
| (...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1790 var body = (n > 0) ? TO_STRING(args[n - 1]) : ''; | 1790 var body = (n > 0) ? TO_STRING(args[n - 1]) : ''; |
| 1791 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; | 1791 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 | 1794 |
| 1795 function FunctionConstructor(arg1) { // length == 1 | 1795 function FunctionConstructor(arg1) { // length == 1 |
| 1796 var source = NewFunctionString(arguments, 'function'); | 1796 var source = NewFunctionString(arguments, 'function'); |
| 1797 var global_proxy = %GlobalProxy(FunctionConstructor); | 1797 var global_proxy = %GlobalProxy(FunctionConstructor); |
| 1798 // Compile the string in the constructor and not a helper so that errors | 1798 // Compile the string in the constructor and not a helper so that errors |
| 1799 // appear to come from here. | 1799 // appear to come from here. |
| 1800 var func = %_CallFunction(global_proxy, %CompileString(source, true)); | 1800 var f = %_CallFunction(global_proxy, %CompileString(source, true)); |
| 1801 // Set name-should-print-as-anonymous flag on the ShareFunctionInfo and | 1801 %FunctionMarkNameShouldPrintAsAnonymous(f); |
| 1802 // ensure that |func| uses correct initial map from |new.target| if | 1802 return f; |
| 1803 // it's available. | |
| 1804 return %CompleteFunctionConstruction(func, GlobalFunction, new.target); | |
| 1805 } | 1803 } |
| 1806 | 1804 |
| 1807 | 1805 |
| 1808 // ---------------------------------------------------------------------------- | 1806 // ---------------------------------------------------------------------------- |
| 1809 | 1807 |
| 1810 %SetCode(GlobalFunction, FunctionConstructor); | 1808 %SetCode(GlobalFunction, FunctionConstructor); |
| 1811 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, | 1809 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, |
| 1812 DONT_ENUM); | 1810 DONT_ENUM); |
| 1813 | 1811 |
| 1814 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [ | 1812 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [ |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 %InstallToContext([ | 1859 %InstallToContext([ |
| 1862 "global_eval_fun", GlobalEval, | 1860 "global_eval_fun", GlobalEval, |
| 1863 "object_value_of", ObjectValueOf, | 1861 "object_value_of", ObjectValueOf, |
| 1864 "object_to_string", ObjectToString, | 1862 "object_to_string", ObjectToString, |
| 1865 "object_define_own_property", DefineOwnPropertyFromAPI, | 1863 "object_define_own_property", DefineOwnPropertyFromAPI, |
| 1866 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1864 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
| 1867 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1865 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
| 1868 ]); | 1866 ]); |
| 1869 | 1867 |
| 1870 }) | 1868 }) |
| OLD | NEW |