OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 j(NegateCondition(is_valid), on_invalid); | 1242 j(NegateCondition(is_valid), on_invalid); |
1243 } | 1243 } |
1244 | 1244 |
1245 | 1245 |
1246 void MacroAssembler::JumpIfNotBothSmi(Register src1, Register src2, | 1246 void MacroAssembler::JumpIfNotBothSmi(Register src1, Register src2, |
1247 Label* on_not_both_smi) { | 1247 Label* on_not_both_smi) { |
1248 Condition both_smi = CheckBothSmi(src1, src2); | 1248 Condition both_smi = CheckBothSmi(src1, src2); |
1249 j(NegateCondition(both_smi), on_not_both_smi); | 1249 j(NegateCondition(both_smi), on_not_both_smi); |
1250 } | 1250 } |
1251 | 1251 |
1252 bool MacroAssembler::IsUnsafeSmi(Smi* value) { | |
1253 return false; | |
1254 } | |
1255 | |
1256 | |
1257 void MacroAssembler::LoadUnsafeSmi(Register dst, Smi* source) { | |
1258 UNIMPLEMENTED(); | |
1259 } | |
1260 | |
1261 | |
1262 void MacroAssembler::Move(Register dst, Smi* source) { | |
1263 if (IsUnsafeSmi(source)) { | |
1264 LoadUnsafeSmi(dst, source); | |
1265 } else { | |
1266 Set(dst, reinterpret_cast<int64_t>(source)); | |
1267 } | |
1268 } | |
1269 | |
1270 | |
1271 void MacroAssembler::Move(const Operand& dst, Smi* source) { | |
1272 if (IsUnsafeSmi(source)) { | |
1273 LoadUnsafeSmi(kScratchRegister, source); | |
1274 movq(dst, kScratchRegister); | |
1275 } else { | |
1276 Set(dst, reinterpret_cast<int64_t>(source)); | |
1277 } | |
1278 } | |
1279 | |
1280 | 1252 |
1281 void MacroAssembler::Move(Register dst, Handle<Object> source) { | 1253 void MacroAssembler::Move(Register dst, Handle<Object> source) { |
1282 ASSERT(!source->IsFailure()); | 1254 ASSERT(!source->IsFailure()); |
1283 if (source->IsSmi()) { | 1255 if (source->IsSmi()) { |
1284 Move(dst, Smi::cast(*source)); | 1256 Move(dst, Smi::cast(*source)); |
1285 } else { | 1257 } else { |
1286 movq(dst, source, RelocInfo::EMBEDDED_OBJECT); | 1258 movq(dst, source, RelocInfo::EMBEDDED_OBJECT); |
1287 } | 1259 } |
1288 } | 1260 } |
1289 | 1261 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 Push(Smi::cast(*source)); | 1297 Push(Smi::cast(*source)); |
1326 } else { | 1298 } else { |
1327 ASSERT(source->IsHeapObject()); | 1299 ASSERT(source->IsHeapObject()); |
1328 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); | 1300 movq(kScratchRegister, source, RelocInfo::EMBEDDED_OBJECT); |
1329 push(kScratchRegister); | 1301 push(kScratchRegister); |
1330 } | 1302 } |
1331 } | 1303 } |
1332 | 1304 |
1333 | 1305 |
1334 void MacroAssembler::Push(Smi* source) { | 1306 void MacroAssembler::Push(Smi* source) { |
1335 if (IsUnsafeSmi(source)) { | 1307 intptr_t smi = reinterpret_cast<intptr_t>(source); |
1336 LoadUnsafeSmi(kScratchRegister, source); | 1308 if (is_int32(smi)) { |
| 1309 push(Immediate(static_cast<int32_t>(smi))); |
| 1310 } else { |
| 1311 Set(kScratchRegister, smi); |
1337 push(kScratchRegister); | 1312 push(kScratchRegister); |
1338 } else { | |
1339 intptr_t smi = reinterpret_cast<intptr_t>(source); | |
1340 if (is_int32(smi)) { | |
1341 push(Immediate(static_cast<int32_t>(smi))); | |
1342 } else { | |
1343 Set(kScratchRegister, smi); | |
1344 push(kScratchRegister); | |
1345 } | |
1346 } | 1313 } |
1347 } | 1314 } |
1348 | 1315 |
1349 | 1316 |
1350 void MacroAssembler::Test(const Operand& src, Smi* source) { | 1317 void MacroAssembler::Test(const Operand& src, Smi* source) { |
1351 if (IsUnsafeSmi(source)) { | 1318 intptr_t smi = reinterpret_cast<intptr_t>(source); |
1352 LoadUnsafeSmi(kScratchRegister, source); | 1319 if (is_int32(smi)) { |
| 1320 testl(src, Immediate(static_cast<int32_t>(smi))); |
| 1321 } else { |
| 1322 Move(kScratchRegister, source); |
1353 testq(src, kScratchRegister); | 1323 testq(src, kScratchRegister); |
1354 } else { | |
1355 intptr_t smi = reinterpret_cast<intptr_t>(source); | |
1356 if (is_int32(smi)) { | |
1357 testl(src, Immediate(static_cast<int32_t>(smi))); | |
1358 } else { | |
1359 Move(kScratchRegister, source); | |
1360 testq(src, kScratchRegister); | |
1361 } | |
1362 } | 1324 } |
1363 } | 1325 } |
1364 | 1326 |
1365 | 1327 |
1366 void MacroAssembler::Jump(ExternalReference ext) { | 1328 void MacroAssembler::Jump(ExternalReference ext) { |
1367 movq(kScratchRegister, ext); | 1329 movq(kScratchRegister, ext); |
1368 jmp(kScratchRegister); | 1330 jmp(kScratchRegister); |
1369 } | 1331 } |
1370 | 1332 |
1371 | 1333 |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 CodePatcher::~CodePatcher() { | 2225 CodePatcher::~CodePatcher() { |
2264 // Indicate that code has changed. | 2226 // Indicate that code has changed. |
2265 CPU::FlushICache(address_, size_); | 2227 CPU::FlushICache(address_, size_); |
2266 | 2228 |
2267 // Check that the code was patched as expected. | 2229 // Check that the code was patched as expected. |
2268 ASSERT(masm_.pc_ == address_ + size_); | 2230 ASSERT(masm_.pc_ == address_ + size_); |
2269 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2231 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2270 } | 2232 } |
2271 | 2233 |
2272 } } // namespace v8::internal | 2234 } } // namespace v8::internal |
OLD | NEW |