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

Side by Side Diff: src/arraybuffer.js

Issue 990883002: Hide Math function implementations in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove printf and unnecessary test case change. Created 5 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
« no previous file with comments | « src/array.js ('k') | src/date.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 // 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 var $ArrayBuffer = global.ArrayBuffer; 7 var $ArrayBuffer = global.ArrayBuffer;
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 21 matching lines...) Expand all
32 ['ArrayBuffer.prototype.slice', this]); 32 ['ArrayBuffer.prototype.slice', this]);
33 } 33 }
34 34
35 var relativeStart = TO_INTEGER(start); 35 var relativeStart = TO_INTEGER(start);
36 if (!IS_UNDEFINED(end)) { 36 if (!IS_UNDEFINED(end)) {
37 end = TO_INTEGER(end); 37 end = TO_INTEGER(end);
38 } 38 }
39 var first; 39 var first;
40 var byte_length = %_ArrayBufferGetByteLength(this); 40 var byte_length = %_ArrayBufferGetByteLength(this);
41 if (relativeStart < 0) { 41 if (relativeStart < 0) {
42 first = MathMax(byte_length + relativeStart, 0); 42 first = $max(byte_length + relativeStart, 0);
43 } else { 43 } else {
44 first = MathMin(relativeStart, byte_length); 44 first = $min(relativeStart, byte_length);
45 } 45 }
46 var relativeEnd = IS_UNDEFINED(end) ? byte_length : end; 46 var relativeEnd = IS_UNDEFINED(end) ? byte_length : end;
47 var fin; 47 var fin;
48 if (relativeEnd < 0) { 48 if (relativeEnd < 0) {
49 fin = MathMax(byte_length + relativeEnd, 0); 49 fin = $max(byte_length + relativeEnd, 0);
50 } else { 50 } else {
51 fin = MathMin(relativeEnd, byte_length); 51 fin = $min(relativeEnd, byte_length);
52 } 52 }
53 53
54 if (fin < first) { 54 if (fin < first) {
55 fin = first; 55 fin = first;
56 } 56 }
57 var newLen = fin - first; 57 var newLen = fin - first;
58 // TODO(dslomov): implement inheritance 58 // TODO(dslomov): implement inheritance
59 var result = new $ArrayBuffer(newLen); 59 var result = new $ArrayBuffer(newLen);
60 60
61 %ArrayBufferSliceImpl(this, result, first); 61 %ArrayBufferSliceImpl(this, result, first);
(...skipping 23 matching lines...) Expand all
85 InstallFunctions($ArrayBuffer, DONT_ENUM, $Array( 85 InstallFunctions($ArrayBuffer, DONT_ENUM, $Array(
86 "isView", ArrayBufferIsViewJS 86 "isView", ArrayBufferIsViewJS
87 )); 87 ));
88 88
89 InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array( 89 InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array(
90 "slice", ArrayBufferSlice 90 "slice", ArrayBufferSlice
91 )); 91 ));
92 } 92 }
93 93
94 SetUpArrayBuffer(); 94 SetUpArrayBuffer();
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698