| 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 |
| 11 // ----------------------------------------------------------------------- | 11 // ----------------------------------------------------------------------- |
| 12 // Utils | 12 // Utils |
| 13 | 13 |
| 14 var imports = UNDEFINED; | 14 var imports = UNDEFINED; |
| 15 var imports_from_experimental = UNDEFINED; | 15 var imports_from_experimental = UNDEFINED; |
| 16 var exports_container = %ExportFromRuntime({}); | 16 var exports_container = %ExportFromRuntime({}); |
| 17 var typed_array_setup = UNDEFINED; |
| 18 |
| 19 // Register context value to be initialized with a typed array in |
| 20 // Genesis::InitializeBuiltinTypedArrays. |
| 21 function SetupTypedArray(f) { |
| 22 f.next = typed_array_setup; |
| 23 typed_array_setup = f; |
| 24 } |
| 17 | 25 |
| 18 // Export to other scripts. | 26 // Export to other scripts. |
| 19 // In normal natives, this exports functions to other normal natives. | 27 // In normal natives, this exports functions to other normal natives. |
| 20 // In experimental natives, this exports to other experimental natives and | 28 // In experimental natives, this exports to other experimental natives and |
| 21 // to normal natives that import using utils.ImportFromExperimental. | 29 // to normal natives that import using utils.ImportFromExperimental. |
| 22 function Export(f) { | 30 function Export(f) { |
| 23 f(exports_container); | 31 f(exports_container); |
| 24 } | 32 } |
| 25 | 33 |
| 26 | 34 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 imports(exports_container); | 237 imports(exports_container); |
| 230 } | 238 } |
| 231 for ( ; !IS_UNDEFINED(imports_from_experimental); | 239 for ( ; !IS_UNDEFINED(imports_from_experimental); |
| 232 imports_from_experimental = imports_from_experimental.next) { | 240 imports_from_experimental = imports_from_experimental.next) { |
| 233 imports_from_experimental(exports_container); | 241 imports_from_experimental(exports_container); |
| 234 } | 242 } |
| 235 | 243 |
| 236 utils.Export = UNDEFINED; | 244 utils.Export = UNDEFINED; |
| 237 utils.PostDebug = UNDEFINED; | 245 utils.PostDebug = UNDEFINED; |
| 238 utils.PostExperimentals = UNDEFINED; | 246 utils.PostExperimentals = UNDEFINED; |
| 247 utils.InitializeBuiltinTypedArrays = UNDEFINED; |
| 248 utils.SetupTypedArray = UNDEFINED; |
| 249 typed_array_setup = UNDEFINED; |
| 239 } | 250 } |
| 240 | 251 |
| 241 | 252 |
| 242 function PostDebug(utils) { | 253 function PostDebug(utils) { |
| 243 for ( ; !IS_UNDEFINED(imports); imports = imports.next) { | 254 for ( ; !IS_UNDEFINED(imports); imports = imports.next) { |
| 244 imports(exports_container); | 255 imports(exports_container); |
| 245 } | 256 } |
| 246 | 257 |
| 247 exports_container = UNDEFINED; | 258 exports_container = UNDEFINED; |
| 248 | 259 |
| 249 utils.Export = UNDEFINED; | 260 utils.Export = UNDEFINED; |
| 250 utils.Import = UNDEFINED; | 261 utils.Import = UNDEFINED; |
| 251 utils.ImportNow = UNDEFINED; | 262 utils.ImportNow = UNDEFINED; |
| 252 utils.PostDebug = UNDEFINED; | 263 utils.PostDebug = UNDEFINED; |
| 253 utils.PostExperimentals = UNDEFINED; | 264 utils.PostExperimentals = UNDEFINED; |
| 265 utils.InitializeBuiltinTypedArrays = UNDEFINED; |
| 266 utils.SetupTypedArray = UNDEFINED; |
| 267 typed_array_setup = UNDEFINED; |
| 268 } |
| 269 |
| 270 |
| 271 function InitializeBuiltinTypedArrays( |
| 272 utils, rng_state, math_constants, rempio2result) { |
| 273 var setup_list = typed_array_setup; |
| 274 |
| 275 for ( ; !IS_UNDEFINED(setup_list); setup_list = setup_list.next) { |
| 276 setup_list(rng_state, math_constants, rempio2result); |
| 277 } |
| 254 } | 278 } |
| 255 | 279 |
| 256 | 280 |
| 257 // ----------------------------------------------------------------------- | 281 // ----------------------------------------------------------------------- |
| 258 | 282 |
| 259 %OptimizeObjectForAddingMultipleProperties(utils, 13); | 283 %OptimizeObjectForAddingMultipleProperties(utils, 15); |
| 260 | 284 |
| 261 utils.Import = Import; | 285 utils.Import = Import; |
| 262 utils.ImportNow = ImportNow; | 286 utils.ImportNow = ImportNow; |
| 263 utils.Export = Export; | 287 utils.Export = Export; |
| 264 utils.ImportFromExperimental = ImportFromExperimental; | 288 utils.ImportFromExperimental = ImportFromExperimental; |
| 265 utils.SetFunctionName = SetFunctionName; | 289 utils.SetFunctionName = SetFunctionName; |
| 266 utils.InstallConstants = InstallConstants; | 290 utils.InstallConstants = InstallConstants; |
| 267 utils.InstallFunctions = InstallFunctions; | 291 utils.InstallFunctions = InstallFunctions; |
| 268 utils.InstallGetter = InstallGetter; | 292 utils.InstallGetter = InstallGetter; |
| 269 utils.InstallGetterSetter = InstallGetterSetter; | 293 utils.InstallGetterSetter = InstallGetterSetter; |
| 270 utils.SetUpLockedPrototype = SetUpLockedPrototype; | 294 utils.SetUpLockedPrototype = SetUpLockedPrototype; |
| 271 utils.PostNatives = PostNatives; | 295 utils.PostNatives = PostNatives; |
| 272 utils.PostExperimentals = PostExperimentals; | 296 utils.PostExperimentals = PostExperimentals; |
| 273 utils.PostDebug = PostDebug; | 297 utils.PostDebug = PostDebug; |
| 298 utils.SetupTypedArray = SetupTypedArray; |
| 299 utils.InitializeBuiltinTypedArrays = InitializeBuiltinTypedArrays; |
| 274 | 300 |
| 275 %ToFastProperties(utils); | 301 %ToFastProperties(utils); |
| 276 | 302 |
| 277 // ----------------------------------------------------------------------- | 303 // ----------------------------------------------------------------------- |
| 278 | 304 |
| 279 %OptimizeObjectForAddingMultipleProperties(extrasUtils, 5); | 305 %OptimizeObjectForAddingMultipleProperties(extrasUtils, 5); |
| 280 | 306 |
| 281 extrasUtils.logStackTrace = function logStackTrace() { | 307 extrasUtils.logStackTrace = function logStackTrace() { |
| 282 %DebugTrace(); | 308 %DebugTrace(); |
| 283 }; | 309 }; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 313 | 339 |
| 314 extrasUtils.uncurryThis = function uncurryThis(func) { | 340 extrasUtils.uncurryThis = function uncurryThis(func) { |
| 315 return function(thisArg) { | 341 return function(thisArg) { |
| 316 return %Apply(func, thisArg, arguments, 1, arguments.length - 1); | 342 return %Apply(func, thisArg, arguments, 1, arguments.length - 1); |
| 317 }; | 343 }; |
| 318 }; | 344 }; |
| 319 | 345 |
| 320 %ToFastProperties(extrasUtils); | 346 %ToFastProperties(extrasUtils); |
| 321 | 347 |
| 322 }) | 348 }) |
| OLD | NEW |