| OLD | NEW |
| 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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { | 1752 if (!IS_STRING(source) || %FunctionIsBuiltin(func)) { |
| 1753 var name = %FunctionGetName(func); | 1753 var name = %FunctionGetName(func); |
| 1754 if (name) { | 1754 if (name) { |
| 1755 // Mimic what KJS does. | 1755 // Mimic what KJS does. |
| 1756 return 'function ' + name + '() { [native code] }'; | 1756 return 'function ' + name + '() { [native code] }'; |
| 1757 } else { | 1757 } else { |
| 1758 return 'function () { [native code] }'; | 1758 return 'function () { [native code] }'; |
| 1759 } | 1759 } |
| 1760 } | 1760 } |
| 1761 | 1761 |
| 1762 if (%FunctionIsArrow(func)) |
| 1763 return source; |
| 1764 |
| 1762 var name = %FunctionNameShouldPrintAsAnonymous(func) | 1765 var name = %FunctionNameShouldPrintAsAnonymous(func) |
| 1763 ? 'anonymous' | 1766 ? 'anonymous' |
| 1764 : %FunctionGetName(func); | 1767 : %FunctionGetName(func); |
| 1765 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; | 1768 var head = %FunctionIsGenerator(func) ? 'function* ' : 'function '; |
| 1766 return head + name + source; | 1769 return head + name + source; |
| 1767 } | 1770 } |
| 1768 | 1771 |
| 1769 | 1772 |
| 1770 function FunctionToString() { | 1773 function FunctionToString() { |
| 1771 return FunctionSourceString(this); | 1774 return FunctionSourceString(this); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 for (var i = 0; i < microtasks.length; i++) { | 1916 for (var i = 0; i < microtasks.length; i++) { |
| 1914 microtasks[i](); | 1917 microtasks[i](); |
| 1915 } | 1918 } |
| 1916 } | 1919 } |
| 1917 } | 1920 } |
| 1918 | 1921 |
| 1919 function EnqueueExternalMicrotask(fn) { | 1922 function EnqueueExternalMicrotask(fn) { |
| 1920 GetMicrotaskQueue().push(fn); | 1923 GetMicrotaskQueue().push(fn); |
| 1921 %SetMicrotaskPending(true); | 1924 %SetMicrotaskPending(true); |
| 1922 } | 1925 } |
| OLD | NEW |