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

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

Issue 836593002: Deletion barrier: Distinguish+verify field initialization in ia32 generated code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('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" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 1711
1712 1712
1713 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate, 1713 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Isolate* isolate,
1714 bool opt) const { 1714 bool opt) const {
1715 const intptr_t kNumInputs = 2; 1715 const intptr_t kNumInputs = 2;
1716 const intptr_t kNumTemps = 1716 const intptr_t kNumTemps =
1717 (IsUnboxedStore() && opt) ? 2 : 1717 (IsUnboxedStore() && opt) ? 2 :
1718 ((IsPotentialUnboxedStore()) ? 3 : 0); 1718 ((IsPotentialUnboxedStore()) ? 3 : 0);
1719 LocationSummary* summary = new(isolate) LocationSummary( 1719 LocationSummary* summary = new(isolate) LocationSummary(
1720 isolate, kNumInputs, kNumTemps, 1720 isolate, kNumInputs, kNumTemps,
1721 ((IsUnboxedStore() && opt && is_initialization_) || 1721 ((IsUnboxedStore() && opt && is_potential_unboxed_initialization_) ||
1722 IsPotentialUnboxedStore()) 1722 IsPotentialUnboxedStore())
1723 ? LocationSummary::kCallOnSlowPath 1723 ? LocationSummary::kCallOnSlowPath
1724 : LocationSummary::kNoCall); 1724 : LocationSummary::kNoCall);
1725 1725
1726 summary->set_in(0, Location::RequiresRegister()); 1726 summary->set_in(0, Location::RequiresRegister());
1727 if (IsUnboxedStore() && opt) { 1727 if (IsUnboxedStore() && opt) {
1728 summary->set_in(1, Location::RequiresFpuRegister()); 1728 summary->set_in(1, Location::RequiresFpuRegister());
1729 summary->set_temp(0, Location::RequiresRegister()); 1729 summary->set_temp(0, Location::RequiresRegister());
1730 summary->set_temp(1, Location::RequiresRegister()); 1730 summary->set_temp(1, Location::RequiresRegister());
1731 } else if (IsPotentialUnboxedStore()) { 1731 } else if (IsPotentialUnboxedStore()) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 Label skip_store; 1772 Label skip_store;
1773 1773
1774 Register instance_reg = locs()->in(0).reg(); 1774 Register instance_reg = locs()->in(0).reg();
1775 1775
1776 if (IsUnboxedStore() && compiler->is_optimizing()) { 1776 if (IsUnboxedStore() && compiler->is_optimizing()) {
1777 XmmRegister value = locs()->in(1).fpu_reg(); 1777 XmmRegister value = locs()->in(1).fpu_reg();
1778 Register temp = locs()->temp(0).reg(); 1778 Register temp = locs()->temp(0).reg();
1779 Register temp2 = locs()->temp(1).reg(); 1779 Register temp2 = locs()->temp(1).reg();
1780 const intptr_t cid = field().UnboxedFieldCid(); 1780 const intptr_t cid = field().UnboxedFieldCid();
1781 1781
1782 if (is_initialization_) { 1782 if (is_potential_unboxed_initialization_) {
1783 const Class* cls = NULL; 1783 const Class* cls = NULL;
1784 switch (cid) { 1784 switch (cid) {
1785 case kDoubleCid: 1785 case kDoubleCid:
1786 cls = &compiler->double_class(); 1786 cls = &compiler->double_class();
1787 break; 1787 break;
1788 case kFloat32x4Cid: 1788 case kFloat32x4Cid:
1789 cls = &compiler->float32x4_class(); 1789 cls = &compiler->float32x4_class();
1790 break; 1790 break;
1791 case kFloat64x2Cid: 1791 case kFloat64x2Cid:
1792 cls = &compiler->float64x2_class(); 1792 cls = &compiler->float64x2_class();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 Register value_reg = locs()->in(1).reg(); 1920 Register value_reg = locs()->in(1).reg();
1921 __ StoreIntoObject(instance_reg, 1921 __ StoreIntoObject(instance_reg,
1922 FieldAddress(instance_reg, offset_in_bytes_), 1922 FieldAddress(instance_reg, offset_in_bytes_),
1923 value_reg, 1923 value_reg,
1924 CanValueBeSmi()); 1924 CanValueBeSmi());
1925 } else { 1925 } else {
1926 if (locs()->in(1).IsConstant()) { 1926 if (locs()->in(1).IsConstant()) {
1927 __ StoreIntoObjectNoBarrier( 1927 __ StoreIntoObjectNoBarrier(
1928 instance_reg, 1928 instance_reg,
1929 FieldAddress(instance_reg, offset_in_bytes_), 1929 FieldAddress(instance_reg, offset_in_bytes_),
1930 locs()->in(1).constant()); 1930 locs()->in(1).constant(),
1931 is_object_reference_initialization_ ?
1932 Assembler::kEmptyOrSmiOrNull :
1933 Assembler::kHeapObjectOrSmi);
1931 } else { 1934 } else {
1932 Register value_reg = locs()->in(1).reg(); 1935 Register value_reg = locs()->in(1).reg();
1933 __ StoreIntoObjectNoBarrier(instance_reg, 1936 __ StoreIntoObjectNoBarrier(instance_reg,
1934 FieldAddress(instance_reg, offset_in_bytes_), value_reg); 1937 FieldAddress(instance_reg, offset_in_bytes_),
1938 value_reg,
1939 is_object_reference_initialization_ ?
1940 Assembler::kEmptyOrSmiOrNull :
1941 Assembler::kHeapObjectOrSmi);
1935 } 1942 }
1936 } 1943 }
1937 __ Bind(&skip_store); 1944 __ Bind(&skip_store);
1938 } 1945 }
1939 1946
1940 1947
1941 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate, 1948 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate,
1942 bool opt) const { 1949 bool opt) const {
1943 const intptr_t kNumInputs = 1; 1950 const intptr_t kNumInputs = 1;
1944 const intptr_t kNumTemps = 0; 1951 const intptr_t kNumTemps = 0;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 const Register kElemTypeReg = ECX; 2050 const Register kElemTypeReg = ECX;
2044 const intptr_t instance_size = Array::InstanceSize(num_elements); 2051 const intptr_t instance_size = Array::InstanceSize(num_elements);
2045 2052
2046 // Instance in EAX. 2053 // Instance in EAX.
2047 // Object end address in EBX. 2054 // Object end address in EBX.
2048 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, 2055 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump,
2049 EAX, // instance 2056 EAX, // instance
2050 EBX); // end address 2057 EBX); // end address
2051 2058
2052 // Store the type argument field. 2059 // Store the type argument field.
2053 __ StoreIntoObjectNoBarrier(EAX, 2060 __ InitializeFieldNoBarrier(EAX,
2054 FieldAddress(EAX, Array::type_arguments_offset()), 2061 FieldAddress(EAX, Array::type_arguments_offset()),
2055 kElemTypeReg); 2062 kElemTypeReg);
2056 2063
2057 // Set the length field. 2064 // Set the length field.
2058 __ StoreIntoObjectNoBarrier(EAX, 2065 __ InitializeFieldNoBarrier(EAX,
2059 FieldAddress(EAX, Array::length_offset()), 2066 FieldAddress(EAX, Array::length_offset()),
2060 kLengthReg); 2067 kLengthReg);
2061 2068
2062 // Initialize all array elements to raw_null. 2069 // Initialize all array elements to raw_null.
2063 // EAX: new object start as a tagged pointer. 2070 // EAX: new object start as a tagged pointer.
2064 // EBX: new object end address. 2071 // EBX: new object end address.
2065 // EDI: iterator which initially points to the start of the variable 2072 // EDI: iterator which initially points to the start of the variable
2066 // data area to be initialized. 2073 // data area to be initialized.
2067 if (num_elements > 0) { 2074 if (num_elements > 0) {
2068 const intptr_t array_size = instance_size - sizeof(RawArray); 2075 const intptr_t array_size = instance_size - sizeof(RawArray);
2069 const Immediate& raw_null = 2076 const Immediate& raw_null =
2070 Immediate(reinterpret_cast<intptr_t>(Object::null())); 2077 Immediate(reinterpret_cast<intptr_t>(Object::null()));
2071 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray))); 2078 __ leal(EDI, FieldAddress(EAX, sizeof(RawArray)));
2072 if (array_size < (kInlineArraySize * kWordSize)) { 2079 if (array_size < (kInlineArraySize * kWordSize)) {
2073 intptr_t current_offset = 0; 2080 intptr_t current_offset = 0;
2074 __ movl(EBX, raw_null); 2081 __ movl(EBX, raw_null);
2075 while (current_offset < array_size) { 2082 while (current_offset < array_size) {
2076 __ StoreIntoObjectNoBarrier(EAX, Address(EDI, current_offset), EBX); 2083 __ InitializeFieldNoBarrier(EAX, Address(EDI, current_offset), EBX);
2077 current_offset += kWordSize; 2084 current_offset += kWordSize;
2078 } 2085 }
2079 } else { 2086 } else {
2080 Label init_loop; 2087 Label init_loop;
2081 __ Bind(&init_loop); 2088 __ Bind(&init_loop);
2082 __ StoreIntoObjectNoBarrier(EAX, Address(EDI, 0), Object::null_object()); 2089 __ InitializeFieldNoBarrier(EAX, Address(EDI, 0), Object::null_object());
2083 __ addl(EDI, Immediate(kWordSize)); 2090 __ addl(EDI, Immediate(kWordSize));
2084 __ cmpl(EDI, EBX); 2091 __ cmpl(EDI, EBX);
2085 __ j(BELOW, &init_loop, Assembler::kNearJump); 2092 __ j(BELOW, &init_loop, Assembler::kNearJump);
2086 } 2093 }
2087 } 2094 }
2088 __ jmp(done, Assembler::kNearJump); 2095 __ jmp(done, Assembler::kNearJump);
2089 } 2096 }
2090 2097
2091 2098
2092 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2099 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(...skipping 4715 matching lines...) Expand 10 before | Expand all | Expand 10 after
6808 #if defined(DEBUG) 6815 #if defined(DEBUG)
6809 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6816 __ movl(EDX, Immediate(kInvalidObjectPointer));
6810 #endif 6817 #endif
6811 } 6818 }
6812 6819
6813 } // namespace dart 6820 } // namespace dart
6814 6821
6815 #undef __ 6822 #undef __
6816 6823
6817 #endif // defined TARGET_ARCH_IA32 6824 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698