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