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

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

Issue 6597104: Move IncrementalRecordWrite to a stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Created 9 years, 9 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 | 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 51
52 void MacroAssembler::IncrementalMarkingRecordWriteHelper(Register object,
53 Register value,
54 Register scratch,
55 ObjectMode object_mode,
56 ValueMode value_mode,
57 ScratchMode scratch_mod e) {
58 ASSERT(!object.is(scratch));
59 ASSERT(!value.is(scratch));
60 ASSERT(!value.is(object));
61
62 bool preserve[Register::kNumRegisters];
63
64 for (int i = 0; i < Register::kNumRegisters; i++) preserve[i] = false;
65
66 preserve[eax.code()] = true;
67 preserve[ecx.code()] = true;
68 preserve[edx.code()] = true;
69 preserve[object.code()] = (object_mode == PRESERVE_OBJECT);
70 preserve[value.code()] = (value_mode == PRESERVE_VALUE);
71 preserve[scratch.code()] = (scratch_mode == PRESERVE_SCRATCH);
72
73 for (int i = 0; i < Register::kNumRegisters; i++) {
74 if (preserve[i]) push(Register::from_code(i));
Erik Corry 2011/03/02 12:34:06 SSE2 registers?
75 }
76
77 PrepareCallCFunction(2, scratch);
78 mov(Operand(esp, 0 * kPointerSize), object);
79 mov(Operand(esp, 1 * kPointerSize), value);
80 CallCFunction(
81 ExternalReference::incremental_marking_record_write_function(), 2);
82
83 for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
84 if (preserve[i]) pop(Register::from_code(i));
85 }
86
Erik Corry 2011/03/02 12:34:06 Extra blank line.
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
87 }
88
89
52 void MacroAssembler::IncrementalMarkingRecordWrite(Register object, 90 void MacroAssembler::IncrementalMarkingRecordWrite(Register object,
53 Register value, 91 Register value,
54 Register scratch) { 92 Register scratch,
55 ASSERT(!object.is(scratch)); 93 SmiCheck smi_check,
56 ASSERT(!value.is(scratch)); 94 ObjectMode object_mode,
57 push(eax); 95 ValueMode value_mode,
58 push(ecx); 96 ScratchMode scratch_mode) {
59 push(edx); 97 if (FLAG_incremental_marking) {
60 PrepareCallCFunction(2, scratch); 98 Label done;
61 mov(Operand(esp, 0 * kPointerSize), object); 99
62 mov(Operand(esp, 1 * kPointerSize), value); 100 if (smi_check == INLINE_SMI_CHECK) {
63 CallCFunction( 101 ASSERT_EQ(0, kSmiTag);
64 ExternalReference::incremental_marking_record_write_function(), 2); 102 test(value, Immediate(kSmiTagMask));
65 pop(edx); 103 j(zero, &done);
66 pop(ecx); 104 }
67 pop(eax); 105
106 IncrementalMarkingRecordWriteStub stub(
107 object, value, scratch, object_mode, value_mode, scratch_mode);
108 CallStub(&stub);
109
110 if (smi_check == INLINE_SMI_CHECK) {
111 bind(&done);
112 }
113 }
68 } 114 }
69 115
Erik Corry 2011/03/02 12:34:06 Extra blank line.
Vyacheslav Egorov (Chromium) 2011/03/02 15:11:32 Done.
70 116
117
71 void MacroAssembler::RecordWriteHelper(Register object, 118 void MacroAssembler::RecordWriteHelper(Register object,
72 Register addr, 119 Register addr,
73 Register scratch, 120 Register scratch,
74 SaveFPRegsMode save_fp) { 121 SaveFPRegsMode save_fp) {
75 if (FLAG_debug_code) { 122 if (FLAG_debug_code) {
76 // Check that the object is not in new space. 123 // Check that the object is not in new space.
77 Label not_in_new_space; 124 Label not_in_new_space;
78 InNewSpace(object, scratch, not_equal, &not_in_new_space); 125 InNewSpace(object, scratch, not_equal, &not_in_new_space);
79 Abort("new-space object passed to RecordWriteHelper"); 126 Abort("new-space object passed to RecordWriteHelper");
80 bind(&not_in_new_space); 127 bind(&not_in_new_space);
(...skipping 27 matching lines...) Expand all
108 SaveFPRegsMode save_fp) { 155 SaveFPRegsMode save_fp) {
109 // First, check if a write barrier is even needed. The tests below 156 // First, check if a write barrier is even needed. The tests below
110 // catch stores of Smis and stores into young gen. 157 // catch stores of Smis and stores into young gen.
111 Label done; 158 Label done;
112 159
113 // Skip barrier if writing a smi. 160 // Skip barrier if writing a smi.
114 ASSERT_EQ(0, kSmiTag); 161 ASSERT_EQ(0, kSmiTag);
115 test(value, Immediate(kSmiTagMask)); 162 test(value, Immediate(kSmiTagMask));
116 j(zero, &done); 163 j(zero, &done);
117 164
118 IncrementalMarkingRecordWrite(object, value, scratch); 165 IncrementalMarkingRecordWrite(object,
166 value,
167 scratch,
168 OMIT_SMI_CHECK,
169 PRESERVE_OBJECT,
170 DESTROY_VALUE,
171 (offset == 0) ? PRESERVE_SCRATCH : DESTROY_SCRAT CH);
119 172
120 InNewSpace(object, value, equal, &done); 173 InNewSpace(object, value, equal, &done);
121 174
122 // The offset is relative to a tagged or untagged HeapObject pointer, 175 // The offset is relative to a tagged or untagged HeapObject pointer,
123 // so either offset or offset + kHeapObjectTag must be a 176 // so either offset or offset + kHeapObjectTag must be a
124 // multiple of kPointerSize. 177 // multiple of kPointerSize.
125 ASSERT(IsAligned(offset, kPointerSize) || 178 ASSERT(IsAligned(offset, kPointerSize) ||
126 IsAligned(offset + kHeapObjectTag, kPointerSize)); 179 IsAligned(offset + kHeapObjectTag, kPointerSize));
127 180
128 Register dst = scratch; 181 Register dst = scratch;
(...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2083
2031 // Check that the code was patched as expected. 2084 // Check that the code was patched as expected.
2032 ASSERT(masm_.pc_ == address_ + size_); 2085 ASSERT(masm_.pc_ == address_ + size_);
2033 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2086 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2034 } 2087 }
2035 2088
2036 2089
2037 } } // namespace v8::internal 2090 } } // namespace v8::internal
2038 2091
2039 #endif // V8_TARGET_ARCH_IA32 2092 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698