| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "use strict"; | 5 "use strict"; | 
| 6 | 6 | 
| 7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made | 
| 8 // in runtime.js: | 8 // in runtime.js: | 
| 9 // var $Array = global.Array; | 9 // var $Array = global.Array; | 
| 10 var $ArrayBuffer = global.ArrayBuffer; | 10 var $ArrayBuffer = global.ArrayBuffer; | 
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 284         return; | 284         return; | 
| 285       } | 285       } | 
| 286       if (intOffset + l > this.length) { | 286       if (intOffset + l > this.length) { | 
| 287         throw MakeRangeError("typed_array_set_source_too_large"); | 287         throw MakeRangeError("typed_array_set_source_too_large"); | 
| 288       } | 288       } | 
| 289       TypedArraySetFromArrayLike(this, obj, l, intOffset); | 289       TypedArraySetFromArrayLike(this, obj, l, intOffset); | 
| 290       return; | 290       return; | 
| 291   } | 291   } | 
| 292 } | 292 } | 
| 293 | 293 | 
|  | 294 function TypedArrayGetToStringTag() { | 
|  | 295   if (!%IsTypedArray(this)) return; | 
|  | 296   var name = %_ClassOf(this); | 
|  | 297   if (IS_UNDEFINED(name)) return; | 
|  | 298   return name; | 
|  | 299 } | 
|  | 300 | 
| 294 // ------------------------------------------------------------------- | 301 // ------------------------------------------------------------------- | 
| 295 | 302 | 
| 296 function SetupTypedArrays() { | 303 function SetupTypedArrays() { | 
| 297 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) | 304 macro SETUP_TYPED_ARRAY(ARRAY_ID, NAME, ELEMENT_SIZE) | 
| 298   %CheckIsBootstrapping(); | 305   %CheckIsBootstrapping(); | 
| 299   %SetCode(global.NAME, NAMEConstructor); | 306   %SetCode(global.NAME, NAMEConstructor); | 
| 300   %FunctionSetPrototype(global.NAME, new $Object()); | 307   %FunctionSetPrototype(global.NAME, new $Object()); | 
| 301 | 308 | 
| 302   %AddNamedProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 309   %AddNamedProperty(global.NAME, "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 
| 303                     READ_ONLY | DONT_ENUM | DONT_DELETE); | 310                     READ_ONLY | DONT_ENUM | DONT_DELETE); | 
| 304   %AddNamedProperty(global.NAME.prototype, | 311   %AddNamedProperty(global.NAME.prototype, | 
| 305                     "constructor", global.NAME, DONT_ENUM); | 312                     "constructor", global.NAME, DONT_ENUM); | 
| 306   %AddNamedProperty(global.NAME.prototype, | 313   %AddNamedProperty(global.NAME.prototype, | 
| 307                     "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 314                     "BYTES_PER_ELEMENT", ELEMENT_SIZE, | 
| 308                     READ_ONLY | DONT_ENUM | DONT_DELETE); | 315                     READ_ONLY | DONT_ENUM | DONT_DELETE); | 
| 309   InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer); | 316   InstallGetter(global.NAME.prototype, "buffer", NAME_GetBuffer); | 
| 310   InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset); | 317   InstallGetter(global.NAME.prototype, "byteOffset", NAME_GetByteOffset); | 
| 311   InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength); | 318   InstallGetter(global.NAME.prototype, "byteLength", NAME_GetByteLength); | 
| 312   InstallGetter(global.NAME.prototype, "length", NAME_GetLength); | 319   InstallGetter(global.NAME.prototype, "length", NAME_GetLength); | 
| 313 | 320   InstallGetter(global.NAME.prototype, symbolToStringTag, | 
|  | 321                 TypedArrayGetToStringTag); | 
| 314   InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array( | 322   InstallFunctions(global.NAME.prototype, DONT_ENUM, $Array( | 
| 315         "subarray", NAMESubArray, | 323         "subarray", NAMESubArray, | 
| 316         "set", TypedArraySet | 324         "set", TypedArraySet | 
| 317   )); | 325   )); | 
| 318 endmacro | 326 endmacro | 
| 319 | 327 | 
| 320 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 328 TYPED_ARRAYS(SETUP_TYPED_ARRAY) | 
| 321 } | 329 } | 
| 322 | 330 | 
| 323 SetupTypedArrays(); | 331 SetupTypedArrays(); | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 430 | 438 | 
| 431 function SetupDataView() { | 439 function SetupDataView() { | 
| 432   %CheckIsBootstrapping(); | 440   %CheckIsBootstrapping(); | 
| 433 | 441 | 
| 434   // Setup the DataView constructor. | 442   // Setup the DataView constructor. | 
| 435   %SetCode($DataView, DataViewConstructor); | 443   %SetCode($DataView, DataViewConstructor); | 
| 436   %FunctionSetPrototype($DataView, new $Object); | 444   %FunctionSetPrototype($DataView, new $Object); | 
| 437 | 445 | 
| 438   // Set up constructor property on the DataView prototype. | 446   // Set up constructor property on the DataView prototype. | 
| 439   %AddNamedProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM); | 447   %AddNamedProperty($DataView.prototype, "constructor", $DataView, DONT_ENUM); | 
|  | 448   %AddNamedProperty( | 
|  | 449       $DataView.prototype, symbolToStringTag, "DataView", READ_ONLY|DONT_ENUM); | 
| 440 | 450 | 
| 441   InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS); | 451   InstallGetter($DataView.prototype, "buffer", DataViewGetBufferJS); | 
| 442   InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset); | 452   InstallGetter($DataView.prototype, "byteOffset", DataViewGetByteOffset); | 
| 443   InstallGetter($DataView.prototype, "byteLength", DataViewGetByteLength); | 453   InstallGetter($DataView.prototype, "byteLength", DataViewGetByteLength); | 
| 444 | 454 | 
| 445   InstallFunctions($DataView.prototype, DONT_ENUM, $Array( | 455   InstallFunctions($DataView.prototype, DONT_ENUM, $Array( | 
| 446       "getInt8", DataViewGetInt8JS, | 456       "getInt8", DataViewGetInt8JS, | 
| 447       "setInt8", DataViewSetInt8JS, | 457       "setInt8", DataViewSetInt8JS, | 
| 448 | 458 | 
| 449       "getUint8", DataViewGetUint8JS, | 459       "getUint8", DataViewGetUint8JS, | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 463 | 473 | 
| 464       "getFloat32", DataViewGetFloat32JS, | 474       "getFloat32", DataViewGetFloat32JS, | 
| 465       "setFloat32", DataViewSetFloat32JS, | 475       "setFloat32", DataViewSetFloat32JS, | 
| 466 | 476 | 
| 467       "getFloat64", DataViewGetFloat64JS, | 477       "getFloat64", DataViewGetFloat64JS, | 
| 468       "setFloat64", DataViewSetFloat64JS | 478       "setFloat64", DataViewSetFloat64JS | 
| 469   )); | 479   )); | 
| 470 } | 480 } | 
| 471 | 481 | 
| 472 SetupDataView(); | 482 SetupDataView(); | 
| OLD | NEW | 
|---|