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 f = %_CallFunction(global_proxy, %CompileString(source, true)); | 1800 var func = %_CallFunction(global_proxy, %CompileString(source, true)); |
1801 %FunctionMarkNameShouldPrintAsAnonymous(f); | 1801 // Set name-should-print-as-anonymous flag on the SFI and ensure that |
Toon Verwaest
2015/10/30 10:58:01
write out sfi
Igor Sheludko
2015/10/30 11:08:57
Done.
| |
1802 return f; | 1802 // |func| uses correct initial map from |new.target| if it's available. |
1803 return %CompleteFunctionConstruction(func, GlobalFunction, new.target); | |
1803 } | 1804 } |
1804 | 1805 |
1805 | 1806 |
1806 // ---------------------------------------------------------------------------- | 1807 // ---------------------------------------------------------------------------- |
1807 | 1808 |
1808 %SetCode(GlobalFunction, FunctionConstructor); | 1809 %SetCode(GlobalFunction, FunctionConstructor); |
1809 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, | 1810 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, |
1810 DONT_ENUM); | 1811 DONT_ENUM); |
1811 | 1812 |
1812 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [ | 1813 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [ |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1859 %InstallToContext([ | 1860 %InstallToContext([ |
1860 "global_eval_fun", GlobalEval, | 1861 "global_eval_fun", GlobalEval, |
1861 "object_value_of", ObjectValueOf, | 1862 "object_value_of", ObjectValueOf, |
1862 "object_to_string", ObjectToString, | 1863 "object_to_string", ObjectToString, |
1863 "object_define_own_property", DefineOwnPropertyFromAPI, | 1864 "object_define_own_property", DefineOwnPropertyFromAPI, |
1864 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, | 1865 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, |
1865 "to_complete_property_descriptor", ToCompletePropertyDescriptor, | 1866 "to_complete_property_descriptor", ToCompletePropertyDescriptor, |
1866 ]); | 1867 ]); |
1867 | 1868 |
1868 }) | 1869 }) |
OLD | NEW |