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

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: final version Created 9 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 | « src/arm/code-stubs-arm.cc ('k') | src/arm/lithium-arm.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 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 1407
1422 1408
1423 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, 1409 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
1424 StrictModeFlag strict_mode) { 1410 StrictModeFlag strict_mode) {
1425 // ---------- S t a t e -------------- 1411 // ---------- S t a t e --------------
1426 // -- r0 : value 1412 // -- r0 : value
1427 // -- r1 : key 1413 // -- r1 : key
1428 // -- r2 : receiver 1414 // -- r2 : receiver
1429 // -- lr : return address 1415 // -- lr : return address
1430 // ----------------------------------- 1416 // -----------------------------------
1431 Label slow, fast, array, extra, check_pixel_array; 1417 Label slow, fast, array, extra;
1432 1418
1433 // Register usage. 1419 // Register usage.
1434 Register value = r0; 1420 Register value = r0;
1435 Register key = r1; 1421 Register key = r1;
1436 Register receiver = r2; 1422 Register receiver = r2;
1437 Register elements = r3; // Elements array of the receiver. 1423 Register elements = r3; // Elements array of the receiver.
1438 // r4 and r5 are used as general scratch registers. 1424 // r4 and r5 are used as general scratch registers.
1439 1425
1440 // Check that the key is a smi. 1426 // Check that the key is a smi.
1441 __ tst(key, Operand(kSmiTagMask)); 1427 __ tst(key, Operand(kSmiTagMask));
(...skipping 15 matching lines...) Expand all
1457 // Check that the object is some kind of JS object. 1443 // Check that the object is some kind of JS object.
1458 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE)); 1444 __ cmp(r4, Operand(FIRST_JS_OBJECT_TYPE));
1459 __ b(lt, &slow); 1445 __ b(lt, &slow);
1460 1446
1461 // Object case: Check key against length in the elements array. 1447 // Object case: Check key against length in the elements array.
1462 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset)); 1448 __ ldr(elements, FieldMemOperand(receiver, JSObject::kElementsOffset));
1463 // Check that the object is in fast mode and writable. 1449 // Check that the object is in fast mode and writable.
1464 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset)); 1450 __ ldr(r4, FieldMemOperand(elements, HeapObject::kMapOffset));
1465 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex); 1451 __ LoadRoot(ip, Heap::kFixedArrayMapRootIndex);
1466 __ cmp(r4, ip); 1452 __ cmp(r4, ip);
1467 __ b(ne, &check_pixel_array); 1453 __ b(ne, &slow);
1468 // Check array bounds. Both the key and the length of FixedArray are smis. 1454 // Check array bounds. Both the key and the length of FixedArray are smis.
1469 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1455 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1470 __ cmp(key, Operand(ip)); 1456 __ cmp(key, Operand(ip));
1471 __ b(lo, &fast); 1457 __ b(lo, &fast);
1472 1458
1473 // Slow case, handle jump to runtime. 1459 // Slow case, handle jump to runtime.
1474 __ bind(&slow); 1460 __ bind(&slow);
1475 // Entry registers are intact. 1461 // Entry registers are intact.
1476 // r0: value. 1462 // r0: value.
1477 // r1: key. 1463 // r1: key.
1478 // r2: receiver. 1464 // r2: receiver.
1479 GenerateRuntimeSetProperty(masm, strict_mode); 1465 GenerateRuntimeSetProperty(masm, strict_mode);
1480 1466
1481 // Check whether the elements is a pixel array.
1482 // r4: elements map.
1483 __ bind(&check_pixel_array);
1484 GenerateFastPixelArrayStore(masm,
1485 r2,
1486 r1,
1487 r0,
1488 elements,
1489 r4,
1490 r5,
1491 r6,
1492 false,
1493 false,
1494 NULL,
1495 &slow,
1496 &slow,
1497 &slow);
1498
1499 // Extra capacity case: Check if there is extra capacity to 1467 // Extra capacity case: Check if there is extra capacity to
1500 // perform the store and update the length. Used for adding one 1468 // perform the store and update the length. Used for adding one
1501 // element to the array by writing to array[array.length]. 1469 // element to the array by writing to array[array.length].
1502 __ bind(&extra); 1470 __ bind(&extra);
1503 // Condition code from comparing key and array length is still available. 1471 // Condition code from comparing key and array length is still available.
1504 __ b(ne, &slow); // Only support writing to writing to array[array.length]. 1472 __ b(ne, &slow); // Only support writing to writing to array[array.length].
1505 // Check for room in the elements backing store. 1473 // Check for room in the elements backing store.
1506 // Both the key and the length of FixedArray are smis. 1474 // Both the key and the length of FixedArray are smis.
1507 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1475 __ ldr(ip, FieldMemOperand(elements, FixedArray::kLengthOffset));
1508 __ cmp(key, Operand(ip)); 1476 __ cmp(key, Operand(ip));
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 Register reg = Assembler::GetRn(instr_at_patch); 1758 Register reg = Assembler::GetRn(instr_at_patch);
1791 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1759 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1792 patcher.EmitCondition(eq); 1760 patcher.EmitCondition(eq);
1793 } 1761 }
1794 } 1762 }
1795 1763
1796 1764
1797 } } // namespace v8::internal 1765 } } // namespace v8::internal
1798 1766
1799 #endif // V8_TARGET_ARCH_ARM 1767 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698