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

Side by Side Diff: src/deoptimizer.cc

Issue 515723004: Deoptimize context value in Turbofan (and Crankshaft). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix tests. Created 6 years, 3 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.h ('k') | src/hydrogen.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/disasm.h" 10 #include "src/disasm.h"
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 BailoutId node_id = BailoutId(iterator->Next()); 919 BailoutId node_id = BailoutId(iterator->Next());
920 JSFunction* function; 920 JSFunction* function;
921 if (frame_index != 0) { 921 if (frame_index != 0) {
922 function = JSFunction::cast(ComputeLiteral(iterator->Next())); 922 function = JSFunction::cast(ComputeLiteral(iterator->Next()));
923 } else { 923 } else {
924 int closure_id = iterator->Next(); 924 int closure_id = iterator->Next();
925 USE(closure_id); 925 USE(closure_id);
926 CHECK_EQ(Translation::kSelfLiteralId, closure_id); 926 CHECK_EQ(Translation::kSelfLiteralId, closure_id);
927 function = function_; 927 function = function_;
928 } 928 }
929 unsigned height = iterator->Next(); 929 unsigned height = iterator->Next() - 1; // Do not count the context.
930 unsigned height_in_bytes = height * kPointerSize; 930 unsigned height_in_bytes = height * kPointerSize;
931 if (trace_scope_ != NULL) { 931 if (trace_scope_ != NULL) {
932 PrintF(trace_scope_->file(), " translating "); 932 PrintF(trace_scope_->file(), " translating ");
933 function->PrintName(trace_scope_->file()); 933 function->PrintName(trace_scope_->file());
934 PrintF(trace_scope_->file(), 934 PrintF(trace_scope_->file(),
935 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes); 935 " => node=%d, height=%d\n", node_id.ToInt(), height_in_bytes);
936 } 936 }
937 937
938 // The 'fixed' part of the frame consists of the incoming parameters and 938 // The 'fixed' part of the frame consists of the incoming parameters and
939 // the part described by JavaScriptFrameConstants. 939 // the part described by JavaScriptFrameConstants.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 top_address + output_offset, output_offset, value); 1054 top_address + output_offset, output_offset, value);
1055 } 1055 }
1056 } 1056 }
1057 1057
1058 // For the bottommost output frame the context can be gotten from the input 1058 // For the bottommost output frame the context can be gotten from the input
1059 // frame. For all subsequent output frames it can be gotten from the function 1059 // frame. For all subsequent output frames it can be gotten from the function
1060 // so long as we don't inline functions that need local contexts. 1060 // so long as we don't inline functions that need local contexts.
1061 Register context_reg = JavaScriptFrame::context_register(); 1061 Register context_reg = JavaScriptFrame::context_register();
1062 output_offset -= kPointerSize; 1062 output_offset -= kPointerSize;
1063 input_offset -= kPointerSize; 1063 input_offset -= kPointerSize;
1064 if (is_bottommost) { 1064 // Read the context from the translations.
1065 value = input_->GetFrameSlot(input_offset); 1065 DoTranslateCommand(iterator, frame_index, output_offset);
1066 } else { 1066 value = output_frame->GetFrameSlot(output_offset);
1067 value = reinterpret_cast<intptr_t>(function->context()); 1067 // The context should not be a placeholder for a materialized object.
1068 } 1068 CHECK(value !=
1069 output_frame->SetFrameSlot(output_offset, value); 1069 reinterpret_cast<intptr_t>(isolate_->heap()->arguments_marker()));
1070 output_frame->SetContext(value); 1070 output_frame->SetContext(value);
1071 if (is_topmost) output_frame->SetRegister(context_reg.code(), value); 1071 if (is_topmost) output_frame->SetRegister(context_reg.code(), value);
1072 if (trace_scope_ != NULL) { 1072 if (trace_scope_ != NULL) {
1073 PrintF(trace_scope_->file(), 1073 PrintF(trace_scope_->file(),
1074 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08" 1074 " 0x%08" V8PRIxPTR ": [top + %d] <- 0x%08"
1075 V8PRIxPTR "; context\n", 1075 V8PRIxPTR "; context\n",
1076 top_address + output_offset, output_offset, value); 1076 top_address + output_offset, output_offset, value);
1077 } 1077 }
1078 1078
1079 // The function was mentioned explicitly in the BEGIN_FRAME. 1079 // The function was mentioned explicitly in the BEGIN_FRAME.
(...skipping 2543 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 return new_array; 3623 return new_array;
3624 } 3624 }
3625 3625
3626 3626
3627 DeoptimizedFrameInfo::DeoptimizedFrameInfo(Deoptimizer* deoptimizer, 3627 DeoptimizedFrameInfo::DeoptimizedFrameInfo(Deoptimizer* deoptimizer,
3628 int frame_index, 3628 int frame_index,
3629 bool has_arguments_adaptor, 3629 bool has_arguments_adaptor,
3630 bool has_construct_stub) { 3630 bool has_construct_stub) {
3631 FrameDescription* output_frame = deoptimizer->output_[frame_index]; 3631 FrameDescription* output_frame = deoptimizer->output_[frame_index];
3632 function_ = output_frame->GetFunction(); 3632 function_ = output_frame->GetFunction();
3633 context_ = reinterpret_cast<Object*>(output_frame->GetContext());
3633 has_construct_stub_ = has_construct_stub; 3634 has_construct_stub_ = has_construct_stub;
3634 expression_count_ = output_frame->GetExpressionCount(); 3635 expression_count_ = output_frame->GetExpressionCount();
3635 expression_stack_ = new Object*[expression_count_]; 3636 expression_stack_ = new Object*[expression_count_];
3636 // Get the source position using the unoptimized code. 3637 // Get the source position using the unoptimized code.
3637 Address pc = reinterpret_cast<Address>(output_frame->GetPc()); 3638 Address pc = reinterpret_cast<Address>(output_frame->GetPc());
3638 Code* code = Code::cast(deoptimizer->isolate()->FindCodeObject(pc)); 3639 Code* code = Code::cast(deoptimizer->isolate()->FindCodeObject(pc));
3639 source_position_ = code->SourcePosition(pc); 3640 source_position_ = code->SourcePosition(pc);
3640 3641
3641 for (int i = 0; i < expression_count_; i++) { 3642 for (int i = 0; i < expression_count_; i++) {
3642 SetExpression(i, output_frame->GetExpression(i)); 3643 SetExpression(i, output_frame->GetExpression(i));
(...skipping 13 matching lines...) Expand all
3656 3657
3657 3658
3658 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() { 3659 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() {
3659 delete[] expression_stack_; 3660 delete[] expression_stack_;
3660 delete[] parameters_; 3661 delete[] parameters_;
3661 } 3662 }
3662 3663
3663 3664
3664 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3665 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3665 v->VisitPointer(BitCast<Object**>(&function_)); 3666 v->VisitPointer(BitCast<Object**>(&function_));
3667 v->VisitPointer(&context_);
3666 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3668 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3667 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3669 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3668 } 3670 }
3669 3671
3670 } } // namespace v8::internal 3672 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/deoptimizer.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698