OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | 500 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
501 | 501 |
502 // Clobber clobbered registers when running with the debug-code flag | 502 // Clobber clobbered registers when running with the debug-code flag |
503 // turned on to provoke errors. | 503 // turned on to provoke errors. |
504 if (emit_debug_code()) { | 504 if (emit_debug_code()) { |
505 Move(address, kZapValue, Assembler::RelocInfoNone()); | 505 Move(address, kZapValue, Assembler::RelocInfoNone()); |
506 Move(value, kZapValue, Assembler::RelocInfoNone()); | 506 Move(value, kZapValue, Assembler::RelocInfoNone()); |
507 } | 507 } |
508 } | 508 } |
509 | 509 |
| 510 void MacroAssembler::RecordWriteCodeEntryField(Register js_function, |
| 511 Register code_entry, |
| 512 Register dst) { |
| 513 const int offset = JSFunction::kCodeEntryOffset; |
| 514 |
| 515 // Since a code entry (value) is always in old space, we don't need to update |
| 516 // remembered set. If incremental marking is off, there is nothing for us to |
| 517 // do. |
| 518 if (!FLAG_incremental_marking) return; |
| 519 |
| 520 leap(dst, FieldOperand(js_function, offset)); |
| 521 |
| 522 DCHECK(!js_function.is(code_entry)); |
| 523 DCHECK(!js_function.is(dst)); |
| 524 DCHECK(!code_entry.is(dst)); |
| 525 AssertNotSmi(js_function); |
| 526 |
| 527 if (emit_debug_code()) { |
| 528 Label ok; |
| 529 cmpp(code_entry, Operand(dst, 0)); |
| 530 j(equal, &ok, Label::kNear); |
| 531 int3(); |
| 532 bind(&ok); |
| 533 } |
| 534 |
| 535 // First, check if a write barrier is even needed. The tests below |
| 536 // catch stores of Smis and stores into young gen. |
| 537 Label done; |
| 538 |
| 539 CheckPageFlag(code_entry, |
| 540 code_entry, // Used as scratch. |
| 541 MemoryChunk::kPointersToHereAreInterestingMask, zero, &done, |
| 542 Label::kNear); |
| 543 CheckPageFlag(js_function, |
| 544 code_entry, // Used as scratch. |
| 545 MemoryChunk::kPointersFromHereAreInterestingMask, zero, &done, |
| 546 Label::kNear); |
| 547 |
| 548 // Save input registers. |
| 549 Push(js_function); |
| 550 Push(code_entry); |
| 551 |
| 552 // Save caller-saved registers. |
| 553 PushCallerSaved(kDontSaveFPRegs, js_function, code_entry); |
| 554 |
| 555 int argument_count = 3; |
| 556 PrepareCallCFunction(argument_count); |
| 557 |
| 558 Push(js_function); |
| 559 Push(dst); |
| 560 Pop(arg_reg_2); |
| 561 Pop(arg_reg_1); |
| 562 Move(arg_reg_3, ExternalReference::isolate_address(isolate())); |
| 563 |
| 564 { |
| 565 AllowExternalCallThatCantCauseGC scope(this); |
| 566 CallCFunction( |
| 567 ExternalReference::incremental_marking_record_write_code_entry_function( |
| 568 isolate()), |
| 569 argument_count); |
| 570 } |
| 571 |
| 572 // Restore caller-saved registers. |
| 573 PopCallerSaved(kDontSaveFPRegs, js_function, code_entry); |
| 574 |
| 575 // Restore input registers. |
| 576 Pop(code_entry); |
| 577 Pop(js_function); |
| 578 |
| 579 bind(&done); |
| 580 } |
510 | 581 |
511 void MacroAssembler::Assert(Condition cc, BailoutReason reason) { | 582 void MacroAssembler::Assert(Condition cc, BailoutReason reason) { |
512 if (emit_debug_code()) Check(cc, reason); | 583 if (emit_debug_code()) Check(cc, reason); |
513 } | 584 } |
514 | 585 |
515 | 586 |
516 void MacroAssembler::AssertFastElements(Register elements) { | 587 void MacroAssembler::AssertFastElements(Register elements) { |
517 if (emit_debug_code()) { | 588 if (emit_debug_code()) { |
518 Label ok; | 589 Label ok; |
519 CompareRoot(FieldOperand(elements, HeapObject::kMapOffset), | 590 CompareRoot(FieldOperand(elements, HeapObject::kMapOffset), |
(...skipping 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5511 movl(rax, dividend); | 5582 movl(rax, dividend); |
5512 shrl(rax, Immediate(31)); | 5583 shrl(rax, Immediate(31)); |
5513 addl(rdx, rax); | 5584 addl(rdx, rax); |
5514 } | 5585 } |
5515 | 5586 |
5516 | 5587 |
5517 } // namespace internal | 5588 } // namespace internal |
5518 } // namespace v8 | 5589 } // namespace v8 |
5519 | 5590 |
5520 #endif // V8_TARGET_ARCH_X64 | 5591 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |