Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: src/typedarray.js

Issue 150813004: In-heap small typed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength); 93 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, offset, newByteLength);
94 } 94 }
95 95
96 function NAMEConstructByLength(obj, length) { 96 function NAMEConstructByLength(obj, length) {
97 var l = IS_UNDEFINED(length) ? 97 var l = IS_UNDEFINED(length) ?
98 0 : ToPositiveInteger(length, "invalid_typed_array_length"); 98 0 : ToPositiveInteger(length, "invalid_typed_array_length");
99 if (l > %_MaxSmi()) { 99 if (l > %_MaxSmi()) {
100 throw MakeRangeError("invalid_typed_array_length"); 100 throw MakeRangeError("invalid_typed_array_length");
101 } 101 }
102 var byteLength = l * ELEMENT_SIZE; 102 var byteLength = l * ELEMENT_SIZE;
103 var buffer = new $ArrayBuffer(byteLength); 103 if (byteLength > %_TypedArrayMaxSizeInHeap()) {
104 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength); 104 var buffer = new $ArrayBuffer(byteLength);
105 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
106 } else {
107 %_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
108 }
105 } 109 }
106 110
107 function NAMEConstructByArrayLike(obj, arrayLike) { 111 function NAMEConstructByArrayLike(obj, arrayLike) {
108 var length = arrayLike.length; 112 var length = arrayLike.length;
109 var l = ToPositiveInteger(length, "invalid_typed_array_length"); 113 var l = ToPositiveInteger(length, "invalid_typed_array_length");
110 114
111 if (l > %_MaxSmi()) { 115 if (l > %_MaxSmi()) {
112 throw MakeRangeError("invalid_typed_array_length"); 116 throw MakeRangeError("invalid_typed_array_length");
113 } 117 }
114 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) { 118 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 466
463 "getFloat32", DataViewGetFloat32, 467 "getFloat32", DataViewGetFloat32,
464 "setFloat32", DataViewSetFloat32, 468 "setFloat32", DataViewSetFloat32,
465 469
466 "getFloat64", DataViewGetFloat64, 470 "getFloat64", DataViewGetFloat64,
467 "setFloat64", DataViewSetFloat64 471 "setFloat64", DataViewSetFloat64
468 )); 472 ));
469 } 473 }
470 474
471 SetupDataView(); 475 SetupDataView();
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698