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

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

Issue 8008016: Small refactor to KeyedStoreIC::GenerateGeneric to make it slightly faster. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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/ia32/ic-ia32.cc » ('j') | src/ia32/ic-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 1353
1354 // Check the key against the length in the array. 1354 // Check the key against the length in the array.
1355 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1355 __ ldr(ip, FieldMemOperand(receiver, JSArray::kLengthOffset));
1356 __ cmp(key, Operand(ip)); 1356 __ cmp(key, Operand(ip));
1357 __ b(hs, &extra); 1357 __ b(hs, &extra);
1358 // Fall through to fast case. 1358 // Fall through to fast case.
1359 1359
1360 __ bind(&fast); 1360 __ bind(&fast);
1361 Register scratch_value = r4; 1361 Register scratch_value = r4;
1362 Register address = r5; 1362 Register address = r5;
1363
1364 Label non_smi_value;
1365 __ JumpIfNotSmi(value, &non_smi_value);
1366 // It's irrelevant whether array is smi-only or not when writing a smi.
1367 __ add(address, elements,
Rico 2011/09/24 18:40:36 fits on one line
1368 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1369 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize));
1370 __ str(value, MemOperand(address));
1371 __ Ret();
1372
1373 __ bind(&non_smi_value);
1363 if (FLAG_smi_only_arrays) { 1374 if (FLAG_smi_only_arrays) {
1364 Label not_smi_only;
1365 // Make sure the elements are smi-only. 1375 // Make sure the elements are smi-only.
Rico 2011/09/24 18:40:36 Comment seems wrong now, that is not what we check
1366 __ ldr(scratch_value, FieldMemOperand(receiver, HeapObject::kMapOffset)); 1376 __ ldr(scratch_value, FieldMemOperand(receiver, HeapObject::kMapOffset));
1367 __ CheckFastSmiOnlyElements(scratch_value, scratch_value, &not_smi_only); 1377 __ CheckFastObjectElements(scratch_value, scratch_value, &slow);
1368 // Non-smis need to call into the runtime if the array is smi only.
1369 __ JumpIfNotSmi(value, &slow);
1370 __ add(address, elements,
1371 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1372 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize));
1373 __ str(value, MemOperand(address));
1374 __ Ret();
1375 __ bind(&not_smi_only);
1376 } 1378 }
1377 // Fast case, store the value to the elements backing store. 1379 // Fast elements array, store the value to the elements backing store.
1378 __ add(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 1380 __ add(address, elements, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
1379 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize)); 1381 __ add(address, address, Operand(key, LSL, kPointerSizeLog2 - kSmiTagSize));
1380 __ str(value, MemOperand(address)); 1382 __ str(value, MemOperand(address));
1381 // Skip write barrier if the written value is a smi.
1382 __ tst(value, Operand(kSmiTagMask));
1383 __ Ret(eq);
1384
1385 // Update write barrier for the elements array address. 1383 // Update write barrier for the elements array address.
1386 __ mov(scratch_value, value); // Preserve the value which is returned. 1384 __ mov(scratch_value, value); // Preserve the value which is returned.
1387 __ RecordWrite(elements, 1385 __ RecordWrite(elements,
1388 address, 1386 address,
1389 scratch_value, 1387 scratch_value,
1390 kLRHasNotBeenSaved, 1388 kLRHasNotBeenSaved,
1391 kDontSaveFPRegs, 1389 kDontSaveFPRegs,
1392 EMIT_REMEMBERED_SET, 1390 EMIT_REMEMBERED_SET,
1393 OMIT_SMI_CHECK); 1391 OMIT_SMI_CHECK);
1394
1395 __ Ret(); 1392 __ Ret();
1396 } 1393 }
1397 1394
1398 1395
1399 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1396 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1400 StrictModeFlag strict_mode) { 1397 StrictModeFlag strict_mode) {
1401 // ----------- S t a t e ------------- 1398 // ----------- S t a t e -------------
1402 // -- r0 : value 1399 // -- r0 : value
1403 // -- r1 : receiver 1400 // -- r1 : receiver
1404 // -- r2 : name 1401 // -- r2 : name
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 Register reg = Assembler::GetRn(instr_at_patch); 1642 Register reg = Assembler::GetRn(instr_at_patch);
1646 patcher.masm()->tst(reg, Operand(kSmiTagMask)); 1643 patcher.masm()->tst(reg, Operand(kSmiTagMask));
1647 patcher.EmitCondition(eq); 1644 patcher.EmitCondition(eq);
1648 } 1645 }
1649 } 1646 }
1650 1647
1651 1648
1652 } } // namespace v8::internal 1649 } } // namespace v8::internal
1653 1650
1654 #endif // V8_TARGET_ARCH_ARM 1651 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/ic-ia32.cc » ('j') | src/ia32/ic-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698