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

Side by Side Diff: src/arm/deoptimizer-arm.cc

Issue 7945009: Merge experimental/gc branch to the bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 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
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/arm/frames-arm.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 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 127 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
128 #ifdef DEBUG 128 #ifdef DEBUG
129 if (FLAG_print_code) { 129 if (FLAG_print_code) {
130 code->PrintLn(); 130 code->PrintLn();
131 } 131 }
132 #endif 132 #endif
133 } 133 }
134 } 134 }
135 135
136 136
137 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, 137 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
138 Address pc_after,
138 Code* check_code, 139 Code* check_code,
139 Code* replacement_code) { 140 Code* replacement_code) {
140 const int kInstrSize = Assembler::kInstrSize; 141 const int kInstrSize = Assembler::kInstrSize;
141 // The call of the stack guard check has the following form: 142 // The call of the stack guard check has the following form:
142 // e1 5d 00 0c cmp sp, <limit> 143 // e1 5d 00 0c cmp sp, <limit>
143 // 2a 00 00 01 bcs ok 144 // 2a 00 00 01 bcs ok
144 // e5 9f c? ?? ldr ip, [pc, <stack guard address>] 145 // e5 9f c? ?? ldr ip, [pc, <stack guard address>]
145 // e1 2f ff 3c blx ip 146 // e1 2f ff 3c blx ip
146 ASSERT(Memory::int32_at(pc_after - kInstrSize) == 147 ASSERT(Memory::int32_at(pc_after - kInstrSize) ==
147 (al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code())); 148 (al | B24 | B21 | 15*B16 | 15*B12 | 15*B8 | BLX | ip.code()));
(...skipping 14 matching lines...) Expand all
162 163
163 // Replace the stack check address in the constant pool 164 // Replace the stack check address in the constant pool
164 // with the entry address of the replacement code. 165 // with the entry address of the replacement code.
165 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - 166 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
166 2 * kInstrSize) & 0xfff; 167 2 * kInstrSize) & 0xfff;
167 Address stack_check_address_pointer = pc_after + stack_check_address_offset; 168 Address stack_check_address_pointer = pc_after + stack_check_address_offset;
168 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 169 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
169 reinterpret_cast<uint32_t>(check_code->entry())); 170 reinterpret_cast<uint32_t>(check_code->entry()));
170 Memory::uint32_at(stack_check_address_pointer) = 171 Memory::uint32_at(stack_check_address_pointer) =
171 reinterpret_cast<uint32_t>(replacement_code->entry()); 172 reinterpret_cast<uint32_t>(replacement_code->entry());
173
174 RelocInfo rinfo(pc_after - 2 * kInstrSize,
175 RelocInfo::CODE_TARGET,
176 NULL,
177 unoptimized_code);
178 unoptimized_code->GetHeap()->incremental_marking()->RecordWriteIntoCode(
179 unoptimized_code, &rinfo, replacement_code);
172 } 180 }
173 181
174 182
175 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 183 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
176 Code* check_code, 184 Code* check_code,
177 Code* replacement_code) { 185 Code* replacement_code) {
178 const int kInstrSize = Assembler::kInstrSize; 186 const int kInstrSize = Assembler::kInstrSize;
179 ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c); 187 ASSERT(Memory::uint32_at(pc_after - kInstrSize) == 0xe12fff3c);
180 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5); 188 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 1) == 0xe5);
181 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f); 189 ASSERT(Memory::uint8_at(pc_after - kInstrSize - 2) == 0x9f);
182 190
183 // Replace NOP with conditional jump. 191 // Replace NOP with conditional jump.
184 CodePatcher patcher(pc_after - 3 * kInstrSize, 1); 192 CodePatcher patcher(pc_after - 3 * kInstrSize, 1);
185 patcher.masm()->b(+4, cs); 193 patcher.masm()->b(+4, cs);
186 194
187 // Replace the stack check address in the constant pool 195 // Replace the stack check address in the constant pool
188 // with the entry address of the replacement code. 196 // with the entry address of the replacement code.
189 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after - 197 uint32_t stack_check_address_offset = Memory::uint16_at(pc_after -
190 2 * kInstrSize) & 0xfff; 198 2 * kInstrSize) & 0xfff;
191 Address stack_check_address_pointer = pc_after + stack_check_address_offset; 199 Address stack_check_address_pointer = pc_after + stack_check_address_offset;
192 ASSERT(Memory::uint32_at(stack_check_address_pointer) == 200 ASSERT(Memory::uint32_at(stack_check_address_pointer) ==
193 reinterpret_cast<uint32_t>(replacement_code->entry())); 201 reinterpret_cast<uint32_t>(replacement_code->entry()));
194 Memory::uint32_at(stack_check_address_pointer) = 202 Memory::uint32_at(stack_check_address_pointer) =
195 reinterpret_cast<uint32_t>(check_code->entry()); 203 reinterpret_cast<uint32_t>(check_code->entry());
204
205 check_code->GetHeap()->incremental_marking()->
206 RecordCodeTargetPatch(pc_after - 2 * kInstrSize, check_code);
196 } 207 }
197 208
198 209
199 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 210 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
200 ByteArray* translations = data->TranslationByteArray(); 211 ByteArray* translations = data->TranslationByteArray();
201 int length = data->DeoptCount(); 212 int length = data->DeoptCount();
202 for (int i = 0; i < length; i++) { 213 for (int i = 0; i < length; i++) {
203 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 214 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
204 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 215 TranslationIterator it(translations, data->TranslationIndex(i)->value());
205 int value = it.Next(); 216 int value = it.Next();
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 __ push(ip); 782 __ push(ip);
772 __ b(&done); 783 __ b(&done);
773 ASSERT(masm()->pc_offset() - start == table_entry_size_); 784 ASSERT(masm()->pc_offset() - start == table_entry_size_);
774 } 785 }
775 __ bind(&done); 786 __ bind(&done);
776 } 787 }
777 788
778 #undef __ 789 #undef __
779 790
780 } } // namespace v8::internal 791 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.h ('k') | src/arm/frames-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698