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

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

Issue 38753007: JS allocations tracking for ia32 architecture (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « src/ia32/macro-assembler-ia32.h ('k') | 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 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 } 1574 }
1575 } 1575 }
1576 jmp(gc_required); 1576 jmp(gc_required);
1577 return; 1577 return;
1578 } 1578 }
1579 ASSERT(!result.is(result_end)); 1579 ASSERT(!result.is(result_end));
1580 1580
1581 // Load address of new object into result. 1581 // Load address of new object into result.
1582 LoadAllocationTopHelper(result, scratch, flags); 1582 LoadAllocationTopHelper(result, scratch, flags);
1583 1583
1584 if (isolate()->heap_profiler()->is_tracking_allocations()) {
1585 RecordObjectAllocation(isolate(), result, object_size, scratch);
1586 }
1587
1584 ExternalReference allocation_limit = 1588 ExternalReference allocation_limit =
1585 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 1589 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
1586 1590
1587 // Align the next allocation. Storing the filler map without checking top is 1591 // Align the next allocation. Storing the filler map without checking top is
1588 // safe in new-space because the limit of the heap is aligned there. 1592 // safe in new-space because the limit of the heap is aligned there.
1589 if ((flags & DOUBLE_ALIGNMENT) != 0) { 1593 if ((flags & DOUBLE_ALIGNMENT) != 0) {
1590 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); 1594 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
1591 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); 1595 ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
1592 Label aligned; 1596 Label aligned;
1593 test(result, Immediate(kDoubleAlignmentMask)); 1597 test(result, Immediate(kDoubleAlignmentMask));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 // Register element_count is not modified by the function. 1655 // Register element_count is not modified by the function.
1652 } 1656 }
1653 jmp(gc_required); 1657 jmp(gc_required);
1654 return; 1658 return;
1655 } 1659 }
1656 ASSERT(!result.is(result_end)); 1660 ASSERT(!result.is(result_end));
1657 1661
1658 // Load address of new object into result. 1662 // Load address of new object into result.
1659 LoadAllocationTopHelper(result, scratch, flags); 1663 LoadAllocationTopHelper(result, scratch, flags);
1660 1664
1665 if (isolate()->heap_profiler()->is_tracking_allocations()) {
1666 RecordObjectAllocation(isolate(),
1667 result,
1668 header_size,
1669 element_size,
1670 element_count,
1671 scratch);
1672 }
1673
1661 ExternalReference allocation_limit = 1674 ExternalReference allocation_limit =
1662 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 1675 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
1663 1676
1664 // Align the next allocation. Storing the filler map without checking top is 1677 // Align the next allocation. Storing the filler map without checking top is
1665 // safe in new-space because the limit of the heap is aligned there. 1678 // safe in new-space because the limit of the heap is aligned there.
1666 if ((flags & DOUBLE_ALIGNMENT) != 0) { 1679 if ((flags & DOUBLE_ALIGNMENT) != 0) {
1667 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); 1680 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
1668 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); 1681 ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
1669 Label aligned; 1682 Label aligned;
1670 test(result, Immediate(kDoubleAlignmentMask)); 1683 test(result, Immediate(kDoubleAlignmentMask));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 // object_size is left unchanged by this function. 1739 // object_size is left unchanged by this function.
1727 } 1740 }
1728 jmp(gc_required); 1741 jmp(gc_required);
1729 return; 1742 return;
1730 } 1743 }
1731 ASSERT(!result.is(result_end)); 1744 ASSERT(!result.is(result_end));
1732 1745
1733 // Load address of new object into result. 1746 // Load address of new object into result.
1734 LoadAllocationTopHelper(result, scratch, flags); 1747 LoadAllocationTopHelper(result, scratch, flags);
1735 1748
1749 if (isolate()->heap_profiler()->is_tracking_allocations()) {
1750 RecordObjectAllocation(isolate(), result, object_size, scratch);
1751 }
1752
1736 ExternalReference allocation_limit = 1753 ExternalReference allocation_limit =
1737 AllocationUtils::GetAllocationLimitReference(isolate(), flags); 1754 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
1738 1755
1739 // Align the next allocation. Storing the filler map without checking top is 1756 // Align the next allocation. Storing the filler map without checking top is
1740 // safe in new-space because the limit of the heap is aligned there. 1757 // safe in new-space because the limit of the heap is aligned there.
1741 if ((flags & DOUBLE_ALIGNMENT) != 0) { 1758 if ((flags & DOUBLE_ALIGNMENT) != 0) {
1742 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); 1759 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
1743 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); 1760 ASSERT(kPointerAlignment * 2 == kDoubleAlignment);
1744 Label aligned; 1761 Label aligned;
1745 test(result, Immediate(kDoubleAlignmentMask)); 1762 test(result, Immediate(kDoubleAlignmentMask));
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3543 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); 3560 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag));
3544 cmp(scratch_reg, Immediate(new_space_start)); 3561 cmp(scratch_reg, Immediate(new_space_start));
3545 j(less, no_memento_found); 3562 j(less, no_memento_found);
3546 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 3563 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3547 j(greater, no_memento_found); 3564 j(greater, no_memento_found);
3548 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), 3565 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize),
3549 Immediate(isolate()->factory()->allocation_memento_map())); 3566 Immediate(isolate()->factory()->allocation_memento_map()));
3550 } 3567 }
3551 3568
3552 3569
3570 void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
3571 Register object,
3572 Register object_size,
3573 Register scratch) {
3574 FrameScope frame(this, StackFrame::EXIT);
3575 PushSafepointRegisters();
3576 if (scratch.is_valid()) {
3577 PrepareCallCFunction(3, scratch);
3578 } else {
3579 PrepareCallCFunction(3, eax);
3580 }
3581 mov(Operand(esp, 0 * kPointerSize),
3582 Immediate(ExternalReference::isolate_address(isolate)));
3583 mov(Operand(esp, 1 * kPointerSize), object);
3584 mov(Operand(esp, 2 * kPointerSize), object_size);
3585 CallCFunction(
3586 ExternalReference::record_object_allocation_function(isolate), 3);
3587 PopSafepointRegisters();
3588 }
3589
3590
3591 void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
3592 Register object,
3593 int object_size,
3594 Register scratch) {
3595 FrameScope frame(this, StackFrame::EXIT);
3596 PushSafepointRegisters();
3597 if (scratch.is_valid()) {
3598 PrepareCallCFunction(3, scratch);
3599 } else {
3600 PrepareCallCFunction(3, eax);
3601 }
3602 mov(Operand(esp, 0 * kPointerSize),
3603 Immediate(ExternalReference::isolate_address(isolate)));
3604 mov(Operand(esp, 1 * kPointerSize), object);
3605 mov(Operand(esp, 2 * kPointerSize), Immediate(object_size));
3606 CallCFunction(
3607 ExternalReference::record_object_allocation_function(isolate), 3);
3608 PopSafepointRegisters();
3609 }
3610
3611
3612 void MacroAssembler::RecordObjectAllocation(Isolate* isolate,
3613 Register object,
3614 int header_size,
3615 ScaleFactor element_size,
3616 Register element_count,
3617 Register scratch) {
3618 FrameScope frame(this, StackFrame::EXIT);
3619 PushSafepointRegisters();
3620 if (scratch.is_valid()) {
3621 PrepareCallCFunction(3, scratch);
3622 } else {
3623 PrepareCallCFunction(3, eax);
3624 }
3625 mov(Operand(esp, 0 * kPointerSize),
3626 Immediate(ExternalReference::isolate_address(isolate)));
3627 mov(Operand(esp, 1 * kPointerSize), object);
3628 shl(element_count, element_size);
3629 add(element_count, Immediate(header_size));
3630 mov(Operand(esp, 2 * kPointerSize), element_count);
3631 CallCFunction(
3632 ExternalReference::record_object_allocation_function(isolate), 3);
3633 PopSafepointRegisters();
3634 }
3635
3636
3553 } } // namespace v8::internal 3637 } } // namespace v8::internal
3554 3638
3555 #endif // V8_TARGET_ARCH_IA32 3639 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698