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

Side by Side Diff: src/frames.cc

Issue 1846183002: Add assertions to FrameSummary and Code::SourcePosition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | src/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/frames.h" 5 #include "src/frames.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopeinfo.h" 10 #include "src/ast/scopeinfo.h"
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 void JavaScriptFrame::RestoreOperandStack(FixedArray* store) { 948 void JavaScriptFrame::RestoreOperandStack(FixedArray* store) {
949 int operands_count = store->length(); 949 int operands_count = store->length();
950 DCHECK_LE(operands_count, ComputeOperandsCount()); 950 DCHECK_LE(operands_count, ComputeOperandsCount());
951 for (int i = 0; i < operands_count; i++) { 951 for (int i = 0; i < operands_count; i++) {
952 DCHECK_EQ(GetOperand(i), isolate()->heap()->the_hole_value()); 952 DCHECK_EQ(GetOperand(i), isolate()->heap()->the_hole_value());
953 Memory::Object_at(GetOperandSlot(i)) = store->get(i); 953 Memory::Object_at(GetOperandSlot(i)) = store->get(i);
954 } 954 }
955 } 955 }
956 956
957 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) {
Benedikt Meurer 2016/04/01 07:50:21 Nit: Put into anonymous namespace.
958 return code->is_turbofanned() && function->shared()->asm_function() &&
959 !FLAG_turbo_asm_deoptimization;
960 }
961
957 FrameSummary::FrameSummary(Object* receiver, JSFunction* function, 962 FrameSummary::FrameSummary(Object* receiver, JSFunction* function,
958 AbstractCode* abstract_code, int code_offset, 963 AbstractCode* abstract_code, int code_offset,
959 bool is_constructor) 964 bool is_constructor)
960 : receiver_(receiver, function->GetIsolate()), 965 : receiver_(receiver, function->GetIsolate()),
961 function_(function), 966 function_(function),
962 abstract_code_(abstract_code), 967 abstract_code_(abstract_code),
963 code_offset_(code_offset), 968 code_offset_(code_offset),
964 is_constructor_(is_constructor) {} 969 is_constructor_(is_constructor) {
970 DCHECK(abstract_code->IsBytecodeArray() ||
971 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION ||
972 CannotDeoptFromAsmCode(Code::cast(abstract_code), function));
973 }
965 974
966 void FrameSummary::Print() { 975 void FrameSummary::Print() {
967 PrintF("receiver: "); 976 PrintF("receiver: ");
968 receiver_->ShortPrint(); 977 receiver_->ShortPrint();
969 PrintF("\nfunction: "); 978 PrintF("\nfunction: ");
970 function_->shared()->DebugName()->ShortPrint(); 979 function_->shared()->DebugName()->ShortPrint();
971 PrintF("\ncode: "); 980 PrintF("\ncode: ");
972 abstract_code_->ShortPrint(); 981 abstract_code_->ShortPrint();
973 if (abstract_code_->IsCode()) { 982 if (abstract_code_->IsCode()) {
974 Code* code = abstract_code_->GetCode(); 983 Code* code = abstract_code_->GetCode();
975 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); 984 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT ");
976 if (code->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT "); 985 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
986 DCHECK(CannotDeoptFromAsmCode(code, *function()));
987 PrintF(" ASM ");
988 }
977 } else { 989 } else {
978 PrintF(" BYTECODE "); 990 PrintF(" BYTECODE ");
979 } 991 }
980 PrintF("\npc: %d\n", code_offset_); 992 PrintF("\npc: %d\n", code_offset_);
981 } 993 }
982 994
983 995
984 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { 996 void OptimizedFrame::Summarize(List<FrameSummary>* frames) {
985 DCHECK(frames->length() == 0); 997 DCHECK(frames->length() == 0);
986 DCHECK(is_optimized()); 998 DCHECK(is_optimized());
987 999
988 // Delegate to JS frame in absence of turbofan deoptimization. 1000 // Delegate to JS frame in absence of turbofan deoptimization.
989 // TODO(turbofan): Revisit once we support deoptimization across the board. 1001 // TODO(turbofan): Revisit once we support deoptimization across the board.
990 Code* code = LookupCode(); 1002 Code* code = LookupCode();
991 if (code->kind() == Code::BUILTIN || 1003 if (code->kind() == Code::BUILTIN ||
992 (code->is_turbofanned() && function()->shared()->asm_function() && 1004 CannotDeoptFromAsmCode(code, function())) {
993 !FLAG_turbo_asm_deoptimization)) {
994 return JavaScriptFrame::Summarize(frames); 1005 return JavaScriptFrame::Summarize(frames);
995 } 1006 }
996 1007
997 DisallowHeapAllocation no_gc; 1008 DisallowHeapAllocation no_gc;
998 int deopt_index = Safepoint::kNoDeoptimizationIndex; 1009 int deopt_index = Safepoint::kNoDeoptimizationIndex;
999 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index); 1010 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index);
1000 FixedArray* const literal_array = data->LiteralArray(); 1011 FixedArray* const literal_array = data->LiteralArray();
1001 1012
1002 TranslationIterator it(data->TranslationByteArray(), 1013 TranslationIterator it(data->TranslationByteArray(),
1003 data->TranslationIndex(deopt_index)->value()); 1014 data->TranslationIndex(deopt_index)->value());
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1733 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1723 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1734 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1724 list.Add(frame, zone); 1735 list.Add(frame, zone);
1725 } 1736 }
1726 return list.ToVector(); 1737 return list.ToVector();
1727 } 1738 }
1728 1739
1729 1740
1730 } // namespace internal 1741 } // namespace internal
1731 } // namespace v8 1742 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698