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

Side by Side Diff: src/array.js

Issue 332673002: Introduce intrinsic to expose debug state to generated code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/arm64/full-codegen-arm64.cc ('k') | src/assembler.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // This file relies on the fact that the following declarations have been made 7 // This file relies on the fact that the following declarations have been made
8 // in runtime.js: 8 // in runtime.js:
9 // var $Array = global.Array; 9 // var $Array = global.Array;
10 10
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 } 1121 }
1122 if (IS_NULL_OR_UNDEFINED(receiver)) { 1122 if (IS_NULL_OR_UNDEFINED(receiver)) {
1123 receiver = %GetDefaultReceiver(f) || receiver; 1123 receiver = %GetDefaultReceiver(f) || receiver;
1124 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) { 1124 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
1125 receiver = ToObject(receiver); 1125 receiver = ToObject(receiver);
1126 } 1126 }
1127 1127
1128 var result = new $Array(); 1128 var result = new $Array();
1129 var accumulator = new InternalArray(); 1129 var accumulator = new InternalArray();
1130 var accumulator_length = 0; 1130 var accumulator_length = 0;
1131 var stepping = %_DebugCallbackSupportsStepping(f); 1131 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
1132 for (var i = 0; i < length; i++) { 1132 for (var i = 0; i < length; i++) {
1133 if (i in array) { 1133 if (i in array) {
1134 var element = array[i]; 1134 var element = array[i];
1135 // Prepare break slots for debugger step in. 1135 // Prepare break slots for debugger step in.
1136 if (stepping) %DebugPrepareStepInIfStepping(f); 1136 if (stepping) %DebugPrepareStepInIfStepping(f);
1137 if (%_CallFunction(receiver, element, i, array, f)) { 1137 if (%_CallFunction(receiver, element, i, array, f)) {
1138 accumulator[accumulator_length++] = element; 1138 accumulator[accumulator_length++] = element;
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
(...skipping 12 matching lines...) Expand all
1154 1154
1155 if (!IS_SPEC_FUNCTION(f)) { 1155 if (!IS_SPEC_FUNCTION(f)) {
1156 throw MakeTypeError('called_non_callable', [ f ]); 1156 throw MakeTypeError('called_non_callable', [ f ]);
1157 } 1157 }
1158 if (IS_NULL_OR_UNDEFINED(receiver)) { 1158 if (IS_NULL_OR_UNDEFINED(receiver)) {
1159 receiver = %GetDefaultReceiver(f) || receiver; 1159 receiver = %GetDefaultReceiver(f) || receiver;
1160 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) { 1160 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
1161 receiver = ToObject(receiver); 1161 receiver = ToObject(receiver);
1162 } 1162 }
1163 1163
1164 var stepping = %_DebugCallbackSupportsStepping(f); 1164 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
1165 for (var i = 0; i < length; i++) { 1165 for (var i = 0; i < length; i++) {
1166 if (i in array) { 1166 if (i in array) {
1167 var element = array[i]; 1167 var element = array[i];
1168 // Prepare break slots for debugger step in. 1168 // Prepare break slots for debugger step in.
1169 if (stepping) %DebugPrepareStepInIfStepping(f); 1169 if (stepping) %DebugPrepareStepInIfStepping(f);
1170 %_CallFunction(receiver, element, i, array, f); 1170 %_CallFunction(receiver, element, i, array, f);
1171 } 1171 }
1172 } 1172 }
1173 } 1173 }
1174 1174
(...skipping 10 matching lines...) Expand all
1185 1185
1186 if (!IS_SPEC_FUNCTION(f)) { 1186 if (!IS_SPEC_FUNCTION(f)) {
1187 throw MakeTypeError('called_non_callable', [ f ]); 1187 throw MakeTypeError('called_non_callable', [ f ]);
1188 } 1188 }
1189 if (IS_NULL_OR_UNDEFINED(receiver)) { 1189 if (IS_NULL_OR_UNDEFINED(receiver)) {
1190 receiver = %GetDefaultReceiver(f) || receiver; 1190 receiver = %GetDefaultReceiver(f) || receiver;
1191 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) { 1191 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
1192 receiver = ToObject(receiver); 1192 receiver = ToObject(receiver);
1193 } 1193 }
1194 1194
1195 var stepping = %_DebugCallbackSupportsStepping(f); 1195 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
1196 for (var i = 0; i < length; i++) { 1196 for (var i = 0; i < length; i++) {
1197 if (i in array) { 1197 if (i in array) {
1198 var element = array[i]; 1198 var element = array[i];
1199 // Prepare break slots for debugger step in. 1199 // Prepare break slots for debugger step in.
1200 if (stepping) %DebugPrepareStepInIfStepping(f); 1200 if (stepping) %DebugPrepareStepInIfStepping(f);
1201 if (%_CallFunction(receiver, element, i, array, f)) return true; 1201 if (%_CallFunction(receiver, element, i, array, f)) return true;
1202 } 1202 }
1203 } 1203 }
1204 return false; 1204 return false;
1205 } 1205 }
1206 1206
1207 1207
1208 function ArrayEvery(f, receiver) { 1208 function ArrayEvery(f, receiver) {
1209 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.every"); 1209 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.every");
1210 1210
1211 // Pull out the length so that modifications to the length in the 1211 // Pull out the length so that modifications to the length in the
1212 // loop will not affect the looping and side effects are visible. 1212 // loop will not affect the looping and side effects are visible.
1213 var array = ToObject(this); 1213 var array = ToObject(this);
1214 var length = TO_UINT32(array.length); 1214 var length = TO_UINT32(array.length);
1215 1215
1216 if (!IS_SPEC_FUNCTION(f)) { 1216 if (!IS_SPEC_FUNCTION(f)) {
1217 throw MakeTypeError('called_non_callable', [ f ]); 1217 throw MakeTypeError('called_non_callable', [ f ]);
1218 } 1218 }
1219 if (IS_NULL_OR_UNDEFINED(receiver)) { 1219 if (IS_NULL_OR_UNDEFINED(receiver)) {
1220 receiver = %GetDefaultReceiver(f) || receiver; 1220 receiver = %GetDefaultReceiver(f) || receiver;
1221 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) { 1221 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
1222 receiver = ToObject(receiver); 1222 receiver = ToObject(receiver);
1223 } 1223 }
1224 1224
1225 var stepping = %_DebugCallbackSupportsStepping(f); 1225 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
1226 for (var i = 0; i < length; i++) { 1226 for (var i = 0; i < length; i++) {
1227 if (i in array) { 1227 if (i in array) {
1228 var element = array[i]; 1228 var element = array[i];
1229 // Prepare break slots for debugger step in. 1229 // Prepare break slots for debugger step in.
1230 if (stepping) %DebugPrepareStepInIfStepping(f); 1230 if (stepping) %DebugPrepareStepInIfStepping(f);
1231 if (!%_CallFunction(receiver, element, i, array, f)) return false; 1231 if (!%_CallFunction(receiver, element, i, array, f)) return false;
1232 } 1232 }
1233 } 1233 }
1234 return true; 1234 return true;
1235 } 1235 }
(...skipping 10 matching lines...) Expand all
1246 throw MakeTypeError('called_non_callable', [ f ]); 1246 throw MakeTypeError('called_non_callable', [ f ]);
1247 } 1247 }
1248 if (IS_NULL_OR_UNDEFINED(receiver)) { 1248 if (IS_NULL_OR_UNDEFINED(receiver)) {
1249 receiver = %GetDefaultReceiver(f) || receiver; 1249 receiver = %GetDefaultReceiver(f) || receiver;
1250 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) { 1250 } else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
1251 receiver = ToObject(receiver); 1251 receiver = ToObject(receiver);
1252 } 1252 }
1253 1253
1254 var result = new $Array(); 1254 var result = new $Array();
1255 var accumulator = new InternalArray(length); 1255 var accumulator = new InternalArray(length);
1256 var stepping = %_DebugCallbackSupportsStepping(f); 1256 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(f);
1257 for (var i = 0; i < length; i++) { 1257 for (var i = 0; i < length; i++) {
1258 if (i in array) { 1258 if (i in array) {
1259 var element = array[i]; 1259 var element = array[i];
1260 // Prepare break slots for debugger step in. 1260 // Prepare break slots for debugger step in.
1261 if (stepping) %DebugPrepareStepInIfStepping(f); 1261 if (stepping) %DebugPrepareStepInIfStepping(f);
1262 accumulator[i] = %_CallFunction(receiver, element, i, array, f); 1262 accumulator[i] = %_CallFunction(receiver, element, i, array, f);
1263 } 1263 }
1264 } 1264 }
1265 %MoveArrayContents(accumulator, result); 1265 %MoveArrayContents(accumulator, result);
1266 return result; 1266 return result;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 current = array[i]; 1393 current = array[i];
1394 if (!IS_UNDEFINED(current) || i in array) { 1394 if (!IS_UNDEFINED(current) || i in array) {
1395 i++; 1395 i++;
1396 break find_initial; 1396 break find_initial;
1397 } 1397 }
1398 } 1398 }
1399 throw MakeTypeError('reduce_no_initial', []); 1399 throw MakeTypeError('reduce_no_initial', []);
1400 } 1400 }
1401 1401
1402 var receiver = %GetDefaultReceiver(callback); 1402 var receiver = %GetDefaultReceiver(callback);
1403 var stepping = %_DebugCallbackSupportsStepping(callback); 1403 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback);
1404 for (; i < length; i++) { 1404 for (; i < length; i++) {
1405 if (i in array) { 1405 if (i in array) {
1406 var element = array[i]; 1406 var element = array[i];
1407 // Prepare break slots for debugger step in. 1407 // Prepare break slots for debugger step in.
1408 if (stepping) %DebugPrepareStepInIfStepping(callback); 1408 if (stepping) %DebugPrepareStepInIfStepping(callback);
1409 current = %_CallFunction(receiver, current, element, i, array, callback); 1409 current = %_CallFunction(receiver, current, element, i, array, callback);
1410 } 1410 }
1411 } 1411 }
1412 return current; 1412 return current;
1413 } 1413 }
(...skipping 16 matching lines...) Expand all
1430 current = array[i]; 1430 current = array[i];
1431 if (!IS_UNDEFINED(current) || i in array) { 1431 if (!IS_UNDEFINED(current) || i in array) {
1432 i--; 1432 i--;
1433 break find_initial; 1433 break find_initial;
1434 } 1434 }
1435 } 1435 }
1436 throw MakeTypeError('reduce_no_initial', []); 1436 throw MakeTypeError('reduce_no_initial', []);
1437 } 1437 }
1438 1438
1439 var receiver = %GetDefaultReceiver(callback); 1439 var receiver = %GetDefaultReceiver(callback);
1440 var stepping = %_DebugCallbackSupportsStepping(callback); 1440 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback);
1441 for (; i >= 0; i--) { 1441 for (; i >= 0; i--) {
1442 if (i in array) { 1442 if (i in array) {
1443 var element = array[i]; 1443 var element = array[i];
1444 // Prepare break slots for debugger step in. 1444 // Prepare break slots for debugger step in.
1445 if (stepping) %DebugPrepareStepInIfStepping(callback); 1445 if (stepping) %DebugPrepareStepInIfStepping(callback);
1446 current = %_CallFunction(receiver, current, element, i, array, callback); 1446 current = %_CallFunction(receiver, current, element, i, array, callback);
1447 } 1447 }
1448 } 1448 }
1449 return current; 1449 return current;
1450 } 1450 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 )); 1525 ));
1526 1526
1527 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array( 1527 SetUpLockedPrototype(InternalPackedArray, $Array(), $Array(
1528 "join", getFunction("join", ArrayJoin), 1528 "join", getFunction("join", ArrayJoin),
1529 "pop", getFunction("pop", ArrayPop), 1529 "pop", getFunction("pop", ArrayPop),
1530 "push", getFunction("push", ArrayPush) 1530 "push", getFunction("push", ArrayPush)
1531 )); 1531 ));
1532 } 1532 }
1533 1533
1534 SetUpArray(); 1534 SetUpArray();
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698