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

Side by Side Diff: src/v8natives.js

Issue 13192004: arrange to create prototypes for generators (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Explicitly add constructor properties in generator.js Created 7 years, 8 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
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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 // ---------------------------------------------------------------------------- 1620 // ----------------------------------------------------------------------------
1621 // Function 1621 // Function
1622 1622
1623 $Function.prototype.constructor = $Function; 1623 $Function.prototype.constructor = $Function;
1624 1624
1625 function FunctionSourceString(func) { 1625 function FunctionSourceString(func) {
1626 while (%IsJSFunctionProxy(func)) { 1626 while (%IsJSFunctionProxy(func)) {
1627 func = %GetCallTrap(func); 1627 func = %GetCallTrap(func);
1628 } 1628 }
1629 1629
1630 // TODO(wingo): Print source using function* for generators.
1630 if (!IS_FUNCTION(func)) { 1631 if (!IS_FUNCTION(func)) {
1631 throw new $TypeError('Function.prototype.toString is not generic'); 1632 throw new $TypeError('Function.prototype.toString is not generic');
1632 } 1633 }
1633 1634
1634 var source = %FunctionGetSourceCode(func); 1635 var source = %FunctionGetSourceCode(func);
1635 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { 1636 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
1636 var name = %FunctionGetName(func); 1637 var name = %FunctionGetName(func);
1637 if (name) { 1638 if (name) {
1638 // Mimic what KJS does. 1639 // Mimic what KJS does.
1639 return 'function ' + name + '() { [native code] }'; 1640 return 'function ' + name + '() { [native code] }';
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 1752
1752 function SetUpFunction() { 1753 function SetUpFunction() {
1753 %CheckIsBootstrapping(); 1754 %CheckIsBootstrapping();
1754 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1755 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1755 "bind", FunctionBind, 1756 "bind", FunctionBind,
1756 "toString", FunctionToString 1757 "toString", FunctionToString
1757 )); 1758 ));
1758 } 1759 }
1759 1760
1760 SetUpFunction(); 1761 SetUpFunction();
OLDNEW
« src/generator.js ('K') | « src/objects.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698