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

Side by Side Diff: runtime/vm/assembler_ia32.cc

Issue 12263010: Optimize stores to ExternalUint8Array and ExternalUint8ClampedArray in the optimizer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/assembler_ia32.h ('k') | runtime/vm/assembler_x64.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/heap.h" 10 #include "vm/heap.h"
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 andl(value, Immediate(kObjectAlignment - 1)); 1618 andl(value, Immediate(kObjectAlignment - 1));
1619 // Compare with the expected bit pattern. 1619 // Compare with the expected bit pattern.
1620 cmpl(value, Immediate( 1620 cmpl(value, Immediate(
1621 (kNewObjectAlignmentOffset >> 1) + kHeapObjectTag + 1621 (kNewObjectAlignmentOffset >> 1) + kHeapObjectTag +
1622 kOldObjectAlignmentOffset + kHeapObjectTag)); 1622 kOldObjectAlignmentOffset + kHeapObjectTag));
1623 j(NOT_ZERO, no_update, Assembler::kNearJump); 1623 j(NOT_ZERO, no_update, Assembler::kNearJump);
1624 } 1624 }
1625 1625
1626 1626
1627 void Assembler::StoreIntoObject(Register object, 1627 void Assembler::StoreIntoObject(Register object,
1628 const FieldAddress& dest, 1628 const Address& dest,
1629 Register value) { 1629 Register value) {
1630 ASSERT(object != value); 1630 ASSERT(object != value);
1631 TraceStoreIntoObject(object, dest, value); 1631 TraceStoreIntoObject(object, dest, value);
1632 movl(dest, value); 1632 movl(dest, value);
1633 Label done; 1633 Label done;
1634 StoreIntoObjectFilter(object, value, &done); 1634 StoreIntoObjectFilter(object, value, &done);
1635 // A store buffer update is required. 1635 // A store buffer update is required.
1636 if (value != EAX) pushl(EAX); // Preserve EAX. 1636 if (value != EAX) pushl(EAX); // Preserve EAX.
1637 leal(EAX, dest); 1637 leal(EAX, dest);
1638 call(&StubCode::UpdateStoreBufferLabel()); 1638 call(&StubCode::UpdateStoreBufferLabel());
1639 if (value != EAX) popl(EAX); // Restore EAX. 1639 if (value != EAX) popl(EAX); // Restore EAX.
1640 Bind(&done); 1640 Bind(&done);
1641 } 1641 }
1642 1642
1643 1643
1644 void Assembler::StoreIntoObjectNoBarrier(Register object, 1644 void Assembler::StoreIntoObjectNoBarrier(Register object,
1645 const FieldAddress& dest, 1645 const Address& dest,
1646 Register value) { 1646 Register value) {
1647 TraceStoreIntoObject(object, dest, value); 1647 TraceStoreIntoObject(object, dest, value);
1648 movl(dest, value); 1648 movl(dest, value);
1649 #if defined(DEBUG) 1649 #if defined(DEBUG)
1650 Label done; 1650 Label done;
1651 pushl(value); 1651 pushl(value);
1652 StoreIntoObjectFilter(object, value, &done); 1652 StoreIntoObjectFilter(object, value, &done);
1653 Stop("Store buffer update is required"); 1653 Stop("Store buffer update is required");
1654 Bind(&done); 1654 Bind(&done);
1655 popl(value); 1655 popl(value);
1656 #endif // defined(DEBUG) 1656 #endif // defined(DEBUG)
1657 // No store buffer update. 1657 // No store buffer update.
1658 } 1658 }
1659 1659
1660 1660
1661 void Assembler::StoreIntoObjectNoBarrier(Register object, 1661 void Assembler::StoreIntoObjectNoBarrier(Register object,
1662 const FieldAddress& dest, 1662 const Address& dest,
1663 const Object& value) { 1663 const Object& value) {
1664 if (value.IsSmi() || value.InVMHeap()) { 1664 if (value.IsSmi() || value.InVMHeap()) {
1665 movl(dest, Immediate(reinterpret_cast<int32_t>(value.raw()))); 1665 movl(dest, Immediate(reinterpret_cast<int32_t>(value.raw())));
1666 } else { 1666 } else {
1667 // No heap trace for an old object store. 1667 // No heap trace for an old object store.
1668 ASSERT(value.IsOld()); 1668 ASSERT(value.IsOld());
1669 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1669 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1670 EmitUint8(0xC7); 1670 EmitUint8(0xC7);
1671 EmitOperand(0, dest); 1671 EmitOperand(0, dest);
1672 buffer_.EmitObject(value); 1672 buffer_.EmitObject(value);
1673 } 1673 }
1674 // No store buffer update. 1674 // No store buffer update.
1675 } 1675 }
1676 1676
1677 1677
1678 void Assembler::TraceStoreIntoObject(Register object, 1678 void Assembler::TraceStoreIntoObject(Register object,
1679 const FieldAddress& dest, 1679 const Address& dest,
1680 Register value) { 1680 Register value) {
1681 if (HeapTrace::is_enabled()) { 1681 if (HeapTrace::is_enabled()) {
1682 pushal(); 1682 pushal();
1683 EnterCallRuntimeFrame(3 * kWordSize); 1683 EnterCallRuntimeFrame(3 * kWordSize);
1684 movl(Address(ESP, 0 * kWordSize), object); 1684 movl(Address(ESP, 0 * kWordSize), object);
1685 leal(EAX, dest); 1685 leal(EAX, dest);
1686 movl(Address(ESP, 1 * kWordSize), EAX); 1686 movl(Address(ESP, 1 * kWordSize), EAX);
1687 movl(Address(ESP, 2 * kWordSize), value); 1687 movl(Address(ESP, 2 * kWordSize), value);
1688 CallRuntime(kHeapTraceStoreRuntimeEntry); 1688 CallRuntime(kHeapTraceStoreRuntimeEntry);
1689 LeaveCallRuntimeFrame(); 1689 LeaveCallRuntimeFrame();
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 2068
2069 const char* Assembler::FpuRegisterName(FpuRegister reg) { 2069 const char* Assembler::FpuRegisterName(FpuRegister reg) {
2070 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2070 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
2071 return xmm_reg_names[reg]; 2071 return xmm_reg_names[reg];
2072 } 2072 }
2073 2073
2074 2074
2075 } // namespace dart 2075 } // namespace dart
2076 2076
2077 #endif // defined TARGET_ARCH_IA32 2077 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/assembler_ia32.h ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698