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

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

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://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
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/full-codegen-ia32.cc » ('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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #ifdef DEBUG 49 #ifdef DEBUG
50 ASSERT(start <= end); 50 ASSERT(start <= end);
51 int size = end - start; 51 int size = end - start;
52 CodePatcher destroyer(start, size); 52 CodePatcher destroyer(start, size);
53 while (size-- > 0) destroyer.masm()->int3(); 53 while (size-- > 0) destroyer.masm()->int3();
54 #endif 54 #endif
55 } 55 }
56 56
57 57
58 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 58 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
59 HandleScope scope;
59 AssertNoAllocation no_allocation; 60 AssertNoAllocation no_allocation;
60 61
61 if (!function->IsOptimized()) return; 62 if (!function->IsOptimized()) return;
62 63
63 // Get the optimized code. 64 // Get the optimized code.
64 Code* code = function->code(); 65 Code* code = function->code();
65 Address code_start_address = code->instruction_start(); 66 Address code_start_address = code->instruction_start();
66 67
67 // We will overwrite the code's relocation info in-place. Relocation info 68 // We will overwrite the code's relocation info in-place. Relocation info
68 // is written backward. The relocation info is the payload of a byte 69 // is written backward. The relocation info is the payload of a byte
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 node->set_next(deoptimizing_code_list_); 126 node->set_next(deoptimizing_code_list_);
126 deoptimizing_code_list_ = node; 127 deoptimizing_code_list_ = node;
127 128
128 // Set the code for the function to non-optimized version. 129 // Set the code for the function to non-optimized version.
129 function->ReplaceCode(function->shared()->code()); 130 function->ReplaceCode(function->shared()->code());
130 131
131 if (FLAG_trace_deopt) { 132 if (FLAG_trace_deopt) {
132 PrintF("[forced deoptimization: "); 133 PrintF("[forced deoptimization: ");
133 function->PrintName(); 134 function->PrintName();
134 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 135 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
136 #ifdef DEBUG
137 if (FLAG_print_code) {
138 code->PrintLn();
139 }
140 #endif
135 } 141 }
136 } 142 }
137 143
138 144
139 // TODO(gc) make use of unoptimized_code when supporting incremental marking. 145 // TODO(gc) make use of unoptimized_code when supporting incremental marking.
140 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code, 146 void Deoptimizer::PatchStackCheckCodeAt(Code* unoptimized_code,
141 Address pc_after, 147 Address pc_after,
142 Code* check_code, 148 Code* check_code,
143 Code* replacement_code) { 149 Code* replacement_code) {
144 Address call_target_address = pc_after - kIntSize; 150 Address call_target_address = pc_after - kIntSize;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 output_frame->SetFrameSlot(output_offset, value); 434 output_frame->SetFrameSlot(output_offset, value);
429 intptr_t fp_value = top_address + output_offset; 435 intptr_t fp_value = top_address + output_offset;
430 ASSERT(!is_bottommost || input_->GetRegister(ebp.code()) == fp_value); 436 ASSERT(!is_bottommost || input_->GetRegister(ebp.code()) == fp_value);
431 output_frame->SetFp(fp_value); 437 output_frame->SetFp(fp_value);
432 if (is_topmost) output_frame->SetRegister(ebp.code(), fp_value); 438 if (is_topmost) output_frame->SetRegister(ebp.code(), fp_value);
433 if (FLAG_trace_deopt) { 439 if (FLAG_trace_deopt) {
434 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n", 440 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
435 fp_value, output_offset, value); 441 fp_value, output_offset, value);
436 } 442 }
437 443
438 // The context can be gotten from the function so long as we don't 444 // For the bottommost output frame the context can be gotten from the input
439 // optimize functions that need local contexts. 445 // frame. For all subsequent output frames it can be gotten from the function
446 // so long as we don't inline functions that need local contexts.
440 output_offset -= kPointerSize; 447 output_offset -= kPointerSize;
441 input_offset -= kPointerSize; 448 input_offset -= kPointerSize;
442 value = reinterpret_cast<uint32_t>(function->context()); 449 if (is_bottommost) {
443 // The context for the bottommost output frame should also agree with the 450 value = input_->GetFrameSlot(input_offset);
444 // input frame. 451 } else {
445 ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value); 452 value = reinterpret_cast<uint32_t>(function->context());
453 }
446 output_frame->SetFrameSlot(output_offset, value); 454 output_frame->SetFrameSlot(output_offset, value);
447 if (is_topmost) output_frame->SetRegister(esi.code(), value); 455 if (is_topmost) output_frame->SetRegister(esi.code(), value);
448 if (FLAG_trace_deopt) { 456 if (FLAG_trace_deopt) {
449 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n", 457 PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
450 top_address + output_offset, output_offset, value); 458 top_address + output_offset, output_offset, value);
451 } 459 }
452 460
453 // The function was mentioned explicitly in the BEGIN_FRAME. 461 // The function was mentioned explicitly in the BEGIN_FRAME.
454 output_offset -= kPointerSize; 462 output_offset -= kPointerSize;
455 input_offset -= kPointerSize; 463 input_offset -= kPointerSize;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 665 }
658 __ bind(&done); 666 __ bind(&done);
659 } 667 }
660 668
661 #undef __ 669 #undef __
662 670
663 671
664 } } // namespace v8::internal 672 } } // namespace v8::internal
665 673
666 #endif // V8_TARGET_ARCH_IA32 674 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698