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 28 matching lines...) Expand all Loading... |
39 %FunctionRemovePrototype(f); | 39 %FunctionRemovePrototype(f); |
40 %SetNativeFlag(f); | 40 %SetNativeFlag(f); |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 // Helper function to install a getter-only accessor property. | 44 // Helper function to install a getter-only accessor property. |
45 function InstallGetter(object, name, getter, attributes) { | 45 function InstallGetter(object, name, getter, attributes) { |
46 if (typeof attributes == "undefined") { | 46 if (typeof attributes == "undefined") { |
47 attributes = DONT_ENUM; | 47 attributes = DONT_ENUM; |
48 } | 48 } |
49 %FunctionSetName(getter, "get " + | 49 %FunctionSetName(getter, name); |
50 (IS_SYMBOL(name) ? "[" + %SymbolDescription(name) + "]" : name)); | |
51 %FunctionRemovePrototype(getter); | 50 %FunctionRemovePrototype(getter); |
52 %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes); | 51 %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes); |
53 %SetNativeFlag(getter); | 52 %SetNativeFlag(getter); |
54 } | 53 } |
55 | 54 |
56 | 55 |
57 // Helper function to install a getter/setter accessor property. | 56 // Helper function to install a getter/setter accessor property. |
58 function InstallGetterSetter(object, name, getter, setter) { | 57 function InstallGetterSetter(object, name, getter, setter) { |
59 var functionName = | 58 %FunctionSetName(getter, name); |
60 IS_SYMBOL(name) ? "[" + %SymbolDescription(name) + "]" : name; | 59 %FunctionSetName(setter, name); |
61 %FunctionSetName(getter, "get " + functionName); | |
62 %FunctionSetName(setter, "set " + functionName); | |
63 %FunctionRemovePrototype(getter); | 60 %FunctionRemovePrototype(getter); |
64 %FunctionRemovePrototype(setter); | 61 %FunctionRemovePrototype(setter); |
65 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); | 62 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); |
66 %SetNativeFlag(getter); | 63 %SetNativeFlag(getter); |
67 %SetNativeFlag(setter); | 64 %SetNativeFlag(setter); |
68 } | 65 } |
69 | 66 |
70 | 67 |
71 // Helper function for installing constant properties on objects. | 68 // Helper function for installing constant properties on objects. |
72 function InstallConstants(object, constants) { | 69 function InstallConstants(object, constants) { |
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 } | 1894 } |
1898 if (!IS_SPEC_FUNCTION(method)) { | 1895 if (!IS_SPEC_FUNCTION(method)) { |
1899 throw MakeTypeError(kNotIterable, obj); | 1896 throw MakeTypeError(kNotIterable, obj); |
1900 } | 1897 } |
1901 var iterator = %_CallFunction(obj, method); | 1898 var iterator = %_CallFunction(obj, method); |
1902 if (!IS_SPEC_OBJECT(iterator)) { | 1899 if (!IS_SPEC_OBJECT(iterator)) { |
1903 throw MakeTypeError(kNotAnIterator, iterator); | 1900 throw MakeTypeError(kNotAnIterator, iterator); |
1904 } | 1901 } |
1905 return iterator; | 1902 return iterator; |
1906 } | 1903 } |
OLD | NEW |