// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_FRAMES_INL_H_
#define V8_FRAMES_INL_H_
#include "frames.h"
#include "isolate.h"
#include "v8memory.h"
#if V8_TARGET_ARCH_IA32
#include "ia32/frames-ia32.h"
#elif V8_TARGET_ARCH_X64
#include "x64/frames-x64.h"
#elif V8_TARGET_ARCH_ARM64
#include "arm64/frames-arm64.h"
#elif V8_TARGET_ARCH_ARM
#include "arm/frames-arm.h"
#elif V8_TARGET_ARCH_MIPS
#include "mips/frames-mips.h"
#else
#error Unsupported target architecture.
#endif
namespace v8 {
namespace internal {
inline Address StackHandler::address() const {
return reinterpret_cast
(const_cast(this));
}
inline StackHandler* StackHandler::next() const {
const int offset = StackHandlerConstants::kNextOffset;
return FromAddress(Memory::Address_at(address() + offset));
}
inline bool StackHandler::includes(Address address) const {
Address start = this->address();
Address end = start + StackHandlerConstants::kSize;
return start <= address && address <= end;
}
inline void StackHandler::Iterate(ObjectVisitor* v, Code* holder) const {
v->VisitPointer(context_address());
v->VisitPointer(code_address());
}
inline StackHandler* StackHandler::FromAddress(Address address) {
return reinterpret_cast(address);
}
inline bool StackHandler::is_js_entry() const {
return kind() == JS_ENTRY;
}
inline bool StackHandler::is_catch() const {
return kind() == CATCH;
}
inline bool StackHandler::is_finally() const {
return kind() == FINALLY;
}
inline StackHandler::Kind StackHandler::kind() const {
const int offset = StackHandlerConstants::kStateOffset;
return KindField::decode(Memory::unsigned_at(address() + offset));
}
inline unsigned StackHandler::index() const {
const int offset = StackHandlerConstants::kStateOffset;
return IndexField::decode(Memory::unsigned_at(address() + offset));
}
inline Object** StackHandler::context_address() const {
const int offset = StackHandlerConstants::kContextOffset;
return reinterpret_cast