Commit edc03cea authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Replace List with std::vector in debugger code.

Bug: v8:6333
Change-Id: I6292bc6b31c696dddd3e3361a519e7275404b144
Reviewed-on: https://chromium-review.googlesource.com/631879Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47663}
parent cff32a6d
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "src/factory.h" #include "src/factory.h"
#include "src/frames-inl.h" #include "src/frames-inl.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/list-inl.h"
#include "src/messages.h" #include "src/messages.h"
#include "src/property-details.h" #include "src/property-details.h"
#include "src/prototype.h" #include "src/prototype.h"
...@@ -822,10 +821,12 @@ static Handle<Object> ArgumentsForInlinedFunction( ...@@ -822,10 +821,12 @@ static Handle<Object> ArgumentsForInlinedFunction(
static int FindFunctionInFrame(JavaScriptFrame* frame, static int FindFunctionInFrame(JavaScriptFrame* frame,
Handle<JSFunction> function) { Handle<JSFunction> function) {
List<FrameSummary> frames(2); std::vector<FrameSummary> frames;
frame->Summarize(&frames); frame->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0; i--) { for (size_t i = frames.size(); i != 0; i--) {
if (*frames[i].AsJavaScript().function() == *function) return i; if (*frames[i - 1].AsJavaScript().function() == *function) {
return static_cast<int>(i) - 1;
}
} }
return -1; return -1;
} }
...@@ -929,16 +930,16 @@ static inline bool AllowAccessToFunction(Context* current_context, ...@@ -929,16 +930,16 @@ static inline bool AllowAccessToFunction(Context* current_context,
class FrameFunctionIterator { class FrameFunctionIterator {
public: public:
explicit FrameFunctionIterator(Isolate* isolate) explicit FrameFunctionIterator(Isolate* isolate)
: isolate_(isolate), frame_iterator_(isolate), frames_(2), index_(0) { : isolate_(isolate), frame_iterator_(isolate) {
GetFrames(); GetFrames();
} }
MaybeHandle<JSFunction> next() { MaybeHandle<JSFunction> next() {
while (true) { while (true) {
if (frames_.length() == 0) return MaybeHandle<JSFunction>(); if (frames_.empty()) return MaybeHandle<JSFunction>();
Handle<JSFunction> next_function = Handle<JSFunction> next_function =
frames_[index_].AsJavaScript().function(); frames_.back().AsJavaScript().function();
index_--; frames_.pop_back();
if (index_ < 0) { if (frames_.empty()) {
GetFrames(); GetFrames();
} }
// Skip functions from other origins. // Skip functions from other origins.
...@@ -960,18 +961,16 @@ class FrameFunctionIterator { ...@@ -960,18 +961,16 @@ class FrameFunctionIterator {
private: private:
void GetFrames() { void GetFrames() {
frames_.Rewind(0); DCHECK(frames_.empty());
if (frame_iterator_.done()) return; if (frame_iterator_.done()) return;
JavaScriptFrame* frame = frame_iterator_.frame(); JavaScriptFrame* frame = frame_iterator_.frame();
frame->Summarize(&frames_); frame->Summarize(&frames_);
DCHECK(frames_.length() > 0); DCHECK(!frames_.empty());
frame_iterator_.Advance(); frame_iterator_.Advance();
index_ = frames_.length() - 1;
} }
Isolate* isolate_; Isolate* isolate_;
JavaScriptFrameIterator frame_iterator_; JavaScriptFrameIterator frame_iterator_;
List<FrameSummary> frames_; std::vector<FrameSummary> frames_;
int index_;
}; };
......
...@@ -210,12 +210,13 @@ int DebugFrameHelper::FindIndexedNonNativeFrame(StackTraceFrameIterator* it, ...@@ -210,12 +210,13 @@ int DebugFrameHelper::FindIndexedNonNativeFrame(StackTraceFrameIterator* it,
int index) { int index) {
int count = -1; int count = -1;
for (; !it->done(); it->Advance()) { for (; !it->done(); it->Advance()) {
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
it->frame()->Summarize(&frames); it->frame()->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0; i--) { for (size_t i = frames.size(); i != 0; i--) {
// Omit functions from native and extension scripts. // Omit functions from native and extension scripts.
if (!frames[i].is_subject_to_debugging()) continue; if (!frames[i - 1].is_subject_to_debugging()) continue;
if (++count == index) return i; if (++count == index) return static_cast<int>(i) - 1;
} }
} }
return -1; return -1;
......
...@@ -27,9 +27,10 @@ DebugStackTraceIterator::DebugStackTraceIterator(Isolate* isolate, int index) ...@@ -27,9 +27,10 @@ DebugStackTraceIterator::DebugStackTraceIterator(Isolate* isolate, int index)
iterator_(isolate, isolate->debug()->break_frame_id()), iterator_(isolate, isolate->debug()->break_frame_id()),
is_top_frame_(true) { is_top_frame_(true) {
if (iterator_.done()) return; if (iterator_.done()) return;
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
iterator_.frame()->Summarize(&frames); iterator_.frame()->Summarize(&frames);
inlined_frame_index_ = frames.length(); inlined_frame_index_ = static_cast<int>(frames.size());
Advance(); Advance();
for (; !Done() && index > 0; --index) Advance(); for (; !Done() && index > 0; --index) Advance();
} }
...@@ -58,9 +59,10 @@ void DebugStackTraceIterator::Advance() { ...@@ -58,9 +59,10 @@ void DebugStackTraceIterator::Advance() {
frame_inspector_.reset(); frame_inspector_.reset();
iterator_.Advance(); iterator_.Advance();
if (iterator_.done()) break; if (iterator_.done()) break;
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
iterator_.frame()->Summarize(&frames); iterator_.frame()->Summarize(&frames);
inlined_frame_index_ = frames.length(); inlined_frame_index_ = static_cast<int>(frames.size());
} }
} }
......
...@@ -809,20 +809,20 @@ void Debug::PrepareStepOnThrow() { ...@@ -809,20 +809,20 @@ void Debug::PrepareStepOnThrow() {
// Deoptimize frame to ensure calls are checked for step-in. // Deoptimize frame to ensure calls are checked for step-in.
Deoptimizer::DeoptimizeFunction(frame->function()); Deoptimizer::DeoptimizeFunction(frame->function());
} }
List<FrameSummary> summaries; std::vector<FrameSummary> summaries;
frame->Summarize(&summaries); frame->Summarize(&summaries);
for (int i = summaries.length() - 1; i >= 0; i--, current_frame_count--) { for (size_t i = summaries.size(); i != 0; i--, current_frame_count--) {
const FrameSummary& summary = summaries[i - 1];
if (!found_handler) { if (!found_handler) {
// We have yet to find the handler. If the frame inlines multiple // We have yet to find the handler. If the frame inlines multiple
// functions, we have to check each one for the handler. // functions, we have to check each one for the handler.
// If it only contains one function, we already found the handler. // If it only contains one function, we already found the handler.
if (summaries.length() > 1) { if (summaries.size() > 1) {
Handle<AbstractCode> code = Handle<AbstractCode> code = summary.AsJavaScript().abstract_code();
summaries[i].AsJavaScript().abstract_code();
CHECK_EQ(AbstractCode::INTERPRETED_FUNCTION, code->kind()); CHECK_EQ(AbstractCode::INTERPRETED_FUNCTION, code->kind());
BytecodeArray* bytecode = code->GetBytecodeArray(); BytecodeArray* bytecode = code->GetBytecodeArray();
HandlerTable* table = HandlerTable::cast(bytecode->handler_table()); HandlerTable* table = HandlerTable::cast(bytecode->handler_table());
int code_offset = summaries[i].code_offset(); int code_offset = summary.code_offset();
HandlerTable::CatchPrediction prediction; HandlerTable::CatchPrediction prediction;
int index = table->LookupRange(code_offset, nullptr, &prediction); int index = table->LookupRange(code_offset, nullptr, &prediction);
if (index > 0) found_handler = true; if (index > 0) found_handler = true;
...@@ -839,7 +839,7 @@ void Debug::PrepareStepOnThrow() { ...@@ -839,7 +839,7 @@ void Debug::PrepareStepOnThrow() {
continue; continue;
} }
Handle<SharedFunctionInfo> info( Handle<SharedFunctionInfo> info(
summaries[i].AsJavaScript().function()->shared()); summary.AsJavaScript().function()->shared());
if (IsBlackboxed(info)) continue; if (IsBlackboxed(info)) continue;
FloodWithOneShot(info); FloodWithOneShot(info);
return; return;
......
...@@ -768,7 +768,7 @@ void StandardFrame::ComputeCallerState(State* state) const { ...@@ -768,7 +768,7 @@ void StandardFrame::ComputeCallerState(State* state) const {
bool StandardFrame::IsConstructor() const { return false; } bool StandardFrame::IsConstructor() const { return false; }
void StandardFrame::Summarize(List<FrameSummary>* functions, void StandardFrame::Summarize(std::vector<FrameSummary>* functions,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
// This should only be called on frames which override this method. // This should only be called on frames which override this method.
UNREACHABLE(); UNREACHABLE();
...@@ -993,16 +993,16 @@ void JavaScriptFrame::GetFunctions( ...@@ -993,16 +993,16 @@ void JavaScriptFrame::GetFunctions(
} }
} }
void JavaScriptFrame::Summarize(List<FrameSummary>* functions, void JavaScriptFrame::Summarize(std::vector<FrameSummary>* functions,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
DCHECK(functions->length() == 0); DCHECK(functions->empty());
Code* code = LookupCode(); Code* code = LookupCode();
int offset = static_cast<int>(pc() - code->instruction_start()); int offset = static_cast<int>(pc() - code->instruction_start());
AbstractCode* abstract_code = AbstractCode::cast(code); AbstractCode* abstract_code = AbstractCode::cast(code);
FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver(), FrameSummary::JavaScriptFrameSummary summary(isolate(), receiver(),
function(), abstract_code, function(), abstract_code,
offset, IsConstructor(), mode); offset, IsConstructor(), mode);
functions->Add(summary); functions->push_back(summary);
} }
JSFunction* JavaScriptFrame::function() const { JSFunction* JavaScriptFrame::function() const {
...@@ -1299,10 +1299,11 @@ FrameSummary::~FrameSummary() { ...@@ -1299,10 +1299,11 @@ FrameSummary::~FrameSummary() {
} }
FrameSummary FrameSummary::GetTop(const StandardFrame* frame) { FrameSummary FrameSummary::GetTop(const StandardFrame* frame) {
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames); frame->Summarize(&frames);
DCHECK_LT(0, frames.length()); DCHECK_LT(0, frames.size());
return frames.last(); return frames.back();
} }
FrameSummary FrameSummary::GetBottom(const StandardFrame* frame) { FrameSummary FrameSummary::GetBottom(const StandardFrame* frame) {
...@@ -1310,17 +1311,18 @@ FrameSummary FrameSummary::GetBottom(const StandardFrame* frame) { ...@@ -1310,17 +1311,18 @@ FrameSummary FrameSummary::GetBottom(const StandardFrame* frame) {
} }
FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) { FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) {
List<FrameSummary> frames(1); std::vector<FrameSummary> frames;
frame->Summarize(&frames); frame->Summarize(&frames);
DCHECK_EQ(1, frames.length()); DCHECK_EQ(1, frames.size());
return frames.first(); return frames.front();
} }
FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) { FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) {
DCHECK_LE(0, index); DCHECK_LE(0, index);
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames); frame->Summarize(&frames);
DCHECK_GT(frames.length(), index); DCHECK_GT(frames.size(), index);
return frames[index]; return frames[index];
} }
...@@ -1351,9 +1353,9 @@ FRAME_SUMMARY_DISPATCH(Handle<Context>, native_context) ...@@ -1351,9 +1353,9 @@ FRAME_SUMMARY_DISPATCH(Handle<Context>, native_context)
#undef FRAME_SUMMARY_DISPATCH #undef FRAME_SUMMARY_DISPATCH
void OptimizedFrame::Summarize(List<FrameSummary>* frames, void OptimizedFrame::Summarize(std::vector<FrameSummary>* frames,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
DCHECK(frames->length() == 0); DCHECK(frames->empty());
DCHECK(is_optimized()); DCHECK(is_optimized());
// Delegate to JS frame in absence of turbofan deoptimization. // Delegate to JS frame in absence of turbofan deoptimization.
...@@ -1421,7 +1423,7 @@ void OptimizedFrame::Summarize(List<FrameSummary>* frames, ...@@ -1421,7 +1423,7 @@ void OptimizedFrame::Summarize(List<FrameSummary>* frames,
FrameSummary::JavaScriptFrameSummary summary(isolate(), *receiver, FrameSummary::JavaScriptFrameSummary summary(isolate(), *receiver,
*function, *abstract_code, *function, *abstract_code,
code_offset, is_constructor); code_offset, is_constructor);
frames->Add(summary); frames->push_back(summary);
is_constructor = false; is_constructor = false;
} else if (it->kind() == TranslatedFrame::kConstructStub) { } else if (it->kind() == TranslatedFrame::kConstructStub) {
// The next encountered JS frame will be marked as a constructor call. // The next encountered JS frame will be marked as a constructor call.
...@@ -1629,15 +1631,15 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index, ...@@ -1629,15 +1631,15 @@ void InterpretedFrame::WriteInterpreterRegister(int register_index,
return SetExpression(index + register_index, value); return SetExpression(index + register_index, value);
} }
void InterpretedFrame::Summarize(List<FrameSummary>* functions, void InterpretedFrame::Summarize(std::vector<FrameSummary>* functions,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
DCHECK(functions->length() == 0); DCHECK(functions->empty());
AbstractCode* abstract_code = AbstractCode* abstract_code =
AbstractCode::cast(function()->shared()->bytecode_array()); AbstractCode::cast(function()->shared()->bytecode_array());
FrameSummary::JavaScriptFrameSummary summary( FrameSummary::JavaScriptFrameSummary summary(
isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(), isolate(), receiver(), function(), abstract_code, GetBytecodeOffset(),
IsConstructor()); IsConstructor());
functions->Add(summary); functions->push_back(summary);
} }
int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
...@@ -1728,15 +1730,15 @@ int WasmCompiledFrame::position() const { ...@@ -1728,15 +1730,15 @@ int WasmCompiledFrame::position() const {
return FrameSummary::GetSingle(this).SourcePosition(); return FrameSummary::GetSingle(this).SourcePosition();
} }
void WasmCompiledFrame::Summarize(List<FrameSummary>* functions, void WasmCompiledFrame::Summarize(std::vector<FrameSummary>* functions,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
DCHECK_EQ(0, functions->length()); DCHECK(functions->empty());
Handle<Code> code(LookupCode(), isolate()); Handle<Code> code(LookupCode(), isolate());
int offset = static_cast<int>(pc() - code->instruction_start()); int offset = static_cast<int>(pc() - code->instruction_start());
Handle<WasmInstanceObject> instance(wasm_instance(), isolate()); Handle<WasmInstanceObject> instance(wasm_instance(), isolate());
FrameSummary::WasmCompiledFrameSummary summary( FrameSummary::WasmCompiledFrameSummary summary(
isolate(), instance, code, offset, at_to_number_conversion()); isolate(), instance, code, offset, at_to_number_conversion());
functions->Add(summary); functions->push_back(summary);
} }
bool WasmCompiledFrame::at_to_number_conversion() const { bool WasmCompiledFrame::at_to_number_conversion() const {
...@@ -1775,7 +1777,7 @@ void WasmInterpreterEntryFrame::Print(StringStream* accumulator, PrintMode mode, ...@@ -1775,7 +1777,7 @@ void WasmInterpreterEntryFrame::Print(StringStream* accumulator, PrintMode mode,
if (mode != OVERVIEW) accumulator->Add("\n"); if (mode != OVERVIEW) accumulator->Add("\n");
} }
void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions, void WasmInterpreterEntryFrame::Summarize(std::vector<FrameSummary>* functions,
FrameSummary::Mode mode) const { FrameSummary::Mode mode) const {
Handle<WasmInstanceObject> instance(wasm_instance(), isolate()); Handle<WasmInstanceObject> instance(wasm_instance(), isolate());
std::vector<std::pair<uint32_t, int>> interpreted_stack = std::vector<std::pair<uint32_t, int>> interpreted_stack =
...@@ -1784,7 +1786,7 @@ void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions, ...@@ -1784,7 +1786,7 @@ void WasmInterpreterEntryFrame::Summarize(List<FrameSummary>* functions,
for (auto& e : interpreted_stack) { for (auto& e : interpreted_stack) {
FrameSummary::WasmInterpretedFrameSummary summary(isolate(), instance, FrameSummary::WasmInterpretedFrameSummary summary(isolate(), instance,
e.first, e.second); e.first, e.second);
functions->Add(summary); functions->push_back(summary);
} }
} }
......
...@@ -636,7 +636,7 @@ class StandardFrame : public StackFrame { ...@@ -636,7 +636,7 @@ class StandardFrame : public StackFrame {
// The functions are ordered bottom-to-top (i.e. summaries.last() is the // The functions are ordered bottom-to-top (i.e. summaries.last() is the
// top-most activation; caller comes before callee). // top-most activation; caller comes before callee).
virtual void Summarize( virtual void Summarize(
List<FrameSummary>* frames, std::vector<FrameSummary>* frames,
FrameSummary::Mode mode = FrameSummary::kExactSummary) const; FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
static StandardFrame* cast(StackFrame* frame) { static StandardFrame* cast(StackFrame* frame) {
...@@ -689,7 +689,7 @@ class JavaScriptFrame : public StandardFrame { ...@@ -689,7 +689,7 @@ class JavaScriptFrame : public StandardFrame {
Type type() const override { return JAVA_SCRIPT; } Type type() const override { return JAVA_SCRIPT; }
void Summarize( void Summarize(
List<FrameSummary>* frames, std::vector<FrameSummary>* frames,
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
// Accessors. // Accessors.
...@@ -830,7 +830,7 @@ class OptimizedFrame : public JavaScriptFrame { ...@@ -830,7 +830,7 @@ class OptimizedFrame : public JavaScriptFrame {
void GetFunctions(std::vector<SharedFunctionInfo*>* functions) const override; void GetFunctions(std::vector<SharedFunctionInfo*>* functions) const override;
void Summarize( void Summarize(
List<FrameSummary>* frames, std::vector<FrameSummary>* frames,
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
// Lookup exception handler for current {pc}, returns -1 if none found. // Lookup exception handler for current {pc}, returns -1 if none found.
...@@ -884,7 +884,7 @@ class InterpretedFrame : public JavaScriptFrame { ...@@ -884,7 +884,7 @@ class InterpretedFrame : public JavaScriptFrame {
// Build a list with summaries for this frame including all inlined frames. // Build a list with summaries for this frame including all inlined frames.
void Summarize( void Summarize(
List<FrameSummary>* frames, std::vector<FrameSummary>* frames,
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
static int GetBytecodeOffset(Address fp); static int GetBytecodeOffset(Address fp);
...@@ -975,7 +975,7 @@ class WasmCompiledFrame final : public StandardFrame { ...@@ -975,7 +975,7 @@ class WasmCompiledFrame final : public StandardFrame {
int position() const override; int position() const override;
bool at_to_number_conversion() const; bool at_to_number_conversion() const;
void Summarize(List<FrameSummary>* frames, void Summarize(std::vector<FrameSummary>* frames,
FrameSummary::Mode mode) const override; FrameSummary::Mode mode) const override;
static WasmCompiledFrame* cast(StackFrame* frame) { static WasmCompiledFrame* cast(StackFrame* frame) {
...@@ -1004,7 +1004,7 @@ class WasmInterpreterEntryFrame final : public StandardFrame { ...@@ -1004,7 +1004,7 @@ class WasmInterpreterEntryFrame final : public StandardFrame {
int index) const override; int index) const override;
void Summarize( void Summarize(
List<FrameSummary>* frames, std::vector<FrameSummary>* frames,
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
// Determine the code for the frame. // Determine the code for the frame.
......
...@@ -504,21 +504,23 @@ Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSReceiver> error_object, ...@@ -504,21 +504,23 @@ Handle<Object> Isolate::CaptureSimpleStackTrace(Handle<JSReceiver> error_object,
JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame); JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame);
// Set initial size to the maximum inlining level + 1 for the outermost // Set initial size to the maximum inlining level + 1 for the outermost
// function. // function.
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
js_frame->Summarize(&frames); js_frame->Summarize(&frames);
for (int i = frames.length() - 1; for (size_t i = frames.size(); i != 0 && elements->FrameCount() < limit;
i >= 0 && elements->FrameCount() < limit; i--) { i--) {
const auto& summ = frames[i].AsJavaScript(); const FrameSummary& summary = frames[i - 1];
const auto& summ = summary.AsJavaScript();
Handle<JSFunction> fun = summ.function(); Handle<JSFunction> fun = summ.function();
// Filter out internal frames that we do not want to show. // Filter out internal frames that we do not want to show.
if (!helper.IsVisibleInStackTrace(*fun)) continue; if (!helper.IsVisibleInStackTrace(*fun)) continue;
Handle<Object> recv = frames[i].receiver(); Handle<Object> recv = summary.receiver();
Handle<AbstractCode> abstract_code = summ.abstract_code(); Handle<AbstractCode> abstract_code = summ.abstract_code();
const int offset = frames[i].code_offset(); const int offset = summary.code_offset();
bool is_constructor = frames[i].is_constructor(); bool is_constructor = summary.is_constructor();
if (frame->type() == StackFrame::BUILTIN) { if (frame->type() == StackFrame::BUILTIN) {
// Help CallSite::IsConstructor correctly detect hand-written // Help CallSite::IsConstructor correctly detect hand-written
// construct stubs. // construct stubs.
...@@ -766,10 +768,11 @@ Handle<FixedArray> Isolate::CaptureCurrentStackTrace( ...@@ -766,10 +768,11 @@ Handle<FixedArray> Isolate::CaptureCurrentStackTrace(
StandardFrame* frame = it.frame(); StandardFrame* frame = it.frame();
// Set initial size to the maximum inlining level + 1 for the outermost // Set initial size to the maximum inlining level + 1 for the outermost
// function. // function.
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames); frame->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { for (size_t i = frames.size(); i != 0 && frames_seen < limit; i--) {
FrameSummary& frame = frames[i]; FrameSummary& frame = frames[i - 1];
if (!frame.is_subject_to_debugging()) continue; if (!frame.is_subject_to_debugging()) continue;
// Filter frames from other security contexts. // Filter frames from other security contexts.
if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) &&
...@@ -1376,10 +1379,10 @@ HandlerTable::CatchPrediction PredictException(JavaScriptFrame* frame) { ...@@ -1376,10 +1379,10 @@ HandlerTable::CatchPrediction PredictException(JavaScriptFrame* frame) {
// This optimized frame will catch. It's handler table does not include // This optimized frame will catch. It's handler table does not include
// exception prediction, and we need to use the corresponding handler // exception prediction, and we need to use the corresponding handler
// tables on the unoptimized code objects. // tables on the unoptimized code objects.
List<FrameSummary> summaries; std::vector<FrameSummary> summaries;
frame->Summarize(&summaries); frame->Summarize(&summaries);
for (int i = summaries.length() - 1; i >= 0; i--) { for (size_t i = summaries.size(); i != 0; i--) {
const FrameSummary& summary = summaries[i]; const FrameSummary& summary = summaries[i - 1];
Handle<AbstractCode> code = summary.AsJavaScript().abstract_code(); Handle<AbstractCode> code = summary.AsJavaScript().abstract_code();
if (code->IsCode() && code->kind() == AbstractCode::BUILTIN) { if (code->IsCode() && code->kind() == AbstractCode::BUILTIN) {
prediction = code->GetCode()->GetBuiltinCatchPrediction(); prediction = code->GetCode()->GetBuiltinCatchPrediction();
...@@ -1554,9 +1557,10 @@ bool Isolate::ComputeLocation(MessageLocation* target) { ...@@ -1554,9 +1557,10 @@ bool Isolate::ComputeLocation(MessageLocation* target) {
// Compute the location from the function and the relocation info of the // Compute the location from the function and the relocation info of the
// baseline code. For optimized code this will use the deoptimization // baseline code. For optimized code this will use the deoptimization
// information to get canonical location information. // information to get canonical location information.
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
frame->Summarize(&frames); frame->Summarize(&frames);
FrameSummary& summary = frames.last(); FrameSummary& summary = frames.back();
int pos = summary.SourcePosition(); int pos = summary.SourcePosition();
Handle<SharedFunctionInfo> shared; Handle<SharedFunctionInfo> shared;
Handle<Object> script = summary.script(); Handle<Object> script = summary.script();
......
...@@ -427,13 +427,14 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) { ...@@ -427,13 +427,14 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) {
return Smi::kZero; return Smi::kZero;
} }
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) { for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) {
frames.Clear(); frames.clear();
it.frame()->Summarize(&frames); it.frame()->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0; i--) { for (size_t i = frames.size(); i != 0; i--) {
// Omit functions from native and extension scripts. // Omit functions from native and extension scripts.
if (frames[i].is_subject_to_debugging()) n++; if (frames[i - 1].is_subject_to_debugging()) n++;
} }
} }
return Smi::FromInt(n); return Smi::FromInt(n);
......
...@@ -369,9 +369,10 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) { ...@@ -369,9 +369,10 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
// Compute the location from the function and the relocation info of the // Compute the location from the function and the relocation info of the
// baseline code. For optimized code this will use the deoptimization // baseline code. For optimized code this will use the deoptimization
// information to get canonical location information. // information to get canonical location information.
List<FrameSummary> frames(FLAG_max_inlining_levels + 1); std::vector<FrameSummary> frames;
frames.reserve(FLAG_max_inlining_levels + 1);
it.frame()->Summarize(&frames); it.frame()->Summarize(&frames);
auto& summary = frames.last().AsJavaScript(); auto& summary = frames.back().AsJavaScript();
Handle<SharedFunctionInfo> shared(summary.function()->shared()); Handle<SharedFunctionInfo> shared(summary.function()->shared());
Handle<Object> script(shared->script(), isolate); Handle<Object> script(shared->script(), isolate);
int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); int pos = summary.abstract_code()->SourcePosition(summary.code_offset());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment