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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 156 } |
157 // Size of movp(destination, src); | 157 // Size of movp(destination, src); |
158 return Assembler::kMoveAddressIntoScratchRegisterInstructionLength; | 158 return Assembler::kMoveAddressIntoScratchRegisterInstructionLength; |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 void MacroAssembler::PushAddress(ExternalReference source) { | 162 void MacroAssembler::PushAddress(ExternalReference source) { |
163 int64_t address = reinterpret_cast<int64_t>(source.address()); | 163 int64_t address = reinterpret_cast<int64_t>(source.address()); |
164 if (is_int32(address) && !Serializer::enabled()) { | 164 if (is_int32(address) && !Serializer::enabled()) { |
165 if (emit_debug_code()) { | 165 if (emit_debug_code()) { |
166 Move(kScratchRegister, kZapValue, RelocInfo::NONE64); | 166 Move(kScratchRegister, kZapValue, Assembler::RelocInfoNone()); |
167 } | 167 } |
168 push(Immediate(static_cast<int32_t>(address))); | 168 push(Immediate(static_cast<int32_t>(address))); |
169 return; | 169 return; |
170 } | 170 } |
171 LoadAddress(kScratchRegister, source); | 171 LoadAddress(kScratchRegister, source); |
172 push(kScratchRegister); | 172 push(kScratchRegister); |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { | 176 void MacroAssembler::LoadRoot(Register destination, Heap::RootListIndex index) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 and_(scratch, object); | 282 and_(scratch, object); |
283 } | 283 } |
284 Move(kScratchRegister, ExternalReference::new_space_start(isolate())); | 284 Move(kScratchRegister, ExternalReference::new_space_start(isolate())); |
285 cmpq(scratch, kScratchRegister); | 285 cmpq(scratch, kScratchRegister); |
286 j(cc, branch, distance); | 286 j(cc, branch, distance); |
287 } else { | 287 } else { |
288 ASSERT(is_int32(static_cast<int64_t>(isolate()->heap()->NewSpaceMask()))); | 288 ASSERT(is_int32(static_cast<int64_t>(isolate()->heap()->NewSpaceMask()))); |
289 intptr_t new_space_start = | 289 intptr_t new_space_start = |
290 reinterpret_cast<intptr_t>(isolate()->heap()->NewSpaceStart()); | 290 reinterpret_cast<intptr_t>(isolate()->heap()->NewSpaceStart()); |
291 Move(kScratchRegister, reinterpret_cast<Address>(-new_space_start), | 291 Move(kScratchRegister, reinterpret_cast<Address>(-new_space_start), |
292 RelocInfo::NONE64); | 292 Assembler::RelocInfoNone()); |
293 if (scratch.is(object)) { | 293 if (scratch.is(object)) { |
294 addq(scratch, kScratchRegister); | 294 addq(scratch, kScratchRegister); |
295 } else { | 295 } else { |
296 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); | 296 lea(scratch, Operand(object, kScratchRegister, times_1, 0)); |
297 } | 297 } |
298 and_(scratch, | 298 and_(scratch, |
299 Immediate(static_cast<int32_t>(isolate()->heap()->NewSpaceMask()))); | 299 Immediate(static_cast<int32_t>(isolate()->heap()->NewSpaceMask()))); |
300 j(cc, branch, distance); | 300 j(cc, branch, distance); |
301 } | 301 } |
302 } | 302 } |
(...skipping 30 matching lines...) Expand all Loading... |
333 } | 333 } |
334 | 334 |
335 RecordWrite( | 335 RecordWrite( |
336 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); | 336 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); |
337 | 337 |
338 bind(&done); | 338 bind(&done); |
339 | 339 |
340 // Clobber clobbered input registers when running with the debug-code flag | 340 // Clobber clobbered input registers when running with the debug-code flag |
341 // turned on to provoke errors. | 341 // turned on to provoke errors. |
342 if (emit_debug_code()) { | 342 if (emit_debug_code()) { |
343 Move(value, kZapValue, RelocInfo::NONE64); | 343 Move(value, kZapValue, Assembler::RelocInfoNone()); |
344 Move(dst, kZapValue, RelocInfo::NONE64); | 344 Move(dst, kZapValue, Assembler::RelocInfoNone()); |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 | 348 |
349 void MacroAssembler::RecordWriteArray(Register object, | 349 void MacroAssembler::RecordWriteArray(Register object, |
350 Register value, | 350 Register value, |
351 Register index, | 351 Register index, |
352 SaveFPRegsMode save_fp, | 352 SaveFPRegsMode save_fp, |
353 RememberedSetAction remembered_set_action, | 353 RememberedSetAction remembered_set_action, |
354 SmiCheck smi_check) { | 354 SmiCheck smi_check) { |
(...skipping 12 matching lines...) Expand all Loading... |
367 FixedArray::kHeaderSize - kHeapObjectTag)); | 367 FixedArray::kHeaderSize - kHeapObjectTag)); |
368 | 368 |
369 RecordWrite( | 369 RecordWrite( |
370 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); | 370 object, dst, value, save_fp, remembered_set_action, OMIT_SMI_CHECK); |
371 | 371 |
372 bind(&done); | 372 bind(&done); |
373 | 373 |
374 // Clobber clobbered input registers when running with the debug-code flag | 374 // Clobber clobbered input registers when running with the debug-code flag |
375 // turned on to provoke errors. | 375 // turned on to provoke errors. |
376 if (emit_debug_code()) { | 376 if (emit_debug_code()) { |
377 Move(value, kZapValue, RelocInfo::NONE64); | 377 Move(value, kZapValue, Assembler::RelocInfoNone()); |
378 Move(index, kZapValue, RelocInfo::NONE64); | 378 Move(index, kZapValue, Assembler::RelocInfoNone()); |
379 } | 379 } |
380 } | 380 } |
381 | 381 |
382 | 382 |
383 void MacroAssembler::RecordWrite(Register object, | 383 void MacroAssembler::RecordWrite(Register object, |
384 Register address, | 384 Register address, |
385 Register value, | 385 Register value, |
386 SaveFPRegsMode fp_mode, | 386 SaveFPRegsMode fp_mode, |
387 RememberedSetAction remembered_set_action, | 387 RememberedSetAction remembered_set_action, |
388 SmiCheck smi_check) { | 388 SmiCheck smi_check) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 Label::kNear); | 432 Label::kNear); |
433 | 433 |
434 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); | 434 RecordWriteStub stub(object, value, address, remembered_set_action, fp_mode); |
435 CallStub(&stub); | 435 CallStub(&stub); |
436 | 436 |
437 bind(&done); | 437 bind(&done); |
438 | 438 |
439 // Clobber clobbered registers when running with the debug-code flag | 439 // Clobber clobbered registers when running with the debug-code flag |
440 // turned on to provoke errors. | 440 // turned on to provoke errors. |
441 if (emit_debug_code()) { | 441 if (emit_debug_code()) { |
442 Move(address, kZapValue, RelocInfo::NONE64); | 442 Move(address, kZapValue, Assembler::RelocInfoNone()); |
443 Move(value, kZapValue, RelocInfo::NONE64); | 443 Move(value, kZapValue, Assembler::RelocInfoNone()); |
444 } | 444 } |
445 } | 445 } |
446 | 446 |
447 | 447 |
448 void MacroAssembler::Assert(Condition cc, BailoutReason reason) { | 448 void MacroAssembler::Assert(Condition cc, BailoutReason reason) { |
449 if (emit_debug_code()) Check(cc, reason); | 449 if (emit_debug_code()) Check(cc, reason); |
450 } | 450 } |
451 | 451 |
452 | 452 |
453 void MacroAssembler::AssertFastElements(Register elements) { | 453 void MacroAssembler::AssertFastElements(Register elements) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 RecordComment(msg); | 521 RecordComment(msg); |
522 } | 522 } |
523 | 523 |
524 if (FLAG_trap_on_abort) { | 524 if (FLAG_trap_on_abort) { |
525 int3(); | 525 int3(); |
526 return; | 526 return; |
527 } | 527 } |
528 #endif | 528 #endif |
529 | 529 |
530 push(rax); | 530 push(rax); |
531 Move(kScratchRegister, reinterpret_cast<Smi*>(p0), RelocInfo::NONE64); | 531 Move(kScratchRegister, reinterpret_cast<Smi*>(p0), |
| 532 Assembler::RelocInfoNone()); |
532 push(kScratchRegister); | 533 push(kScratchRegister); |
533 Move(kScratchRegister, Smi::FromInt(static_cast<int>(p1 - p0)), | 534 Move(kScratchRegister, Smi::FromInt(static_cast<int>(p1 - p0)), |
534 RelocInfo::NONE64); | 535 Assembler::RelocInfoNone()); |
535 push(kScratchRegister); | 536 push(kScratchRegister); |
536 | 537 |
537 if (!has_frame_) { | 538 if (!has_frame_) { |
538 // We don't actually want to generate a pile of code for this, so just | 539 // We don't actually want to generate a pile of code for this, so just |
539 // claim there is a stack frame, without generating one. | 540 // claim there is a stack frame, without generating one. |
540 FrameScope scope(this, StackFrame::NONE); | 541 FrameScope scope(this, StackFrame::NONE); |
541 CallRuntime(Runtime::kAbort, 2); | 542 CallRuntime(Runtime::kAbort, 2); |
542 } else { | 543 } else { |
543 CallRuntime(Runtime::kAbort, 2); | 544 CallRuntime(Runtime::kAbort, 2); |
544 } | 545 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 if (value == 1) { | 1037 if (value == 1) { |
1037 return kSmiConstantRegister; | 1038 return kSmiConstantRegister; |
1038 } | 1039 } |
1039 LoadSmiConstant(kScratchRegister, source); | 1040 LoadSmiConstant(kScratchRegister, source); |
1040 return kScratchRegister; | 1041 return kScratchRegister; |
1041 } | 1042 } |
1042 | 1043 |
1043 | 1044 |
1044 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { | 1045 void MacroAssembler::LoadSmiConstant(Register dst, Smi* source) { |
1045 if (emit_debug_code()) { | 1046 if (emit_debug_code()) { |
1046 Move(dst, Smi::FromInt(kSmiConstantRegisterValue), RelocInfo::NONE64); | 1047 Move(dst, Smi::FromInt(kSmiConstantRegisterValue), |
| 1048 Assembler::RelocInfoNone()); |
1047 cmpq(dst, kSmiConstantRegister); | 1049 cmpq(dst, kSmiConstantRegister); |
1048 Assert(equal, kUninitializedKSmiConstantRegister); | 1050 Assert(equal, kUninitializedKSmiConstantRegister); |
1049 } | 1051 } |
1050 int value = source->value(); | 1052 int value = source->value(); |
1051 if (value == 0) { | 1053 if (value == 0) { |
1052 xorl(dst, dst); | 1054 xorl(dst, dst); |
1053 return; | 1055 return; |
1054 } | 1056 } |
1055 bool negative = value < 0; | 1057 bool negative = value < 0; |
1056 unsigned int uvalue = negative ? -value : value; | 1058 unsigned int uvalue = negative ? -value : value; |
(...skipping 19 matching lines...) Expand all Loading... |
1076 case 2: | 1078 case 2: |
1077 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0)); | 1079 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_1, 0)); |
1078 break; | 1080 break; |
1079 case 1: | 1081 case 1: |
1080 movp(dst, kSmiConstantRegister); | 1082 movp(dst, kSmiConstantRegister); |
1081 break; | 1083 break; |
1082 case 0: | 1084 case 0: |
1083 UNREACHABLE(); | 1085 UNREACHABLE(); |
1084 return; | 1086 return; |
1085 default: | 1087 default: |
1086 Move(dst, source, RelocInfo::NONE64); | 1088 Move(dst, source, Assembler::RelocInfoNone()); |
1087 return; | 1089 return; |
1088 } | 1090 } |
1089 if (negative) { | 1091 if (negative) { |
1090 neg(dst); | 1092 neg(dst); |
1091 } | 1093 } |
1092 } | 1094 } |
1093 | 1095 |
1094 | 1096 |
1095 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { | 1097 void MacroAssembler::Integer32ToSmi(Register dst, Register src) { |
1096 STATIC_ASSERT(kSmiTag == 0); | 1098 STATIC_ASSERT(kSmiTag == 0); |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 LoadAddress(kScratchRegister, ext); | 2618 LoadAddress(kScratchRegister, ext); |
2617 call(kScratchRegister); | 2619 call(kScratchRegister); |
2618 #ifdef DEBUG | 2620 #ifdef DEBUG |
2619 CHECK_EQ(end_position, pc_offset()); | 2621 CHECK_EQ(end_position, pc_offset()); |
2620 #endif | 2622 #endif |
2621 } | 2623 } |
2622 | 2624 |
2623 | 2625 |
2624 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { | 2626 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { |
2625 #ifdef DEBUG | 2627 #ifdef DEBUG |
2626 int end_position = pc_offset() + CallSize(destination, rmode); | 2628 int end_position = pc_offset() + CallSize(destination); |
2627 #endif | 2629 #endif |
2628 Move(kScratchRegister, destination, rmode); | 2630 Move(kScratchRegister, destination, rmode); |
2629 call(kScratchRegister); | 2631 call(kScratchRegister); |
2630 #ifdef DEBUG | 2632 #ifdef DEBUG |
2631 CHECK_EQ(pc_offset(), end_position); | 2633 CHECK_EQ(pc_offset(), end_position); |
2632 #endif | 2634 #endif |
2633 } | 2635 } |
2634 | 2636 |
2635 | 2637 |
2636 void MacroAssembler::Call(Handle<Code> code_object, | 2638 void MacroAssembler::Call(Handle<Code> code_object, |
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4984 j(equal, found); | 4986 j(equal, found); |
4985 movp(current, FieldOperand(current, Map::kPrototypeOffset)); | 4987 movp(current, FieldOperand(current, Map::kPrototypeOffset)); |
4986 CompareRoot(current, Heap::kNullValueRootIndex); | 4988 CompareRoot(current, Heap::kNullValueRootIndex); |
4987 j(not_equal, &loop_again); | 4989 j(not_equal, &loop_again); |
4988 } | 4990 } |
4989 | 4991 |
4990 | 4992 |
4991 } } // namespace v8::internal | 4993 } } // namespace v8::internal |
4992 | 4994 |
4993 #endif // V8_TARGET_ARCH_X64 | 4995 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |