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

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: fix 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 namespace {
958
959 bool CannotDeoptFromAsmCode(Code* code, JSFunction* function) {
960 return code->is_turbofanned() && function->shared()->asm_function() &&
961 !FLAG_turbo_asm_deoptimization;
962 }
963
964 } // namespace
965
957 FrameSummary::FrameSummary(Object* receiver, JSFunction* function, 966 FrameSummary::FrameSummary(Object* receiver, JSFunction* function,
958 AbstractCode* abstract_code, int code_offset, 967 AbstractCode* abstract_code, int code_offset,
959 bool is_constructor) 968 bool is_constructor)
960 : receiver_(receiver, function->GetIsolate()), 969 : receiver_(receiver, function->GetIsolate()),
961 function_(function), 970 function_(function),
962 abstract_code_(abstract_code), 971 abstract_code_(abstract_code),
963 code_offset_(code_offset), 972 code_offset_(code_offset),
964 is_constructor_(is_constructor) {} 973 is_constructor_(is_constructor) {
974 DCHECK(abstract_code->IsBytecodeArray() ||
975 Code::cast(abstract_code)->kind() != Code::OPTIMIZED_FUNCTION ||
976 CannotDeoptFromAsmCode(Code::cast(abstract_code), function));
977 }
965 978
966 void FrameSummary::Print() { 979 void FrameSummary::Print() {
967 PrintF("receiver: "); 980 PrintF("receiver: ");
968 receiver_->ShortPrint(); 981 receiver_->ShortPrint();
969 PrintF("\nfunction: "); 982 PrintF("\nfunction: ");
970 function_->shared()->DebugName()->ShortPrint(); 983 function_->shared()->DebugName()->ShortPrint();
971 PrintF("\ncode: "); 984 PrintF("\ncode: ");
972 abstract_code_->ShortPrint(); 985 abstract_code_->ShortPrint();
973 if (abstract_code_->IsCode()) { 986 if (abstract_code_->IsCode()) {
974 Code* code = abstract_code_->GetCode(); 987 Code* code = abstract_code_->GetCode();
975 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT "); 988 if (code->kind() == Code::FUNCTION) PrintF(" UNOPT ");
976 if (code->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT "); 989 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
990 DCHECK(CannotDeoptFromAsmCode(code, *function()));
991 PrintF(" ASM ");
992 }
977 } else { 993 } else {
978 PrintF(" BYTECODE "); 994 PrintF(" BYTECODE ");
979 } 995 }
980 PrintF("\npc: %d\n", code_offset_); 996 PrintF("\npc: %d\n", code_offset_);
981 } 997 }
982 998
983 999
984 void OptimizedFrame::Summarize(List<FrameSummary>* frames) { 1000 void OptimizedFrame::Summarize(List<FrameSummary>* frames) {
985 DCHECK(frames->length() == 0); 1001 DCHECK(frames->length() == 0);
986 DCHECK(is_optimized()); 1002 DCHECK(is_optimized());
987 1003
988 // Delegate to JS frame in absence of turbofan deoptimization. 1004 // Delegate to JS frame in absence of turbofan deoptimization.
989 // TODO(turbofan): Revisit once we support deoptimization across the board. 1005 // TODO(turbofan): Revisit once we support deoptimization across the board.
990 Code* code = LookupCode(); 1006 Code* code = LookupCode();
991 if (code->kind() == Code::BUILTIN || 1007 if (code->kind() == Code::BUILTIN ||
992 (code->is_turbofanned() && function()->shared()->asm_function() && 1008 CannotDeoptFromAsmCode(code, function())) {
993 !FLAG_turbo_asm_deoptimization)) {
994 return JavaScriptFrame::Summarize(frames); 1009 return JavaScriptFrame::Summarize(frames);
995 } 1010 }
996 1011
997 DisallowHeapAllocation no_gc; 1012 DisallowHeapAllocation no_gc;
998 int deopt_index = Safepoint::kNoDeoptimizationIndex; 1013 int deopt_index = Safepoint::kNoDeoptimizationIndex;
999 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index); 1014 DeoptimizationInputData* const data = GetDeoptimizationData(&deopt_index);
1000 FixedArray* const literal_array = data->LiteralArray(); 1015 FixedArray* const literal_array = data->LiteralArray();
1001 1016
1002 TranslationIterator it(data->TranslationByteArray(), 1017 TranslationIterator it(data->TranslationByteArray(),
1003 data->TranslationIndex(deopt_index)->value()); 1018 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()) { 1737 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1723 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1738 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1724 list.Add(frame, zone); 1739 list.Add(frame, zone);
1725 } 1740 }
1726 return list.ToVector(); 1741 return list.ToVector();
1727 } 1742 }
1728 1743
1729 1744
1730 } // namespace internal 1745 } // namespace internal
1731 } // namespace v8 1746 } // 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