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

Side by Side Diff: src/arraybuffer.js

Issue 1144163002: Revert of Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/array-iterator.js ('k') | src/bootstrapper.cc » ('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 // 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, shared, exports) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11
12 // -------------------------------------------------------------------
13 // Imports
14
15 var GlobalArrayBuffer = global.ArrayBuffer; 11 var GlobalArrayBuffer = global.ArrayBuffer;
16 var GlobalObject = global.Object; 12 var GlobalObject = global.Object;
17 13
18 var MathMax;
19 var MathMin;
20
21 utils.Import(function(from) {
22 MathMax = from.MathMax;
23 MathMin = from.MathMin;
24 });
25
26 // ------------------------------------------------------------------- 14 // -------------------------------------------------------------------
27 15
28 function ArrayBufferConstructor(length) { // length = 1 16 function ArrayBufferConstructor(length) { // length = 1
29 if (%_IsConstructCall()) { 17 if (%_IsConstructCall()) {
30 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength); 18 var byteLength = $toPositiveInteger(length, kInvalidArrayBufferLength);
31 %ArrayBufferInitialize(this, byteLength); 19 %ArrayBufferInitialize(this, byteLength);
32 } else { 20 } else {
33 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer"); 21 throw MakeTypeError(kConstructorNotFunction, "ArrayBuffer");
34 } 22 }
35 } 23 }
(...skipping 13 matching lines...) Expand all
49 'ArrayBuffer.prototype.slice', this); 37 'ArrayBuffer.prototype.slice', this);
50 } 38 }
51 39
52 var relativeStart = TO_INTEGER(start); 40 var relativeStart = TO_INTEGER(start);
53 if (!IS_UNDEFINED(end)) { 41 if (!IS_UNDEFINED(end)) {
54 end = TO_INTEGER(end); 42 end = TO_INTEGER(end);
55 } 43 }
56 var first; 44 var first;
57 var byte_length = %_ArrayBufferGetByteLength(this); 45 var byte_length = %_ArrayBufferGetByteLength(this);
58 if (relativeStart < 0) { 46 if (relativeStart < 0) {
59 first = MathMax(byte_length + relativeStart, 0); 47 first = $max(byte_length + relativeStart, 0);
60 } else { 48 } else {
61 first = MathMin(relativeStart, byte_length); 49 first = $min(relativeStart, byte_length);
62 } 50 }
63 var relativeEnd = IS_UNDEFINED(end) ? byte_length : end; 51 var relativeEnd = IS_UNDEFINED(end) ? byte_length : end;
64 var fin; 52 var fin;
65 if (relativeEnd < 0) { 53 if (relativeEnd < 0) {
66 fin = MathMax(byte_length + relativeEnd, 0); 54 fin = $max(byte_length + relativeEnd, 0);
67 } else { 55 } else {
68 fin = MathMin(relativeEnd, byte_length); 56 fin = $min(relativeEnd, byte_length);
69 } 57 }
70 58
71 if (fin < first) { 59 if (fin < first) {
72 fin = first; 60 fin = first;
73 } 61 }
74 var newLen = fin - first; 62 var newLen = fin - first;
75 // TODO(dslomov): implement inheritance 63 // TODO(dslomov): implement inheritance
76 var result = new GlobalArrayBuffer(newLen); 64 var result = new GlobalArrayBuffer(newLen);
77 65
78 %ArrayBufferSliceImpl(this, result, first); 66 %ArrayBufferSliceImpl(this, result, first);
(...skipping 20 matching lines...) Expand all
99 87
100 $installFunctions(GlobalArrayBuffer, DONT_ENUM, [ 88 $installFunctions(GlobalArrayBuffer, DONT_ENUM, [
101 "isView", ArrayBufferIsViewJS 89 "isView", ArrayBufferIsViewJS
102 ]); 90 ]);
103 91
104 $installFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [ 92 $installFunctions(GlobalArrayBuffer.prototype, DONT_ENUM, [
105 "slice", ArrayBufferSlice 93 "slice", ArrayBufferSlice
106 ]); 94 ]);
107 95
108 }) 96 })
OLDNEW
« no previous file with comments | « src/array-iterator.js ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698