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 14 matching lines...) Expand all Loading... |
25 var f = functions[i + 1]; | 25 var f = functions[i + 1]; |
26 %FunctionSetName(f, key); | 26 %FunctionSetName(f, key); |
27 %FunctionRemovePrototype(f); | 27 %FunctionRemovePrototype(f); |
28 %AddNamedProperty(object, key, f, attributes); | 28 %AddNamedProperty(object, key, f, attributes); |
29 %SetNativeFlag(f); | 29 %SetNativeFlag(f); |
30 } | 30 } |
31 %ToFastProperties(object); | 31 %ToFastProperties(object); |
32 } | 32 } |
33 | 33 |
34 | 34 |
| 35 function OverrideFunction(object, name, f) { |
| 36 ObjectDefineProperty(object, name, { value: f, |
| 37 writeable: true, |
| 38 configurable: true, |
| 39 enumerable: false }); |
| 40 %FunctionSetName(f, name); |
| 41 %FunctionRemovePrototype(f); |
| 42 %SetNativeFlag(f); |
| 43 } |
| 44 |
| 45 |
35 // Helper function to install a getter-only accessor property. | 46 // Helper function to install a getter-only accessor property. |
36 function InstallGetter(object, name, getter) { | 47 function InstallGetter(object, name, getter) { |
37 %FunctionSetName(getter, name); | 48 %FunctionSetName(getter, name); |
38 %FunctionRemovePrototype(getter); | 49 %FunctionRemovePrototype(getter); |
39 %DefineAccessorPropertyUnchecked(object, name, getter, null, DONT_ENUM); | 50 %DefineAccessorPropertyUnchecked(object, name, getter, null, DONT_ENUM); |
40 %SetNativeFlag(getter); | 51 %SetNativeFlag(getter); |
41 } | 52 } |
42 | 53 |
43 | 54 |
44 // Helper function to install a getter/setter accessor property. | 55 // Helper function to install a getter/setter accessor property. |
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 } | 1894 } |
1884 if (!IS_SPEC_FUNCTION(method)) { | 1895 if (!IS_SPEC_FUNCTION(method)) { |
1885 throw MakeTypeError('not_iterable', [obj]); | 1896 throw MakeTypeError('not_iterable', [obj]); |
1886 } | 1897 } |
1887 var iterator = %_CallFunction(obj, method); | 1898 var iterator = %_CallFunction(obj, method); |
1888 if (!IS_SPEC_OBJECT(iterator)) { | 1899 if (!IS_SPEC_OBJECT(iterator)) { |
1889 throw MakeTypeError('not_an_iterator', [iterator]); | 1900 throw MakeTypeError('not_an_iterator', [iterator]); |
1890 } | 1901 } |
1891 return iterator; | 1902 return iterator; |
1892 } | 1903 } |
OLD | NEW |