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

Side by Side Diff: src/typedarray.js

Issue 211003003: Revert "This implements allocating small typed arrays in heap." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 if (byteLength > %_TypedArrayMaxSizeInHeap()) { 103 var buffer = new $ArrayBuffer(byteLength);
104 var buffer = new $ArrayBuffer(byteLength); 104 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
105 %_TypedArrayInitialize(obj, ARRAY_ID, buffer, 0, byteLength);
106 } else {
107 %_TypedArrayInitialize(obj, ARRAY_ID, null, 0, byteLength);
108 }
109 } 105 }
110 106
111 function NAMEConstructByArrayLike(obj, arrayLike) { 107 function NAMEConstructByArrayLike(obj, arrayLike) {
112 var length = arrayLike.length; 108 var length = arrayLike.length;
113 var l = ToPositiveInteger(length, "invalid_typed_array_length"); 109 var l = ToPositiveInteger(length, "invalid_typed_array_length");
114 110
115 if (l > %_MaxSmi()) { 111 if (l > %_MaxSmi()) {
116 throw MakeRangeError("invalid_typed_array_length"); 112 throw MakeRangeError("invalid_typed_array_length");
117 } 113 }
118 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) { 114 if(!%TypedArrayInitializeFromArrayLike(obj, ARRAY_ID, arrayLike, l)) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 462
467 "getFloat32", DataViewGetFloat32, 463 "getFloat32", DataViewGetFloat32,
468 "setFloat32", DataViewSetFloat32, 464 "setFloat32", DataViewSetFloat32,
469 465
470 "getFloat64", DataViewGetFloat64, 466 "getFloat64", DataViewGetFloat64,
471 "setFloat64", DataViewSetFloat64 467 "setFloat64", DataViewSetFloat64
472 )); 468 ));
473 } 469 }
474 470
475 SetupDataView(); 471 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