Chromium Code Reviews

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

Issue 6542047: Basic implementation of incremental marking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 30 matching lines...)
41 // ------------------------------------------------------------------------- 41 // -------------------------------------------------------------------------
42 // MacroAssembler implementation. 42 // MacroAssembler implementation.
43 43
44 MacroAssembler::MacroAssembler(void* buffer, int size) 44 MacroAssembler::MacroAssembler(void* buffer, int size)
45 : Assembler(buffer, size), 45 : Assembler(buffer, size),
46 generating_stub_(false), 46 generating_stub_(false),
47 allow_stub_calls_(true), 47 allow_stub_calls_(true),
48 code_object_(Heap::undefined_value()) { 48 code_object_(Heap::undefined_value()) {
49 } 49 }
50 50
51
52 void MacroAssembler::IncrementalMarkingRecordWrite(Register object,
53 Register value,
54 Register scratch) {
55 ASSERT(!object.is(scratch));
56 ASSERT(!value.is(scratch));
57 push(eax);
58 push(ecx);
59 push(edx);
60 PrepareCallCFunction(2, scratch);
61 mov(Operand(esp, 0 * kPointerSize), object);
62 mov(Operand(esp, 1 * kPointerSize), value);
63 CallCFunction(
64 ExternalReference::incremental_marking_record_write_function(), 2);
65 pop(edx);
66 pop(ecx);
67 pop(eax);
68 }
69
70
51 void MacroAssembler::RecordWriteHelper(Register object, 71 void MacroAssembler::RecordWriteHelper(Register object,
52 Register addr, 72 Register addr,
53 Register scratch, 73 Register scratch,
54 SaveFPRegsMode save_fp) { 74 SaveFPRegsMode save_fp) {
55 if (FLAG_debug_code) { 75 if (FLAG_debug_code) {
56 // Check that the object is not in new space. 76 // Check that the object is not in new space.
57 Label not_in_new_space; 77 Label not_in_new_space;
58 InNewSpace(object, scratch, not_equal, &not_in_new_space); 78 InNewSpace(object, scratch, not_equal, &not_in_new_space);
59 Abort("new-space object passed to RecordWriteHelper"); 79 Abort("new-space object passed to RecordWriteHelper");
60 bind(&not_in_new_space); 80 bind(&not_in_new_space);
(...skipping 20 matching lines...)
81 } 101 }
82 102
83 103
84 void MacroAssembler::RecordWrite(Register object, 104 void MacroAssembler::RecordWrite(Register object,
85 int offset, 105 int offset,
86 Register value, 106 Register value,
87 Register scratch, 107 Register scratch,
88 SaveFPRegsMode save_fp) { 108 SaveFPRegsMode save_fp) {
89 // First, check if a write barrier is even needed. The tests below 109 // First, check if a write barrier is even needed. The tests below
90 // catch stores of Smis and stores into young gen. 110 // catch stores of Smis and stores into young gen.
91 NearLabel done; 111 Label done;
92 112
93 // Skip barrier if writing a smi. 113 // Skip barrier if writing a smi.
94 ASSERT_EQ(0, kSmiTag); 114 ASSERT_EQ(0, kSmiTag);
95 test(value, Immediate(kSmiTagMask)); 115 test(value, Immediate(kSmiTagMask));
96 j(zero, &done); 116 j(zero, &done);
97 117
118 IncrementalMarkingRecordWrite(object, value, scratch);
119
98 InNewSpace(object, value, equal, &done); 120 InNewSpace(object, value, equal, &done);
99 121
100 // The offset is relative to a tagged or untagged HeapObject pointer, 122 // The offset is relative to a tagged or untagged HeapObject pointer,
101 // so either offset or offset + kHeapObjectTag must be a 123 // so either offset or offset + kHeapObjectTag must be a
102 // multiple of kPointerSize. 124 // multiple of kPointerSize.
103 ASSERT(IsAligned(offset, kPointerSize) || 125 ASSERT(IsAligned(offset, kPointerSize) ||
104 IsAligned(offset + kHeapObjectTag, kPointerSize)); 126 IsAligned(offset + kHeapObjectTag, kPointerSize));
105 127
106 Register dst = scratch; 128 Register dst = scratch;
107 if (offset != 0) { 129 if (offset != 0) {
(...skipping 1900 matching lines...)
2008 2030
2009 // Check that the code was patched as expected. 2031 // Check that the code was patched as expected.
2010 ASSERT(masm_.pc_ == address_ + size_); 2032 ASSERT(masm_.pc_ == address_ + size_);
2011 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2033 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2012 } 2034 }
2013 2035
2014 2036
2015 } } // namespace v8::internal 2037 } } // namespace v8::internal
2016 2038
2017 #endif // V8_TARGET_ARCH_IA32 2039 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine