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

Side by Side Diff: src/v8natives.js

Issue 14829005: Remove separate maps for function instances (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove outdated comment Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/function-prototype.js » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 // compile. We avoid this problem by checking for this early on. 1768 // compile. We avoid this problem by checking for this early on.
1769 if (p.indexOf(')') != -1) throw MakeSyntaxError('paren_in_arg_string',[]); 1769 if (p.indexOf(')') != -1) throw MakeSyntaxError('paren_in_arg_string',[]);
1770 // If the formal parameters include an unbalanced block comment, the 1770 // If the formal parameters include an unbalanced block comment, the
1771 // function must be rejected. Since JavaScript does not allow nested 1771 // function must be rejected. Since JavaScript does not allow nested
1772 // comments we can include a trailing block comment to catch this. 1772 // comments we can include a trailing block comment to catch this.
1773 p += '\n/' + '**/'; 1773 p += '\n/' + '**/';
1774 } 1774 }
1775 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : ''; 1775 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : '';
1776 var source = '(function(' + p + ') {\n' + body + '\n})'; 1776 var source = '(function(' + p + ') {\n' + body + '\n})';
1777 1777
1778 // The call to SetNewFunctionAttributes will ensure the prototype
1779 // property of the resulting function is enumerable (ECMA262, 15.3.5.2).
1780 var global_receiver = %GlobalReceiver(global); 1778 var global_receiver = %GlobalReceiver(global);
1781 var f = %_CallFunction(global_receiver, %CompileString(source, true)); 1779 var f = %_CallFunction(global_receiver, %CompileString(source, true));
1782 1780
1783 %FunctionMarkNameShouldPrintAsAnonymous(f); 1781 %FunctionMarkNameShouldPrintAsAnonymous(f);
1784 return %SetNewFunctionAttributes(f); 1782 return f;
1785 } 1783 }
1786 1784
1787 1785
1788 // ---------------------------------------------------------------------------- 1786 // ----------------------------------------------------------------------------
1789 1787
1790 function SetUpFunction() { 1788 function SetUpFunction() {
1791 %CheckIsBootstrapping(); 1789 %CheckIsBootstrapping();
1792 1790
1793 %SetCode($Function, NewFunction); 1791 %SetCode($Function, NewFunction);
1794 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); 1792 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
1795 1793
1796 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1794 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1797 "bind", FunctionBind, 1795 "bind", FunctionBind,
1798 "toString", FunctionToString 1796 "toString", FunctionToString
1799 )); 1797 ));
1800 } 1798 }
1801 1799
1802 SetUpFunction(); 1800 SetUpFunction();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/function-prototype.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698