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

Side by Side Diff: src/js/v8natives.js

Issue 1415683007: Reland "[es6] Fix Function and GeneratorFunction built-ins subclassing." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix-subclass
Patch Set: Improved test Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « src/js/generator.js ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 var body = (n > 0) ? TO_STRING(args[n - 1]) : ''; 1779 var body = (n > 0) ? TO_STRING(args[n - 1]) : '';
1780 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; 1780 return '(' + function_token + '(' + p + ') {\n' + body + '\n})';
1781 } 1781 }
1782 1782
1783 1783
1784 function FunctionConstructor(arg1) { // length == 1 1784 function FunctionConstructor(arg1) { // length == 1
1785 var source = NewFunctionString(arguments, 'function'); 1785 var source = NewFunctionString(arguments, 'function');
1786 var global_proxy = %GlobalProxy(FunctionConstructor); 1786 var global_proxy = %GlobalProxy(FunctionConstructor);
1787 // Compile the string in the constructor and not a helper so that errors 1787 // Compile the string in the constructor and not a helper so that errors
1788 // appear to come from here. 1788 // appear to come from here.
1789 var f = %_CallFunction(global_proxy, %CompileString(source, true)); 1789 var func = %_CallFunction(global_proxy, %CompileString(source, true));
1790 %FunctionMarkNameShouldPrintAsAnonymous(f); 1790 // Set name-should-print-as-anonymous flag on the ShareFunctionInfo and
1791 return f; 1791 // ensure that |func| uses correct initial map from |new.target| if
1792 // it's available.
1793 return %CompleteFunctionConstruction(func, GlobalFunction, new.target);
1792 } 1794 }
1793 1795
1794 1796
1795 // ---------------------------------------------------------------------------- 1797 // ----------------------------------------------------------------------------
1796 1798
1797 %SetCode(GlobalFunction, FunctionConstructor); 1799 %SetCode(GlobalFunction, FunctionConstructor);
1798 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction, 1800 %AddNamedProperty(GlobalFunction.prototype, "constructor", GlobalFunction,
1799 DONT_ENUM); 1801 DONT_ENUM);
1800 1802
1801 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [ 1803 utils.InstallFunctions(GlobalFunction.prototype, DONT_ENUM, [
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 1849
1848 %InstallToContext([ 1850 %InstallToContext([
1849 "global_eval_fun", GlobalEval, 1851 "global_eval_fun", GlobalEval,
1850 "object_value_of", ObjectValueOf, 1852 "object_value_of", ObjectValueOf,
1851 "object_to_string", ObjectToString, 1853 "object_to_string", ObjectToString,
1852 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor, 1854 "object_get_own_property_descriptor", ObjectGetOwnPropertyDescriptor,
1853 "to_complete_property_descriptor", ToCompletePropertyDescriptor, 1855 "to_complete_property_descriptor", ToCompletePropertyDescriptor,
1854 ]); 1856 ]);
1855 1857
1856 }) 1858 })
OLDNEW
« no previous file with comments | « src/js/generator.js ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698