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" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 } | 2156 } |
2157 | 2157 |
2158 | 2158 |
2159 void Assembler::LoadIsolate(Register dst) { | 2159 void Assembler::LoadIsolate(Register dst) { |
2160 movl(dst, Address(THR, Thread::isolate_offset())); | 2160 movl(dst, Address(THR, Thread::isolate_offset())); |
2161 } | 2161 } |
2162 | 2162 |
2163 | 2163 |
2164 void Assembler::LoadObject(Register dst, const Object& object) { | 2164 void Assembler::LoadObject(Register dst, const Object& object) { |
2165 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 2165 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 2166 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
2166 if (object.IsSmi() || object.InVMHeap()) { | 2167 if (object.IsSmi() || object.InVMHeap()) { |
2167 movl(dst, Immediate(reinterpret_cast<int32_t>(object.raw()))); | 2168 movl(dst, Immediate(reinterpret_cast<int32_t>(object.raw()))); |
2168 } else { | 2169 } else { |
2169 ASSERT(object.IsNotTemporaryScopedHandle()); | 2170 ASSERT(object.IsNotTemporaryScopedHandle()); |
2170 ASSERT(object.IsOld()); | 2171 ASSERT(object.IsOld()); |
2171 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2172 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
2172 EmitUint8(0xB8 + dst); | 2173 EmitUint8(0xB8 + dst); |
2173 buffer_.EmitObject(object); | 2174 buffer_.EmitObject(object); |
2174 } | 2175 } |
2175 } | 2176 } |
2176 | 2177 |
2177 | 2178 |
2178 void Assembler::LoadObjectSafely(Register dst, const Object& object) { | 2179 void Assembler::LoadObjectSafely(Register dst, const Object& object) { |
2179 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 2180 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 2181 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
2180 if (Assembler::IsSafe(object)) { | 2182 if (Assembler::IsSafe(object)) { |
2181 LoadObject(dst, object); | 2183 LoadObject(dst, object); |
2182 } else { | 2184 } else { |
2183 int32_t cookie = jit_cookie(); | 2185 int32_t cookie = jit_cookie(); |
2184 movl(dst, Immediate(reinterpret_cast<int32_t>(object.raw()) ^ cookie)); | 2186 movl(dst, Immediate(reinterpret_cast<int32_t>(object.raw()) ^ cookie)); |
2185 xorl(dst, Immediate(cookie)); | 2187 xorl(dst, Immediate(cookie)); |
2186 } | 2188 } |
2187 } | 2189 } |
2188 | 2190 |
2189 | 2191 |
2190 void Assembler::PushObject(const Object& object) { | 2192 void Assembler::PushObject(const Object& object) { |
2191 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 2193 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 2194 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
2192 if (object.IsSmi() || object.InVMHeap()) { | 2195 if (object.IsSmi() || object.InVMHeap()) { |
2193 pushl(Immediate(reinterpret_cast<int32_t>(object.raw()))); | 2196 pushl(Immediate(reinterpret_cast<int32_t>(object.raw()))); |
2194 } else { | 2197 } else { |
2195 ASSERT(object.IsNotTemporaryScopedHandle()); | 2198 ASSERT(object.IsNotTemporaryScopedHandle()); |
2196 ASSERT(object.IsOld()); | 2199 ASSERT(object.IsOld()); |
2197 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2200 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
2198 EmitUint8(0x68); | 2201 EmitUint8(0x68); |
2199 buffer_.EmitObject(object); | 2202 buffer_.EmitObject(object); |
2200 } | 2203 } |
2201 } | 2204 } |
2202 | 2205 |
2203 | 2206 |
2204 void Assembler::CompareObject(Register reg, const Object& object) { | 2207 void Assembler::CompareObject(Register reg, const Object& object) { |
2205 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); | 2208 ASSERT(!object.IsICData() || ICData::Cast(object).IsOriginal()); |
| 2209 ASSERT(!object.IsField() || Field::Cast(object).IsOriginal()); |
2206 if (object.IsSmi() || object.InVMHeap()) { | 2210 if (object.IsSmi() || object.InVMHeap()) { |
2207 cmpl(reg, Immediate(reinterpret_cast<int32_t>(object.raw()))); | 2211 cmpl(reg, Immediate(reinterpret_cast<int32_t>(object.raw()))); |
2208 } else { | 2212 } else { |
2209 ASSERT(object.IsNotTemporaryScopedHandle()); | 2213 ASSERT(object.IsNotTemporaryScopedHandle()); |
2210 ASSERT(object.IsOld()); | 2214 ASSERT(object.IsOld()); |
2211 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2215 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
2212 if (reg == EAX) { | 2216 if (reg == EAX) { |
2213 EmitUint8(0x05 + (7 << 3)); | 2217 EmitUint8(0x05 + (7 << 3)); |
2214 buffer_.EmitObject(object); | 2218 buffer_.EmitObject(object); |
2215 } else { | 2219 } else { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2395 Bind(&done); | 2399 Bind(&done); |
2396 popl(value); | 2400 popl(value); |
2397 #endif // defined(DEBUG) | 2401 #endif // defined(DEBUG) |
2398 // No store buffer update. | 2402 // No store buffer update. |
2399 } | 2403 } |
2400 | 2404 |
2401 | 2405 |
2402 void Assembler::UnverifiedStoreOldObject(const Address& dest, | 2406 void Assembler::UnverifiedStoreOldObject(const Address& dest, |
2403 const Object& value) { | 2407 const Object& value) { |
2404 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); | 2408 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); |
| 2409 ASSERT(!value.IsField() || Field::Cast(value).IsOriginal()); |
2405 ASSERT(value.IsOld()); | 2410 ASSERT(value.IsOld()); |
2406 ASSERT(!value.InVMHeap()); | 2411 ASSERT(!value.InVMHeap()); |
2407 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2412 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
2408 EmitUint8(0xC7); | 2413 EmitUint8(0xC7); |
2409 EmitOperand(0, dest); | 2414 EmitOperand(0, dest); |
2410 buffer_.EmitObject(value); | 2415 buffer_.EmitObject(value); |
2411 } | 2416 } |
2412 | 2417 |
2413 | 2418 |
2414 void Assembler::StoreIntoObjectNoBarrier(Register object, | 2419 void Assembler::StoreIntoObjectNoBarrier(Register object, |
2415 const Address& dest, | 2420 const Address& dest, |
2416 const Object& value, | 2421 const Object& value, |
2417 FieldContent old_content) { | 2422 FieldContent old_content) { |
2418 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); | 2423 ASSERT(!value.IsICData() || ICData::Cast(value).IsOriginal()); |
| 2424 ASSERT(!value.IsField() || Field::Cast(value).IsOriginal()); |
2419 VerifyHeapWord(dest, old_content); | 2425 VerifyHeapWord(dest, old_content); |
2420 if (value.IsSmi() || value.InVMHeap()) { | 2426 if (value.IsSmi() || value.InVMHeap()) { |
2421 Immediate imm_value(reinterpret_cast<int32_t>(value.raw())); | 2427 Immediate imm_value(reinterpret_cast<int32_t>(value.raw())); |
2422 movl(dest, imm_value); | 2428 movl(dest, imm_value); |
2423 if (VerifiedMemory::enabled()) { | 2429 if (VerifiedMemory::enabled()) { |
2424 Register temp = ECX; | 2430 Register temp = ECX; |
2425 pushl(temp); | 2431 pushl(temp); |
2426 leal(temp, dest); | 2432 leal(temp, dest); |
2427 movl(Address(temp, VerifiedMemory::offset()), imm_value); | 2433 movl(Address(temp, VerifiedMemory::offset()), imm_value); |
2428 popl(temp); | 2434 popl(temp); |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 | 3223 |
3218 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3224 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3219 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 3225 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
3220 return xmm_reg_names[reg]; | 3226 return xmm_reg_names[reg]; |
3221 } | 3227 } |
3222 | 3228 |
3223 | 3229 |
3224 } // namespace dart | 3230 } // namespace dart |
3225 | 3231 |
3226 #endif // defined TARGET_ARCH_IA32 | 3232 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |