| 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" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/simulator.h" | 9 #include "vm/simulator.h" |
| 10 #include "vm/runtime_entry.h" | 10 #include "vm/runtime_entry.h" |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 movt(rd, value_high); | 1255 movt(rd, value_high); |
| 1256 } | 1256 } |
| 1257 add(rd, PP, ShifterOperand(LR)); | 1257 add(rd, PP, ShifterOperand(LR)); |
| 1258 } | 1258 } |
| 1259 ldr(rd, Address(rd, offset_lo)); | 1259 ldr(rd, Address(rd, offset_lo)); |
| 1260 } | 1260 } |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 | 1263 |
| 1264 void Assembler::LoadObject(Register rd, const Object& object) { | 1264 void Assembler::LoadObject(Register rd, const Object& object) { |
| 1265 // Since objects in the VM heap are never relocated, test instead |
| 1266 // if (object.IsSmi() || object.InVMHeap()) { |
| 1267 // and modify the decoding code in CallPattern to understand movt, movw. |
| 1265 if (object.IsNull() || | 1268 if (object.IsNull() || |
| 1266 object.IsSmi() || | 1269 object.IsSmi() || |
| 1267 (object.raw() == Bool::True().raw()) || | 1270 (object.raw() == Bool::True().raw()) || |
| 1268 (object.raw() == Bool::False().raw())) { | 1271 (object.raw() == Bool::False().raw())) { |
| 1269 // This object is never relocated; do not use object pool. | 1272 // This object is never relocated; do not use object pool. |
| 1270 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); | 1273 LoadImmediate(rd, reinterpret_cast<int32_t>(object.raw())); |
| 1271 return; | 1274 return; |
| 1272 } | 1275 } |
| 1273 const int32_t offset = | 1276 const int32_t offset = |
| 1274 Array::data_offset() + 4*AddObject(object) - kHeapObjectTag; | 1277 Array::data_offset() + 4*AddObject(object) - kHeapObjectTag; |
| 1275 LoadWordFromPoolOffset(rd, offset); | 1278 LoadWordFromPoolOffset(rd, offset); |
| 1276 } | 1279 } |
| 1277 | 1280 |
| 1278 | 1281 |
| 1279 void Assembler::PushObject(const Object& object) { | 1282 void Assembler::PushObject(const Object& object) { |
| 1280 LoadObject(IP, object); | 1283 LoadObject(IP, object); |
| 1281 Push(IP); | 1284 Push(IP); |
| 1282 } | 1285 } |
| 1283 | 1286 |
| 1284 | 1287 |
| 1288 void Assembler::CompareObject(Register rn, const Object& object) { |
| 1289 ASSERT(rn != IP); |
| 1290 LoadObject(IP, object); |
| 1291 cmp(rn, ShifterOperand(IP)); |
| 1292 } |
| 1293 |
| 1294 |
| 1285 void Assembler::Bind(Label* label) { | 1295 void Assembler::Bind(Label* label) { |
| 1286 ASSERT(!label->IsBound()); | 1296 ASSERT(!label->IsBound()); |
| 1287 int bound_pc = buffer_.Size(); | 1297 int bound_pc = buffer_.Size(); |
| 1288 while (label->IsLinked()) { | 1298 while (label->IsLinked()) { |
| 1289 int32_t position = label->Position(); | 1299 int32_t position = label->Position(); |
| 1290 int32_t next = buffer_.Load<int32_t>(position); | 1300 int32_t next = buffer_.Load<int32_t>(position); |
| 1291 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); | 1301 int32_t encoded = Assembler::EncodeBranchOffset(bound_pc - position, next); |
| 1292 buffer_.Store<int32_t>(position, encoded); | 1302 buffer_.Store<int32_t>(position, encoded); |
| 1293 label->position_ = Assembler::DecodeBranchOffset(next); | 1303 label->position_ = Assembler::DecodeBranchOffset(next); |
| 1294 } | 1304 } |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1912 } | 1922 } |
| 1913 | 1923 |
| 1914 | 1924 |
| 1915 int Assembler::DecodeBranchOffset(int32_t inst) { | 1925 int Assembler::DecodeBranchOffset(int32_t inst) { |
| 1916 // Sign-extend, left-shift by 2, then add 8. | 1926 // Sign-extend, left-shift by 2, then add 8. |
| 1917 return ((((inst & kBranchOffsetMask) << 8) >> 6) + 8); | 1927 return ((((inst & kBranchOffsetMask) << 8) >> 6) + 8); |
| 1918 } | 1928 } |
| 1919 | 1929 |
| 1920 | 1930 |
| 1921 int32_t Assembler::AddObject(const Object& obj) { | 1931 int32_t Assembler::AddObject(const Object& obj) { |
| 1932 ASSERT(obj.IsNotTemporaryScopedHandle()); |
| 1933 ASSERT(obj.IsOld()); |
| 1922 if (object_pool_.IsNull()) { | 1934 if (object_pool_.IsNull()) { |
| 1923 // The object pool cannot be used in the vm isolate. | 1935 // The object pool cannot be used in the vm isolate. |
| 1924 ASSERT(Isolate::Current() != Dart::vm_isolate()); | 1936 ASSERT(Isolate::Current() != Dart::vm_isolate()); |
| 1925 object_pool_ = GrowableObjectArray::New(); | 1937 object_pool_ = GrowableObjectArray::New(); |
| 1926 } | 1938 } |
| 1927 for (int i = 0; i < object_pool_.Length(); i++) { | 1939 for (int i = 0; i < object_pool_.Length(); i++) { |
| 1928 if (object_pool_.At(i) == obj.raw()) { | 1940 if (object_pool_.At(i) == obj.raw()) { |
| 1929 return i; | 1941 return i; |
| 1930 } | 1942 } |
| 1931 } | 1943 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1947 // Do not reuse an existing entry, since each reference may be patched | 1959 // Do not reuse an existing entry, since each reference may be patched |
| 1948 // independently. | 1960 // independently. |
| 1949 object_pool_.Add(smi); | 1961 object_pool_.Add(smi); |
| 1950 return object_pool_.Length() - 1; | 1962 return object_pool_.Length() - 1; |
| 1951 } | 1963 } |
| 1952 | 1964 |
| 1953 } // namespace dart | 1965 } // namespace dart |
| 1954 | 1966 |
| 1955 #endif // defined TARGET_ARCH_ARM | 1967 #endif // defined TARGET_ARCH_ARM |
| 1956 | 1968 |
| OLD | NEW |