Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 1647123002: Write barrier for storing a code entry, and usage in CompileLazy builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE and comment response. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/macro-assembler-arm64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/division-by-constant.h" 10 #include "src/base/division-by-constant.h"
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 value); 644 value);
645 645
646 // Clobber clobbered registers when running with the debug-code flag 646 // Clobber clobbered registers when running with the debug-code flag
647 // turned on to provoke errors. 647 // turned on to provoke errors.
648 if (emit_debug_code()) { 648 if (emit_debug_code()) {
649 mov(address, Operand(bit_cast<int32_t>(kZapValue + 12))); 649 mov(address, Operand(bit_cast<int32_t>(kZapValue + 12)));
650 mov(value, Operand(bit_cast<int32_t>(kZapValue + 16))); 650 mov(value, Operand(bit_cast<int32_t>(kZapValue + 16)));
651 } 651 }
652 } 652 }
653 653
654 void MacroAssembler::RecordWriteCodeEntryField(Register js_function,
655 Register code_entry,
656 Register scratch) {
657 const int offset = JSFunction::kCodeEntryOffset;
658
659 // Since a code entry (value) is always in old space, we don't need to update
660 // remembered set. If incremental marking is off, there is nothing for us to
661 // do.
662 if (!FLAG_incremental_marking) return;
663
664 DCHECK(js_function.is(r1));
665 DCHECK(code_entry.is(r4));
666 DCHECK(scratch.is(r5));
667 AssertNotSmi(js_function);
668
669 if (emit_debug_code()) {
670 add(scratch, js_function, Operand(offset - kHeapObjectTag));
671 ldr(ip, MemOperand(scratch));
672 cmp(ip, code_entry);
673 Check(eq, kWrongAddressOrValuePassedToRecordWrite);
674 }
675
676 // First, check if a write barrier is even needed. The tests below
677 // catch stores of Smis and stores into young gen.
678 Label done;
679
680 CheckPageFlag(code_entry, scratch,
681 MemoryChunk::kPointersToHereAreInterestingMask, eq, &done);
682 CheckPageFlag(js_function, scratch,
683 MemoryChunk::kPointersFromHereAreInterestingMask, eq, &done);
684
685 const Register dst = scratch;
686 add(dst, js_function, Operand(offset - kHeapObjectTag));
687
688 push(code_entry);
689
690 // Save caller-saved registers, which includes js_function.
691 DCHECK((kCallerSaved & js_function.bit()) != 0);
692 DCHECK_EQ(kCallerSaved & code_entry.bit(), 0);
693 stm(db_w, sp, (kCallerSaved | lr.bit()));
694
695 int argument_count = 3;
696 PrepareCallCFunction(argument_count, code_entry);
697
698 mov(r0, js_function);
699 mov(r1, dst);
700 mov(r2, Operand(ExternalReference::isolate_address(isolate())));
701
702 {
703 AllowExternalCallThatCantCauseGC scope(this);
704 CallCFunction(
705 ExternalReference::incremental_marking_record_write_code_entry_function(
706 isolate()),
707 argument_count);
708 }
709
710 // Restore caller-saved registers (including js_function and code_entry).
711 ldm(ia_w, sp, (kCallerSaved | lr.bit()));
712
713 pop(code_entry);
714
715 bind(&done);
716 }
654 717
655 void MacroAssembler::RememberedSetHelper(Register object, // For debug tests. 718 void MacroAssembler::RememberedSetHelper(Register object, // For debug tests.
656 Register address, 719 Register address,
657 Register scratch, 720 Register scratch,
658 SaveFPRegsMode fp_mode, 721 SaveFPRegsMode fp_mode,
659 RememberedSetFinalAction and_then) { 722 RememberedSetFinalAction and_then) {
660 Label done; 723 Label done;
661 if (emit_debug_code()) { 724 if (emit_debug_code()) {
662 Label ok; 725 Label ok;
663 JumpIfNotInNewSpace(object, scratch, &ok); 726 JumpIfNotInNewSpace(object, scratch, &ok);
(...skipping 2946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 } 3673 }
3611 } 3674 }
3612 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); 3675 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift));
3613 add(result, result, Operand(dividend, LSR, 31)); 3676 add(result, result, Operand(dividend, LSR, 31));
3614 } 3677 }
3615 3678
3616 } // namespace internal 3679 } // namespace internal
3617 } // namespace v8 3680 } // namespace v8
3618 3681
3619 #endif // V8_TARGET_ARCH_ARM 3682 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/macro-assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698