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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 function GlobalParseFloat(string) { | 156 function GlobalParseFloat(string) { |
157 string = TO_STRING_INLINE(string); | 157 string = TO_STRING_INLINE(string); |
158 if (%_HasCachedArrayIndex(string)) return %_GetCachedArrayIndex(string); | 158 if (%_HasCachedArrayIndex(string)) return %_GetCachedArrayIndex(string); |
159 return %StringParseFloat(string); | 159 return %StringParseFloat(string); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 function GlobalEval(x) { | 163 function GlobalEval(x) { |
164 if (!IS_STRING(x)) return x; | 164 if (!IS_STRING(x)) return x; |
165 | 165 |
166 // For consistency with JSC we require the global object passed to | |
167 // eval to be the global object from which 'eval' originated. This | |
168 // is not mandated by the spec. | |
169 // We only throw if the global has been detached, since we need the | |
170 // receiver as this-value for the call. | |
171 if (!%IsAttachedGlobal(global)) { | |
172 throw new $EvalError('The "this" value passed to eval must ' + | |
173 'be the global object from which eval originated'); | |
174 } | |
175 | |
176 var global_proxy = %GlobalProxy(global); | 166 var global_proxy = %GlobalProxy(global); |
177 | 167 |
178 var f = %CompileString(x, false, 0); | 168 var f = %CompileString(x, false, 0); |
179 if (!IS_FUNCTION(f)) return f; | 169 if (!IS_FUNCTION(f)) return f; |
180 | 170 |
181 return %_CallFunction(global_proxy, f); | 171 return %_CallFunction(global_proxy, f); |
182 } | 172 } |
183 | 173 |
184 | 174 |
185 // ---------------------------------------------------------------------------- | 175 // ---------------------------------------------------------------------------- |
(...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1900 } | 1890 } |
1901 if (!IS_SPEC_FUNCTION(method)) { | 1891 if (!IS_SPEC_FUNCTION(method)) { |
1902 throw MakeTypeError('not_iterable', [obj]); | 1892 throw MakeTypeError('not_iterable', [obj]); |
1903 } | 1893 } |
1904 var iterator = %_CallFunction(obj, method); | 1894 var iterator = %_CallFunction(obj, method); |
1905 if (!IS_SPEC_OBJECT(iterator)) { | 1895 if (!IS_SPEC_OBJECT(iterator)) { |
1906 throw MakeTypeError('not_an_iterator', [iterator]); | 1896 throw MakeTypeError('not_an_iterator', [iterator]); |
1907 } | 1897 } |
1908 return iterator; | 1898 return iterator; |
1909 } | 1899 } |
OLD | NEW |