| Index: src/deoptimizer.cc
|
| diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
|
| index 2fc04fa6e051bce5609f453f23944ed7439326b1..74b9cea037ef660c96011d669b8f32925e5baff0 100644
|
| --- a/src/deoptimizer.cc
|
| +++ b/src/deoptimizer.cc
|
| @@ -344,9 +344,11 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
|
| shared->EvictFromOptimizedCodeMap(code, "deoptimized function");
|
|
|
| if (FLAG_trace_deopt) {
|
| - PrintF("[deoptimizer unlinked: ");
|
| - function->PrintName();
|
| - PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
|
| + CodeTracer::Scope scope(code->GetHeap()->isolate()->GetCodeTracer());
|
| + PrintF(scope.file(), "[deoptimizer unlinked: ");
|
| + function->PrintName(scope.file());
|
| + PrintF(scope.file(),
|
| + " / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
|
| }
|
| }
|
| };
|
| @@ -409,7 +411,8 @@ void Deoptimizer::DeoptimizeMarkedCodeForContext(Context* context) {
|
|
|
| void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
|
| if (FLAG_trace_deopt) {
|
| - PrintF("[deoptimize all code in all contexts]\n");
|
| + CodeTracer::Scope scope(isolate->GetCodeTracer());
|
| + PrintF(scope.file(), "[deoptimize all code in all contexts]\n");
|
| }
|
| DisallowHeapAllocation no_allocation;
|
| // For all contexts, mark all code, then deoptimize.
|
| @@ -425,7 +428,8 @@ void Deoptimizer::DeoptimizeAll(Isolate* isolate) {
|
|
|
| void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
|
| if (FLAG_trace_deopt) {
|
| - PrintF("[deoptimize marked code in all contexts]\n");
|
| + CodeTracer::Scope scope(isolate->GetCodeTracer());
|
| + PrintF(scope.file(), "[deoptimize marked code in all contexts]\n");
|
| }
|
| DisallowHeapAllocation no_allocation;
|
| // For all contexts, deoptimize code already marked.
|
| @@ -440,7 +444,8 @@ void Deoptimizer::DeoptimizeMarkedCode(Isolate* isolate) {
|
|
|
| void Deoptimizer::DeoptimizeGlobalObject(JSObject* object) {
|
| if (FLAG_trace_deopt) {
|
| - PrintF("[deoptimize global object @ 0x%08" V8PRIxPTR "]\n",
|
| + CodeTracer::Scope scope(object->GetHeap()->isolate()->GetCodeTracer());
|
| + PrintF(scope.file(), "[deoptimize global object @ 0x%08" V8PRIxPTR "]\n",
|
| reinterpret_cast<intptr_t>(object));
|
| }
|
| if (object->IsJSGlobalProxy()) {
|
| @@ -541,7 +546,7 @@ Deoptimizer::Deoptimizer(Isolate* isolate,
|
| materialized_objects_(NULL),
|
| materialization_value_index_(0),
|
| materialization_object_index_(0),
|
| - trace_(false) {
|
| + trace_scope_(NULL) {
|
| // For COMPILED_STUBs called from builtins, the function pointer is a SMI
|
| // indicating an internal frame.
|
| if (function->IsSmi()) {
|
| @@ -571,7 +576,8 @@ Deoptimizer::Deoptimizer(Isolate* isolate,
|
| StackFrame::Type frame_type = function == NULL
|
| ? StackFrame::STUB
|
| : StackFrame::JAVA_SCRIPT;
|
| - trace_ = TraceEnabledFor(type, frame_type);
|
| + trace_scope_ = TraceEnabledFor(type, frame_type) ?
|
| + new CodeTracer::Scope(isolate->GetCodeTracer()) : NULL;
|
| #ifdef DEBUG
|
| CHECK(AllowHeapAllocation::IsAllowed());
|
| disallow_heap_allocation_ = new DisallowHeapAllocation();
|
| @@ -604,9 +610,10 @@ Code* Deoptimizer::FindOptimizedCode(JSFunction* function,
|
|
|
| void Deoptimizer::PrintFunctionName() {
|
| if (function_->IsJSFunction()) {
|
| - function_->PrintName();
|
| + function_->PrintName(trace_scope_->file());
|
| } else {
|
| - PrintF("%s", Code::Kind2String(compiled_code_->kind()));
|
| + PrintF(trace_scope_->file(),
|
| + "%s", Code::Kind2String(compiled_code_->kind()));
|
| }
|
| }
|
|
|
| @@ -614,6 +621,7 @@ void Deoptimizer::PrintFunctionName() {
|
| Deoptimizer::~Deoptimizer() {
|
| ASSERT(input_ == NULL && output_ == NULL);
|
| ASSERT(disallow_heap_allocation_ == NULL);
|
| + delete trace_scope_;
|
| }
|
|
|
|
|
| @@ -681,13 +689,13 @@ int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data,
|
| return data->PcAndState(i)->value();
|
| }
|
| }
|
| - PrintF("[couldn't find pc offset for node=%d]\n", id.ToInt());
|
| - PrintF("[method: %s]\n", *shared->DebugName()->ToCString());
|
| + PrintF(stderr, "[couldn't find pc offset for node=%d]\n", id.ToInt());
|
| + PrintF(stderr, "[method: %s]\n", *shared->DebugName()->ToCString());
|
| // Print the source code if available.
|
| HeapStringAllocator string_allocator;
|
| StringStream stream(&string_allocator);
|
| shared->SourceCodePrint(&stream, -1);
|
| - PrintF("[source:\n%s\n]", *stream.ToCString());
|
| + PrintF(stderr, "[source:\n%s\n]", *stream.ToCString());
|
|
|
| FATAL("unable to find pc offset during deoptimization");
|
| return -1;
|
| @@ -722,15 +730,19 @@ void Deoptimizer::DoComputeOutputFrames() {
|
| LOG(isolate(), CodeDeoptEvent(compiled_code_));
|
| }
|
| ElapsedTimer timer;
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| timer.Start();
|
| - PrintF("[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ",
|
| + PrintF(trace_scope_->file(),
|
| + "[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ",
|
| MessageFor(bailout_type_),
|
| reinterpret_cast<intptr_t>(function_));
|
| PrintFunctionName();
|
| - PrintF(" @%d, FP to SP delta: %d]\n", bailout_id_, fp_to_sp_delta_);
|
| + PrintF(trace_scope_->file(),
|
| + " @%d, FP to SP delta: %d]\n",
|
| + bailout_id_,
|
| + fp_to_sp_delta_);
|
| if (bailout_type_ == EAGER || bailout_type_ == SOFT) {
|
| - compiled_code_->PrintDeoptLocation(bailout_id_);
|
| + compiled_code_->PrintDeoptLocation(trace_scope_->file(), bailout_id_);
|
| }
|
| }
|
|
|
| @@ -803,15 +815,17 @@ void Deoptimizer::DoComputeOutputFrames() {
|
| }
|
|
|
| // Print some helpful diagnostic information.
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| double ms = timer.Elapsed().InMillisecondsF();
|
| int index = output_count_ - 1; // Index of the topmost frame.
|
| JSFunction* function = output_[index]->GetFunction();
|
| - PrintF("[deoptimizing (%s): end 0x%08" V8PRIxPTR " ",
|
| + PrintF(trace_scope_->file(),
|
| + "[deoptimizing (%s): end 0x%08" V8PRIxPTR " ",
|
| MessageFor(bailout_type_),
|
| reinterpret_cast<intptr_t>(function));
|
| PrintFunctionName();
|
| - PrintF(" @%d => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s,"
|
| + PrintF(trace_scope_->file(),
|
| + " @%d => node=%d, pc=0x%08" V8PRIxPTR ", state=%s, alignment=%s,"
|
| " took %0.3f ms]\n",
|
| bailout_id_,
|
| node_id.ToInt(),
|
| @@ -839,10 +853,11 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
|
| }
|
| unsigned height = iterator->Next();
|
| unsigned height_in_bytes = height * kPointerSize;
|
| - if (trace_) {
|
| - PrintF(" translating ");
|
| - function->PrintName();
|
| - PrintF(" => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(), " translating ");
|
| + function->PrintName(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
|
| }
|
|
|
| // The 'fixed' part of the frame consists of the incoming parameters and
|
| @@ -909,8 +924,9 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
|
| value = output_[frame_index - 1]->GetPc();
|
| }
|
| output_frame->SetCallerPc(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's pc\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -932,8 +948,9 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
|
| has_alignment_padding_ * kPointerSize) == fp_value);
|
| output_frame->SetFp(fp_value);
|
| if (is_topmost) output_frame->SetRegister(fp_reg.code(), fp_value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's fp\n",
|
| fp_value, output_offset, value);
|
| }
|
| @@ -954,8 +971,9 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
|
| output_frame->SetFrameSlot(output_offset, value);
|
| output_frame->SetContext(value);
|
| if (is_topmost) output_frame->SetRegister(context_reg.code(), value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR "; context\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -968,8 +986,9 @@ void Deoptimizer::DoComputeJSFrame(TranslationIterator* iterator,
|
| // input frame.
|
| ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR "; function\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1017,8 +1036,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
|
| unsigned height = iterator->Next();
|
| unsigned height_in_bytes = height * kPointerSize;
|
| - if (trace_) {
|
| - PrintF(" translating arguments adaptor => height=%d\n", height_in_bytes);
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " translating arguments adaptor => height=%d\n", height_in_bytes);
|
| }
|
|
|
| unsigned fixed_frame_size = ArgumentsAdaptorFrameConstants::kFrameSize;
|
| @@ -1052,8 +1072,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| output_offset -= kPCOnStackSize;
|
| intptr_t callers_pc = output_[frame_index - 1]->GetPc();
|
| output_frame->SetCallerPc(output_offset, callers_pc);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's pc\n",
|
| top_address + output_offset, output_offset, callers_pc);
|
| }
|
| @@ -1064,8 +1085,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| output_frame->SetCallerFp(output_offset, value);
|
| intptr_t fp_value = top_address + output_offset;
|
| output_frame->SetFp(fp_value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's fp\n",
|
| fp_value, output_offset, value);
|
| }
|
| @@ -1075,8 +1097,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| intptr_t context = reinterpret_cast<intptr_t>(
|
| Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| output_frame->SetFrameSlot(output_offset, context);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; context (adaptor sentinel)\n",
|
| top_address + output_offset, output_offset, context);
|
| }
|
| @@ -1085,8 +1108,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(function);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; function\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1095,8 +1119,9 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; argc (%d)\n",
|
| top_address + output_offset, output_offset, value, height - 1);
|
| }
|
| @@ -1120,8 +1145,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
|
| unsigned height = iterator->Next();
|
| unsigned height_in_bytes = height * kPointerSize;
|
| - if (trace_) {
|
| - PrintF(" translating construct stub => height=%d\n", height_in_bytes);
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " translating construct stub => height=%d\n", height_in_bytes);
|
| }
|
|
|
| unsigned fixed_frame_size = ConstructFrameConstants::kFrameSize;
|
| @@ -1163,8 +1189,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPCOnStackSize;
|
| intptr_t callers_pc = output_[frame_index - 1]->GetPc();
|
| output_frame->SetCallerPc(output_offset, callers_pc);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's pc\n",
|
| top_address + output_offset, output_offset, callers_pc);
|
| }
|
| @@ -1175,8 +1202,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_frame->SetCallerFp(output_offset, value);
|
| intptr_t fp_value = top_address + output_offset;
|
| output_frame->SetFp(fp_value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's fp\n",
|
| fp_value, output_offset, value);
|
| }
|
| @@ -1185,8 +1213,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = output_[frame_index - 1]->GetContext();
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; context\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1195,8 +1224,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::CONSTRUCT));
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; function (construct sentinel)\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1205,8 +1235,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(construct_stub);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; code object\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1215,8 +1246,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(Smi::FromInt(height - 1));
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; argc (%d)\n",
|
| top_address + output_offset, output_offset, value, height - 1);
|
| }
|
| @@ -1227,8 +1259,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(function);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; constructor function\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1239,8 +1272,9 @@ void Deoptimizer::DoComputeConstructStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = output_frame->GetFrameSlot(output_frame_size - kPointerSize);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; allocated receiver\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1264,8 +1298,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| unsigned height = 0;
|
| unsigned height_in_bytes = height * kPointerSize;
|
| const char* kind = is_setter_stub_frame ? "setter" : "getter";
|
| - if (trace_) {
|
| - PrintF(" translating %s stub => height=%u\n", kind, height_in_bytes);
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " translating %s stub => height=%u\n", kind, height_in_bytes);
|
| }
|
|
|
| // We need 1 stack entry for the return address + 4 stack entries from
|
| @@ -1300,8 +1335,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPCOnStackSize;
|
| intptr_t callers_pc = output_[frame_index - 1]->GetPc();
|
| output_frame->SetCallerPc(output_offset, callers_pc);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| " ; caller's pc\n",
|
| top_address + output_offset, output_offset, callers_pc);
|
| }
|
| @@ -1312,8 +1348,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| output_frame->SetCallerFp(output_offset, value);
|
| intptr_t fp_value = top_address + output_offset;
|
| output_frame->SetFp(fp_value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| " ; caller's fp\n",
|
| fp_value, output_offset, value);
|
| }
|
| @@ -1322,8 +1359,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = output_[frame_index - 1]->GetContext();
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| " ; context\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1332,8 +1370,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| output_offset -= kPointerSize;
|
| value = reinterpret_cast<intptr_t>(Smi::FromInt(StackFrame::INTERNAL));
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| " ; function (%s sentinel)\n",
|
| top_address + output_offset, output_offset, value, kind);
|
| }
|
| @@ -1346,8 +1385,9 @@ void Deoptimizer::DoComputeAccessorStubFrame(TranslationIterator* iterator,
|
| Code* accessor_stub = isolate_->builtins()->builtin(name);
|
| value = reinterpret_cast<intptr_t>(accessor_stub);
|
| output_frame->SetFrameSlot(output_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %u] <- 0x%08" V8PRIxPTR
|
| " ; code object\n",
|
| top_address + output_offset, output_offset, value);
|
| }
|
| @@ -1423,8 +1463,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| int fixed_frame_size = StandardFrameConstants::kFixedFrameSize;
|
| int input_frame_size = input_->GetFrameSize();
|
| int output_frame_size = height_in_bytes + fixed_frame_size;
|
| - if (trace_) {
|
| - PrintF(" translating %s => StubFailureTrampolineStub, height=%d\n",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " translating %s => StubFailureTrampolineStub, height=%d\n",
|
| CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false),
|
| height_in_bytes);
|
| }
|
| @@ -1449,8 +1490,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| unsigned output_frame_offset = output_frame_size - kFPOnStackSize;
|
| intptr_t value = input_->GetFrameSlot(input_frame_offset);
|
| output_frame->SetCallerPc(output_frame_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's pc\n",
|
| top_address + output_frame_offset, output_frame_offset, value);
|
| }
|
| @@ -1463,8 +1505,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| intptr_t frame_ptr = input_->GetRegister(fp_reg.code());
|
| output_frame->SetRegister(fp_reg.code(), frame_ptr);
|
| output_frame->SetFp(frame_ptr);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; caller's fp\n",
|
| top_address + output_frame_offset, output_frame_offset, value);
|
| }
|
| @@ -1476,8 +1519,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| output_frame->SetRegister(context_reg.code(), value);
|
| output_frame_offset -= kPointerSize;
|
| output_frame->SetFrameSlot(output_frame_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; context\n",
|
| top_address + output_frame_offset, output_frame_offset, value);
|
| }
|
| @@ -1487,8 +1531,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| value = reinterpret_cast<intptr_t>(
|
| Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
|
| output_frame->SetFrameSlot(output_frame_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; function (stub failure sentinel)\n",
|
| top_address + output_frame_offset, output_frame_offset, value);
|
| }
|
| @@ -1509,8 +1554,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| }
|
|
|
| output_frame->SetFrameSlot(args_arguments_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; args.arguments %s\n",
|
| top_address + args_arguments_offset, args_arguments_offset, value,
|
| arg_count_known ? "" : "(the hole)");
|
| @@ -1520,8 +1566,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| int length_frame_offset = output_frame_offset;
|
| value = arg_count_known ? caller_arg_count : the_hole;
|
| output_frame->SetFrameSlot(length_frame_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; args.length %s\n",
|
| top_address + length_frame_offset, length_frame_offset, value,
|
| arg_count_known ? "" : "(the hole)");
|
| @@ -1531,8 +1578,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| value = frame_ptr + StandardFrameConstants::kCallerSPOffset -
|
| (output_frame_size - output_frame_offset) + kPointerSize;
|
| output_frame->SetFrameSlot(output_frame_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; args*\n",
|
| top_address + output_frame_offset, output_frame_offset, value);
|
| }
|
| @@ -1550,8 +1598,9 @@ void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
|
| value = frame_ptr + StandardFrameConstants::kCallerSPOffset +
|
| (caller_arg_count - 1) * kPointerSize;
|
| output_frame->SetFrameSlot(args_arguments_offset, value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
|
| V8PRIxPTR " ; args.arguments\n",
|
| top_address + args_arguments_offset, args_arguments_offset, value);
|
| }
|
| @@ -1651,7 +1700,8 @@ Handle<Object> Deoptimizer::MaterializeNextHeapObject() {
|
| break;
|
| }
|
| default:
|
| - PrintF("[couldn't handle instance type %d]\n", map->instance_type());
|
| + PrintF(stderr,
|
| + "[couldn't handle instance type %d]\n", map->instance_type());
|
| UNREACHABLE();
|
| }
|
| }
|
| @@ -1696,8 +1746,9 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
|
| for (int i = 0; i < deferred_heap_numbers_.length(); i++) {
|
| HeapNumberMaterializationDescriptor<Address> d = deferred_heap_numbers_[i];
|
| Handle<Object> num = isolate_->factory()->NewNumber(d.value());
|
| - if (trace_) {
|
| - PrintF("Materialized a new heap number %p [%e] in slot %p\n",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + "Materialized a new heap number %p [%e] in slot %p\n",
|
| reinterpret_cast<void*>(*num),
|
| d.value(),
|
| d.destination());
|
| @@ -1710,8 +1761,9 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
|
| HeapNumberMaterializationDescriptor<int> d =
|
| deferred_objects_double_values_[i];
|
| Handle<Object> num = isolate_->factory()->NewNumber(d.value());
|
| - if (trace_) {
|
| - PrintF("Materialized a new heap number %p [%e] for object at %d\n",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + "Materialized a new heap number %p [%e] for object at %d\n",
|
| reinterpret_cast<void*>(*num),
|
| d.value(),
|
| d.destination());
|
| @@ -1739,19 +1791,21 @@ void Deoptimizer::MaterializeHeapObjects(JavaScriptFrameIterator* it) {
|
| // the materialized object into the frame slot.
|
| Handle<Object> object = MaterializeNextHeapObject();
|
| Memory::Object_at(descriptor.slot_address()) = *object;
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| if (descriptor.is_arguments()) {
|
| - PrintF("Materialized %sarguments object of length %d for %p: ",
|
| + PrintF(trace_scope_->file(),
|
| + "Materialized %sarguments object of length %d for %p: ",
|
| ArgumentsObjectIsAdapted(object_index) ? "(adapted) " : "",
|
| Handle<JSObject>::cast(object)->elements()->length(),
|
| reinterpret_cast<void*>(descriptor.slot_address()));
|
| } else {
|
| - PrintF("Materialized captured object of size %d for %p: ",
|
| + PrintF(trace_scope_->file(),
|
| + "Materialized captured object of size %d for %p: ",
|
| Handle<HeapObject>::cast(object)->Size(),
|
| reinterpret_cast<void*>(descriptor.slot_address()));
|
| }
|
| - object->ShortPrint();
|
| - PrintF("\n");
|
| + object->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(), "\n");
|
| }
|
| }
|
|
|
| @@ -1783,8 +1837,9 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame(
|
| int index = (info->parameters_count() - 1) -
|
| static_cast<int>(slot - parameters_top) / kPointerSize;
|
|
|
| - if (trace_) {
|
| - PrintF("Materializing a new heap number %p [%e] in slot %p"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + "Materializing a new heap number %p [%e] in slot %p"
|
| "for parameter slot #%d\n",
|
| reinterpret_cast<void*>(*num),
|
| d.value(),
|
| @@ -1799,8 +1854,9 @@ void Deoptimizer::MaterializeHeapNumbersForDebuggerInspectableFrame(
|
| int index = info->expression_count() - 1 -
|
| static_cast<int>(slot - expressions_top) / kPointerSize;
|
|
|
| - if (trace_) {
|
| - PrintF("Materializing a new heap number %p [%e] in slot %p"
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + "Materializing a new heap number %p [%e] in slot %p"
|
| "for expression slot #%d\n",
|
| reinterpret_cast<void*>(*num),
|
| d.value(),
|
| @@ -1849,14 +1905,18 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| case Translation::REGISTER: {
|
| int input_reg = iterator->Next();
|
| intptr_t input_value = input_->GetRegister(input_reg);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("0x%08" V8PRIxPTR " ; %s ", input_value,
|
| + PrintF(trace_scope_->file(),
|
| + "0x%08" V8PRIxPTR " ; %s ", input_value,
|
| converter.NameOfCPURegister(input_reg));
|
| - reinterpret_cast<Object*>(input_value)->ShortPrint();
|
| - PrintF("\n");
|
| + reinterpret_cast<Object*>(input_value)->ShortPrint(
|
| + trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + "\n");
|
| }
|
| AddObjectTaggedValue(input_value);
|
| return;
|
| @@ -1866,11 +1926,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| int input_reg = iterator->Next();
|
| intptr_t value = input_->GetRegister(input_reg);
|
| bool is_smi = Smi::IsValid(value);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%" V8PRIdPTR " ; %s (%s)\n", value,
|
| + PrintF(trace_scope_->file(),
|
| + "%" V8PRIdPTR " ; %s (%s)\n", value,
|
| converter.NameOfCPURegister(input_reg),
|
| TraceValueType(is_smi));
|
| }
|
| @@ -1889,11 +1951,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| int input_reg = iterator->Next();
|
| uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
|
| bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%" V8PRIdPTR " ; uint %s (%s)\n", value,
|
| + PrintF(trace_scope_->file(),
|
| + "%" V8PRIdPTR " ; uint %s (%s)\n", value,
|
| converter.NameOfCPURegister(input_reg),
|
| TraceValueType(is_smi));
|
| }
|
| @@ -1911,11 +1975,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| case Translation::DOUBLE_REGISTER: {
|
| int input_reg = iterator->Next();
|
| double value = input_->GetDoubleRegister(input_reg);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%e ; %s\n", value,
|
| + PrintF(trace_scope_->file(),
|
| + "%e ; %s\n", value,
|
| DoubleRegister::AllocationIndexToString(input_reg));
|
| }
|
| AddObjectDoubleValue(value);
|
| @@ -1926,13 +1992,17 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| int input_slot_index = iterator->Next();
|
| unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
|
| intptr_t input_value = input_->GetFrameSlot(input_offset);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("0x%08" V8PRIxPTR " ; [sp + %d] ", input_value, input_offset);
|
| - reinterpret_cast<Object*>(input_value)->ShortPrint();
|
| - PrintF("\n");
|
| + PrintF(trace_scope_->file(),
|
| + "0x%08" V8PRIxPTR " ; [sp + %d] ", input_value, input_offset);
|
| + reinterpret_cast<Object*>(input_value)->ShortPrint(
|
| + trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + "\n");
|
| }
|
| AddObjectTaggedValue(input_value);
|
| return;
|
| @@ -1943,11 +2013,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
|
| intptr_t value = input_->GetFrameSlot(input_offset);
|
| bool is_smi = Smi::IsValid(value);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%" V8PRIdPTR " ; [sp + %d] (%s)\n",
|
| + PrintF(trace_scope_->file(),
|
| + "%" V8PRIdPTR " ; [sp + %d] (%s)\n",
|
| value, input_offset, TraceValueType(is_smi));
|
| }
|
| if (is_smi) {
|
| @@ -1967,11 +2039,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| uintptr_t value =
|
| static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
|
| bool is_smi = (value <= static_cast<uintptr_t>(Smi::kMaxValue));
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%" V8PRIdPTR " ; [sp + %d] (uint %s)\n",
|
| + PrintF(trace_scope_->file(),
|
| + "%" V8PRIdPTR " ; [sp + %d] (uint %s)\n",
|
| value, input_offset, TraceValueType(is_smi));
|
| }
|
| if (is_smi) {
|
| @@ -1989,11 +2063,13 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| int input_slot_index = iterator->Next();
|
| unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
|
| double value = input_->GetDoubleFrameSlot(input_offset);
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - PrintF("%e ; [sp + %d]\n", value, input_offset);
|
| + PrintF(trace_scope_->file(),
|
| + "%e ; [sp + %d]\n", value, input_offset);
|
| }
|
| AddObjectDoubleValue(value);
|
| return;
|
| @@ -2001,12 +2077,14 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
|
|
| case Translation::LITERAL: {
|
| Object* literal = ComputeLiteral(iterator->Next());
|
| - if (trace_) {
|
| - PrintF(" object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " object @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - literal->ShortPrint();
|
| - PrintF(" ; literal\n");
|
| + literal->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " ; literal\n");
|
| }
|
| intptr_t value = reinterpret_cast<intptr_t>(literal);
|
| AddObjectTaggedValue(value);
|
| @@ -2015,12 +2093,14 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
|
|
| case Translation::DUPLICATED_OBJECT: {
|
| int object_index = iterator->Next();
|
| - if (trace_) {
|
| - PrintF(" nested @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " nested @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - isolate_->heap()->arguments_marker()->ShortPrint();
|
| - PrintF(" ; duplicate of object #%d\n", object_index);
|
| + isolate_->heap()->arguments_marker()->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " ; duplicate of object #%d\n", object_index);
|
| }
|
| // Use the materialization marker value as a sentinel and fill in
|
| // the object after the deoptimized frame is built.
|
| @@ -2035,12 +2115,14 @@ void Deoptimizer::DoTranslateObject(TranslationIterator* iterator,
|
| case Translation::CAPTURED_OBJECT: {
|
| int length = iterator->Next();
|
| bool is_args = opcode == Translation::ARGUMENTS_OBJECT;
|
| - if (trace_) {
|
| - PrintF(" nested @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " nested @0x%08" V8PRIxPTR ": [field #%d] <- ",
|
| reinterpret_cast<intptr_t>(object_slot),
|
| field_index);
|
| - isolate_->heap()->arguments_marker()->ShortPrint();
|
| - PrintF(" ; object (length = %d, is_args = %d)\n", length, is_args);
|
| + isolate_->heap()->arguments_marker()->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " ; object (length = %d, is_args = %d)\n", length, is_args);
|
| }
|
| // Use the materialization marker value as a sentinel and fill in
|
| // the object after the deoptimized frame is built.
|
| @@ -2086,15 +2168,17 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| case Translation::REGISTER: {
|
| int input_reg = iterator->Next();
|
| intptr_t input_value = input_->GetRegister(input_reg);
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| PrintF(
|
| + trace_scope_->file(),
|
| " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" V8PRIxPTR " ; %s ",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset,
|
| input_value,
|
| converter.NameOfCPURegister(input_reg));
|
| - reinterpret_cast<Object*>(input_value)->ShortPrint();
|
| - PrintF("\n");
|
| + reinterpret_cast<Object*>(input_value)->ShortPrint(
|
| + trace_scope_->file());
|
| + PrintF(trace_scope_->file(), "\n");
|
| }
|
| output_[frame_index]->SetFrameSlot(output_offset, input_value);
|
| return;
|
| @@ -2105,8 +2189,9 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| intptr_t value = input_->GetRegister(input_reg);
|
| bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
|
| Smi::IsValid(value);
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| PrintF(
|
| + trace_scope_->file(),
|
| " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIdPTR " ; %s (%s)\n",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset,
|
| @@ -2136,8 +2221,9 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| uintptr_t value = static_cast<uintptr_t>(input_->GetRegister(input_reg));
|
| bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
|
| (value <= static_cast<uintptr_t>(Smi::kMaxValue));
|
| - if (trace_) {
|
| + if (trace_scope_ != NULL) {
|
| PrintF(
|
| + trace_scope_->file(),
|
| " 0x%08" V8PRIxPTR ": [top + %d] <- %" V8PRIuPTR
|
| " ; uint %s (%s)\n",
|
| output_[frame_index]->GetTop() + output_offset,
|
| @@ -2166,8 +2252,9 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| case Translation::DOUBLE_REGISTER: {
|
| int input_reg = iterator->Next();
|
| double value = input_->GetDoubleRegister(input_reg);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; %s\n",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset,
|
| value,
|
| @@ -2184,15 +2271,18 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| int input_slot_index = iterator->Next();
|
| unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
|
| intptr_t input_value = input_->GetFrameSlot(input_offset);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": ",
|
| output_[frame_index]->GetTop() + output_offset);
|
| - PrintF("[top + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d] ",
|
| + PrintF(trace_scope_->file(),
|
| + "[top + %d] <- 0x%08" V8PRIxPTR " ; [sp + %d] ",
|
| output_offset,
|
| input_value,
|
| input_offset);
|
| - reinterpret_cast<Object*>(input_value)->ShortPrint();
|
| - PrintF("\n");
|
| + reinterpret_cast<Object*>(input_value)->ShortPrint(
|
| + trace_scope_->file());
|
| + PrintF(trace_scope_->file(), "\n");
|
| }
|
| output_[frame_index]->SetFrameSlot(output_offset, input_value);
|
| return;
|
| @@ -2204,10 +2294,12 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| intptr_t value = input_->GetFrameSlot(input_offset);
|
| bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
|
| Smi::IsValid(value);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": ",
|
| output_[frame_index]->GetTop() + output_offset);
|
| - PrintF("[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n",
|
| + PrintF(trace_scope_->file(),
|
| + "[top + %d] <- %" V8PRIdPTR " ; [sp + %d] (%s)\n",
|
| output_offset,
|
| value,
|
| input_offset,
|
| @@ -2237,10 +2329,12 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| static_cast<uintptr_t>(input_->GetFrameSlot(input_offset));
|
| bool is_smi = (value_type == TRANSLATED_VALUE_IS_TAGGED) &&
|
| (value <= static_cast<uintptr_t>(Smi::kMaxValue));
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": ",
|
| output_[frame_index]->GetTop() + output_offset);
|
| - PrintF("[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n",
|
| + PrintF(trace_scope_->file(),
|
| + "[top + %d] <- %" V8PRIuPTR " ; [sp + %d] (uint32 %s)\n",
|
| output_offset,
|
| value,
|
| input_offset,
|
| @@ -2267,8 +2361,9 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| int input_slot_index = iterator->Next();
|
| unsigned input_offset = input_->GetOffsetFromSlotIndex(input_slot_index);
|
| double value = input_->GetDoubleFrameSlot(input_offset);
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- %e ; [sp + %d]\n",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset,
|
| value,
|
| @@ -2283,12 +2378,13 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
|
|
| case Translation::LITERAL: {
|
| Object* literal = ComputeLiteral(iterator->Next());
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset);
|
| - literal->ShortPrint();
|
| - PrintF(" ; literal\n");
|
| + literal->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(), " ; literal\n");
|
| }
|
| intptr_t value = reinterpret_cast<intptr_t>(literal);
|
| output_[frame_index]->SetFrameSlot(output_offset, value);
|
| @@ -2297,12 +2393,14 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
|
|
| case Translation::DUPLICATED_OBJECT: {
|
| int object_index = iterator->Next();
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset);
|
| - isolate_->heap()->arguments_marker()->ShortPrint();
|
| - PrintF(" ; duplicate of object #%d\n", object_index);
|
| + isolate_->heap()->arguments_marker()->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " ; duplicate of object #%d\n", object_index);
|
| }
|
| // Use the materialization marker value as a sentinel and fill in
|
| // the object after the deoptimized frame is built.
|
| @@ -2318,12 +2416,14 @@ void Deoptimizer::DoTranslateCommand(TranslationIterator* iterator,
|
| case Translation::CAPTURED_OBJECT: {
|
| int length = iterator->Next();
|
| bool is_args = opcode == Translation::ARGUMENTS_OBJECT;
|
| - if (trace_) {
|
| - PrintF(" 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| + if (trace_scope_ != NULL) {
|
| + PrintF(trace_scope_->file(),
|
| + " 0x%08" V8PRIxPTR ": [top + %d] <- ",
|
| output_[frame_index]->GetTop() + output_offset,
|
| output_offset);
|
| - isolate_->heap()->arguments_marker()->ShortPrint();
|
| - PrintF(" ; object (length = %d, is_args = %d)\n", length, is_args);
|
| + isolate_->heap()->arguments_marker()->ShortPrint(trace_scope_->file());
|
| + PrintF(trace_scope_->file(),
|
| + " ; object (length = %d, is_args = %d)\n", length, is_args);
|
| }
|
| // Use the materialization marker value as a sentinel and fill in
|
| // the object after the deoptimized frame is built.
|
|
|