Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index ba9ec7913a519d7317c2500a83cc4d31c677318a..4c9c3a487f9be7fd410aba24b72f2a01c299ad5c 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -16,6 +16,7 @@ |
#include "src/safepoint-table.h" |
#include "src/string-stream.h" |
#include "src/vm-state-inl.h" |
+#include "src/wasm/wasm-module.h" |
namespace v8 { |
namespace internal { |
@@ -63,19 +64,14 @@ StackFrameIteratorBase::StackFrameIteratorBase(Isolate* isolate, |
} |
#undef INITIALIZE_SINGLETON |
- |
StackFrameIterator::StackFrameIterator(Isolate* isolate) |
- : StackFrameIteratorBase(isolate, true) { |
- Reset(isolate->thread_local_top()); |
-} |
- |
+ : StackFrameIterator(isolate, isolate->thread_local_top()) {} |
StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t) |
: StackFrameIteratorBase(isolate, true) { |
Reset(t); |
} |
- |
void StackFrameIterator::Advance() { |
DCHECK(!done()); |
// Compute the state of the calling frame before restoring |
@@ -165,6 +161,11 @@ StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate) |
if (!done() && !IsValidFrame(iterator_.frame())) Advance(); |
} |
+StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate, |
+ StackFrame::Id id) |
+ : StackTraceFrameIterator(isolate) { |
+ while (!done() && frame()->id() != id) Advance(); |
+} |
void StackTraceFrameIterator::Advance() { |
do { |
@@ -185,6 +186,11 @@ bool StackTraceFrameIterator::IsValidFrame(StackFrame* frame) const { |
return frame->is_wasm(); |
} |
+void StackTraceFrameIterator::AdvanceToArgumentsFrame() { |
+ if (!is_javascript() || !javascript_frame()->has_adapted_arguments()) return; |
+ iterator_.Advance(); |
+ DCHECK(iterator_.frame()->is_arguments_adaptor()); |
+} |
// ------------------------------------------------------------------------- |
@@ -1339,23 +1345,16 @@ Address WasmFrame::GetCallerStackPointer() const { |
return fp() + ExitFrameConstants::kCallerSPOffset; |
} |
-Object* WasmFrame::wasm_obj() { |
+Object* WasmFrame::wasm_obj() const { |
FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
DCHECK(deopt_data->length() == 2); |
return deopt_data->get(0); |
} |
-uint32_t WasmFrame::function_index() { |
+uint32_t WasmFrame::function_index() const { |
FixedArray* deopt_data = LookupCode()->deoptimization_data(); |
DCHECK(deopt_data->length() == 2); |
- Object* func_index_obj = deopt_data->get(1); |
- if (func_index_obj->IsUndefined(isolate())) return static_cast<uint32_t>(-1); |
- if (func_index_obj->IsSmi()) return Smi::cast(func_index_obj)->value(); |
- DCHECK(func_index_obj->IsHeapNumber()); |
- uint32_t val = static_cast<uint32_t>(-1); |
- func_index_obj->ToUint32(&val); |
- DCHECK(val != static_cast<uint32_t>(-1)); |
- return val; |
+ return Smi::cast(deopt_data->get(1))->value(); |
} |
namespace { |