| 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) { | 5 (function(global, utils) { |
| 6 | 6 |
| 7 "use strict"; | 7 "use strict"; |
| 8 | 8 |
| 9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 for (var i = 0; i < constants.length; i += 2) { | 69 for (var i = 0; i < constants.length; i += 2) { |
| 70 var name = constants[i]; | 70 var name = constants[i]; |
| 71 var k = constants[i + 1]; | 71 var k = constants[i + 1]; |
| 72 %AddNamedProperty(object, name, k, attributes); | 72 %AddNamedProperty(object, name, k, attributes); |
| 73 } | 73 } |
| 74 %ToFastProperties(object); | 74 %ToFastProperties(object); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 function InstallFunctions(object, attributes, functions) { | 78 function InstallFunctions(object, attributes, functions) { |
| 79 %CheckIsBootstrapping(); | 79 %InstallFunctionsFromArray(object, attributes, functions); |
| 80 %OptimizeObjectForAddingMultipleProperties(object, functions.length >> 1); | |
| 81 for (var i = 0; i < functions.length; i += 2) { | |
| 82 var key = functions[i]; | |
| 83 var f = functions[i + 1]; | |
| 84 SetFunctionName(f, key); | |
| 85 %FunctionRemovePrototype(f); | |
| 86 %AddNamedProperty(object, key, f, attributes); | |
| 87 %SetNativeFlag(f); | |
| 88 } | |
| 89 %ToFastProperties(object); | |
| 90 } | 80 } |
| 91 | 81 |
| 92 | 82 |
| 93 // Helper function to install a getter-only accessor property. | 83 // Helper function to install a getter-only accessor property. |
| 94 function InstallGetter(object, name, getter, attributes) { | 84 function InstallGetter(object, name, getter, attributes) { |
| 95 %CheckIsBootstrapping(); | 85 %CheckIsBootstrapping(); |
| 96 if (typeof attributes == "undefined") { | 86 if (typeof attributes == "undefined") { |
| 97 attributes = DONT_ENUM; | 87 attributes = DONT_ENUM; |
| 98 } | 88 } |
| 99 SetFunctionName(getter, name, "get"); | 89 SetFunctionName(getter, name, "get"); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 "InstallConstants", InstallConstants, | 249 "InstallConstants", InstallConstants, |
| 260 "InstallFunctions", InstallFunctions, | 250 "InstallFunctions", InstallFunctions, |
| 261 "InstallGetter", InstallGetter, | 251 "InstallGetter", InstallGetter, |
| 262 "InstallGetterSetter", InstallGetterSetter, | 252 "InstallGetterSetter", InstallGetterSetter, |
| 263 "SetUpLockedPrototype", SetUpLockedPrototype, | 253 "SetUpLockedPrototype", SetUpLockedPrototype, |
| 264 "PostNatives", PostNatives, | 254 "PostNatives", PostNatives, |
| 265 "PostExperimentals", PostExperimentals, | 255 "PostExperimentals", PostExperimentals, |
| 266 "PostDebug", PostDebug, | 256 "PostDebug", PostDebug, |
| 267 ]); | 257 ]); |
| 268 | 258 |
| 269 // TODO(yangguo): run prologue.js before runtime.js | |
| 270 ExportToRuntime(function(to) { | |
| 271 to.ToNumber = $toNumber; | |
| 272 to.ToString = $toString; | |
| 273 to.ToInteger = $toInteger; | |
| 274 to.ToLength = $toLength; | |
| 275 }); | |
| 276 | |
| 277 }) | 259 }) |
| OLD | NEW |