| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file relies on the fact that the following declarations have been made | 5 // This file relies on the fact that the following declarations have been made |
| 6 // in runtime.js: | 6 // in runtime.js: |
| 7 // var $Object = global.Object; | 7 // var $Object = global.Object; |
| 8 // var $Boolean = global.Boolean; | 8 // var $Boolean = global.Boolean; |
| 9 // var $Number = global.Number; | 9 // var $Number = global.Number; |
| 10 // var $Function = global.Function; | 10 // var $Function = global.Function; |
| (...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1852 var body = (n > 0) ? ToString(arguments[n - 1]) : ''; | 1852 var body = (n > 0) ? ToString(arguments[n - 1]) : ''; |
| 1853 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; | 1853 return '(' + function_token + '(' + p + ') {\n' + body + '\n})'; |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 | 1856 |
| 1857 function FunctionConstructor(arg1) { // length == 1 | 1857 function FunctionConstructor(arg1) { // length == 1 |
| 1858 var source = NewFunctionString(arguments, 'function'); | 1858 var source = NewFunctionString(arguments, 'function'); |
| 1859 var global_proxy = %GlobalProxy(global); | 1859 var global_proxy = %GlobalProxy(global); |
| 1860 // Compile the string in the constructor and not a helper so that errors | 1860 // Compile the string in the constructor and not a helper so that errors |
| 1861 // appear to come from here. | 1861 // appear to come from here. |
| 1862 var f = %CompileString(source, true); | 1862 var f = %_CallFunction(global_proxy, %CompileString(source, true)); |
| 1863 if (!IS_FUNCTION(f)) return f; | |
| 1864 f = %_CallFunction(global_proxy, f); | |
| 1865 %FunctionMarkNameShouldPrintAsAnonymous(f); | 1863 %FunctionMarkNameShouldPrintAsAnonymous(f); |
| 1866 return f; | 1864 return f; |
| 1867 } | 1865 } |
| 1868 | 1866 |
| 1869 | 1867 |
| 1870 // ---------------------------------------------------------------------------- | 1868 // ---------------------------------------------------------------------------- |
| 1871 | 1869 |
| 1872 function SetUpFunction() { | 1870 function SetUpFunction() { |
| 1873 %CheckIsBootstrapping(); | 1871 %CheckIsBootstrapping(); |
| 1874 | 1872 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1905 } | 1903 } |
| 1906 if (!IS_SPEC_FUNCTION(method)) { | 1904 if (!IS_SPEC_FUNCTION(method)) { |
| 1907 throw MakeTypeError('not_iterable', [obj]); | 1905 throw MakeTypeError('not_iterable', [obj]); |
| 1908 } | 1906 } |
| 1909 var iterator = %_CallFunction(obj, method); | 1907 var iterator = %_CallFunction(obj, method); |
| 1910 if (!IS_SPEC_OBJECT(iterator)) { | 1908 if (!IS_SPEC_OBJECT(iterator)) { |
| 1911 throw MakeTypeError('not_an_iterator', [iterator]); | 1909 throw MakeTypeError('not_an_iterator', [iterator]); |
| 1912 } | 1910 } |
| 1913 return iterator; | 1911 return iterator; |
| 1914 } | 1912 } |
| OLD | NEW |