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

Side by Side Diff: src/v8natives.js

Issue 7475002: Ensure that the length property of bound functions are actual unique (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 | « src/runtime.cc ('k') | test/mjsunit/regress/regress-1419.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1492
1493 // We already have caller and arguments properties on functions, 1493 // We already have caller and arguments properties on functions,
1494 // which are non-configurable. It therefore makes no sence to 1494 // which are non-configurable. It therefore makes no sence to
1495 // try to redefine these as defined by the spec. The spec says 1495 // try to redefine these as defined by the spec. The spec says
1496 // that bind should make these throw a TypeError if get or set 1496 // that bind should make these throw a TypeError if get or set
1497 // is called and make them non-enumerable and non-configurable. 1497 // is called and make them non-enumerable and non-configurable.
1498 // To be consistent with our normal functions we leave this as it is. 1498 // To be consistent with our normal functions we leave this as it is.
1499 1499
1500 // Set the correct length. 1500 // Set the correct length.
1501 var length = (this.length - argc_bound) > 0 ? this.length - argc_bound : 0; 1501 var length = (this.length - argc_bound) > 0 ? this.length - argc_bound : 0;
1502 %FunctionSetLength(result, length);
1503 %FunctionRemovePrototype(result); 1502 %FunctionRemovePrototype(result);
1504 %FunctionSetBound(result); 1503 %FunctionSetBound(result);
1504 %BoundFunctionSetLength(result, length);
1505 return result; 1505 return result;
1506 } 1506 }
1507 1507
1508 1508
1509 function NewFunction(arg1) { // length == 1 1509 function NewFunction(arg1) { // length == 1
1510 var n = %_ArgumentsLength(); 1510 var n = %_ArgumentsLength();
1511 var p = ''; 1511 var p = '';
1512 if (n > 1) { 1512 if (n > 1) {
1513 p = new InternalArray(n - 1); 1513 p = new InternalArray(n - 1);
1514 for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i); 1514 for (var i = 0; i < n - 1; i++) p[i] = %_Arguments(i);
(...skipping 18 matching lines...) Expand all
1533 // ---------------------------------------------------------------------------- 1533 // ----------------------------------------------------------------------------
1534 1534
1535 function SetupFunction() { 1535 function SetupFunction() {
1536 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1536 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1537 "bind", FunctionBind, 1537 "bind", FunctionBind,
1538 "toString", FunctionToString 1538 "toString", FunctionToString
1539 )); 1539 ));
1540 } 1540 }
1541 1541
1542 SetupFunction(); 1542 SetupFunction();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress/regress-1419.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698