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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 11091068: Use immediate add when possible in space allocator (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | 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 // 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 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 reinterpret_cast<intptr_t>(new_space_allocation_top.address()); 1563 reinterpret_cast<intptr_t>(new_space_allocation_top.address());
1564 intptr_t limit = 1564 intptr_t limit =
1565 reinterpret_cast<intptr_t>(new_space_allocation_limit.address()); 1565 reinterpret_cast<intptr_t>(new_space_allocation_limit.address());
1566 ASSERT((limit - top) == kPointerSize); 1566 ASSERT((limit - top) == kPointerSize);
1567 ASSERT(result.code() < ip.code()); 1567 ASSERT(result.code() < ip.code());
1568 1568
1569 // Set up allocation top address and object size registers. 1569 // Set up allocation top address and object size registers.
1570 Register topaddr = scratch1; 1570 Register topaddr = scratch1;
1571 Register obj_size_reg = scratch2; 1571 Register obj_size_reg = scratch2;
1572 mov(topaddr, Operand(new_space_allocation_top)); 1572 mov(topaddr, Operand(new_space_allocation_top));
1573 mov(obj_size_reg, Operand(object_size)); 1573 Operand obj_size_operand = Operand(object_size);
1574 if (!obj_size_operand.is_single_instruction(this)) {
1575 // We are about to steal IP, so we need to load this value first
1576 mov(obj_size_reg, obj_size_operand);
1577 }
1574 1578
1575 // This code stores a temporary value in ip. This is OK, as the code below 1579 // This code stores a temporary value in ip. This is OK, as the code below
1576 // does not need ip for implicit literal generation. 1580 // does not need ip for implicit literal generation.
1577 if ((flags & RESULT_CONTAINS_TOP) == 0) { 1581 if ((flags & RESULT_CONTAINS_TOP) == 0) {
1578 // Load allocation top into result and allocation limit into ip. 1582 // Load allocation top into result and allocation limit into ip.
1579 ldm(ia, topaddr, result.bit() | ip.bit()); 1583 ldm(ia, topaddr, result.bit() | ip.bit());
1580 } else { 1584 } else {
1581 if (emit_debug_code()) { 1585 if (emit_debug_code()) {
1582 // Assert that result actually contains top on entry. ip is used 1586 // Assert that result actually contains top on entry. ip is used
1583 // immediately below so this use of ip does not cause difference with 1587 // immediately below so this use of ip does not cause difference with
1584 // respect to register content between debug and release mode. 1588 // respect to register content between debug and release mode.
1585 ldr(ip, MemOperand(topaddr)); 1589 ldr(ip, MemOperand(topaddr));
1586 cmp(result, ip); 1590 cmp(result, ip);
1587 Check(eq, "Unexpected allocation top"); 1591 Check(eq, "Unexpected allocation top");
1588 } 1592 }
1589 // Load allocation limit into ip. Result already contains allocation top. 1593 // Load allocation limit into ip. Result already contains allocation top.
1590 ldr(ip, MemOperand(topaddr, limit - top)); 1594 ldr(ip, MemOperand(topaddr, limit - top));
1591 } 1595 }
1592 1596
1593 // Calculate new top and bail out if new space is exhausted. Use result 1597 // Calculate new top and bail out if new space is exhausted. Use result
1594 // to calculate the new top. 1598 // to calculate the new top.
1595 add(scratch2, result, Operand(obj_size_reg), SetCC); 1599 if (obj_size_operand.is_single_instruction(this)) {
1600 // We can add the size as an immediate
1601 add(scratch2, result, obj_size_operand, SetCC);
1602 } else {
1603 // Doesn't fit in an immediate, we have to use the register
1604 add(scratch2, result, obj_size_reg, SetCC);
1605 }
1596 b(cs, gc_required); 1606 b(cs, gc_required);
1597 cmp(scratch2, Operand(ip)); 1607 cmp(scratch2, Operand(ip));
1598 b(hi, gc_required); 1608 b(hi, gc_required);
1599 str(scratch2, MemOperand(topaddr)); 1609 str(scratch2, MemOperand(topaddr));
1600 1610
1601 // Tag object if requested. 1611 // Tag object if requested.
1602 if ((flags & TAG_OBJECT) != 0) { 1612 if ((flags & TAG_OBJECT) != 0) {
1603 add(result, result, Operand(kHeapObjectTag)); 1613 add(result, result, Operand(kHeapObjectTag));
1604 } 1614 }
1605 } 1615 }
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
3854 void CodePatcher::EmitCondition(Condition cond) { 3864 void CodePatcher::EmitCondition(Condition cond) {
3855 Instr instr = Assembler::instr_at(masm_.pc_); 3865 Instr instr = Assembler::instr_at(masm_.pc_);
3856 instr = (instr & ~kCondMask) | cond; 3866 instr = (instr & ~kCondMask) | cond;
3857 masm_.emit(instr); 3867 masm_.emit(instr);
3858 } 3868 }
3859 3869
3860 3870
3861 } } // namespace v8::internal 3871 } } // namespace v8::internal
3862 3872
3863 #endif // V8_TARGET_ARCH_ARM 3873 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698