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

Side by Side Diff: src/arraybuffer.js

Issue 197793003: Use intrinsics for builtin ArrayBuffer property accesses (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 | « no previous file | src/runtime.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 // 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 // ES6 Draft 15.13.5.5.3 51 // ES6 Draft 15.13.5.5.3
52 function ArrayBufferSlice(start, end) { 52 function ArrayBufferSlice(start, end) {
53 if (!IS_ARRAYBUFFER(this)) { 53 if (!IS_ARRAYBUFFER(this)) {
54 throw MakeTypeError('incompatible_method_receiver', 54 throw MakeTypeError('incompatible_method_receiver',
55 ['ArrayBuffer.prototype.slice', this]); 55 ['ArrayBuffer.prototype.slice', this]);
56 } 56 }
57 57
58 var relativeStart = TO_INTEGER(start); 58 var relativeStart = TO_INTEGER(start);
59 var first; 59 var first;
60 var byte_length = %ArrayBufferGetByteLength(this);
60 if (relativeStart < 0) { 61 if (relativeStart < 0) {
61 first = MathMax(this.byteLength + relativeStart, 0); 62 first = MathMax(byte_length + relativeStart, 0);
62 } else { 63 } else {
63 first = MathMin(relativeStart, this.byteLength); 64 first = MathMin(relativeStart, byte_length);
64 } 65 }
65 var relativeEnd = IS_UNDEFINED(end) ? this.byteLength : TO_INTEGER(end); 66 var relativeEnd = IS_UNDEFINED(end) ? byte_length : TO_INTEGER(end);
66 var fin; 67 var fin;
67 if (relativeEnd < 0) { 68 if (relativeEnd < 0) {
68 fin = MathMax(this.byteLength + relativeEnd, 0); 69 fin = MathMax(byte_length + relativeEnd, 0);
69 } else { 70 } else {
70 fin = MathMin(relativeEnd, this.byteLength); 71 fin = MathMin(relativeEnd, byte_length);
71 } 72 }
72 73
73 if (fin < first) { 74 if (fin < first) {
74 fin = first; 75 fin = first;
75 } 76 }
76 var newLen = fin - first; 77 var newLen = fin - first;
77 // TODO(dslomov): implement inheritance 78 // TODO(dslomov): implement inheritance
78 var result = new $ArrayBuffer(newLen); 79 var result = new $ArrayBuffer(newLen);
79 80
80 %ArrayBufferSliceImpl(this, result, first); 81 %ArrayBufferSliceImpl(this, result, first);
(...skipping 19 matching lines...) Expand all
100 InstallFunctions($ArrayBuffer, DONT_ENUM, $Array( 101 InstallFunctions($ArrayBuffer, DONT_ENUM, $Array(
101 "isView", ArrayBufferIsView 102 "isView", ArrayBufferIsView
102 )); 103 ));
103 104
104 InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array( 105 InstallFunctions($ArrayBuffer.prototype, DONT_ENUM, $Array(
105 "slice", ArrayBufferSlice 106 "slice", ArrayBufferSlice
106 )); 107 ));
107 } 108 }
108 109
109 SetUpArrayBuffer(); 110 SetUpArrayBuffer();
OLDNEW
« no previous file with comments | « no previous file | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698