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

Side by Side Diff: src/v8natives.js

Issue 23190013: Give bound function name for aesthetic matters (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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 | « no previous file | test/mjsunit/function-names.js » ('j') | test/mjsunit/function-names.js » ('J')
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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 function FunctionToString() { 1721 function FunctionToString() {
1722 return FunctionSourceString(this); 1722 return FunctionSourceString(this);
1723 } 1723 }
1724 1724
1725 1725
1726 // ES5 15.3.4.5 1726 // ES5 15.3.4.5
1727 function FunctionBind(this_arg) { // Length is 1. 1727 function FunctionBind(this_arg) { // Length is 1.
1728 if (!IS_SPEC_FUNCTION(this)) { 1728 if (!IS_SPEC_FUNCTION(this)) {
1729 throw new $TypeError('Bind must be called on a function'); 1729 throw new $TypeError('Bind must be called on a function');
1730 } 1730 }
1731 var boundFunction = function () { 1731 var boundFunction = function BoundFunction() {
1732 // Poison .arguments and .caller, but is otherwise not detectable. 1732 // Poison .arguments and .caller, but is otherwise not detectable.
1733 "use strict"; 1733 "use strict";
1734 // This function must not use any object literals (Object, Array, RegExp), 1734 // This function must not use any object literals (Object, Array, RegExp),
1735 // since the literals-array is being used to store the bound data. 1735 // since the literals-array is being used to store the bound data.
1736 if (%_IsConstructCall()) { 1736 if (%_IsConstructCall()) {
1737 return %NewObjectFromBound(boundFunction); 1737 return %NewObjectFromBound(boundFunction);
1738 } 1738 }
1739 var bindings = %BoundFunctionGetBindings(boundFunction); 1739 var bindings = %BoundFunctionGetBindings(boundFunction);
1740 1740
1741 var argc = %_ArgumentsLength(); 1741 var argc = %_ArgumentsLength();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 %SetCode($Function, FunctionConstructor); 1829 %SetCode($Function, FunctionConstructor);
1830 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM); 1830 %SetProperty($Function.prototype, "constructor", $Function, DONT_ENUM);
1831 1831
1832 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1832 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1833 "bind", FunctionBind, 1833 "bind", FunctionBind,
1834 "toString", FunctionToString 1834 "toString", FunctionToString
1835 )); 1835 ));
1836 } 1836 }
1837 1837
1838 SetUpFunction(); 1838 SetUpFunction();
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/function-names.js » ('j') | test/mjsunit/function-names.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698