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

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

Issue 23454032: - Tighten assertions in the X64 assembler related to object pool usage. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « no previous file | runtime/vm/dart_api_impl_test.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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after
2200 } 2200 }
2201 // If the call is patchable, do not reuse an existing entry since each 2201 // If the call is patchable, do not reuse an existing entry since each
2202 // reference may be patched independently. 2202 // reference may be patched independently.
2203 object_pool_.Add(smi, Heap::kOld); 2203 object_pool_.Add(smi, Heap::kOld);
2204 patchable_pool_entries_.Add(patchable); 2204 patchable_pool_entries_.Add(patchable);
2205 return object_pool_.Length() - 1; 2205 return object_pool_.Length() - 1;
2206 } 2206 }
2207 2207
2208 2208
2209 bool Assembler::CanLoadFromObjectPool(const Object& object) { 2209 bool Assembler::CanLoadFromObjectPool(const Object& object) {
2210 return !object.IsSmi() && // Not a Smi 2210 // TODO(zra, kmillikin): Move the use of large Smis into the constant pool.
2211 if (object.IsSmi()) {
2212 return false;
2213 }
2214 ASSERT(object.IsNotTemporaryScopedHandle());
2215 ASSERT(object.IsOld());
2216 return (Isolate::Current() != Dart::vm_isolate()) &&
2211 // Not in the VMHeap, OR is one of the VMHeap objects we put in every 2217 // Not in the VMHeap, OR is one of the VMHeap objects we put in every
2212 // object pool. 2218 // object pool.
2219 // TODO(zra): Evaluate putting all VM heap objects into the pool.
2213 (!object.InVMHeap() || (object.raw() == Object::null()) || 2220 (!object.InVMHeap() || (object.raw() == Object::null()) ||
2214 (object.raw() == Bool::True().raw()) || 2221 (object.raw() == Bool::True().raw()) ||
2215 (object.raw() == Bool::False().raw())) && 2222 (object.raw() == Bool::False().raw()));
2216 object.IsNotTemporaryScopedHandle() &&
2217 object.IsOld();
2218 } 2223 }
2219 2224
2220 2225
2221 void Assembler::LoadWordFromPoolOffset(Register dst, Register pp, 2226 void Assembler::LoadWordFromPoolOffset(Register dst, Register pp,
2222 int32_t offset) { 2227 int32_t offset) {
2223 // This sequence must be of fixed size. AddressBaseImm32 2228 // This sequence must be of fixed size. AddressBaseImm32
2224 // forces the address operand to use a fixed-size imm32 encoding. 2229 // forces the address operand to use a fixed-size imm32 encoding.
2225 movq(dst, Address::AddressBaseImm32(pp, offset)); 2230 movq(dst, Address::AddressBaseImm32(pp, offset));
2226 } 2231 }
2227 2232
2228 2233
2229 void Assembler::LoadObject(Register dst, const Object& object, Register pp) { 2234 void Assembler::LoadObject(Register dst, const Object& object, Register pp) {
2230 if (CanLoadFromObjectPool(object)) { 2235 if (CanLoadFromObjectPool(object)) {
2231 const int32_t offset = 2236 const int32_t offset =
2232 Array::element_offset(FindObject(object, kNotPatchable)); 2237 Array::element_offset(FindObject(object, kNotPatchable));
2233 LoadWordFromPoolOffset(dst, pp, offset - kHeapObjectTag); 2238 LoadWordFromPoolOffset(dst, pp, offset - kHeapObjectTag);
2234 } else { 2239 } else {
2240 ASSERT((Isolate::Current() == Dart::vm_isolate()) ||
2241 object.IsSmi() ||
2242 object.InVMHeap());
2235 movq(dst, Immediate(reinterpret_cast<int64_t>(object.raw()))); 2243 movq(dst, Immediate(reinterpret_cast<int64_t>(object.raw())));
2236 } 2244 }
2237 } 2245 }
2238 2246
2239 2247
2240 void Assembler::StoreObject(const Address& dst, const Object& object) { 2248 void Assembler::StoreObject(const Address& dst, const Object& object) {
2241 if (CanLoadFromObjectPool(object)) { 2249 if (CanLoadFromObjectPool(object)) {
2242 LoadObject(TMP, object, PP); 2250 LoadObject(TMP, object, PP);
2243 movq(dst, TMP); 2251 movq(dst, TMP);
2244 } else { 2252 } else {
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2853 2861
2854 2862
2855 const char* Assembler::FpuRegisterName(FpuRegister reg) { 2863 const char* Assembler::FpuRegisterName(FpuRegister reg) {
2856 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); 2864 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters));
2857 return xmm_reg_names[reg]; 2865 return xmm_reg_names[reg];
2858 } 2866 }
2859 2867
2860 } // namespace dart 2868 } // namespace dart
2861 2869
2862 #endif // defined TARGET_ARCH_X64 2870 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698