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

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

Issue 8330021: Add write barrier helper for code patching and refactor stack check patching. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 2 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/deoptimizer.cc ('k') | src/incremental-marking.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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // test eax, <loop nesting depth> 251 // test eax, <loop nesting depth>
252 // ok: 252 // ok:
253 ASSERT(*(call_target_address - 3) == 0x73 && // jae 253 ASSERT(*(call_target_address - 3) == 0x73 && // jae
254 *(call_target_address - 2) == 0x07 && // offset 254 *(call_target_address - 2) == 0x07 && // offset
255 *(call_target_address - 1) == 0xe8); // call 255 *(call_target_address - 1) == 0xe8); // call
256 *(call_target_address - 3) = 0x90; // nop 256 *(call_target_address - 3) = 0x90; // nop
257 *(call_target_address - 2) = 0x90; // nop 257 *(call_target_address - 2) = 0x90; // nop
258 Assembler::set_target_address_at(call_target_address, 258 Assembler::set_target_address_at(call_target_address,
259 replacement_code->entry()); 259 replacement_code->entry());
260 260
261 RelocInfo rinfo(call_target_address, 261 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
262 RelocInfo::CODE_TARGET, 262 unoptimized_code, call_target_address, replacement_code);
263 0,
264 unoptimized_code);
265 unoptimized_code->GetHeap()->incremental_marking()->RecordWriteIntoCode(
266 unoptimized_code, &rinfo, replacement_code);
267 } 263 }
268 264
269 265
270 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after, 266 void Deoptimizer::RevertStackCheckCodeAt(Code* unoptimized_code,
267 Address pc_after,
271 Code* check_code, 268 Code* check_code,
272 Code* replacement_code) { 269 Code* replacement_code) {
273 Address call_target_address = pc_after - kIntSize; 270 Address call_target_address = pc_after - kIntSize;
274 ASSERT(replacement_code->entry() == 271 ASSERT(replacement_code->entry() ==
275 Assembler::target_address_at(call_target_address)); 272 Assembler::target_address_at(call_target_address));
276 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to 273 // Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
277 // restore the conditional branch. 274 // restore the conditional branch.
278 ASSERT(*(call_target_address - 3) == 0x90 && // nop 275 ASSERT(*(call_target_address - 3) == 0x90 && // nop
279 *(call_target_address - 2) == 0x90 && // nop 276 *(call_target_address - 2) == 0x90 && // nop
280 *(call_target_address - 1) == 0xe8); // call 277 *(call_target_address - 1) == 0xe8); // call
281 *(call_target_address - 3) = 0x73; // jae 278 *(call_target_address - 3) = 0x73; // jae
282 *(call_target_address - 2) = 0x07; // offset 279 *(call_target_address - 2) = 0x07; // offset
283 Assembler::set_target_address_at(call_target_address, 280 Assembler::set_target_address_at(call_target_address,
284 check_code->entry()); 281 check_code->entry());
285 282
286 check_code->GetHeap()->incremental_marking()-> 283 check_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
287 RecordCodeTargetPatch(call_target_address, check_code); 284 unoptimized_code, call_target_address, check_code);
288 } 285 }
289 286
290 287
291 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) { 288 static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
292 ByteArray* translations = data->TranslationByteArray(); 289 ByteArray* translations = data->TranslationByteArray();
293 int length = data->DeoptCount(); 290 int length = data->DeoptCount();
294 for (int i = 0; i < length; i++) { 291 for (int i = 0; i < length; i++) {
295 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) { 292 if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
296 TranslationIterator it(translations, data->TranslationIndex(i)->value()); 293 TranslationIterator it(translations, data->TranslationIndex(i)->value());
297 int value = it.Next(); 294 int value = it.Next();
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 } 843 }
847 __ bind(&done); 844 __ bind(&done);
848 } 845 }
849 846
850 #undef __ 847 #undef __
851 848
852 849
853 } } // namespace v8::internal 850 } } // namespace v8::internal
854 851
855 #endif // V8_TARGET_ARCH_IA32 852 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/deoptimizer.cc ('k') | src/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698