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

Side by Side Diff: src/v8natives.js

Issue 10912118: Back port r12439 and r12442 to the 3.8 branch: (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.8/
Patch Set: Created 8 years, 3 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/accessors.cc ('k') | src/version.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 // If the formal parameters string include ) - an illegal 1628 // If the formal parameters string include ) - an illegal
1629 // character - it may make the combined function expression 1629 // character - it may make the combined function expression
1630 // compile. We avoid this problem by checking for this early on. 1630 // compile. We avoid this problem by checking for this early on.
1631 if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]); 1631 if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]);
1632 } 1632 }
1633 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : ''; 1633 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : '';
1634 var source = '(function(' + p + ') {\n' + body + '\n})'; 1634 var source = '(function(' + p + ') {\n' + body + '\n})';
1635 1635
1636 // The call to SetNewFunctionAttributes will ensure the prototype 1636 // The call to SetNewFunctionAttributes will ensure the prototype
1637 // property of the resulting function is enumerable (ECMA262, 15.3.5.2). 1637 // property of the resulting function is enumerable (ECMA262, 15.3.5.2).
1638 var f = %CompileString(source)(); 1638 var global_receiver = %GlobalReceiver(global);
1639 var f = %_CallFunction(global_receiver, %CompileString(source));
1640
1639 %FunctionMarkNameShouldPrintAsAnonymous(f); 1641 %FunctionMarkNameShouldPrintAsAnonymous(f);
1640 return %SetNewFunctionAttributes(f); 1642 return %SetNewFunctionAttributes(f);
1641 } 1643 }
1642 1644
1643 %SetCode($Function, NewFunction); 1645 %SetCode($Function, NewFunction);
1644 1646
1645 // ---------------------------------------------------------------------------- 1647 // ----------------------------------------------------------------------------
1646 1648
1647 function SetUpFunction() { 1649 function SetUpFunction() {
1648 %CheckIsBootstrapping(); 1650 %CheckIsBootstrapping();
1649 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1651 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1650 "bind", FunctionBind, 1652 "bind", FunctionBind,
1651 "toString", FunctionToString 1653 "toString", FunctionToString
1652 )); 1654 ));
1653 } 1655 }
1654 1656
1655 SetUpFunction(); 1657 SetUpFunction();
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698