From 147d05011d698c6784f80ed62b75335adec83d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Z=C3=BCnd?= Date: Mon, 28 Jan 2019 11:51:07 +0100 Subject: [PATCH] [refactor] Change method names in FrameArrayIterator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/1436023 Reviewed-by: Jakob Gruber Commit-Queue: Simon Zünd Cr-Commit-Position: refs/heads/master@{#59117} --- src/messages.cc | 20 ++++++++++---------- src/messages.h | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/messages.cc b/src/messages.cc index f89d3a5746..2eecb85131 100644 --- a/src/messages.cc +++ b/src/messages.cc @@ -838,33 +838,33 @@ MaybeHandle AsmJsWasmStackFrame::ToString() { FrameArrayIterator::FrameArrayIterator(Isolate* isolate, Handle 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 { - return (next_frame_ix_ < array_->FrameCount()); +bool FrameArrayIterator::HasFrame() const { + return (frame_ix_ < array_->FrameCount()); } -void FrameArrayIterator::Next() { next_frame_ix_++; } +void FrameArrayIterator::Advance() { frame_ix_++; } StackFrameBase* FrameArrayIterator::Frame() { - DCHECK(HasNext()); - const int flags = array_->Flags(next_frame_ix_)->value(); + DCHECK(HasFrame()); + const int flags = array_->Flags(frame_ix_)->value(); int flag_mask = FrameArray::kIsWasmFrame | FrameArray::kIsWasmInterpretedFrame | FrameArray::kIsAsmJsWasmFrame; switch (flags & flag_mask) { case 0: // JavaScript Frame. - js_frame_.FromFrameArray(isolate_, array_, next_frame_ix_); + js_frame_.FromFrameArray(isolate_, array_, frame_ix_); return &js_frame_; case FrameArray::kIsWasmFrame: case FrameArray::kIsWasmInterpretedFrame: // Wasm Frame: - wasm_frame_.FromFrameArray(isolate_, array_, next_frame_ix_); + wasm_frame_.FromFrameArray(isolate_, array_, frame_ix_); return &wasm_frame_; case FrameArray::kIsAsmJsWasmFrame: // 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_; default: UNREACHABLE(); @@ -1040,7 +1040,7 @@ MaybeHandle ErrorUtils::FormatStackTrace(Isolate* isolate, RETURN_ON_EXCEPTION(isolate, AppendErrorString(isolate, error, &builder), Object); - for (FrameArrayIterator it(isolate, elems); it.HasNext(); it.Next()) { + for (FrameArrayIterator it(isolate, elems); it.HasFrame(); it.Advance()) { builder.AppendCString("\n at "); StackFrameBase* frame = it.Frame(); diff --git a/src/messages.h b/src/messages.h index f030190aa8..b1583e58d8 100644 --- a/src/messages.h +++ b/src/messages.h @@ -222,14 +222,14 @@ class FrameArrayIterator { StackFrameBase* Frame(); - bool HasNext() const; - void Next(); + bool HasFrame() const; + void Advance(); private: Isolate* isolate_; Handle array_; - int next_frame_ix_; + int frame_ix_; WasmStackFrame wasm_frame_; AsmJsWasmStackFrame asm_wasm_frame_;