2012-02-09 09:43:37 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_FRAMES_H_
|
|
|
|
#define V8_FRAMES_H_
|
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/allocation.h"
|
|
|
|
#include "src/handles.h"
|
|
|
|
#include "src/safepoint-table.h"
|
2011-01-12 14:14:14 +00:00
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-03-21 09:28:26 +00:00
|
|
|
#if V8_TARGET_ARCH_ARM64
|
2014-02-12 09:19:30 +00:00
|
|
|
typedef uint64_t RegList;
|
|
|
|
#else
|
2008-07-03 15:10:15 +00:00
|
|
|
typedef uint32_t RegList;
|
2014-02-12 09:19:30 +00:00
|
|
|
#endif
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Get the number of registers in a given register list.
|
|
|
|
int NumRegs(RegList list);
|
|
|
|
|
2012-04-05 14:10:39 +00:00
|
|
|
void SetUpJSCallerSavedCodeData();
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Return the code of the n-th saved register available to JavaScript.
|
|
|
|
int JSCallerSavedCode(int n);
|
|
|
|
|
|
|
|
|
|
|
|
// Forward declarations.
|
2013-07-23 15:01:38 +00:00
|
|
|
class ExternalCallbackScope;
|
2013-06-27 09:34:31 +00:00
|
|
|
class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
class ThreadLocalTop;
|
2011-03-18 20:35:07 +00:00
|
|
|
class Isolate;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
class InnerPointerToCodeCache {
|
2010-08-30 08:54:43 +00:00
|
|
|
public:
|
2011-09-20 10:08:39 +00:00
|
|
|
struct InnerPointerToCodeCacheEntry {
|
|
|
|
Address inner_pointer;
|
2010-08-30 08:54:43 +00:00
|
|
|
Code* code;
|
2011-01-12 14:14:14 +00:00
|
|
|
SafepointEntry safepoint_entry;
|
2010-08-30 08:54:43 +00:00
|
|
|
};
|
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
explicit InnerPointerToCodeCache(Isolate* isolate) : isolate_(isolate) {
|
2011-03-18 20:35:07 +00:00
|
|
|
Flush();
|
2010-08-30 08:54:43 +00:00
|
|
|
}
|
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
Code* GcSafeFindCodeForInnerPointer(Address inner_pointer);
|
|
|
|
Code* GcSafeCastToCode(HeapObject* object, Address inner_pointer);
|
2010-08-30 08:54:43 +00:00
|
|
|
|
2011-03-18 20:35:07 +00:00
|
|
|
void Flush() {
|
2010-08-30 08:54:43 +00:00
|
|
|
memset(&cache_[0], 0, sizeof(cache_));
|
|
|
|
}
|
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
InnerPointerToCodeCacheEntry* GetCacheEntry(Address inner_pointer);
|
2010-08-30 08:54:43 +00:00
|
|
|
|
|
|
|
private:
|
2011-09-20 10:08:39 +00:00
|
|
|
InnerPointerToCodeCacheEntry* cache(int index) { return &cache_[index]; }
|
2011-03-18 20:35:07 +00:00
|
|
|
|
|
|
|
Isolate* isolate_;
|
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
static const int kInnerPointerToCodeCacheSize = 1024;
|
|
|
|
InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize];
|
2011-03-18 20:35:07 +00:00
|
|
|
|
2011-09-20 10:08:39 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache);
|
2010-08-30 08:54:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-03-25 13:13:51 +00:00
|
|
|
// Every try-block pushes the context register.
|
|
|
|
class TryBlockConstant : public AllStatic {
|
|
|
|
public:
|
|
|
|
static const int kElementCount = 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-08 11:17:32 +00:00
|
|
|
class StackHandlerConstants : public AllStatic {
|
|
|
|
public:
|
2015-03-25 13:13:51 +00:00
|
|
|
static const int kNextOffset = 0 * kPointerSize;
|
2013-04-08 11:17:32 +00:00
|
|
|
|
2015-03-25 13:13:51 +00:00
|
|
|
static const int kSize = kNextOffset + kPointerSize;
|
2013-05-08 08:08:23 +00:00
|
|
|
static const int kSlotCount = kSize >> kPointerSizeLog2;
|
2013-04-08 11:17:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
class StackHandler BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
// Get the address of this stack handler.
|
|
|
|
inline Address address() const;
|
|
|
|
|
|
|
|
// Get the next stack handler in the chain.
|
|
|
|
inline StackHandler* next() const;
|
|
|
|
|
|
|
|
// Conversion support.
|
|
|
|
static inline StackHandler* FromAddress(Address address);
|
|
|
|
|
|
|
|
private:
|
2008-08-13 09:32:07 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2013-01-29 09:12:20 +00:00
|
|
|
#define STACK_FRAME_TYPE_LIST(V) \
|
2015-10-16 15:06:10 +00:00
|
|
|
V(ENTRY, EntryFrame) \
|
|
|
|
V(ENTRY_CONSTRUCT, EntryConstructFrame) \
|
|
|
|
V(EXIT, ExitFrame) \
|
|
|
|
V(JAVA_SCRIPT, JavaScriptFrame) \
|
|
|
|
V(OPTIMIZED, OptimizedFrame) \
|
2016-02-23 19:38:50 +00:00
|
|
|
V(WASM, WasmFrame) \
|
2016-03-04 04:45:22 +00:00
|
|
|
V(WASM_TO_JS, WasmToJsFrame) \
|
|
|
|
V(JS_TO_WASM, JsToWasmFrame) \
|
2015-10-16 15:06:10 +00:00
|
|
|
V(INTERPRETED, InterpretedFrame) \
|
|
|
|
V(STUB, StubFrame) \
|
2013-01-29 09:12:20 +00:00
|
|
|
V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \
|
2015-10-16 15:06:10 +00:00
|
|
|
V(INTERNAL, InternalFrame) \
|
|
|
|
V(CONSTRUCT, ConstructFrame) \
|
2016-06-17 07:40:13 +00:00
|
|
|
V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) \
|
2016-06-30 06:55:22 +00:00
|
|
|
V(BUILTIN, BuiltinFrame) \
|
|
|
|
V(BUILTIN_EXIT, BuiltinExitFrame)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2016-02-18 12:51:48 +00:00
|
|
|
// Every pointer in a frame has a slot id. On 32-bit platforms, doubles consume
|
|
|
|
// two slots.
|
|
|
|
//
|
|
|
|
// Stack slot indices >= 0 access the callee stack with slot 0 corresponding to
|
|
|
|
// the callee's saved return address and 1 corresponding to the saved frame
|
|
|
|
// pointer. Some frames have additional information stored in the fixed header,
|
|
|
|
// for example JSFunctions store the function context and marker in the fixed
|
|
|
|
// header, with slot index 2 corresponding to the current function context and 3
|
|
|
|
// corresponding to the frame marker/JSFunction.
|
|
|
|
//
|
|
|
|
// slot JS frame
|
|
|
|
// +-----------------+--------------------------------
|
|
|
|
// -n-1 | parameter 0 | ^
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -n | | Caller
|
|
|
|
// ... | ... | frame slots
|
|
|
|
// -2 | parameter n-1 | (slot < 0)
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -1 | parameter n | v
|
|
|
|
// -----+-----------------+--------------------------------
|
|
|
|
// 0 | return addr | ^ ^
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 1 | saved frame ptr | Fixed |
|
|
|
|
// |- - - - - - - - -| Header <-- frame ptr |
|
|
|
|
// 2 | [Constant Pool] | | |
|
|
|
|
// |- - - - - - - - -| | |
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
// 2+cp |Context/Frm. Type| v if a constant pool |
|
|
|
|
// |-----------------+---- is used, cp = 1, |
|
|
|
|
// 3+cp | | ^ otherwise, cp = 0 |
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 4+cp | | | Callee
|
2016-02-18 12:51:48 +00:00
|
|
|
// |- - - - - - - - -| | frame slots
|
|
|
|
// ... | | Frame slots (slot >= 0)
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// | | v |
|
|
|
|
// -----+-----------------+----- <-- stack ptr -------------
|
|
|
|
//
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
class CommonFrameConstants : public AllStatic {
|
2013-02-05 08:09:32 +00:00
|
|
|
public:
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kCallerFPOffset = 0 * kPointerSize;
|
|
|
|
static const int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize;
|
|
|
|
static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
|
|
|
|
|
2013-02-05 08:09:32 +00:00
|
|
|
// Fixed part of the frame consists of return address, caller fp,
|
2015-06-04 14:44:00 +00:00
|
|
|
// constant pool (if FLAG_enable_embedded_constant_pool), context, and
|
|
|
|
// function. StandardFrame::IterateExpressions assumes that kLastObjectOffset
|
|
|
|
// is the last object pointer.
|
[turbofan] Unify referencing of stack slots
Previously, it was not possible to specify StackSlotOperands for all
slots in both the caller and callee stacks. Specifically, the region
of the callee's stack including the saved return address, frame
pointer, function pointer and context pointer could not be addressed
by the register allocator/gap resolver.
In preparation for better tail call support, which will use the gap
resolver to reconcile outgoing parameters, this change makes it
possible to address all slots on the stack, because slots in the
previously inaccessible dead zone may become parameter slots for
outgoing tail calls. All caller stack slots are accessible as they
were before, with slot -1 corresponding to the last stack
parameter. Stack slot indices >= 0 access the callee stack, with slot
0 corresponding to the callee's saved return address, 1 corresponding
to the saved frame pointer, 2 corresponding to the current function
context, 3 corresponding to the frame marker/JSFunction, and slots 4
and above corresponding to spill slots.
The following changes were specifically needed:
* Frame has been changed to explicitly manage three areas of the
callee frame, the fixed header, the spill slot area, and the
callee-saved register area.
* Conversions from stack slot indices to fp offsets all now go through
a common bottleneck: OptimizedFrame::StackSlotOffsetRelativeToFp
* The generation of deoptimization translation tables has been changed
to support the new stack slot indexing scheme. Crankshaft, which
doesn't support the new slot numbering in its register allocator,
must adapt the indexes when creating translation tables.
* Callee-saved parameters are now kept below spill slots, not above,
to support saving only the optimal set of used registers, which is
only known after register allocation is finished and spill slots
have been allocated.
Review URL: https://codereview.chromium.org/1261923007
Cr-Commit-Position: refs/heads/master@{#30224}
2015-08-18 14:47:56 +00:00
|
|
|
static const int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize;
|
|
|
|
static const int kFixedSlotCountAboveFp =
|
|
|
|
kFixedFrameSizeAboveFp / kPointerSize;
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kCPSlotSize =
|
|
|
|
FLAG_enable_embedded_constant_pool ? kPointerSize : 0;
|
2015-08-28 06:34:55 +00:00
|
|
|
static const int kCPSlotCount = kCPSlotSize / kPointerSize;
|
2015-06-04 14:44:00 +00:00
|
|
|
static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0;
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kContextOrFrameTypeSize = kPointerSize;
|
|
|
|
static const int kContextOrFrameTypeOffset =
|
|
|
|
-(kCPSlotSize + kContextOrFrameTypeSize);
|
|
|
|
};
|
2015-06-04 14:44:00 +00:00
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
// StandardFrames are used for interpreted, full-codegen and optimized
|
|
|
|
// JavaScript frames. They always have a context below the saved fp/constant
|
|
|
|
// pool and below that the JSFunction of the executing function.
|
|
|
|
//
|
|
|
|
// slot JS frame
|
|
|
|
// +-----------------+--------------------------------
|
|
|
|
// -n-1 | parameter 0 | ^
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -n | | Caller
|
|
|
|
// ... | ... | frame slots
|
|
|
|
// -2 | parameter n-1 | (slot < 0)
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -1 | parameter n | v
|
|
|
|
// -----+-----------------+--------------------------------
|
|
|
|
// 0 | return addr | ^ ^
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 1 | saved frame ptr | Fixed |
|
|
|
|
// |- - - - - - - - -| Header <-- frame ptr |
|
|
|
|
// 2 | [Constant Pool] | | |
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 2+cp | Context | | if a constant pool |
|
|
|
|
// |- - - - - - - - -| | is used, cp = 1, |
|
|
|
|
// 3+cp | JSFunction | v otherwise, cp = 0 |
|
|
|
|
// +-----------------+---- |
|
|
|
|
// 4+cp | | ^ Callee
|
|
|
|
// |- - - - - - - - -| | frame slots
|
|
|
|
// ... | | Frame slots (slot >= 0)
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// | | v |
|
|
|
|
// -----+-----------------+----- <-- stack ptr -------------
|
|
|
|
//
|
|
|
|
class StandardFrameConstants : public CommonFrameConstants {
|
|
|
|
public:
|
|
|
|
static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
|
|
|
|
static const int kFixedFrameSize =
|
|
|
|
kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
|
|
|
|
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize;
|
|
|
|
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
|
|
|
|
static const int kContextOffset = kContextOrFrameTypeOffset;
|
|
|
|
static const int kFunctionOffset = -2 * kPointerSize - kCPSlotSize;
|
|
|
|
static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize;
|
2015-06-04 14:44:00 +00:00
|
|
|
static const int kLastObjectOffset = kContextOffset;
|
2013-02-05 08:09:32 +00:00
|
|
|
};
|
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
// TypedFrames have a SMI type maker value below the saved FP/constant pool to
|
|
|
|
// distinguish them from StandardFrames, which have a context in that position
|
|
|
|
// instead.
|
|
|
|
//
|
|
|
|
// slot JS frame
|
|
|
|
// +-----------------+--------------------------------
|
|
|
|
// -n-1 | parameter 0 | ^
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -n | | Caller
|
|
|
|
// ... | ... | frame slots
|
|
|
|
// -2 | parameter n-1 | (slot < 0)
|
|
|
|
// |- - - - - - - - -| |
|
|
|
|
// -1 | parameter n | v
|
|
|
|
// -----+-----------------+--------------------------------
|
|
|
|
// 0 | return addr | ^ ^
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 1 | saved frame ptr | Fixed |
|
|
|
|
// |- - - - - - - - -| Header <-- frame ptr |
|
|
|
|
// 2 | [Constant Pool] | | |
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 2+cp |Frame Type Marker| v if a constant pool |
|
|
|
|
// |-----------------+---- is used, cp = 1, |
|
|
|
|
// 3+cp | | ^ otherwise, cp = 0 |
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// 4+cp | | | Callee
|
|
|
|
// |- - - - - - - - -| | frame slots
|
|
|
|
// ... | | Frame slots (slot >= 0)
|
|
|
|
// |- - - - - - - - -| | |
|
|
|
|
// | | v |
|
|
|
|
// -----+-----------------+----- <-- stack ptr -------------
|
|
|
|
//
|
|
|
|
class TypedFrameConstants : public CommonFrameConstants {
|
|
|
|
public:
|
|
|
|
static const int kFrameTypeSize = kContextOrFrameTypeSize;
|
|
|
|
static const int kFrameTypeOffset = kContextOrFrameTypeOffset;
|
|
|
|
static const int kFixedFrameSizeFromFp = kCPSlotSize + kFrameTypeSize;
|
|
|
|
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize;
|
|
|
|
static const int kFixedFrameSize =
|
|
|
|
StandardFrameConstants::kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
|
|
|
|
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
|
|
|
|
static const int kFirstPushedFrameValueOffset =
|
|
|
|
-StandardFrameConstants::kCPSlotSize - kFrameTypeSize - kPointerSize;
|
|
|
|
};
|
2013-02-05 08:09:32 +00:00
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
#define TYPED_FRAME_PUSHED_VALUE_OFFSET(x) \
|
|
|
|
(TypedFrameConstants::kFirstPushedFrameValueOffset - (x)*kPointerSize)
|
|
|
|
#define TYPED_FRAME_SIZE(count) \
|
|
|
|
(TypedFrameConstants::kFixedFrameSize + (count)*kPointerSize)
|
|
|
|
#define TYPED_FRAME_SIZE_FROM_SP(count) \
|
|
|
|
(TypedFrameConstants::kFixedFrameSizeFromFp + (count)*kPointerSize)
|
|
|
|
#define DEFINE_TYPED_FRAME_SIZES(count) \
|
|
|
|
static const int kFixedFrameSize = TYPED_FRAME_SIZE(count); \
|
|
|
|
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize; \
|
|
|
|
static const int kFixedFrameSizeFromFp = TYPED_FRAME_SIZE_FROM_SP(count); \
|
|
|
|
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize
|
|
|
|
|
|
|
|
class ArgumentsAdaptorFrameConstants : public TypedFrameConstants {
|
2015-07-07 08:14:20 +00:00
|
|
|
public:
|
|
|
|
// FP-relative.
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
|
|
|
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(2);
|
2015-07-07 08:14:20 +00:00
|
|
|
};
|
|
|
|
|
2016-06-17 07:40:13 +00:00
|
|
|
class BuiltinFrameConstants : public TypedFrameConstants {
|
|
|
|
public:
|
|
|
|
// FP-relative.
|
|
|
|
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
|
|
|
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(2);
|
|
|
|
};
|
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
class InternalFrameConstants : public TypedFrameConstants {
|
2015-07-07 08:14:20 +00:00
|
|
|
public:
|
|
|
|
// FP-relative.
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(1);
|
2015-07-07 08:14:20 +00:00
|
|
|
};
|
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
class FrameDropperFrameConstants : public InternalFrameConstants {
|
|
|
|
public:
|
|
|
|
// FP-relative.
|
|
|
|
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(2);
|
|
|
|
};
|
2015-07-07 08:14:20 +00:00
|
|
|
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
class ConstructFrameConstants : public TypedFrameConstants {
|
2015-07-07 08:14:20 +00:00
|
|
|
public:
|
|
|
|
// FP-relative.
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
static const int kContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
2016-10-18 06:06:21 +00:00
|
|
|
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
|
|
|
static const int kImplicitReceiverOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(3);
|
[runtime] Unify and simplify how frames are marked
Before this CL, various code stubs used different techniques
for marking their frames to enable stack-crawling and other
access to data in the frame. All of them were based on a abuse
of the "standard" frame representation, e.g. storing the a
context pointer immediately below the frame's fp, and a
function pointer after that. Although functional, this approach
tends to make stubs and builtins do an awkward, unnecessary
dance to appear like standard frames, even if they have
nothing to do with JavaScript execution.
This CL attempts to improve this by:
* Ensuring that there are only two fundamentally different
types of frames, a "standard" frame and a "typed" frame.
Standard frames, as before, contain both a context and
function pointer. Typed frames contain only a minimum
of a smi marker in the position immediately below the fp
where the context is in standard frames.
* Only interpreted, full codegen, and optimized Crankshaft and
TurboFan JavaScript frames use the "standard" format. All
other frames use the type frame format with an explicit
marker.
* Typed frames can contain one or more values below the
type marker. There is new magic macro machinery in
frames.h that simplifies defining the offsets of these fields
in typed frames.
* A new flag in the CallDescriptor enables specifying whether
a frame is a standard frame or a typed frame. Secondary
register location spilling is now only enabled for standard
frames.
* A zillion places in the code have been updated to deal with
the fact that most code stubs and internal frames use the
typed frame format. This includes changes in the
deoptimizer, debugger, and liveedit.
* StandardFrameConstants::kMarkerOffset is deprecated,
(CommonFrameConstants::kContextOrFrameTypeOffset
and StandardFrameConstants::kFrameOffset are now used
in its stead).
LOG=N
Review URL: https://codereview.chromium.org/1696043002
Cr-Commit-Position: refs/heads/master@{#34571}
2016-03-08 08:35:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class StubFailureTrampolineFrameConstants : public InternalFrameConstants {
|
|
|
|
public:
|
|
|
|
static const int kArgumentsArgumentsOffset =
|
|
|
|
TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
|
|
|
|
static const int kArgumentsLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
|
|
|
|
static const int kArgumentsPointerOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
|
|
|
|
static const int kFixedHeaderBottomOffset = kArgumentsPointerOffset;
|
|
|
|
DEFINE_TYPED_FRAME_SIZES(3);
|
2015-07-07 08:14:20 +00:00
|
|
|
};
|
|
|
|
|
2016-06-30 06:55:22 +00:00
|
|
|
// Behaves like an exit frame but with target and new target args.
|
|
|
|
class BuiltinExitFrameConstants : public CommonFrameConstants {
|
|
|
|
public:
|
|
|
|
static const int kNewTargetOffset = kCallerPCOffset + 1 * kPointerSize;
|
|
|
|
static const int kTargetOffset = kNewTargetOffset + 1 * kPointerSize;
|
2016-07-04 12:44:18 +00:00
|
|
|
static const int kArgcOffset = kTargetOffset + 1 * kPointerSize;
|
2016-06-30 06:55:22 +00:00
|
|
|
};
|
2015-07-07 08:14:20 +00:00
|
|
|
|
2015-08-27 10:32:26 +00:00
|
|
|
class InterpreterFrameConstants : public AllStatic {
|
|
|
|
public:
|
2016-07-27 08:19:43 +00:00
|
|
|
// Fixed frame includes new.target, bytecode array, and bytecode offset.
|
2015-12-18 18:34:21 +00:00
|
|
|
static const int kFixedFrameSize =
|
2016-02-11 13:10:45 +00:00
|
|
|
StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
|
2015-12-18 18:34:21 +00:00
|
|
|
static const int kFixedFrameSizeFromFp =
|
2016-02-11 13:10:45 +00:00
|
|
|
StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize;
|
2015-12-18 18:34:21 +00:00
|
|
|
|
2015-12-16 15:14:13 +00:00
|
|
|
// FP-relative.
|
2016-04-19 12:47:25 +00:00
|
|
|
static const int kLastParamFromFp = StandardFrameConstants::kCallerSPOffset;
|
2016-05-27 15:57:35 +00:00
|
|
|
static const int kCallerPCOffsetFromFp =
|
|
|
|
StandardFrameConstants::kCallerPCOffset;
|
2016-02-11 13:10:45 +00:00
|
|
|
static const int kNewTargetFromFp =
|
|
|
|
-StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize;
|
2016-02-16 12:35:38 +00:00
|
|
|
static const int kBytecodeArrayFromFp =
|
2016-01-20 18:10:13 +00:00
|
|
|
-StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize;
|
2016-02-11 13:10:45 +00:00
|
|
|
static const int kBytecodeOffsetFromFp =
|
2015-12-16 15:14:13 +00:00
|
|
|
-StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize;
|
2016-04-19 12:47:25 +00:00
|
|
|
static const int kRegisterFileFromFp =
|
2016-02-11 13:10:45 +00:00
|
|
|
-StandardFrameConstants::kFixedFrameSizeFromFp - 4 * kPointerSize;
|
2015-12-16 15:14:13 +00:00
|
|
|
|
2016-04-19 12:47:25 +00:00
|
|
|
static const int kExpressionsOffset = kRegisterFileFromFp;
|
2016-02-16 15:33:54 +00:00
|
|
|
|
2016-07-27 08:19:43 +00:00
|
|
|
// Number of fixed slots in addition to a {StandardFrame}.
|
|
|
|
static const int kExtraSlotCount =
|
|
|
|
InterpreterFrameConstants::kFixedFrameSize / kPointerSize -
|
|
|
|
StandardFrameConstants::kFixedFrameSize / kPointerSize;
|
|
|
|
|
2016-01-20 18:10:13 +00:00
|
|
|
// Expression index for {StandardFrame::GetExpressionAddress}.
|
2016-02-16 15:33:54 +00:00
|
|
|
static const int kBytecodeArrayExpressionIndex = -2;
|
|
|
|
static const int kBytecodeOffsetExpressionIndex = -1;
|
|
|
|
static const int kRegisterFileExpressionIndex = 0;
|
2015-08-27 10:32:26 +00:00
|
|
|
};
|
|
|
|
|
2016-02-18 12:51:48 +00:00
|
|
|
inline static int FPOffsetToFrameSlot(int frame_offset) {
|
|
|
|
return StandardFrameConstants::kFixedSlotCountAboveFp - 1 -
|
|
|
|
frame_offset / kPointerSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline static int FrameSlotToFPOffset(int slot) {
|
|
|
|
return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) *
|
|
|
|
kPointerSize;
|
|
|
|
}
|
2015-08-27 10:32:26 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Abstract base class for all stack frames.
|
|
|
|
class StackFrame BASE_EMBEDDED {
|
|
|
|
public:
|
|
|
|
#define DECLARE_TYPE(type, ignore) type,
|
|
|
|
enum Type {
|
|
|
|
NONE = 0,
|
|
|
|
STACK_FRAME_TYPE_LIST(DECLARE_TYPE)
|
2011-09-15 11:30:45 +00:00
|
|
|
NUMBER_OF_TYPES,
|
|
|
|
// Used by FrameScope to indicate that the stack frame is constructed
|
|
|
|
// manually and the FrameScope does not need to emit code.
|
|
|
|
MANUAL
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
#undef DECLARE_TYPE
|
|
|
|
|
|
|
|
// Opaque data type for identifying stack frames. Used extensively
|
|
|
|
// by the debugger.
|
2010-08-16 17:14:34 +00:00
|
|
|
// ID_MIN_VALUE and ID_MAX_VALUE are specified to ensure that enumeration type
|
|
|
|
// has correct value range (see Issue 830 for more details).
|
|
|
|
enum Id {
|
|
|
|
ID_MIN_VALUE = kMinInt,
|
|
|
|
ID_MAX_VALUE = kMaxInt,
|
|
|
|
NO_ID = 0
|
|
|
|
};
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-05-17 11:11:12 +00:00
|
|
|
// Used to mark the outermost JS entry frame.
|
|
|
|
enum JsFrameMarker {
|
|
|
|
INNER_JSENTRY_FRAME = 0,
|
|
|
|
OUTERMOST_JSENTRY_FRAME = 1
|
|
|
|
};
|
|
|
|
|
2010-09-16 08:51:13 +00:00
|
|
|
struct State {
|
2014-03-14 15:11:58 +00:00
|
|
|
State() : sp(NULL), fp(NULL), pc_address(NULL),
|
|
|
|
constant_pool_address(NULL) { }
|
2010-09-16 08:51:13 +00:00
|
|
|
Address sp;
|
|
|
|
Address fp;
|
|
|
|
Address* pc_address;
|
2014-03-14 15:11:58 +00:00
|
|
|
Address* constant_pool_address;
|
2010-09-16 08:51:13 +00:00
|
|
|
};
|
|
|
|
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
// Copy constructor; it breaks the connection to host iterator
|
|
|
|
// (as an iterator usually lives on stack).
|
2010-04-06 17:58:28 +00:00
|
|
|
StackFrame(const StackFrame& original) {
|
|
|
|
this->state_ = original.state_;
|
|
|
|
this->iterator_ = NULL;
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
this->isolate_ = original.isolate_;
|
2010-04-06 17:58:28 +00:00
|
|
|
}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Type testers.
|
|
|
|
bool is_entry() const { return type() == ENTRY; }
|
|
|
|
bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; }
|
|
|
|
bool is_exit() const { return type() == EXIT; }
|
2010-12-07 11:31:57 +00:00
|
|
|
bool is_optimized() const { return type() == OPTIMIZED; }
|
2016-01-20 18:10:13 +00:00
|
|
|
bool is_interpreted() const { return type() == INTERPRETED; }
|
2016-02-23 19:38:50 +00:00
|
|
|
bool is_wasm() const { return type() == WASM; }
|
2016-03-04 04:45:22 +00:00
|
|
|
bool is_wasm_to_js() const { return type() == WASM_TO_JS; }
|
|
|
|
bool is_js_to_wasm() const { return type() == JS_TO_WASM; }
|
2008-07-03 15:10:15 +00:00
|
|
|
bool is_arguments_adaptor() const { return type() == ARGUMENTS_ADAPTOR; }
|
2016-06-17 07:40:13 +00:00
|
|
|
bool is_builtin() const { return type() == BUILTIN; }
|
2008-07-03 15:10:15 +00:00
|
|
|
bool is_internal() const { return type() == INTERNAL; }
|
2013-01-29 09:12:20 +00:00
|
|
|
bool is_stub_failure_trampoline() const {
|
|
|
|
return type() == STUB_FAILURE_TRAMPOLINE;
|
|
|
|
}
|
2008-10-10 09:09:38 +00:00
|
|
|
bool is_construct() const { return type() == CONSTRUCT; }
|
2016-06-30 06:55:22 +00:00
|
|
|
bool is_builtin_exit() const { return type() == BUILTIN_EXIT; }
|
2008-07-03 15:10:15 +00:00
|
|
|
virtual bool is_standard() const { return false; }
|
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
bool is_java_script() const {
|
|
|
|
Type type = this->type();
|
2015-10-22 21:41:47 +00:00
|
|
|
return (type == JAVA_SCRIPT) || (type == OPTIMIZED) ||
|
2016-06-17 07:40:13 +00:00
|
|
|
(type == INTERPRETED) || (type == BUILTIN);
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Accessors.
|
|
|
|
Address sp() const { return state_.sp; }
|
|
|
|
Address fp() const { return state_.fp; }
|
2009-06-10 15:08:25 +00:00
|
|
|
Address caller_sp() const { return GetCallerStackPointer(); }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-06-12 10:22:33 +00:00
|
|
|
// If this frame is optimized and was dynamically aligned return its old
|
|
|
|
// unaligned frame pointer. When the frame is deoptimized its FP will shift
|
|
|
|
// up one word and become unaligned.
|
|
|
|
Address UnpaddedFP() const;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
Address pc() const { return *pc_address(); }
|
|
|
|
void set_pc(Address pc) { *pc_address() = pc; }
|
|
|
|
|
2014-03-14 15:11:58 +00:00
|
|
|
Address constant_pool() const { return *constant_pool_address(); }
|
2015-06-04 14:44:00 +00:00
|
|
|
void set_constant_pool(Address constant_pool) {
|
|
|
|
*constant_pool_address() = constant_pool;
|
2014-03-14 15:11:58 +00:00
|
|
|
}
|
|
|
|
|
2010-04-06 17:58:28 +00:00
|
|
|
virtual void SetCallerFp(Address caller_fp) = 0;
|
|
|
|
|
2012-05-03 17:31:34 +00:00
|
|
|
// Manually changes value of fp in this object.
|
|
|
|
void UpdateFp(Address fp) { state_.fp = fp; }
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
Address* pc_address() const { return state_.pc_address; }
|
|
|
|
|
2014-03-14 15:11:58 +00:00
|
|
|
Address* constant_pool_address() const {
|
|
|
|
return state_.constant_pool_address;
|
|
|
|
}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Get the id of this stack frame.
|
2009-06-10 15:08:25 +00:00
|
|
|
Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-03-05 13:02:34 +00:00
|
|
|
// Get the top handler from the current stack iterator.
|
|
|
|
inline StackHandler* top_handler() const;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Get the type of this frame.
|
|
|
|
virtual Type type() const = 0;
|
|
|
|
|
|
|
|
// Get the code associated with this frame.
|
2010-08-17 11:44:01 +00:00
|
|
|
// This method could be called during marking phase of GC.
|
|
|
|
virtual Code* unchecked_code() const = 0;
|
|
|
|
|
|
|
|
// Get the code associated with this frame.
|
2011-10-03 11:13:20 +00:00
|
|
|
inline Code* LookupCode() const;
|
2010-08-30 08:54:43 +00:00
|
|
|
|
|
|
|
// Get the code object that contains the given pc.
|
2011-03-18 20:35:07 +00:00
|
|
|
static inline Code* GetContainingCode(Isolate* isolate, Address pc);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
// Get the code object containing the given pc and fill in the
|
|
|
|
// safepoint entry and the number of stack slots. The pc must be at
|
|
|
|
// a safepoint.
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
static Code* GetSafepointData(Isolate* isolate,
|
|
|
|
Address pc,
|
2011-01-12 14:14:14 +00:00
|
|
|
SafepointEntry* safepoint_entry,
|
2010-12-07 11:31:57 +00:00
|
|
|
unsigned* stack_slots);
|
|
|
|
|
2010-08-30 08:54:43 +00:00
|
|
|
virtual void Iterate(ObjectVisitor* v) const = 0;
|
2015-06-04 14:44:00 +00:00
|
|
|
static void IteratePc(ObjectVisitor* v, Address* pc_address,
|
|
|
|
Address* constant_pool_address, Code* holder);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-02-27 15:15:53 +00:00
|
|
|
// Sets a callback function for return-address rewriting profilers
|
|
|
|
// to resolve the location of a return address to the location of the
|
|
|
|
// profiler's stashed return address.
|
|
|
|
static void SetReturnAddressLocationResolver(
|
|
|
|
ReturnAddressLocationResolver resolver);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-28 13:40:41 +00:00
|
|
|
// Resolves pc_address through the resolution address function if one is set.
|
|
|
|
static inline Address* ResolveReturnAddressLocation(Address* pc_address);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Printing support.
|
|
|
|
enum PrintMode { OVERVIEW, DETAILS };
|
|
|
|
virtual void Print(StringStream* accumulator,
|
|
|
|
PrintMode mode,
|
|
|
|
int index) const { }
|
|
|
|
|
2012-12-18 16:25:45 +00:00
|
|
|
Isolate* isolate() const { return isolate_; }
|
|
|
|
|
2016-08-25 03:13:09 +00:00
|
|
|
void operator=(const StackFrame& original) = delete;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit StackFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
virtual ~StackFrame() { }
|
|
|
|
|
|
|
|
// Compute the stack pointer for the calling frame.
|
|
|
|
virtual Address GetCallerStackPointer() const = 0;
|
|
|
|
|
|
|
|
// Printing support.
|
|
|
|
static void PrintIndex(StringStream* accumulator,
|
|
|
|
PrintMode mode,
|
|
|
|
int index);
|
|
|
|
|
|
|
|
// Compute the stack frame type for the given state.
|
2013-06-27 09:34:31 +00:00
|
|
|
static Type ComputeType(const StackFrameIteratorBase* iterator, State* state);
|
2013-06-25 10:09:19 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
bool can_access_heap_objects() const;
|
|
|
|
#endif
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
const StackFrameIteratorBase* iterator_;
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
Isolate* isolate_;
|
2008-09-12 03:29:06 +00:00
|
|
|
State state_;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-28 13:40:41 +00:00
|
|
|
static ReturnAddressLocationResolver return_address_location_resolver_;
|
|
|
|
|
2009-03-20 14:49:12 +00:00
|
|
|
// Fill in the state of the calling frame.
|
|
|
|
virtual void ComputeCallerState(State* state) const = 0;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Get the type and the state of the calling frame.
|
2009-03-20 14:49:12 +00:00
|
|
|
virtual Type GetCallerState(State* state) const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
static const intptr_t kIsolateTag = 1;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
friend class StackFrameIterator;
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
friend class StackHandlerIterator;
|
2009-03-20 14:49:12 +00:00
|
|
|
friend class SafeStackFrameIterator;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Entry frames are used to enter JavaScript execution from C.
|
|
|
|
class EntryFrame: public StackFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return ENTRY; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Garbage collection support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
static EntryFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_entry());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<EntryFrame*>(frame);
|
|
|
|
}
|
2015-11-03 16:19:58 +00:00
|
|
|
void SetCallerFp(Address caller_fp) override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit EntryFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// The caller stack pointer for entry frames is always zero. The
|
|
|
|
// real information about the caller frame is available through the
|
|
|
|
// link to the top exit frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override { return 0; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2015-11-03 16:19:58 +00:00
|
|
|
void ComputeCallerState(State* state) const override;
|
|
|
|
Type GetCallerState(State* state) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class EntryConstructFrame: public EntryFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return ENTRY_CONSTRUCT; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
static EntryConstructFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_entry_construct());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<EntryConstructFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit EntryConstructFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Exit frames are used to exit JavaScript execution and go to C.
|
|
|
|
class ExitFrame: public StackFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return EXIT; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-11-04 08:51:48 +00:00
|
|
|
Object*& code_slot() const;
|
|
|
|
|
2009-01-15 19:08:34 +00:00
|
|
|
// Garbage collection support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
void SetCallerFp(Address caller_fp) override;
|
2010-04-06 17:58:28 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
static ExitFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_exit());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<ExitFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Compute the state and type of an exit frame given a frame
|
|
|
|
// pointer. Used when constructing the first stack frame seen by an
|
|
|
|
// iterator and the frames following entry frames.
|
|
|
|
static Type GetStateForFramePointer(Address fp, State* state);
|
2010-09-16 08:23:34 +00:00
|
|
|
static Address ComputeStackPointer(Address fp);
|
2016-06-30 06:55:22 +00:00
|
|
|
static StackFrame::Type ComputeFrameType(Address fp);
|
2010-09-16 08:23:34 +00:00
|
|
|
static void FillState(Address fp, Address sp, State* state);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit ExitFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2015-11-03 16:19:58 +00:00
|
|
|
void ComputeCallerState(State* state) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2016-06-30 06:55:22 +00:00
|
|
|
// Builtin exit frames are a special case of exit frames, which are used
|
|
|
|
// whenever C++ builtins (e.g., Math.acos) are called. Their main purpose is
|
|
|
|
// to allow such builtins to appear in stack traces.
|
|
|
|
class BuiltinExitFrame : public ExitFrame {
|
|
|
|
public:
|
|
|
|
Type type() const override { return BUILTIN_EXIT; }
|
|
|
|
|
|
|
|
static BuiltinExitFrame* cast(StackFrame* frame) {
|
|
|
|
DCHECK(frame->is_builtin_exit());
|
|
|
|
return static_cast<BuiltinExitFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
2016-07-04 12:44:18 +00:00
|
|
|
JSFunction* function() const;
|
|
|
|
Object* receiver() const;
|
|
|
|
|
|
|
|
bool IsConstructor() const;
|
2016-06-30 06:55:22 +00:00
|
|
|
|
2016-07-11 13:27:48 +00:00
|
|
|
void Print(StringStream* accumulator, PrintMode mode,
|
|
|
|
int index) const override;
|
|
|
|
|
2016-06-30 06:55:22 +00:00
|
|
|
protected:
|
|
|
|
inline explicit BuiltinExitFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
|
|
|
private:
|
2016-07-11 13:27:48 +00:00
|
|
|
Object* GetParameter(int i) const;
|
|
|
|
int ComputeParametersCount() const;
|
|
|
|
|
|
|
|
inline Object* receiver_slot_object() const;
|
|
|
|
inline Object* argc_slot_object() const;
|
2016-07-04 12:44:18 +00:00
|
|
|
inline Object* target_slot_object() const;
|
|
|
|
inline Object* new_target_slot_object() const;
|
2016-06-30 06:55:22 +00:00
|
|
|
|
|
|
|
friend class StackFrameIteratorBase;
|
|
|
|
};
|
|
|
|
|
2016-04-18 13:20:45 +00:00
|
|
|
class JavaScriptFrame;
|
|
|
|
|
2016-04-06 11:37:15 +00:00
|
|
|
class FrameSummary BASE_EMBEDDED {
|
|
|
|
public:
|
2016-05-06 09:07:30 +00:00
|
|
|
// Mode for JavaScriptFrame::Summarize. Exact summary is required to produce
|
|
|
|
// an exact stack trace. It will trigger an assertion failure if that is not
|
2016-04-22 12:37:24 +00:00
|
|
|
// possible, e.g., because of missing deoptimization information. The
|
|
|
|
// approximate mode should produce a summary even without deoptimization
|
|
|
|
// information, but it might miss frames.
|
|
|
|
enum Mode { kExactSummary, kApproximateSummary };
|
|
|
|
|
2016-04-06 11:37:15 +00:00
|
|
|
FrameSummary(Object* receiver, JSFunction* function,
|
|
|
|
AbstractCode* abstract_code, int code_offset,
|
2016-04-22 12:37:24 +00:00
|
|
|
bool is_constructor, Mode mode = kExactSummary);
|
2016-04-06 11:37:15 +00:00
|
|
|
|
2016-04-18 13:20:45 +00:00
|
|
|
static FrameSummary GetFirst(JavaScriptFrame* frame);
|
|
|
|
|
2016-08-02 13:46:54 +00:00
|
|
|
Handle<Object> receiver() const { return receiver_; }
|
|
|
|
Handle<JSFunction> function() const { return function_; }
|
|
|
|
Handle<AbstractCode> abstract_code() const { return abstract_code_; }
|
|
|
|
int code_offset() const { return code_offset_; }
|
|
|
|
bool is_constructor() const { return is_constructor_; }
|
2016-04-06 11:37:15 +00:00
|
|
|
|
|
|
|
void Print();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Handle<Object> receiver_;
|
|
|
|
Handle<JSFunction> function_;
|
|
|
|
Handle<AbstractCode> abstract_code_;
|
|
|
|
int code_offset_;
|
|
|
|
bool is_constructor_;
|
|
|
|
};
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2016-04-06 11:37:15 +00:00
|
|
|
class StandardFrame : public StackFrame {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
|
|
|
// Testers.
|
2015-11-03 16:19:58 +00:00
|
|
|
bool is_standard() const override { return true; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Accessors.
|
2016-06-29 10:21:43 +00:00
|
|
|
virtual Object* receiver() const;
|
|
|
|
virtual Script* script() const;
|
|
|
|
virtual Object* context() const;
|
2016-10-13 13:54:46 +00:00
|
|
|
virtual int position() const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Access the expressions in the stack frame including locals.
|
|
|
|
inline Object* GetExpression(int index) const;
|
|
|
|
inline void SetExpression(int index, Object* value);
|
|
|
|
int ComputeExpressionsCount() const;
|
|
|
|
|
2016-06-29 10:21:43 +00:00
|
|
|
// Access the parameters.
|
|
|
|
virtual Object* GetParameter(int index) const;
|
|
|
|
virtual int ComputeParametersCount() const;
|
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
void SetCallerFp(Address caller_fp) override;
|
2010-04-06 17:58:28 +00:00
|
|
|
|
2016-06-29 10:21:43 +00:00
|
|
|
// Check if this frame is a constructor frame invoked through 'new'.
|
|
|
|
virtual bool IsConstructor() const;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
static StandardFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_standard());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<StandardFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit StandardFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
void ComputeCallerState(State* state) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Accessors.
|
|
|
|
inline Address caller_fp() const;
|
|
|
|
inline Address caller_pc() const;
|
|
|
|
|
|
|
|
// Computes the address of the PC field in the standard frame given
|
|
|
|
// by the provided frame pointer.
|
|
|
|
static inline Address ComputePCAddress(Address fp);
|
|
|
|
|
2014-03-14 15:11:58 +00:00
|
|
|
// Computes the address of the constant pool field in the standard
|
|
|
|
// frame given by the provided frame pointer.
|
|
|
|
static inline Address ComputeConstantPoolAddress(Address fp);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Iterate over expression stack including stack handlers, locals,
|
|
|
|
// and parts of the fixed part including context and code fields.
|
|
|
|
void IterateExpressions(ObjectVisitor* v) const;
|
|
|
|
|
|
|
|
// Returns the address of the n'th expression stack element.
|
2016-02-16 15:33:54 +00:00
|
|
|
virtual Address GetExpressionAddress(int n) const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Determines if the standard frame for the given frame pointer is
|
|
|
|
// an arguments adaptor frame.
|
|
|
|
static inline bool IsArgumentsAdaptorFrame(Address fp);
|
|
|
|
|
2008-10-10 09:09:38 +00:00
|
|
|
// Determines if the standard frame for the given frame pointer is a
|
|
|
|
// construct frame.
|
|
|
|
static inline bool IsConstructFrame(Address fp);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-12-18 16:25:45 +00:00
|
|
|
// Used by OptimizedFrames and StubFrames.
|
|
|
|
void IterateCompiledFrame(ObjectVisitor* v) const;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
|
|
|
friend class StackFrame;
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class SafeStackFrameIterator;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2016-02-23 19:38:50 +00:00
|
|
|
class JavaScriptFrame : public StandardFrame {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return JAVA_SCRIPT; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2016-05-06 09:07:30 +00:00
|
|
|
// Build a list with summaries for this frame including all inlined frames.
|
|
|
|
virtual void Summarize(
|
|
|
|
List<FrameSummary>* frames,
|
|
|
|
FrameSummary::Mode mode = FrameSummary::kExactSummary) const;
|
|
|
|
|
|
|
|
// Accessors.
|
|
|
|
virtual JSFunction* function() const;
|
2016-06-29 10:21:43 +00:00
|
|
|
Object* receiver() const override;
|
|
|
|
Object* context() const override;
|
|
|
|
Script* script() const override;
|
2016-04-06 11:37:15 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
inline void set_receiver(Object* value);
|
|
|
|
|
|
|
|
// Access the parameters.
|
2011-04-06 14:23:27 +00:00
|
|
|
inline Address GetParameterSlot(int index) const;
|
2016-06-29 10:21:43 +00:00
|
|
|
Object* GetParameter(int index) const override;
|
|
|
|
int ComputeParametersCount() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-04-26 12:09:32 +00:00
|
|
|
// Access the operand stack.
|
|
|
|
inline Address GetOperandSlot(int index) const;
|
|
|
|
inline Object* GetOperand(int index) const;
|
|
|
|
inline int ComputeOperandsCount() const;
|
|
|
|
|
2015-03-25 13:13:51 +00:00
|
|
|
// Generator support to preserve operand stack.
|
|
|
|
void SaveOperandStack(FixedArray* store) const;
|
2013-05-08 08:08:23 +00:00
|
|
|
|
2012-12-11 23:27:38 +00:00
|
|
|
// Debugger access.
|
|
|
|
void SetParameterValue(int index, Object* value) const;
|
|
|
|
|
2008-10-10 09:09:38 +00:00
|
|
|
// Check if this frame is a constructor frame invoked through 'new'.
|
2016-06-29 10:21:43 +00:00
|
|
|
bool IsConstructor() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-09-16 11:32:54 +00:00
|
|
|
// Determines whether this frame includes inlined activations. To get details
|
|
|
|
// about the inlined frames use {GetFunctions} and {Summarize}.
|
2015-11-03 16:19:58 +00:00
|
|
|
bool HasInlinedFrames() const;
|
2015-09-16 11:32:54 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Check if this frame has "adapted" arguments in the sense that the
|
|
|
|
// actual passed arguments are available in an arguments adaptor
|
|
|
|
// frame below it on the stack.
|
|
|
|
inline bool has_adapted_arguments() const;
|
2011-06-29 13:02:00 +00:00
|
|
|
int GetArgumentsLength() const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-01-15 19:08:34 +00:00
|
|
|
// Garbage collection support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Printing support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Print(StringStream* accumulator, PrintMode mode,
|
|
|
|
int index) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Determine the code for the frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
// Return a list with JSFunctions of this frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
virtual void GetFunctions(List<JSFunction*>* functions) const;
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2015-03-25 13:13:51 +00:00
|
|
|
// Lookup exception handler for current {pc}, returns -1 if none found. Also
|
2016-02-05 13:51:42 +00:00
|
|
|
// returns data associated with the handler site specific to the frame type:
|
|
|
|
// - JavaScriptFrame : Data is the stack depth at entry of the try-block.
|
|
|
|
// - OptimizedFrame : Data is the stack slot count of the entire frame.
|
|
|
|
// - InterpretedFrame: Data is the register index holding the context.
|
2015-05-29 10:05:22 +00:00
|
|
|
virtual int LookupExceptionHandlerInTable(
|
2016-02-05 13:51:42 +00:00
|
|
|
int* data, HandlerTable::CatchPrediction* prediction);
|
2015-03-25 13:13:51 +00:00
|
|
|
|
2013-05-17 08:27:56 +00:00
|
|
|
// Architecture-specific register description.
|
|
|
|
static Register fp_register();
|
|
|
|
static Register context_register();
|
2013-12-30 11:23:59 +00:00
|
|
|
static Register constant_pool_pointer_register();
|
2013-05-17 08:27:56 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
static JavaScriptFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_java_script());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<JavaScriptFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
2016-10-13 14:47:44 +00:00
|
|
|
static void PrintFunctionAndOffset(JSFunction* function, AbstractCode* code,
|
|
|
|
int code_offset, FILE* file,
|
2014-07-08 08:28:08 +00:00
|
|
|
bool print_line_number);
|
|
|
|
|
|
|
|
static void PrintTop(Isolate* isolate, FILE* file, bool print_args,
|
2013-02-15 09:27:10 +00:00
|
|
|
bool print_line_number);
|
2011-10-20 09:38:24 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit JavaScriptFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-04-06 14:23:27 +00:00
|
|
|
virtual int GetNumberOfIncomingArguments() const;
|
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
// Garbage collection support. Iterates over incoming arguments,
|
|
|
|
// receiver, and any callee-saved registers.
|
|
|
|
void IterateArguments(ObjectVisitor* v) const;
|
|
|
|
|
2016-07-11 13:27:48 +00:00
|
|
|
virtual void PrintFrameKind(StringStream* accumulator) const {}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2009-03-20 14:49:12 +00:00
|
|
|
inline Object* function_slot_object() const;
|
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-12-18 16:25:45 +00:00
|
|
|
class StubFrame : public StandardFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return STUB; }
|
2012-12-18 16:25:45 +00:00
|
|
|
|
|
|
|
// GC support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2012-12-18 16:25:45 +00:00
|
|
|
|
|
|
|
// Determine the code for the frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2012-12-18 16:25:45 +00:00
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit StubFrame(StackFrameIteratorBase* iterator);
|
2012-12-18 16:25:45 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override;
|
2012-12-18 16:25:45 +00:00
|
|
|
|
|
|
|
virtual int GetNumberOfIncomingArguments() const;
|
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2012-12-18 16:25:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-12-10 11:09:12 +00:00
|
|
|
class OptimizedFrame : public JavaScriptFrame {
|
2010-12-07 11:31:57 +00:00
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return OPTIMIZED; }
|
2010-12-07 11:31:57 +00:00
|
|
|
|
|
|
|
// GC support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2010-12-07 11:31:57 +00:00
|
|
|
|
|
|
|
// Return a list with JSFunctions of this frame.
|
|
|
|
// The functions are ordered bottom-to-top (i.e. functions.last()
|
|
|
|
// is the top-most activation)
|
2015-11-03 16:19:58 +00:00
|
|
|
void GetFunctions(List<JSFunction*>* functions) const override;
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2016-04-22 12:37:24 +00:00
|
|
|
void Summarize(
|
|
|
|
List<FrameSummary>* frames,
|
|
|
|
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2016-02-05 13:51:42 +00:00
|
|
|
// Lookup exception handler for current {pc}, returns -1 if none found.
|
2015-11-03 16:19:58 +00:00
|
|
|
int LookupExceptionHandlerInTable(
|
2016-02-05 13:51:42 +00:00
|
|
|
int* data, HandlerTable::CatchPrediction* prediction) override;
|
2015-03-25 13:13:51 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
DeoptimizationInputData* GetDeoptimizationData(int* deopt_index) const;
|
2010-12-07 11:31:57 +00:00
|
|
|
|
[turbofan] Unify referencing of stack slots
Previously, it was not possible to specify StackSlotOperands for all
slots in both the caller and callee stacks. Specifically, the region
of the callee's stack including the saved return address, frame
pointer, function pointer and context pointer could not be addressed
by the register allocator/gap resolver.
In preparation for better tail call support, which will use the gap
resolver to reconcile outgoing parameters, this change makes it
possible to address all slots on the stack, because slots in the
previously inaccessible dead zone may become parameter slots for
outgoing tail calls. All caller stack slots are accessible as they
were before, with slot -1 corresponding to the last stack
parameter. Stack slot indices >= 0 access the callee stack, with slot
0 corresponding to the callee's saved return address, 1 corresponding
to the saved frame pointer, 2 corresponding to the current function
context, 3 corresponding to the frame marker/JSFunction, and slots 4
and above corresponding to spill slots.
The following changes were specifically needed:
* Frame has been changed to explicitly manage three areas of the
callee frame, the fixed header, the spill slot area, and the
callee-saved register area.
* Conversions from stack slot indices to fp offsets all now go through
a common bottleneck: OptimizedFrame::StackSlotOffsetRelativeToFp
* The generation of deoptimization translation tables has been changed
to support the new stack slot indexing scheme. Crankshaft, which
doesn't support the new slot numbering in its register allocator,
must adapt the indexes when creating translation tables.
* Callee-saved parameters are now kept below spill slots, not above,
to support saving only the optimal set of used registers, which is
only known after register allocation is finished and spill slots
have been allocated.
Review URL: https://codereview.chromium.org/1261923007
Cr-Commit-Position: refs/heads/master@{#30224}
2015-08-18 14:47:56 +00:00
|
|
|
static int StackSlotOffsetRelativeToFp(int slot_index);
|
|
|
|
|
2010-12-07 11:31:57 +00:00
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit OptimizedFrame(StackFrameIteratorBase* iterator);
|
2010-12-07 11:31:57 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2015-06-16 06:04:42 +00:00
|
|
|
|
|
|
|
Object* StackSlotAt(int index) const;
|
2010-12-07 11:31:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-10-16 15:06:10 +00:00
|
|
|
class InterpretedFrame : public JavaScriptFrame {
|
2016-01-20 18:10:13 +00:00
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return INTERPRETED; }
|
2015-10-16 15:06:10 +00:00
|
|
|
|
2016-10-13 13:54:46 +00:00
|
|
|
// Accessors.
|
|
|
|
int position() const override;
|
|
|
|
|
2016-02-05 13:51:42 +00:00
|
|
|
// Lookup exception handler for current {pc}, returns -1 if none found.
|
2016-01-20 18:10:13 +00:00
|
|
|
int LookupExceptionHandlerInTable(
|
2016-02-05 13:51:42 +00:00
|
|
|
int* data, HandlerTable::CatchPrediction* prediction) override;
|
2016-01-20 18:10:13 +00:00
|
|
|
|
|
|
|
// Returns the current offset into the bytecode stream.
|
|
|
|
int GetBytecodeOffset() const;
|
|
|
|
|
|
|
|
// Updates the current offset into the bytecode stream, mainly used for stack
|
|
|
|
// unwinding to continue execution at a different bytecode offset.
|
|
|
|
void PatchBytecodeOffset(int new_offset);
|
|
|
|
|
2016-02-16 12:35:38 +00:00
|
|
|
// Returns the frame's current bytecode array.
|
2016-04-18 13:20:45 +00:00
|
|
|
BytecodeArray* GetBytecodeArray() const;
|
2016-02-11 13:10:45 +00:00
|
|
|
|
2016-02-16 12:35:38 +00:00
|
|
|
// Updates the frame's BytecodeArray with |bytecode_array|. Used by the
|
|
|
|
// debugger to swap execution onto a BytecodeArray patched with breakpoints.
|
2016-04-18 13:20:45 +00:00
|
|
|
void PatchBytecodeArray(BytecodeArray* bytecode_array);
|
2016-02-11 13:10:45 +00:00
|
|
|
|
2016-02-04 13:43:45 +00:00
|
|
|
// Access to the interpreter register file for this frame.
|
2016-04-18 14:13:04 +00:00
|
|
|
Object* ReadInterpreterRegister(int register_index) const;
|
|
|
|
void WriteInterpreterRegister(int register_index, Object* value);
|
2016-02-04 13:43:45 +00:00
|
|
|
|
2016-01-28 12:11:55 +00:00
|
|
|
// Build a list with summaries for this frame including all inlined frames.
|
2016-04-22 12:37:24 +00:00
|
|
|
void Summarize(
|
|
|
|
List<FrameSummary>* frames,
|
|
|
|
FrameSummary::Mode mode = FrameSummary::kExactSummary) const override;
|
2016-01-28 12:11:55 +00:00
|
|
|
|
2016-10-13 14:47:44 +00:00
|
|
|
static int GetBytecodeOffset(Address fp);
|
|
|
|
|
2015-10-16 15:06:10 +00:00
|
|
|
protected:
|
|
|
|
inline explicit InterpretedFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
2016-02-16 15:33:54 +00:00
|
|
|
Address GetExpressionAddress(int n) const override;
|
|
|
|
|
2015-10-16 15:06:10 +00:00
|
|
|
private:
|
|
|
|
friend class StackFrameIteratorBase;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Arguments adaptor frames are automatically inserted below
|
|
|
|
// JavaScript frames when the actual number of parameters does not
|
|
|
|
// match the formal number of parameters.
|
|
|
|
class ArgumentsAdaptorFrame: public JavaScriptFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return ARGUMENTS_ADAPTOR; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Determine the code for the frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
static ArgumentsAdaptorFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_arguments_adaptor());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<ArgumentsAdaptorFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Printing support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Print(StringStream* accumulator, PrintMode mode,
|
|
|
|
int index) const override;
|
2011-09-08 19:57:14 +00:00
|
|
|
|
2016-02-16 15:33:54 +00:00
|
|
|
static int GetLength(Address fp);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit ArgumentsAdaptorFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
int GetNumberOfIncomingArguments() const override;
|
2011-04-06 14:23:27 +00:00
|
|
|
|
2016-06-17 07:40:13 +00:00
|
|
|
private:
|
|
|
|
friend class StackFrameIteratorBase;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Builtin frames are built for builtins with JavaScript linkage, such as
|
|
|
|
// various standard library functions (i.e. Math.asin, Math.floor, etc.).
|
|
|
|
class BuiltinFrame final : public JavaScriptFrame {
|
|
|
|
public:
|
|
|
|
Type type() const final { return BUILTIN; }
|
|
|
|
|
|
|
|
static BuiltinFrame* cast(StackFrame* frame) {
|
|
|
|
DCHECK(frame->is_builtin());
|
|
|
|
return static_cast<BuiltinFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
inline explicit BuiltinFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
|
|
|
int GetNumberOfIncomingArguments() const final;
|
2016-07-11 13:27:48 +00:00
|
|
|
void PrintFrameKind(StringStream* accumulator) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2016-02-23 19:38:50 +00:00
|
|
|
class WasmFrame : public StandardFrame {
|
|
|
|
public:
|
|
|
|
Type type() const override { return WASM; }
|
|
|
|
|
|
|
|
// GC support.
|
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
|
|
|
|
|
|
|
// Printing support.
|
|
|
|
void Print(StringStream* accumulator, PrintMode mode,
|
|
|
|
int index) const override;
|
|
|
|
|
2016-09-30 16:09:12 +00:00
|
|
|
// Lookup exception handler for current {pc}, returns -1 if none found. Also
|
|
|
|
// returns the stack slot count of the entire frame.
|
|
|
|
int LookupExceptionHandlerInTable(int* data);
|
|
|
|
|
2016-02-23 19:38:50 +00:00
|
|
|
// Determine the code for the frame.
|
|
|
|
Code* unchecked_code() const override;
|
|
|
|
|
2016-06-29 10:21:43 +00:00
|
|
|
// Accessors.
|
2016-10-19 10:30:04 +00:00
|
|
|
Object* wasm_instance() const;
|
2016-06-29 10:21:43 +00:00
|
|
|
uint32_t function_index() const;
|
|
|
|
Script* script() const override;
|
2016-10-13 13:54:46 +00:00
|
|
|
int position() const override;
|
2016-05-06 09:07:30 +00:00
|
|
|
|
2016-03-29 17:41:42 +00:00
|
|
|
static WasmFrame* cast(StackFrame* frame) {
|
|
|
|
DCHECK(frame->is_wasm());
|
|
|
|
return static_cast<WasmFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
2016-02-23 19:38:50 +00:00
|
|
|
protected:
|
|
|
|
inline explicit WasmFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
|
|
|
Address GetCallerStackPointer() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class StackFrameIteratorBase;
|
2016-03-04 04:45:22 +00:00
|
|
|
};
|
|
|
|
|
2016-03-29 17:41:42 +00:00
|
|
|
class WasmToJsFrame : public StubFrame {
|
2016-03-04 04:45:22 +00:00
|
|
|
public:
|
|
|
|
Type type() const override { return WASM_TO_JS; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
inline explicit WasmToJsFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class StackFrameIteratorBase;
|
|
|
|
};
|
|
|
|
|
2016-03-29 17:41:42 +00:00
|
|
|
class JsToWasmFrame : public StubFrame {
|
2016-03-04 04:45:22 +00:00
|
|
|
public:
|
|
|
|
Type type() const override { return JS_TO_WASM; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
inline explicit JsToWasmFrame(StackFrameIteratorBase* iterator);
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class StackFrameIteratorBase;
|
2016-02-23 19:38:50 +00:00
|
|
|
};
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
class InternalFrame: public StandardFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return INTERNAL; }
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-01-15 19:08:34 +00:00
|
|
|
// Garbage collection support.
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Determine the code for the frame.
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
static InternalFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_internal());
|
2008-07-03 15:10:15 +00:00
|
|
|
return static_cast<InternalFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit InternalFrame(StackFrameIteratorBase* iterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-02-05 08:09:32 +00:00
|
|
|
class StubFailureTrampolineFrame: public StandardFrame {
|
2013-01-29 09:12:20 +00:00
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return STUB_FAILURE_TRAMPOLINE; }
|
2013-01-29 09:12:20 +00:00
|
|
|
|
2013-02-05 08:09:32 +00:00
|
|
|
// Get the code associated with this frame.
|
|
|
|
// This method could be called during marking phase of GC.
|
2015-11-03 16:19:58 +00:00
|
|
|
Code* unchecked_code() const override;
|
2013-02-05 08:09:32 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
void Iterate(ObjectVisitor* v) const override;
|
2013-01-29 09:12:20 +00:00
|
|
|
|
2013-03-08 16:18:50 +00:00
|
|
|
// Architecture-specific register description.
|
|
|
|
static Register fp_register();
|
|
|
|
static Register context_register();
|
2013-12-30 11:23:59 +00:00
|
|
|
static Register constant_pool_pointer_register();
|
2013-03-08 16:18:50 +00:00
|
|
|
|
2013-01-29 09:12:20 +00:00
|
|
|
protected:
|
|
|
|
inline explicit StubFailureTrampolineFrame(
|
2013-06-27 09:34:31 +00:00
|
|
|
StackFrameIteratorBase* iterator);
|
2013-01-29 09:12:20 +00:00
|
|
|
|
2015-11-03 16:19:58 +00:00
|
|
|
Address GetCallerStackPointer() const override;
|
2013-02-05 08:09:32 +00:00
|
|
|
|
2013-01-29 09:12:20 +00:00
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2013-01-29 09:12:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-10-10 09:09:38 +00:00
|
|
|
// Construct frames are special trampoline frames introduced to handle
|
|
|
|
// function invocations through 'new'.
|
|
|
|
class ConstructFrame: public InternalFrame {
|
|
|
|
public:
|
2015-11-03 16:19:58 +00:00
|
|
|
Type type() const override { return CONSTRUCT; }
|
2008-10-10 09:09:38 +00:00
|
|
|
|
|
|
|
static ConstructFrame* cast(StackFrame* frame) {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(frame->is_construct());
|
2008-10-10 09:09:38 +00:00
|
|
|
return static_cast<ConstructFrame*>(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2013-06-27 09:34:31 +00:00
|
|
|
inline explicit ConstructFrame(StackFrameIteratorBase* iterator);
|
2008-10-10 09:09:38 +00:00
|
|
|
|
|
|
|
private:
|
2013-06-27 09:34:31 +00:00
|
|
|
friend class StackFrameIteratorBase;
|
2008-10-10 09:09:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
class StackFrameIteratorBase BASE_EMBEDDED {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
Isolate* isolate() const { return isolate_; }
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
bool done() const { return frame_ == NULL; }
|
2013-06-25 10:09:19 +00:00
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
protected:
|
|
|
|
// An iterator that iterates over a given thread's stack.
|
|
|
|
StackFrameIteratorBase(Isolate* isolate, bool can_access_heap_objects);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
Isolate* isolate_;
|
2008-07-03 15:10:15 +00:00
|
|
|
#define DECLARE_SINGLETON(ignore, type) type type##_;
|
|
|
|
STACK_FRAME_TYPE_LIST(DECLARE_SINGLETON)
|
|
|
|
#undef DECLARE_SINGLETON
|
|
|
|
StackFrame* frame_;
|
|
|
|
StackHandler* handler_;
|
2013-06-25 10:09:19 +00:00
|
|
|
const bool can_access_heap_objects_;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
StackHandler* handler() const {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(!done());
|
2008-07-03 15:10:15 +00:00
|
|
|
return handler_;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the type-specific frame singleton in a given state.
|
|
|
|
StackFrame* SingletonFor(StackFrame::Type type, StackFrame::State* state);
|
2009-03-20 14:49:12 +00:00
|
|
|
// A helper function, can return a NULL pointer.
|
|
|
|
StackFrame* SingletonFor(StackFrame::Type type);
|
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
private:
|
2008-07-03 15:10:15 +00:00
|
|
|
friend class StackFrame;
|
2013-06-27 09:34:31 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(StackFrameIteratorBase);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class StackFrameIterator: public StackFrameIteratorBase {
|
|
|
|
public:
|
|
|
|
// An iterator that iterates over the isolate's current thread's stack,
|
|
|
|
explicit StackFrameIterator(Isolate* isolate);
|
|
|
|
// An iterator that iterates over a given thread's stack.
|
|
|
|
StackFrameIterator(Isolate* isolate, ThreadLocalTop* t);
|
|
|
|
|
|
|
|
StackFrame* frame() const {
|
2014-08-04 11:34:54 +00:00
|
|
|
DCHECK(!done());
|
2013-06-27 09:34:31 +00:00
|
|
|
return frame_;
|
|
|
|
}
|
|
|
|
void Advance();
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Go back to the first frame.
|
|
|
|
void Reset(ThreadLocalTop* top);
|
|
|
|
|
2008-08-28 09:55:41 +00:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(StackFrameIterator);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Iterator that supports iterating through all JavaScript frames.
|
2013-06-24 08:38:37 +00:00
|
|
|
class JavaScriptFrameIterator BASE_EMBEDDED {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2013-06-24 08:38:37 +00:00
|
|
|
inline explicit JavaScriptFrameIterator(Isolate* isolate);
|
|
|
|
inline JavaScriptFrameIterator(Isolate* isolate, ThreadLocalTop* top);
|
2008-07-03 15:10:15 +00:00
|
|
|
// Skip frames until the frame with the given id is reached.
|
2013-06-24 08:38:37 +00:00
|
|
|
JavaScriptFrameIterator(Isolate* isolate, StackFrame::Id id);
|
2011-03-18 20:35:07 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
inline JavaScriptFrame* frame() const;
|
|
|
|
|
|
|
|
bool done() const { return iterator_.done(); }
|
|
|
|
void Advance();
|
|
|
|
|
|
|
|
// Advance to the frame holding the arguments for the current
|
|
|
|
// frame. This only affects the current frame if it has adapted
|
|
|
|
// arguments.
|
|
|
|
void AdvanceToArgumentsFrame();
|
|
|
|
|
|
|
|
private:
|
2013-06-24 08:38:37 +00:00
|
|
|
StackFrameIterator iterator_;
|
2009-03-03 11:56:44 +00:00
|
|
|
};
|
|
|
|
|
2016-04-06 11:37:15 +00:00
|
|
|
// NOTE: The stack trace frame iterator is an iterator that only traverse proper
|
|
|
|
// JavaScript frames that have proper JavaScript functions and WASM frames.
|
|
|
|
// This excludes the problematic functions in runtime.js.
|
|
|
|
class StackTraceFrameIterator BASE_EMBEDDED {
|
2009-03-03 11:56:44 +00:00
|
|
|
public:
|
Simplify isolates access during stack iteration (WAS: Move SafeStackFrameIterator::active_count_...)
While trying to fix Mac and Windows versions for this change:
http://codereview.chromium.org/6771047/, I figured out, that we
already store an isolate in StackFrameIterator, so we can use it in
frame objects, instead of requiring it from caller.
I've changed iterators usage to the following scheme: whenever a
caller maintains an isolate pointer, it just passes it to stack
iterator, and no more worries about passing it to frame content
accessors. If a caller uses current isolate, it can omit passing it
to iterator, in this case, an iterator will use the current isolate,
too.
There was a special case with LiveEdit, which creates
detached copies of frame objects.
R=vitalyr@chromium.org
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6794019
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-04-05 09:01:47 +00:00
|
|
|
explicit StackTraceFrameIterator(Isolate* isolate);
|
2016-06-29 10:21:43 +00:00
|
|
|
StackTraceFrameIterator(Isolate* isolate, StackFrame::Id id);
|
2016-04-06 11:37:15 +00:00
|
|
|
bool done() const { return iterator_.done(); }
|
2009-03-03 11:56:44 +00:00
|
|
|
void Advance();
|
2010-02-01 10:34:57 +00:00
|
|
|
|
2016-04-06 11:37:15 +00:00
|
|
|
inline StandardFrame* frame() const;
|
|
|
|
|
|
|
|
inline bool is_javascript() const;
|
|
|
|
inline bool is_wasm() const;
|
|
|
|
inline JavaScriptFrame* javascript_frame() const;
|
|
|
|
inline WasmFrame* wasm_frame() const;
|
|
|
|
|
2016-06-29 10:21:43 +00:00
|
|
|
// Advance to the frame holding the arguments for the current
|
|
|
|
// frame. This only affects the current frame if it is a javascript frame and
|
|
|
|
// has adapted arguments.
|
|
|
|
void AdvanceToArgumentsFrame();
|
|
|
|
|
2010-02-01 10:34:57 +00:00
|
|
|
private:
|
2016-04-06 11:37:15 +00:00
|
|
|
StackFrameIterator iterator_;
|
|
|
|
bool IsValidFrame(StackFrame* frame) const;
|
2009-03-03 11:56:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
class SafeStackFrameIterator: public StackFrameIteratorBase {
|
2009-03-03 11:56:44 +00:00
|
|
|
public:
|
2011-03-18 20:35:07 +00:00
|
|
|
SafeStackFrameIterator(Isolate* isolate,
|
|
|
|
Address fp, Address sp,
|
2013-07-03 16:20:59 +00:00
|
|
|
Address js_entry_sp);
|
2009-03-03 11:56:44 +00:00
|
|
|
|
2013-07-23 15:01:38 +00:00
|
|
|
inline StackFrame* frame() const;
|
2009-03-03 11:56:44 +00:00
|
|
|
void Advance();
|
|
|
|
|
2013-07-03 14:04:37 +00:00
|
|
|
StackFrame::Type top_frame_type() const { return top_frame_type_; }
|
|
|
|
|
2013-06-24 13:27:48 +00:00
|
|
|
private:
|
2013-06-25 07:14:06 +00:00
|
|
|
void AdvanceOneFrame();
|
|
|
|
|
2009-03-20 14:49:12 +00:00
|
|
|
bool IsValidStackAddress(Address addr) const {
|
2013-06-27 09:34:31 +00:00
|
|
|
return low_bound_ <= addr && addr <= high_bound_;
|
2009-03-03 11:56:44 +00:00
|
|
|
}
|
2009-03-20 14:49:12 +00:00
|
|
|
bool IsValidFrame(StackFrame* frame) const;
|
|
|
|
bool IsValidCaller(StackFrame* frame);
|
2013-06-27 09:34:31 +00:00
|
|
|
bool IsValidExitFrame(Address fp) const;
|
|
|
|
bool IsValidTop(ThreadLocalTop* top) const;
|
2009-03-03 11:56:44 +00:00
|
|
|
|
2013-06-27 09:34:31 +00:00
|
|
|
const Address low_bound_;
|
|
|
|
const Address high_bound_;
|
2013-07-03 14:04:37 +00:00
|
|
|
StackFrame::Type top_frame_type_;
|
2013-07-23 15:01:38 +00:00
|
|
|
ExternalCallbackScope* external_callback_scope_;
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class StackFrameLocator BASE_EMBEDDED {
|
|
|
|
public:
|
2013-02-15 09:27:10 +00:00
|
|
|
explicit StackFrameLocator(Isolate* isolate) : iterator_(isolate) {}
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Find the nth JavaScript frame on the stack. The caller must
|
|
|
|
// guarantee that such a frame exists.
|
|
|
|
JavaScriptFrame* FindJavaScriptFrame(int n);
|
|
|
|
|
|
|
|
private:
|
|
|
|
StackFrameIterator iterator_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-04-06 17:58:28 +00:00
|
|
|
// Reads all frames on the current stack and copies them into the current
|
|
|
|
// zone memory.
|
2013-02-15 09:27:10 +00:00
|
|
|
Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
|
2010-04-06 17:58:28 +00:00
|
|
|
|
2015-09-30 13:46:56 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#endif // V8_FRAMES_H_
|