| OLD | NEW |
| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 if (ShouldEmitStoreBarrier()) { | 1921 if (ShouldEmitStoreBarrier()) { |
| 1922 Register value_reg = locs()->in(1).reg(); | 1922 Register value_reg = locs()->in(1).reg(); |
| 1923 __ StoreIntoObject(instance_reg, | 1923 __ StoreIntoObject(instance_reg, |
| 1924 FieldAddress(instance_reg, offset_in_bytes_), | 1924 FieldAddress(instance_reg, offset_in_bytes_), |
| 1925 value_reg, | 1925 value_reg, |
| 1926 CanValueBeSmi()); | 1926 CanValueBeSmi()); |
| 1927 } else { | 1927 } else { |
| 1928 if (locs()->in(1).IsConstant()) { | 1928 if (locs()->in(1).IsConstant()) { |
| 1929 __ StoreIntoObjectNoBarrier(instance_reg, | 1929 __ StoreIntoObjectNoBarrier(instance_reg, |
| 1930 FieldAddress(instance_reg, offset_in_bytes_), | 1930 FieldAddress(instance_reg, offset_in_bytes_), |
| 1931 locs()->in(1).constant(), PP); | 1931 locs()->in(1).constant(), |
| 1932 PP, |
| 1933 is_object_reference_initialization_ ? |
| 1934 Assembler::kEmptyOrSmiOrNull : |
| 1935 Assembler::kHeapObjectOrSmi); |
| 1932 } else { | 1936 } else { |
| 1933 Register value_reg = locs()->in(1).reg(); | 1937 Register value_reg = locs()->in(1).reg(); |
| 1934 __ StoreIntoObjectNoBarrier(instance_reg, | 1938 __ StoreIntoObjectNoBarrier(instance_reg, |
| 1935 FieldAddress(instance_reg, offset_in_bytes_), value_reg); | 1939 FieldAddress(instance_reg, offset_in_bytes_), |
| 1940 value_reg, |
| 1941 is_object_reference_initialization_ ? |
| 1942 Assembler::kEmptyOrSmiOrNull : |
| 1943 Assembler::kHeapObjectOrSmi); |
| 1936 } | 1944 } |
| 1937 } | 1945 } |
| 1938 __ Bind(&skip_store); | 1946 __ Bind(&skip_store); |
| 1939 } | 1947 } |
| 1940 | 1948 |
| 1941 | 1949 |
| 1942 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate, | 1950 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Isolate* isolate, |
| 1943 bool opt) const { | 1951 bool opt) const { |
| 1944 const intptr_t kNumInputs = 1; | 1952 const intptr_t kNumInputs = 1; |
| 1945 const intptr_t kNumTemps = 0; | 1953 const intptr_t kNumTemps = 0; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 const Register kLengthReg = R10; | 2049 const Register kLengthReg = R10; |
| 2042 const Register kElemTypeReg = RBX; | 2050 const Register kElemTypeReg = RBX; |
| 2043 const intptr_t instance_size = Array::InstanceSize(num_elements); | 2051 const intptr_t instance_size = Array::InstanceSize(num_elements); |
| 2044 | 2052 |
| 2045 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, | 2053 __ TryAllocateArray(kArrayCid, instance_size, slow_path, Assembler::kFarJump, |
| 2046 RAX, // instance | 2054 RAX, // instance |
| 2047 RCX); // end address | 2055 RCX); // end address |
| 2048 | 2056 |
| 2049 // RAX: new object start as a tagged pointer. | 2057 // RAX: new object start as a tagged pointer. |
| 2050 // Store the type argument field. | 2058 // Store the type argument field. |
| 2051 __ StoreIntoObjectNoBarrier(RAX, | 2059 __ InitializeFieldNoBarrier(RAX, |
| 2052 FieldAddress(RAX, Array::type_arguments_offset()), | 2060 FieldAddress(RAX, Array::type_arguments_offset()), |
| 2053 kElemTypeReg); | 2061 kElemTypeReg); |
| 2054 | 2062 |
| 2055 // Set the length field. | 2063 // Set the length field. |
| 2056 __ StoreIntoObjectNoBarrier(RAX, | 2064 __ InitializeFieldNoBarrier(RAX, |
| 2057 FieldAddress(RAX, Array::length_offset()), | 2065 FieldAddress(RAX, Array::length_offset()), |
| 2058 kLengthReg); | 2066 kLengthReg); |
| 2059 | 2067 |
| 2060 // Initialize all array elements to raw_null. | 2068 // Initialize all array elements to raw_null. |
| 2061 // RAX: new object start as a tagged pointer. | 2069 // RAX: new object start as a tagged pointer. |
| 2062 // RCX: new object end address. | 2070 // RCX: new object end address. |
| 2063 // RDI: iterator which initially points to the start of the variable | 2071 // RDI: iterator which initially points to the start of the variable |
| 2064 // data area to be initialized. | 2072 // data area to be initialized. |
| 2065 if (num_elements > 0) { | 2073 if (num_elements > 0) { |
| 2066 const intptr_t array_size = instance_size - sizeof(RawArray); | 2074 const intptr_t array_size = instance_size - sizeof(RawArray); |
| 2067 __ LoadObject(R12, Object::null_object(), PP); | 2075 __ LoadObject(R12, Object::null_object(), PP); |
| 2068 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); | 2076 __ leaq(RDI, FieldAddress(RAX, sizeof(RawArray))); |
| 2069 if (array_size < (kInlineArraySize * kWordSize)) { | 2077 if (array_size < (kInlineArraySize * kWordSize)) { |
| 2070 intptr_t current_offset = 0; | 2078 intptr_t current_offset = 0; |
| 2071 while (current_offset < array_size) { | 2079 while (current_offset < array_size) { |
| 2072 __ StoreIntoObjectNoBarrier(RAX, Address(RDI, current_offset), R12); | 2080 __ InitializeFieldNoBarrier(RAX, Address(RDI, current_offset), R12); |
| 2073 current_offset += kWordSize; | 2081 current_offset += kWordSize; |
| 2074 } | 2082 } |
| 2075 } else { | 2083 } else { |
| 2076 Label init_loop; | 2084 Label init_loop; |
| 2077 __ Bind(&init_loop); | 2085 __ Bind(&init_loop); |
| 2078 __ StoreIntoObjectNoBarrier(RAX, Address(RDI, 0), R12); | 2086 __ InitializeFieldNoBarrier(RAX, Address(RDI, 0), R12); |
| 2079 __ addq(RDI, Immediate(kWordSize)); | 2087 __ addq(RDI, Immediate(kWordSize)); |
| 2080 __ cmpq(RDI, RCX); | 2088 __ cmpq(RDI, RCX); |
| 2081 __ j(BELOW, &init_loop, Assembler::kNearJump); | 2089 __ j(BELOW, &init_loop, Assembler::kNearJump); |
| 2082 } | 2090 } |
| 2083 } | 2091 } |
| 2084 __ jmp(done, Assembler::kNearJump); | 2092 __ jmp(done, Assembler::kNearJump); |
| 2085 } | 2093 } |
| 2086 | 2094 |
| 2087 | 2095 |
| 2088 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2096 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6402 __ movq(R10, Immediate(kInvalidObjectPointer)); | 6410 __ movq(R10, Immediate(kInvalidObjectPointer)); |
| 6403 __ movq(RBX, Immediate(kInvalidObjectPointer)); | 6411 __ movq(RBX, Immediate(kInvalidObjectPointer)); |
| 6404 #endif | 6412 #endif |
| 6405 } | 6413 } |
| 6406 | 6414 |
| 6407 } // namespace dart | 6415 } // namespace dart |
| 6408 | 6416 |
| 6409 #undef __ | 6417 #undef __ |
| 6410 | 6418 |
| 6411 #endif // defined TARGET_ARCH_X64 | 6419 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |