OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 SetFunctionName(f, key); | 95 SetFunctionName(f, key); |
96 %FunctionRemovePrototype(f); | 96 %FunctionRemovePrototype(f); |
97 %AddNamedProperty(object, key, f, attributes); | 97 %AddNamedProperty(object, key, f, attributes); |
98 %SetNativeFlag(f); | 98 %SetNativeFlag(f); |
99 } | 99 } |
100 %ToFastProperties(object); | 100 %ToFastProperties(object); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 // Helper function to install a getter-only accessor property. | 104 // Helper function to install a getter-only accessor property. |
105 function InstallGetter(object, name, getter, attributes) { | 105 function InstallGetter(object, name, getter, attributes, prefix) { |
106 %CheckIsBootstrapping(); | 106 %CheckIsBootstrapping(); |
107 if (typeof attributes == "undefined") { | 107 if (IS_UNDEFINED(attributes)) attributes = DONT_ENUM; |
108 attributes = DONT_ENUM; | 108 SetFunctionName(getter, name, IS_UNDEFINED(prefix) ? "get" : prefix); |
109 } | |
110 SetFunctionName(getter, name, "get"); | |
111 %FunctionRemovePrototype(getter); | 109 %FunctionRemovePrototype(getter); |
112 %DefineAccessorPropertyUnchecked(object, name, getter, null, attributes); | 110 %DefineGetterPropertyUnchecked(object, name, getter, attributes); |
113 %SetNativeFlag(getter); | 111 %SetNativeFlag(getter); |
114 } | 112 } |
115 | 113 |
116 | 114 |
117 // Helper function to install a getter/setter accessor property. | 115 // Helper function to install a getter/setter accessor property. |
118 function InstallGetterSetter(object, name, getter, setter) { | 116 function InstallGetterSetter(object, name, getter, setter, attributes) { |
119 %CheckIsBootstrapping(); | 117 %CheckIsBootstrapping(); |
| 118 if (IS_UNDEFINED(attributes)) attributes = DONT_ENUM; |
120 SetFunctionName(getter, name, "get"); | 119 SetFunctionName(getter, name, "get"); |
121 SetFunctionName(setter, name, "set"); | 120 SetFunctionName(setter, name, "set"); |
122 %FunctionRemovePrototype(getter); | 121 %FunctionRemovePrototype(getter); |
123 %FunctionRemovePrototype(setter); | 122 %FunctionRemovePrototype(setter); |
124 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); | 123 %DefineAccessorPropertyUnchecked(object, name, getter, setter, DONT_ENUM); |
125 %SetNativeFlag(getter); | 124 %SetNativeFlag(getter); |
126 %SetNativeFlag(setter); | 125 %SetNativeFlag(setter); |
127 } | 126 } |
128 | 127 |
129 | 128 |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 346 |
348 extrasUtils.uncurryThis = function uncurryThis(func) { | 347 extrasUtils.uncurryThis = function uncurryThis(func) { |
349 return function(thisArg) { | 348 return function(thisArg) { |
350 return %Apply(func, thisArg, arguments, 1, arguments.length - 1); | 349 return %Apply(func, thisArg, arguments, 1, arguments.length - 1); |
351 }; | 350 }; |
352 }; | 351 }; |
353 | 352 |
354 %ToFastProperties(extrasUtils); | 353 %ToFastProperties(extrasUtils); |
355 | 354 |
356 }) | 355 }) |
OLD | NEW |