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

Side by Side Diff: src/arm/ic-arm.cc

Issue 6546036: Combine typed and pixel arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix wrong external element call Created 9 years, 10 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 } 1163 }
1164 1164
1165 1165
1166 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 1166 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
1167 // ---------- S t a t e -------------- 1167 // ---------- S t a t e --------------
1168 // -- lr : return address 1168 // -- lr : return address
1169 // -- r0 : key 1169 // -- r0 : key
1170 // -- r1 : receiver 1170 // -- r1 : receiver
1171 // ----------------------------------- 1171 // -----------------------------------
1172 Label slow, check_string, index_smi, index_string, property_array_property; 1172 Label slow, check_string, index_smi, index_string, property_array_property;
1173 Label check_pixel_array, probe_dictionary, check_number_dictionary; 1173 Label probe_dictionary, check_number_dictionary;
1174 1174
1175 Register key = r0; 1175 Register key = r0;
1176 Register receiver = r1; 1176 Register receiver = r1;
1177 1177
1178 // Check that the key is a smi. 1178 // Check that the key is a smi.
1179 __ JumpIfNotSmi(key, &check_string); 1179 __ JumpIfNotSmi(key, &check_string);
1180 __ bind(&index_smi); 1180 __ bind(&index_smi);
1181 // Now the key is known to be a smi. This place is also jumped to from below 1181 // Now the key is known to be a smi. This place is also jumped to from below
1182 // where a numeric string is converted to a smi. 1182 // where a numeric string is converted to a smi.
1183 1183
1184 GenerateKeyedLoadReceiverCheck( 1184 GenerateKeyedLoadReceiverCheck(
1185 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow); 1185 masm, receiver, r2, r3, Map::kHasIndexedInterceptor, &slow);
1186 1186
1187 // Check the "has fast elements" bit in the receiver's map which is 1187 // Check the "has fast elements" bit in the receiver's map which is
1188 // now in r2. 1188 // now in r2.
1189 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset)); 1189 __ ldrb(r3, FieldMemOperand(r2, Map::kBitField2Offset));
1190 __ tst(r3, Operand(1 << Map::kHasFastElements)); 1190 __ tst(r3, Operand(1 << Map::kHasFastElements));
1191 __ b(eq, &check_pixel_array); 1191 __ b(eq, &check_number_dictionary);
1192 1192
1193 GenerateFastArrayLoad( 1193 GenerateFastArrayLoad(
1194 masm, receiver, key, r4, r3, r2, r0, NULL, &slow); 1194 masm, receiver, key, r4, r3, r2, r0, NULL, &slow);
1195 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3); 1195 __ IncrementCounter(&Counters::keyed_load_generic_smi, 1, r2, r3);
1196 __ Ret(); 1196 __ Ret();
1197 1197
1198 // Check whether the elements is a pixel array. 1198 __ bind(&check_number_dictionary);
1199 // r0: key 1199 __ ldr(r4, FieldMemOperand(receiver, JSObject::kElementsOffset));
1200 // r1: receiver 1200 __ ldr(r3, FieldMemOperand(r4, JSObject::kMapOffset));
1201 __ bind(&check_pixel_array);
1202 1201
1203 GenerateFastPixelArrayLoad(masm,
1204 r1,
1205 r0,
1206 r3,
1207 r4,
1208 r2,
1209 r5,
1210 r0,
1211 &check_number_dictionary,
1212 NULL,
1213 &slow);
1214
1215 __ bind(&check_number_dictionary);
1216 // Check whether the elements is a number dictionary. 1202 // Check whether the elements is a number dictionary.
1217 // r0: key 1203 // r0: key
1218 // r3: elements map 1204 // r3: elements map
1219 // r4: elements 1205 // r4: elements
1220 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); 1206 __ LoadRoot(ip, Heap::kHashTableMapRootIndex);
1221 __ cmp(r3, ip); 1207 __ cmp(r3, ip);
1222 __ b(ne, &slow); 1208 __ b(ne, &slow);
1223 __ mov(r2, Operand(r0, ASR, kSmiTagSize)); 1209 __ mov(r2, Operand(r0, ASR, kSmiTagSize));
1224 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5); 1210 GenerateNumberDictionaryLoad(masm, &slow, r4, r0, r0, r2, r3, r5);
1225 __ Ret(); 1211 __ Ret();
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 } 1401 }
1416 1402
1417 1403
1418 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 1404 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
1419 // ---------- S t a t e -------------- 1405 // ---------- S t a t e --------------
1420 // -- r0 : value 1406 // -- r0 : value
1421 // -- r1 : key 1407 // -- r1 : key
1422 // -- r2 : receiver 1408 // -- r2 : receiver
1423 // -- lr : return address 1409 // -- lr : return address
1424 // ----------------------------------- 1410 // -----------------------------------
1425 Label slow, fast, array, extra, check_pixel_array; 1411 Label slow, fast, array, extra;
1426 1412
1427 // Register usage. 1413 // Register usage.
1428 Register value = r0; 1414 Register value = r0;
1429 Register key = r1; 1415 Register key = r1;
1430 Register receiver = r2; 1416 Register receiver = r2;
1431 Register elements = r3; // Elements array of the receiver. 1417 Register elements = r3; // Elements array of the receiver.
1432 // r4 and r5 are used as general scratch registers. 1418 // r4 and r5 are used as general scratch registers.
1433 1419
1434 // Check that the key is a smi. 1420 // Check that the key is a smi.
1435 __ tst(key, Operand(kSmiTagMask)); 1421 __ tst(key, Operand(kSmiTagMask));
(...skipping 15 matching lines...) Expand all
1451 // Check that the object is some kind of JS object. 1437 // Check that the object is some kind of JS object.
1452 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); 1438 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE));
1453 __ b(lt, &slow); 1439 __ b(lt, &slow);
1454 1440
1455 // Object case: Check key against length in the elements array. 1441 // Object case: Check key against length in the elements array.
1456 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1442 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1457 // Check that the object is in fast mode and writable. 1443 // Check that the object is in fast mode and writable.
1458 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); 1444 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset));
1459 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 1445 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
1460 __ cmp(r4, ip); 1446 __ cmp(r4, ip);
1461 __ b(ne, &check_pixel_array); 1447 __ b(ne, &slow);
1462 // Check array bounds. Both the key and the length of FixedArray are smis. 1448 // Check array bounds. Both the key and the length of FixedArray are smis.
1463 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1449 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1464 __ cmp(key, Operand(ip)); 1450 __ cmp(key, Operand(ip));
1465 __ b(lo, &fast); 1451 __ b(lo, &fast);
1466 1452
1467 // Slow case, handle jump to runtime. 1453 // Slow case, handle jump to runtime.
1468 __ bind(&slow); 1454 __ bind(&slow);
1469 // Entry registers are intact. 1455 // Entry registers are intact.
1470 // r0: value. 1456 // r0: value.
1471 // r1: key. 1457 // r1: key.
1472 // r2: receiver. 1458 // r2: receiver.
1473 GenerateRuntimeSetProperty(masm); 1459 GenerateRuntimeSetProperty(masm);
1474 1460
1475 // Check whether the elements is a pixel array.
1476 // r4: elements map.
1477 __ bind(&check_pixel_array);
1478 GenerateFastPixelArrayStore(masm,
1479 r2,
1480 r1,
1481 r0,
1482 elements,
1483 r4,
1484 r5,
1485 r6,
1486 false,
1487 false,
1488 NULL,
1489 &slow,
1490 &slow,
1491 &slow);
1492
1493 // Extra capacity case: Check if there is extra capacity to 1461 // Extra capacity case: Check if there is extra capacity to
1494 // perform the store and update the length. Used for adding one 1462 // perform the store and update the length. Used for adding one
1495 // element to the array by writing to array[array.length]. 1463 // element to the array by writing to array[array.length].
1496 __ bind(&extra); 1464 __ bind(&extra);
1497 // Condition code from comparing key and array length is still available. 1465 // Condition code from comparing key and array length is still available.
1498 __ b(ne, &slow); // Only support writing to writing to array[array.length]. 1466 __ b(ne, &slow); // Only support writing to writing to array[array.length].
1499 // Check for room in the elements backing store. 1467 // Check for room in the elements backing store.
1500 // Both the key and the length of FixedArray are smis. 1468 // Both the key and the length of FixedArray are smis.
1501 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1469 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1502 __ cmp(key, Operand(ip)); 1470 __ cmp(key, Operand(ip));
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 Register reg = Assembler::GetRn(instr_at_patch); 1747 Register reg = Assembler::GetRn(instr_at_patch);
1780 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1748 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1781 patcher.EmitCondition(eq); 1749 patcher.EmitCondition(eq);
1782 } 1750 }
1783 } 1751 }
1784 1752
1785 1753
1786 } } // namespace v8::internal 1754 } } // namespace v8::internal
1787 1755
1788 #endif // V8_TARGET_ARCH_ARM 1756 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698