Commit 147d0501 authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[refactor] Change method names in FrameArrayIterator

This CL changes 'HasNext' to 'HasFrame' and 'Next' to 'Advance' to
better reflect the semantics of the iterator.
'Next' usually returns the next element.

R=jgruber@chromium.org

Bug: v8:8562
Change-Id: Idbd1c084c39dd4a10c1c6a6db7782637b9b16cc4
Reviewed-on: https://chromium-review.googlesource.com/c/1436023Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59117}
parent 76133452
...@@ -838,33 +838,33 @@ MaybeHandle<String> AsmJsWasmStackFrame::ToString() { ...@@ -838,33 +838,33 @@ MaybeHandle<String> AsmJsWasmStackFrame::ToString() {
FrameArrayIterator::FrameArrayIterator(Isolate* isolate, FrameArrayIterator::FrameArrayIterator(Isolate* isolate,
Handle<FrameArray> array, int frame_ix) Handle<FrameArray> array, int frame_ix)
: isolate_(isolate), array_(array), next_frame_ix_(frame_ix) {} : isolate_(isolate), array_(array), frame_ix_(frame_ix) {}
bool FrameArrayIterator::HasNext() const { bool FrameArrayIterator::HasFrame() const {
return (next_frame_ix_ < array_->FrameCount()); return (frame_ix_ < array_->FrameCount());
} }
void FrameArrayIterator::Next() { next_frame_ix_++; } void FrameArrayIterator::Advance() { frame_ix_++; }
StackFrameBase* FrameArrayIterator::Frame() { StackFrameBase* FrameArrayIterator::Frame() {
DCHECK(HasNext()); DCHECK(HasFrame());
const int flags = array_->Flags(next_frame_ix_)->value(); const int flags = array_->Flags(frame_ix_)->value();
int flag_mask = FrameArray::kIsWasmFrame | int flag_mask = FrameArray::kIsWasmFrame |
FrameArray::kIsWasmInterpretedFrame | FrameArray::kIsWasmInterpretedFrame |
FrameArray::kIsAsmJsWasmFrame; FrameArray::kIsAsmJsWasmFrame;
switch (flags & flag_mask) { switch (flags & flag_mask) {
case 0: case 0:
// JavaScript Frame. // JavaScript Frame.
js_frame_.FromFrameArray(isolate_, array_, next_frame_ix_); js_frame_.FromFrameArray(isolate_, array_, frame_ix_);
return &js_frame_; return &js_frame_;
case FrameArray::kIsWasmFrame: case FrameArray::kIsWasmFrame:
case FrameArray::kIsWasmInterpretedFrame: case FrameArray::kIsWasmInterpretedFrame:
// Wasm Frame: // Wasm Frame:
wasm_frame_.FromFrameArray(isolate_, array_, next_frame_ix_); wasm_frame_.FromFrameArray(isolate_, array_, frame_ix_);
return &wasm_frame_; return &wasm_frame_;
case FrameArray::kIsAsmJsWasmFrame: case FrameArray::kIsAsmJsWasmFrame:
// Asm.js Wasm Frame: // Asm.js Wasm Frame:
asm_wasm_frame_.FromFrameArray(isolate_, array_, next_frame_ix_); asm_wasm_frame_.FromFrameArray(isolate_, array_, frame_ix_);
return &asm_wasm_frame_; return &asm_wasm_frame_;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -1040,7 +1040,7 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate, ...@@ -1040,7 +1040,7 @@ MaybeHandle<Object> ErrorUtils::FormatStackTrace(Isolate* isolate,
RETURN_ON_EXCEPTION(isolate, AppendErrorString(isolate, error, &builder), RETURN_ON_EXCEPTION(isolate, AppendErrorString(isolate, error, &builder),
Object); Object);
for (FrameArrayIterator it(isolate, elems); it.HasNext(); it.Next()) { for (FrameArrayIterator it(isolate, elems); it.HasFrame(); it.Advance()) {
builder.AppendCString("\n at "); builder.AppendCString("\n at ");
StackFrameBase* frame = it.Frame(); StackFrameBase* frame = it.Frame();
......
...@@ -222,14 +222,14 @@ class FrameArrayIterator { ...@@ -222,14 +222,14 @@ class FrameArrayIterator {
StackFrameBase* Frame(); StackFrameBase* Frame();
bool HasNext() const; bool HasFrame() const;
void Next(); void Advance();
private: private:
Isolate* isolate_; Isolate* isolate_;
Handle<FrameArray> array_; Handle<FrameArray> array_;
int next_frame_ix_; int frame_ix_;
WasmStackFrame wasm_frame_; WasmStackFrame wasm_frame_;
AsmJsWasmStackFrame asm_wasm_frame_; AsmJsWasmStackFrame asm_wasm_frame_;
......
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