OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 // Size of movq(destination, src); | 156 // Size of movq(destination, src); |
157 return 10; | 157 return 10; |
158 } | 158 } |
159 | 159 |
160 | 160 |
161 void MacroAssembler::PushAddress(ExternalReference source) { | 161 void MacroAssembler::PushAddress(ExternalReference source) { |
162 int64_t address = reinterpret_cast<int64_t>(source.address()); | 162 int64_t address = reinterpret_cast<int64_t>(source.address()); |
163 if (is_int32(address) && !Serializer::enabled()) { | 163 if (is_int32(address) && !Serializer::enabled()) { |
164 if (emit_debug_code()) { | 164 if (emit_debug_code()) { |
165 movq(kScratchRegister, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 165 movq(kScratchRegister, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
166 } | 166 } |
167 push(Immediate(static_cast<int32_t>(address))); | 167 push(Immediate(static_cast<int32_t>(address))); |
168 return; | 168 return; |
169 } | 169 } |
170 LoadAddress(kScratchRegister, source); | 170 LoadAddress(kScratchRegister, source); |
171 push(kScratchRegister); | 171 push(kScratchRegister); |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { | 175 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 movq(scratch, ExternalReference::new_space_mask(isolate())); | 280 movq(scratch, ExternalReference::new_space_mask(isolate())); |
281 and_(scratch, object); | 281 and_(scratch, object); |
282 } | 282 } |
283 movq(kScratchRegister, ExternalReference::new_space_start(isolate())); | 283 movq(kScratchRegister, ExternalReference::new_space_start(isolate())); |
284 cmpq(scratch, kScratchRegister); | 284 cmpq(scratch, kScratchRegister); |
285 j(cc, branch, distance); | 285 j(cc, branch, distance); |
286 } else { | 286 } else { |
287 ASSERT(is_int32(static_cast<int64_t>(HEAP->NewSpaceMask()))); | 287 ASSERT(is_int32(static_cast<int64_t>(HEAP->NewSpaceMask()))); |
288 intptr_t new_space_start = | 288 intptr_t new_space_start = |
289 reinterpret_cast<intptr_t>(HEAP->NewSpaceStart()); | 289 reinterpret_cast<intptr_t>(HEAP->NewSpaceStart()); |
290 movq(kScratchRegister, -new_space_start, RelocInfo::NONE); | 290 movq(kScratchRegister, -new_space_start, RelocInfo::NONE64); |
291 if (scratch.is(object)) { | 291 if (scratch.is(object)) { |
292 addq(scratch, kScratchRegister); | 292 addq(scratch, kScratchRegister); |
293 } else { | 293 } else { |
294 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); | 294 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); |
295 } | 295 } |
296 and_(scratch, Immediate(static_cast<int32_t>(HEAP->NewSpaceMask()))); | 296 and_(scratch, Immediate(static_cast<int32_t>(HEAP->NewSpaceMask()))); |
297 j(cc, branch, distance); | 297 j(cc, branch, distance); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 335 } |
336 | 336 |
337 RecordWrite( | 337 RecordWrite( |
338 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); | 338 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); |
339 | 339 |
340 bind(&done); | 340 bind(&done); |
341 | 341 |
342 // Clobber clobbered input registers when running with the debug-code flag | 342 // Clobber clobbered input registers when running with the debug-code flag |
343 // turned on to provoke errors. | 343 // turned on to provoke errors. |
344 if (emit_debug_code()) { | 344 if (emit_debug_code()) { |
345 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 345 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
346 movq(dst, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 346 movq(dst, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 | 350 |
351 void MacroAssembler::RecordWriteArray(Register object, | 351 void MacroAssembler::RecordWriteArray(Register object, |
352 Register value, | 352 Register value, |
353 Register index, | 353 Register index, |
354 SaveFPRegsMode save_fp, | 354 SaveFPRegsMode save_fp, |
355 RememberedSetAction remembered_set_action, | 355 RememberedSetAction remembered_set_action, |
356 SmiCheck smi_check) { | 356 SmiCheck smi_check) { |
(...skipping 12 matching lines...) Expand all Loading... |
369 FixedArray::kHeaderSize - kHeapObjectTag)); | 369 FixedArray::kHeaderSize - kHeapObjectTag)); |
370 | 370 |
371 RecordWrite( | 371 RecordWrite( |
372 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); | 372 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); |
373 | 373 |
374 bind(&done); | 374 bind(&done); |
375 | 375 |
376 // Clobber clobbered input registers when running with the debug-code flag | 376 // Clobber clobbered input registers when running with the debug-code flag |
377 // turned on to provoke errors. | 377 // turned on to provoke errors. |
378 if (emit_debug_code()) { | 378 if (emit_debug_code()) { |
379 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 379 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
380 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 380 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
381 } | 381 } |
382 } | 382 } |
383 | 383 |
384 | 384 |
385 void MacroAssembler::RecordWrite(Register object, | 385 void MacroAssembler::RecordWrite(Register object, |
386 Register address, | 386 Register address, |
387 Register value, | 387 Register value, |
388 SaveFPRegsMode fp_mode, | 388 SaveFPRegsMode fp_mode, |
389 RememberedSetAction remembered_set_action, | 389 RememberedSetAction remembered_set_action, |
390 SmiCheck smi_check) { | 390 SmiCheck smi_check) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 Label::kNear); | 435 Label::kNear); |
436 | 436 |
437 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); | 437 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); |
438 CallStub(&stub); | 438 CallStub(&stub); |
439 | 439 |
440 bind(&done); | 440 bind(&done); |
441 | 441 |
442 // Clobber clobbered registers when running with the debug-code flag | 442 // Clobber clobbered registers when running with the debug-code flag |
443 // turned on to provoke errors. | 443 // turned on to provoke errors. |
444 if (emit_debug_code()) { | 444 if (emit_debug_code()) { |
445 movq(address, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 445 movq(address, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
446 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE); | 446 movq(value, BitCast<int64_t>(kZapValue), RelocInfo::NONE64); |
447 } | 447 } |
448 } | 448 } |
449 | 449 |
450 | 450 |
451 void MacroAssembler::Assert(Condition cc, const char* msg) { | 451 void MacroAssembler::Assert(Condition cc, const char* msg) { |
452 if (emit_debug_code()) Check(cc, msg); | 452 if (emit_debug_code()) Check(cc, msg); |
453 } | 453 } |
454 | 454 |
455 | 455 |
456 void MacroAssembler::AssertFastElements(Register elements) { | 456 void MacroAssembler::AssertFastElements(Register elements) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 517 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
518 // Note: p0 might not be a valid Smi _value_, but it has a valid Smi tag. | 518 // Note: p0 might not be a valid Smi _value_, but it has a valid Smi tag. |
519 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 519 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
520 #ifdef DEBUG | 520 #ifdef DEBUG |
521 if (msg != NULL) { | 521 if (msg != NULL) { |
522 RecordComment("Abort message: "); | 522 RecordComment("Abort message: "); |
523 RecordComment(msg); | 523 RecordComment(msg); |
524 } | 524 } |
525 #endif | 525 #endif |
526 push(rax); | 526 push(rax); |
527 movq(kScratchRegister, p0, RelocInfo::NONE); | 527 movq(kScratchRegister, p0, RelocInfo::NONE64); |
528 push(kScratchRegister); | 528 push(kScratchRegister); |
529 movq(kScratchRegister, | 529 movq(kScratchRegister, |
530 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(p1 - p0))), | 530 reinterpret_cast<intptr_t>(Smi::FromInt(static_cast<int>(p1 - p0))), |
531 RelocInfo::NONE); | 531 RelocInfo::NONE64); |
532 push(kScratchRegister); | 532 push(kScratchRegister); |
533 | 533 |
534 if (!has_frame_) { | 534 if (!has_frame_) { |
535 // We don't actually want to generate a pile of code for this, so just | 535 // We don't actually want to generate a pile of code for this, so just |
536 // claim there is a stack frame, without generating one. | 536 // claim there is a stack frame, without generating one. |
537 FrameScope scope(this, StackFrame::NONE); | 537 FrameScope scope(this, StackFrame::NONE); |
538 CallRuntime(Runtime::kAbort, 2); | 538 CallRuntime(Runtime::kAbort, 2); |
539 } else { | 539 } else { |
540 CallRuntime(Runtime::kAbort, 2); | 540 CallRuntime(Runtime::kAbort, 2); |
541 } | 541 } |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 | 930 |
931 | 931 |
932 void MacroAssembler::Set(Register dst, int64_t x) { | 932 void MacroAssembler::Set(Register dst, int64_t x) { |
933 if (x == 0) { | 933 if (x == 0) { |
934 xorl(dst, dst); | 934 xorl(dst, dst); |
935 } else if (is_uint32(x)) { | 935 } else if (is_uint32(x)) { |
936 movl(dst, Immediate(static_cast<uint32_t>(x))); | 936 movl(dst, Immediate(static_cast<uint32_t>(x))); |
937 } else if (is_int32(x)) { | 937 } else if (is_int32(x)) { |
938 movq(dst, Immediate(static_cast<int32_t>(x))); | 938 movq(dst, Immediate(static_cast<int32_t>(x))); |
939 } else { | 939 } else { |
940 movq(dst, x, RelocInfo::NONE); | 940 movq(dst, x, RelocInfo::NONE64); |
941 } | 941 } |
942 } | 942 } |
943 | 943 |
944 void MacroAssembler::Set(const Operand& dst, int64_t x) { | 944 void MacroAssembler::Set(const Operand& dst, int64_t x) { |
945 if (is_int32(x)) { | 945 if (is_int32(x)) { |
946 movq(dst, Immediate(static_cast<int32_t>(x))); | 946 movq(dst, Immediate(static_cast<int32_t>(x))); |
947 } else { | 947 } else { |
948 Set(kScratchRegister, x); | 948 Set(kScratchRegister, x); |
949 movq(dst, kScratchRegister); | 949 movq(dst, kScratchRegister); |
950 } | 950 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 return kSmiConstantRegister; | 995 return kSmiConstantRegister; |
996 } | 996 } |
997 LoadSmiConstant(kScratchRegister, source); | 997 LoadSmiConstant(kScratchRegister, source); |
998 return kScratchRegister; | 998 return kScratchRegister; |
999 } | 999 } |
1000 | 1000 |
1001 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { | 1001 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
1002 if (emit_debug_code()) { | 1002 if (emit_debug_code()) { |
1003 movq(dst, | 1003 movq(dst, |
1004 reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)), | 1004 reinterpret_cast<uint64_t>(Smi::FromInt(kSmiConstantRegisterValue)), |
1005 RelocInfo::NONE); | 1005 RelocInfo::NONE64); |
1006 cmpq(dst, kSmiConstantRegister); | 1006 cmpq(dst, kSmiConstantRegister); |
1007 if (allow_stub_calls()) { | 1007 if (allow_stub_calls()) { |
1008 Assert(equal, "Uninitialized kSmiConstantRegister"); | 1008 Assert(equal, "Uninitialized kSmiConstantRegister"); |
1009 } else { | 1009 } else { |
1010 Label ok; | 1010 Label ok; |
1011 j(equal, &ok, Label::kNear); | 1011 j(equal, &ok, Label::kNear); |
1012 int3(); | 1012 int3(); |
1013 bind(&ok); | 1013 bind(&ok); |
1014 } | 1014 } |
1015 } | 1015 } |
(...skipping 26 matching lines...) Expand all Loading... |
1042 case 2: | 1042 case 2: |
1043 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0)); | 1043 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0)); |
1044 break; | 1044 break; |
1045 case 1: | 1045 case 1: |
1046 movq(dst, kSmiConstantRegister); | 1046 movq(dst, kSmiConstantRegister); |
1047 break; | 1047 break; |
1048 case 0: | 1048 case 0: |
1049 UNREACHABLE(); | 1049 UNREACHABLE(); |
1050 return; | 1050 return; |
1051 default: | 1051 default: |
1052 movq(dst, reinterpret_cast<uint64_t>(source), RelocInfo::NONE); | 1052 movq(dst, reinterpret_cast<uint64_t>(source), RelocInfo::NONE64); |
1053 return; | 1053 return; |
1054 } | 1054 } |
1055 if (negative) { | 1055 if (negative) { |
1056 neg(dst); | 1056 neg(dst); |
1057 } | 1057 } |
1058 } | 1058 } |
1059 | 1059 |
1060 | 1060 |
1061 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { | 1061 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { |
1062 STATIC_ASSERT(kSmiTag == 0); | 1062 STATIC_ASSERT(kSmiTag == 0); |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2920 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; | 2920 static_cast<double>(static_cast<uint32_t>(0xFFFFFFFF)) + 1; |
2921 | 2921 |
2922 | 2922 |
2923 void MacroAssembler::LoadUint32(XMMRegister dst, | 2923 void MacroAssembler::LoadUint32(XMMRegister dst, |
2924 Register src, | 2924 Register src, |
2925 XMMRegister scratch) { | 2925 XMMRegister scratch) { |
2926 Label done; | 2926 Label done; |
2927 cmpl(src, Immediate(0)); | 2927 cmpl(src, Immediate(0)); |
2928 movq(kScratchRegister, | 2928 movq(kScratchRegister, |
2929 reinterpret_cast<int64_t>(&kUint32Bias), | 2929 reinterpret_cast<int64_t>(&kUint32Bias), |
2930 RelocInfo::NONE); | 2930 RelocInfo::NONE64); |
2931 movsd(scratch, Operand(kScratchRegister, 0)); | 2931 movsd(scratch, Operand(kScratchRegister, 0)); |
2932 cvtlsi2sd(dst, src); | 2932 cvtlsi2sd(dst, src); |
2933 j(not_sign, &done, Label::kNear); | 2933 j(not_sign, &done, Label::kNear); |
2934 addsd(dst, scratch); | 2934 addsd(dst, scratch); |
2935 bind(&done); | 2935 bind(&done); |
2936 } | 2936 } |
2937 | 2937 |
2938 | 2938 |
2939 void MacroAssembler::LoadInstanceDescriptors(Register map, | 2939 void MacroAssembler::LoadInstanceDescriptors(Register map, |
2940 Register descriptors) { | 2940 Register descriptors) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 if (emit_debug_code()) { | 3004 if (emit_debug_code()) { |
3005 Condition is_smi = CheckSmi(object); | 3005 Condition is_smi = CheckSmi(object); |
3006 Check(is_smi, "Operand is not a smi"); | 3006 Check(is_smi, "Operand is not a smi"); |
3007 } | 3007 } |
3008 } | 3008 } |
3009 | 3009 |
3010 | 3010 |
3011 void MacroAssembler::AssertZeroExtended(Register int32_register) { | 3011 void MacroAssembler::AssertZeroExtended(Register int32_register) { |
3012 if (emit_debug_code()) { | 3012 if (emit_debug_code()) { |
3013 ASSERT(!int32_register.is(kScratchRegister)); | 3013 ASSERT(!int32_register.is(kScratchRegister)); |
3014 movq(kScratchRegister, 0x100000000l, RelocInfo::NONE); | 3014 movq(kScratchRegister, 0x100000000l, RelocInfo::NONE64); |
3015 cmpq(kScratchRegister, int32_register); | 3015 cmpq(kScratchRegister, int32_register); |
3016 Check(above_equal, "32 bit value in register is not zero-extended"); | 3016 Check(above_equal, "32 bit value in register is not zero-extended"); |
3017 } | 3017 } |
3018 } | 3018 } |
3019 | 3019 |
3020 | 3020 |
3021 void MacroAssembler::AssertString(Register object) { | 3021 void MacroAssembler::AssertString(Register object) { |
3022 if (emit_debug_code()) { | 3022 if (emit_debug_code()) { |
3023 testb(object, Immediate(kSmiTagMask)); | 3023 testb(object, Immediate(kSmiTagMask)); |
3024 Check(not_equal, "Operand is a smi and not a string"); | 3024 Check(not_equal, "Operand is a smi and not a string"); |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4606 | 4606 |
4607 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); | 4607 movq(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); |
4608 cmpq(rcx, null_value); | 4608 cmpq(rcx, null_value); |
4609 j(not_equal, &next); | 4609 j(not_equal, &next); |
4610 } | 4610 } |
4611 | 4611 |
4612 | 4612 |
4613 } } // namespace v8::internal | 4613 } } // namespace v8::internal |
4614 | 4614 |
4615 #endif // V8_TARGET_ARCH_X64 | 4615 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |