Commit 940b6516 authored by danno@chromium.org's avatar danno@chromium.org

Add separate flag for --trace-stub-failures

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/12208011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13598 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 53f29b32
...@@ -643,7 +643,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -643,7 +643,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
intptr_t fp_value = top_address + output_offset; intptr_t fp_value = top_address + output_offset;
output_frame->SetFp(fp_value); output_frame->SetFp(fp_value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
fp_value, output_offset, value); fp_value, output_offset, value);
} }
...@@ -652,7 +652,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -652,7 +652,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = output_[frame_index - 1]->GetContext(); value = output_[frame_index - 1]->GetContext();
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -661,7 +661,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -661,7 +661,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT)); value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (construct sentinel)\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -670,7 +670,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -670,7 +670,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(construct_stub); value = reinterpret_cast<intptr_t>(construct_stub);
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; code object\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; code object\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -679,7 +679,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -679,7 +679,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1)); value = reinterpret_cast<uint32_t>(Smi::FromInt(height - 1));
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; argc (%d)\n",
top_address + output_offset, output_offset, value, height - 1); top_address + output_offset, output_offset, value, height - 1);
} }
...@@ -688,7 +688,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -688,7 +688,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(function); value = reinterpret_cast<intptr_t>(function);
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; constructor function\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; constructor function\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -698,7 +698,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator, ...@@ -698,7 +698,7 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = output_frame->GetFrameSlot(output_frame_size - kPointerSize); value = output_frame->GetFrameSlot(output_frame_size - kPointerSize);
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; allocated receiver\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -722,7 +722,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -722,7 +722,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
unsigned height = 0; unsigned height = 0;
unsigned height_in_bytes = height * kPointerSize; unsigned height_in_bytes = height * kPointerSize;
const char* kind = is_setter_stub_frame ? "setter" : "getter"; const char* kind = is_setter_stub_frame ? "setter" : "getter";
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes); PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes);
} }
...@@ -755,7 +755,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -755,7 +755,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
intptr_t callers_pc = output_[frame_index - 1]->GetPc(); intptr_t callers_pc = output_[frame_index - 1]->GetPc();
output_frame->SetFrameSlot(output_offset, callers_pc); output_frame->SetFrameSlot(output_offset, callers_pc);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
" ; caller's pc\n", " ; caller's pc\n",
top_address + output_offset, output_offset, callers_pc); top_address + output_offset, output_offset, callers_pc);
...@@ -767,7 +767,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -767,7 +767,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
intptr_t fp_value = top_address + output_offset; intptr_t fp_value = top_address + output_offset;
output_frame->SetFp(fp_value); output_frame->SetFp(fp_value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
" ; caller's fp\n", " ; caller's fp\n",
fp_value, output_offset, value); fp_value, output_offset, value);
...@@ -777,7 +777,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -777,7 +777,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = output_[frame_index - 1]->GetContext(); value = output_[frame_index - 1]->GetContext();
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
" ; context\n", " ; context\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
...@@ -787,7 +787,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -787,7 +787,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
output_offset -= kPointerSize; output_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL)); value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
" ; function (%s sentinel)\n", " ; function (%s sentinel)\n",
top_address + output_offset, output_offset, value, kind); top_address + output_offset, output_offset, value, kind);
...@@ -801,7 +801,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator, ...@@ -801,7 +801,7 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
Code* accessor_stub = isolate_->builtins()->builtin(name); Code* accessor_stub = isolate_->builtins()->builtin(name);
value = reinterpret_cast<intptr_t>(accessor_stub); value = reinterpret_cast<intptr_t>(accessor_stub);
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
" ; code object\n", " ; code object\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
...@@ -847,7 +847,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, ...@@ -847,7 +847,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
} }
unsigned height = iterator->Next(); unsigned height = iterator->Next();
unsigned height_in_bytes = height * kPointerSize; unsigned height_in_bytes = height * kPointerSize;
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" translating "); PrintF(" translating ");
function->PrintName(); function->PrintName();
PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
...@@ -911,7 +911,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, ...@@ -911,7 +911,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
value = output_[frame_index - 1]->GetPc(); value = output_[frame_index - 1]->GetPc();
} }
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -934,7 +934,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, ...@@ -934,7 +934,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
if (is_topmost) { if (is_topmost) {
output_frame->SetRegister(fp.code(), fp_value); output_frame->SetRegister(fp.code(), fp_value);
} }
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
fp_value, output_offset, value); fp_value, output_offset, value);
} }
...@@ -952,7 +952,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, ...@@ -952,7 +952,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
output_frame->SetContext(value); output_frame->SetContext(value);
if (is_topmost) output_frame->SetRegister(cp.code(), value); if (is_topmost) output_frame->SetRegister(cp.code(), value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
...@@ -965,7 +965,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator, ...@@ -965,7 +965,7 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
// input frame. // input frame.
ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value); ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
output_frame->SetFrameSlot(output_offset, value); output_frame->SetFrameSlot(output_offset, value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function\n", PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function\n",
top_address + output_offset, output_offset, value); top_address + output_offset, output_offset, value);
} }
......
// Copyright 2012 the V8 project authors. All rights reserved. // Copyright 2013 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -491,12 +491,15 @@ void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) { ...@@ -491,12 +491,15 @@ void Deoptimizer::ComputeOutputFrames(Deoptimizer* deoptimizer) {
} }
bool Deoptimizer::TraceEnabledFor(BailoutType type) { bool Deoptimizer::TraceEnabledFor(BailoutType deopt_type,
switch (type) { StackFrame::Type frame_type) {
switch (deopt_type) {
case EAGER: case EAGER:
case LAZY: case LAZY:
case DEBUGGER: case DEBUGGER:
return FLAG_trace_deopt; return (frame_type == StackFrame::STUB)
? FLAG_trace_stub_failures
: FLAG_trace_deopt;
case OSR: case OSR:
return FLAG_trace_osr; return FLAG_trace_osr;
} }
...@@ -540,7 +543,8 @@ Deoptimizer::Deoptimizer(Isolate* isolate, ...@@ -540,7 +543,8 @@ Deoptimizer::Deoptimizer(Isolate* isolate,
output_(NULL), output_(NULL),
deferred_arguments_objects_values_(0), deferred_arguments_objects_values_(0),
deferred_arguments_objects_(0), deferred_arguments_objects_(0),
deferred_heap_numbers_(0) { deferred_heap_numbers_(0),
trace_(false) {
// For COMPILED_STUBs called from builtins, the function pointer is a SMI // For COMPILED_STUBs called from builtins, the function pointer is a SMI
// indicating an internal frame. // indicating an internal frame.
if (function->IsSmi()) { if (function->IsSmi()) {
...@@ -550,13 +554,14 @@ Deoptimizer::Deoptimizer(Isolate* isolate, ...@@ -550,13 +554,14 @@ Deoptimizer::Deoptimizer(Isolate* isolate,
function->shared()->increment_deopt_count(); function->shared()->increment_deopt_count();
} }
compiled_code_ = FindOptimizedCode(function, optimized_code); compiled_code_ = FindOptimizedCode(function, optimized_code);
if (TraceEnabledFor(type)) Trace();
ASSERT(HEAP->allow_allocation(false));
unsigned size = ComputeInputFrameSize();
input_ = new(size) FrameDescription(size, function);
StackFrame::Type frame_type = function == NULL StackFrame::Type frame_type = function == NULL
? StackFrame::STUB ? StackFrame::STUB
: StackFrame::JAVA_SCRIPT; : StackFrame::JAVA_SCRIPT;
trace_ = TraceEnabledFor(type, frame_type);
if (trace_) Trace();
ASSERT(HEAP->allow_allocation(false));
unsigned size = ComputeInputFrameSize();
input_ = new(size) FrameDescription(size, function);
input_->SetFrameType(frame_type); input_->SetFrameType(frame_type);
} }
...@@ -717,7 +722,7 @@ void Deoptimizer::DoComputeOutputFrames() { ...@@ -717,7 +722,7 @@ void Deoptimizer::DoComputeOutputFrames() {
// Print some helpful diagnostic information. // Print some helpful diagnostic information.
int64_t start = OS::Ticks(); int64_t start = OS::Ticks();
if (FLAG_trace_deopt) { if (trace_) {
PrintF("[deoptimizing%s: begin 0x%08" V8PRIxPTR " ", PrintF("[deoptimizing%s: begin 0x%08" V8PRIxPTR " ",
(bailout_type_ == LAZY ? " (lazy)" : ""), (bailout_type_ == LAZY ? " (lazy)" : ""),
reinterpret_cast<intptr_t>(function_)); reinterpret_cast<intptr_t>(function_));
...@@ -795,7 +800,7 @@ void Deoptimizer::DoComputeOutputFrames() { ...@@ -795,7 +800,7 @@ void Deoptimizer::DoComputeOutputFrames() {
} }
// Print some helpful diagnostic information. // Print some helpful diagnostic information.
if (FLAG_trace_deopt) { if (trace_) {
double ms = static_cast<double>(OS::Ticks() - start) / 1000; double ms = static_cast<double>(OS::Ticks() - start) / 1000;
int index = output_count_ - 1; // Index of the topmost frame. int index = output_count_ - 1; // Index of the topmost frame.
JSFunction* function = output_[index]->GetFunction(); JSFunction* function = output_[index]->GetFunction();
...@@ -833,7 +838,7 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { ...@@ -833,7 +838,7 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
for (int i = 0; i < deferred_heap_numbers_.length(); i++) { for (int i = 0; i < deferred_heap_numbers_.length(); i++) {
HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i]; HeapNumberMaterializationDescriptor d = deferred_heap_numbers_[i];
Handle<Object> num = isolate_->factory()->NewNumber(d.value()); Handle<Object> num = isolate_->factory()->NewNumber(d.value());
if (FLAG_trace_deopt) { if (trace_) {
PrintF("Materializing a new heap number %p [%e] in slot %p\n", PrintF("Materializing a new heap number %p [%e] in slot %p\n",
reinterpret_cast<void*>(*num), reinterpret_cast<void*>(*num),
d.value(), d.value(),
...@@ -878,7 +883,7 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) { ...@@ -878,7 +883,7 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
} }
frame->SetExpression(i, *arguments); frame->SetExpression(i, *arguments);
ASSERT_EQ(Memory::Object_at(descriptor.slot_address()), *arguments); ASSERT_EQ(Memory::Object_at(descriptor.slot_address()), *arguments);
if (FLAG_trace_deopt) { if (trace_) {
PrintF("Materializing %sarguments object for %p: ", PrintF("Materializing %sarguments object for %p: ",
frame->has_adapted_arguments() ? "(adapted) " : "", frame->has_adapted_arguments() ? "(adapted) " : "",
reinterpret_cast<void*>(descriptor.slot_address())); reinterpret_cast<void*>(descriptor.slot_address()));
...@@ -913,7 +918,7 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( ...@@ -913,7 +918,7 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame(
int index = (info->parameters_count() - 1) - int index = (info->parameters_count() - 1) -
static_cast<int>(slot - parameters_top) / kPointerSize; static_cast<int>(slot - parameters_top) / kPointerSize;
if (FLAG_trace_deopt) { if (trace_) {
PrintF("Materializing a new heap number %p [%e] in slot %p" PrintF("Materializing a new heap number %p [%e] in slot %p"
"for parameter slot #%d\n", "for parameter slot #%d\n",
reinterpret_cast<void*>(*num), reinterpret_cast<void*>(*num),
...@@ -929,7 +934,7 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame( ...@@ -929,7 +934,7 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame(
int index = info->expression_count() - 1 - int index = info->expression_count() - 1 -
static_cast<int>(slot - expressions_top) / kPointerSize; static_cast<int>(slot - expressions_top) / kPointerSize;
if (FLAG_trace_deopt) { if (trace_) {
PrintF("Materializing a new heap number %p [%e] in slot %p" PrintF("Materializing a new heap number %p [%e] in slot %p"
"for expression slot #%d\n", "for expression slot #%d\n",
reinterpret_cast<void*>(*num), reinterpret_cast<void*>(*num),
...@@ -976,7 +981,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -976,7 +981,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::REGISTER: { case Translation::REGISTER: {
int input_reg = iterator->Next(); int input_reg = iterator->Next();
intptr_t input_value = input_->GetRegister(input_reg); intptr_t input_value = input_->GetRegister(input_reg);
if (FLAG_trace_deopt) { if (trace_) {
PrintF( PrintF(
" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ", " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
...@@ -994,7 +999,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -994,7 +999,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
int input_reg = iterator->Next(); int input_reg = iterator->Next();
intptr_t value = input_->GetRegister(input_reg); intptr_t value = input_->GetRegister(input_reg);
bool is_smi = Smi::IsValid(value); bool is_smi = Smi::IsValid(value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF( PrintF(
" 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n", " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
...@@ -1021,7 +1026,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1021,7 +1026,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
int input_reg = iterator->Next(); int input_reg = iterator->Next();
uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg)); uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue)); bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
if (FLAG_trace_deopt) { if (trace_) {
PrintF( PrintF(
" 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR
" ; uint %s (%s)\n", " ; uint %s (%s)\n",
...@@ -1048,7 +1053,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1048,7 +1053,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::DOUBLE_REGISTER: { case Translation::DOUBLE_REGISTER: {
int input_reg = iterator->Next(); int input_reg = iterator->Next();
double value = input_->GetDoubleRegister(input_reg); double value = input_->GetDoubleRegister(input_reg);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n", PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
output_offset, output_offset,
...@@ -1067,7 +1072,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1067,7 +1072,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
unsigned input_offset = unsigned input_offset =
input_->GetOffsetFromSlotIndex(input_slot_index); input_->GetOffsetFromSlotIndex(input_slot_index);
intptr_t input_value = input_->GetFrameSlot(input_offset); intptr_t input_value = input_->GetFrameSlot(input_offset);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": ", PrintF(" 0x%08" V8PRIxPTR ": ",
output_[frame_index]->GetTop() + output_offset); output_[frame_index]->GetTop() + output_offset);
PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d] ", PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d] ",
...@@ -1087,7 +1092,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1087,7 +1092,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
input_->GetOffsetFromSlotIndex(input_slot_index); input_->GetOffsetFromSlotIndex(input_slot_index);
intptr_t value = input_->GetFrameSlot(input_offset); intptr_t value = input_->GetFrameSlot(input_offset);
bool is_smi = Smi::IsValid(value); bool is_smi = Smi::IsValid(value);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": ", PrintF(" 0x%08" V8PRIxPTR ": ",
output_[frame_index]->GetTop() + output_offset); output_[frame_index]->GetTop() + output_offset);
PrintF("[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n", PrintF("[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n",
...@@ -1117,7 +1122,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1117,7 +1122,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
uintptr_t value = uintptr_t value =
static_cast<uintptr_t>(input_->GetFrameSlot(input_offset)); static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue)); bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": ", PrintF(" 0x%08" V8PRIxPTR ": ",
output_[frame_index]->GetTop() + output_offset); output_[frame_index]->GetTop() + output_offset);
PrintF("[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n", PrintF("[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n",
...@@ -1145,7 +1150,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1145,7 +1150,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
unsigned input_offset = unsigned input_offset =
input_->GetOffsetFromSlotIndex(input_slot_index); input_->GetOffsetFromSlotIndex(input_slot_index);
double value = input_->GetDoubleFrameSlot(input_offset); double value = input_->GetDoubleFrameSlot(input_offset);
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n", PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
output_offset, output_offset,
...@@ -1161,7 +1166,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1161,7 +1166,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::LITERAL: { case Translation::LITERAL: {
Object* literal = ComputeLiteral(iterator->Next()); Object* literal = ComputeLiteral(iterator->Next());
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ", PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
output_offset); output_offset);
...@@ -1176,7 +1181,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator, ...@@ -1176,7 +1181,7 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
case Translation::ARGUMENTS_OBJECT: { case Translation::ARGUMENTS_OBJECT: {
int args_index = iterator->Next() + 1; // Skip receiver. int args_index = iterator->Next() + 1; // Skip receiver.
int args_length = iterator->Next() - 1; // Skip receiver. int args_length = iterator->Next() - 1; // Skip receiver.
if (FLAG_trace_deopt) { if (trace_) {
PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ", PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
output_[frame_index]->GetTop() + output_offset, output_[frame_index]->GetTop() + output_offset,
output_offset); output_offset);
......
...@@ -144,7 +144,8 @@ class Deoptimizer : public Malloced { ...@@ -144,7 +144,8 @@ class Deoptimizer : public Malloced {
DEBUGGER DEBUGGER
}; };
static bool TraceEnabledFor(BailoutType type); static bool TraceEnabledFor(BailoutType deopt_type,
StackFrame::Type frame_type);
static const char* MessageFor(BailoutType type); static const char* MessageFor(BailoutType type);
int output_count() const { return output_count_; } int output_count() const { return output_count_; }
...@@ -407,6 +408,8 @@ class Deoptimizer : public Malloced { ...@@ -407,6 +408,8 @@ class Deoptimizer : public Malloced {
List<ArgumentsObjectMaterializationDescriptor> deferred_arguments_objects_; List<ArgumentsObjectMaterializationDescriptor> deferred_arguments_objects_;
List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_; List<HeapNumberMaterializationDescriptor> deferred_heap_numbers_;
bool trace_;
static const int table_entry_size_; static const int table_entry_size_;
friend class FrameDescription; friend class FrameDescription;
......
...@@ -344,7 +344,9 @@ DEFINE_bool(trace_opt_stats, false, "trace lazy optimization statistics") ...@@ -344,7 +344,9 @@ DEFINE_bool(trace_opt_stats, false, "trace lazy optimization statistics")
DEFINE_bool(opt, true, "use adaptive optimizations") DEFINE_bool(opt, true, "use adaptive optimizations")
DEFINE_bool(always_opt, false, "always try to optimize functions") DEFINE_bool(always_opt, false, "always try to optimize functions")
DEFINE_bool(prepare_always_opt, false, "prepare for turning on always opt") DEFINE_bool(prepare_always_opt, false, "prepare for turning on always opt")
DEFINE_bool(trace_deopt, false, "trace deoptimization") DEFINE_bool(trace_deopt, false, "trace optimize function deoptimization")
DEFINE_bool(trace_stub_failures, false,
"trace deoptimization of generated code stubs")
// compiler.cc // compiler.cc
DEFINE_int(min_preparse_length, 1024, DEFINE_int(min_preparse_length, 1024,
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment