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

Side by Side Diff: src/v8natives.js

Issue 7584005: Revert "Fix a bug in scope analysis." (Closed) Base URL: https://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-1583.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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { 1421 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
1422 var name = %FunctionGetName(func); 1422 var name = %FunctionGetName(func);
1423 if (name) { 1423 if (name) {
1424 // Mimic what KJS does. 1424 // Mimic what KJS does.
1425 return 'function ' + name + '() { [native code] }'; 1425 return 'function ' + name + '() { [native code] }';
1426 } else { 1426 } else {
1427 return 'function () { [native code] }'; 1427 return 'function () { [native code] }';
1428 } 1428 }
1429 } 1429 }
1430 1430
1431 var name = %FunctionNameShouldPrintAsAnonymous(func) 1431 var name = %FunctionGetName(func);
1432 ? 'anonymous'
1433 : %FunctionGetName(func);
1434 return 'function ' + name + source; 1432 return 'function ' + name + source;
1435 } 1433 }
1436 1434
1437 1435
1438 function FunctionToString() { 1436 function FunctionToString() {
1439 return FunctionSourceString(this); 1437 return FunctionSourceString(this);
1440 } 1438 }
1441 1439
1442 1440
1443 // ES5 15.3.4.5 1441 // ES5 15.3.4.5
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 // character - it may make the combined function expression 1516 // character - it may make the combined function expression
1519 // compile. We avoid this problem by checking for this early on. 1517 // compile. We avoid this problem by checking for this early on.
1520 if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]); 1518 if (p.indexOf(')') != -1) throw MakeSyntaxError('unable_to_parse',[]);
1521 } 1519 }
1522 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : ''; 1520 var body = (n > 0) ? ToString(%_Arguments(n - 1)) : '';
1523 var source = '(function(' + p + ') {\n' + body + '\n})'; 1521 var source = '(function(' + p + ') {\n' + body + '\n})';
1524 1522
1525 // The call to SetNewFunctionAttributes will ensure the prototype 1523 // The call to SetNewFunctionAttributes will ensure the prototype
1526 // property of the resulting function is enumerable (ECMA262, 15.3.5.2). 1524 // property of the resulting function is enumerable (ECMA262, 15.3.5.2).
1527 var f = %CompileString(source)(); 1525 var f = %CompileString(source)();
1528 %FunctionMarkNameShouldPrintAsAnonymous(f); 1526 %FunctionSetName(f, "anonymous");
1529 return %SetNewFunctionAttributes(f); 1527 return %SetNewFunctionAttributes(f);
1530 } 1528 }
1531 1529
1532 %SetCode($Function, NewFunction); 1530 %SetCode($Function, NewFunction);
1533 1531
1534 // ---------------------------------------------------------------------------- 1532 // ----------------------------------------------------------------------------
1535 1533
1536 function SetupFunction() { 1534 function SetupFunction() {
1537 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1535 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1538 "bind", FunctionBind, 1536 "bind", FunctionBind,
1539 "toString", FunctionToString 1537 "toString", FunctionToString
1540 )); 1538 ));
1541 } 1539 }
1542 1540
1543 SetupFunction(); 1541 SetupFunction();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/regress/regress-1583.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698