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

Side by Side Diff: src/frames.cc

Issue 2647433002: Clarify the order of frame summaries and rename getters (Closed)
Patch Set: Fix bug Created 3 years, 11 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 | « src/frames.h ('k') | 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 <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 field.~type(); \ 1256 field.~type(); \
1257 break; 1257 break;
1258 switch (base_.kind()) { 1258 switch (base_.kind()) {
1259 FRAME_SUMMARY_VARIANTS(FRAME_SUMMARY_DESTR) 1259 FRAME_SUMMARY_VARIANTS(FRAME_SUMMARY_DESTR)
1260 default: 1260 default:
1261 UNREACHABLE(); 1261 UNREACHABLE();
1262 } 1262 }
1263 #undef FRAME_SUMMARY_DESTR 1263 #undef FRAME_SUMMARY_DESTR
1264 } 1264 }
1265 1265
1266 FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) { 1266 FrameSummary FrameSummary::GetTop(const StandardFrame* frame) {
1267 DCHECK_LE(0, index);
1268 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); 1267 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
1269 frame->Summarize(&frames); 1268 frame->Summarize(&frames);
1270 DCHECK_GT(frames.length(), index); 1269 DCHECK_LT(0, frames.length());
1271 return frames[index]; 1270 return frames.last();
1271 }
1272
1273 FrameSummary FrameSummary::GetBottom(const StandardFrame* frame) {
1274 return Get(frame, 0);
1272 } 1275 }
1273 1276
1274 FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) { 1277 FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) {
1275 List<FrameSummary> frames(1); 1278 List<FrameSummary> frames(1);
1276 frame->Summarize(&frames); 1279 frame->Summarize(&frames);
1277 DCHECK_EQ(1, frames.length()); 1280 DCHECK_EQ(1, frames.length());
1278 return frames.first(); 1281 return frames.first();
1279 } 1282 }
1280 1283
1284 FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) {
1285 DCHECK_LE(0, index);
1286 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
1287 frame->Summarize(&frames);
1288 DCHECK_GT(frames.length(), index);
1289 return frames[index];
1290 }
1291
1281 #define FRAME_SUMMARY_DISPATCH(ret, name) \ 1292 #define FRAME_SUMMARY_DISPATCH(ret, name) \
1282 ret FrameSummary::name() const { \ 1293 ret FrameSummary::name() const { \
1283 switch (base_.kind()) { \ 1294 switch (base_.kind()) { \
1284 case JAVA_SCRIPT: \ 1295 case JAVA_SCRIPT: \
1285 return java_script_summary_.name(); \ 1296 return java_script_summary_.name(); \
1286 case WASM_COMPILED: \ 1297 case WASM_COMPILED: \
1287 return wasm_compiled_summary_.name(); \ 1298 return wasm_compiled_summary_.name(); \
1288 case WASM_INTERPRETED: \ 1299 case WASM_INTERPRETED: \
1289 return wasm_interpreted_summary_.name(); \ 1300 return wasm_interpreted_summary_.name(); \
1290 default: \ 1301 default: \
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 // This is a live stack frame, there must be a live wasm instance available. 1785 // This is a live stack frame, there must be a live wasm instance available.
1775 DCHECK_NOT_NULL(ret); 1786 DCHECK_NOT_NULL(ret);
1776 return ret; 1787 return ret;
1777 } 1788 }
1778 1789
1779 Script* WasmInterpreterEntryFrame::script() const { 1790 Script* WasmInterpreterEntryFrame::script() const {
1780 return wasm_instance()->compiled_module()->script(); 1791 return wasm_instance()->compiled_module()->script();
1781 } 1792 }
1782 1793
1783 int WasmInterpreterEntryFrame::position() const { 1794 int WasmInterpreterEntryFrame::position() const {
1784 return FrameSummary::GetFirst(this).AsWasmInterpreted().SourcePosition(); 1795 return FrameSummary::GetBottom(this).AsWasmInterpreted().SourcePosition();
1785 } 1796 }
1786 1797
1787 Address WasmInterpreterEntryFrame::GetCallerStackPointer() const { 1798 Address WasmInterpreterEntryFrame::GetCallerStackPointer() const {
1788 return fp() + ExitFrameConstants::kCallerSPOffset; 1799 return fp() + ExitFrameConstants::kCallerSPOffset;
1789 } 1800 }
1790 1801
1791 namespace { 1802 namespace {
1792 1803
1793 1804
1794 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, 1805 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 2230 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
2220 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 2231 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
2221 list.Add(frame, zone); 2232 list.Add(frame, zone);
2222 } 2233 }
2223 return list.ToVector(); 2234 return list.ToVector();
2224 } 2235 }
2225 2236
2226 2237
2227 } // namespace internal 2238 } // namespace internal
2228 } // namespace v8 2239 } // namespace v8
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698