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

Unified Diff: src/deoptimizer.cc

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://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. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/deoptimizer.h ('k') | src/disassembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/deoptimizer.cc
===================================================================
--- src/deoptimizer.cc (revision 6800)
+++ src/deoptimizer.cc (working copy)
@@ -618,17 +618,17 @@
}
case Translation::ARGUMENTS_OBJECT: {
- // Use the hole value as a sentinel and fill in the arguments object
- // after the deoptimized frame is built.
+ // Use the arguments marker value as a sentinel and fill in the arguments
+ // object after the deoptimized frame is built.
ASSERT(frame_index == 0); // Only supported for first frame.
if (FLAG_trace_deopt) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
output_[frame_index]->GetTop() + output_offset,
output_offset);
- Heap::the_hole_value()->ShortPrint();
+ Heap::arguments_marker()->ShortPrint();
PrintF(" ; arguments object\n");
}
- intptr_t value = reinterpret_cast<intptr_t>(Heap::the_hole_value());
+ intptr_t value = reinterpret_cast<intptr_t>(Heap::arguments_marker());
output_[frame_index]->SetFrameSlot(output_offset, value);
return;
}
@@ -663,7 +663,7 @@
case Translation::REGISTER: {
int output_reg = iterator->Next();
if (FLAG_trace_osr) {
- PrintF(" %s <- 0x%08" V8PRIxPTR " ; [esp + %d]\n",
+ PrintF(" %s <- 0x%08" V8PRIxPTR " ; [sp + %d]\n",
converter.NameOfCPURegister(output_reg),
input_value,
*input_offset);
@@ -690,7 +690,7 @@
return false;
}
if (FLAG_trace_osr) {
- PrintF(" %s <- %d (int32) ; [esp + %d]\n",
+ PrintF(" %s <- %d (int32) ; [sp + %d]\n",
converter.NameOfCPURegister(output_reg),
int32_value,
*input_offset);
@@ -706,7 +706,7 @@
int output_reg = iterator->Next();
double double_value = input_object->Number();
if (FLAG_trace_osr) {
- PrintF(" %s <- %g (double) ; [esp + %d]\n",
+ PrintF(" %s <- %g (double) ; [sp + %d]\n",
DoubleRegister::AllocationIndexToString(output_reg),
double_value,
*input_offset);
@@ -720,7 +720,7 @@
unsigned output_offset =
output->GetOffsetFromSlotIndex(this, output_index);
if (FLAG_trace_osr) {
- PrintF(" [esp + %d] <- 0x%08" V8PRIxPTR " ; [esp + %d]\n",
+ PrintF(" [sp + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d]\n",
output_offset,
input_value,
*input_offset);
@@ -749,7 +749,7 @@
return false;
}
if (FLAG_trace_osr) {
- PrintF(" [esp + %d] <- %d (int32) ; [esp + %d]\n",
+ PrintF(" [sp + %d] <- %d (int32) ; [sp + %d]\n",
output_offset,
int32_value,
*input_offset);
@@ -773,12 +773,12 @@
int32_t lower = static_cast<int32_t>(int_value);
int32_t upper = static_cast<int32_t>(int_value >> kBitsPerInt);
if (FLAG_trace_osr) {
- PrintF(" [esp + %d] <- 0x%08x (upper bits of %g) ; [esp + %d]\n",
+ PrintF(" [sp + %d] <- 0x%08x (upper bits of %g) ; [sp + %d]\n",
output_offset + kUpperOffset,
upper,
double_value,
*input_offset);
- PrintF(" [esp + %d] <- 0x%08x (lower bits of %g) ; [esp + %d]\n",
+ PrintF(" [sp + %d] <- 0x%08x (lower bits of %g) ; [sp + %d]\n",
output_offset + kLowerOffset,
lower,
double_value,
@@ -810,6 +810,44 @@
}
+void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code,
+ Code* check_code,
+ Code* replacement_code) {
+ // Iterate over the stack check table and patch every stack check
+ // call to an unconditional call to the replacement code.
+ ASSERT(unoptimized_code->kind() == Code::FUNCTION);
+ Address stack_check_cursor = unoptimized_code->instruction_start() +
+ unoptimized_code->stack_check_table_offset();
+ uint32_t table_length = Memory::uint32_at(stack_check_cursor);
+ stack_check_cursor += kIntSize;
+ for (uint32_t i = 0; i < table_length; ++i) {
+ uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize);
+ Address pc_after = unoptimized_code->instruction_start() + pc_offset;
+ PatchStackCheckCodeAt(pc_after, check_code, replacement_code);
+ stack_check_cursor += 2 * kIntSize;
+ }
+}
+
+
+void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code,
+ Code* check_code,
+ Code* replacement_code) {
+ // Iterate over the stack check table and revert the patched
+ // stack check calls.
+ ASSERT(unoptimized_code->kind() == Code::FUNCTION);
+ Address stack_check_cursor = unoptimized_code->instruction_start() +
+ unoptimized_code->stack_check_table_offset();
+ uint32_t table_length = Memory::uint32_at(stack_check_cursor);
+ stack_check_cursor += kIntSize;
+ for (uint32_t i = 0; i < table_length; ++i) {
+ uint32_t pc_offset = Memory::uint32_at(stack_check_cursor + kIntSize);
+ Address pc_after = unoptimized_code->instruction_start() + pc_offset;
+ RevertStackCheckCodeAt(pc_after, check_code, replacement_code);
+ stack_check_cursor += 2 * kIntSize;
+ }
+}
+
+
unsigned Deoptimizer::ComputeInputFrameSize() const {
unsigned fixed_size = ComputeFixedSize(function_);
// The fp-to-sp delta already takes the context and the function
« no previous file with comments | « src/deoptimizer.h ('k') | src/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698