diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-10-18 15:03:02 -0700 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-10-18 17:01:41 -0700 |
commit | 3d1b3df9486c0e7708065257f7311902f6b7b366 (patch) | |
tree | cb051bdeaead11e06dcd97725783e0f113afb1bf /deps/v8/src/frames.h | |
parent | e2cddbb8ccdb7b3c4a40c8acc630f68703bc77b5 (diff) | |
download | android-node-v8-3d1b3df9486c0e7708065257f7311902f6b7b366.tar.gz android-node-v8-3d1b3df9486c0e7708065257f7311902f6b7b366.tar.bz2 android-node-v8-3d1b3df9486c0e7708065257f7311902f6b7b366.zip |
deps: update V8 to 6.2.414.32
PR-URL: https://github.com/nodejs/node/pull/15362
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/src/frames.h')
-rw-r--r-- | deps/v8/src/frames.h | 395 |
1 files changed, 31 insertions, 364 deletions
diff --git a/deps/v8/src/frames.h b/deps/v8/src/frames.h index 92cce268f1..24f7dcd7f8 100644 --- a/deps/v8/src/frames.h +++ b/deps/v8/src/frames.h @@ -19,21 +19,6 @@ class Debug; class ObjectVisitor; class StringStream; -#if V8_TARGET_ARCH_ARM64 -typedef uint64_t RegList; -#else -typedef uint32_t RegList; -#endif - -// Get the number of registers in a given register list. -int NumRegs(RegList list); - -void SetUpJSCallerSavedCodeData(); - -// Return the code of the n-th saved register available to JavaScript. -int JSCallerSavedCode(int n); - - // Forward declarations. class ExternalCallbackScope; class Isolate; @@ -101,7 +86,7 @@ class StackHandler BASE_EMBEDDED { #define STACK_FRAME_TYPE_LIST(V) \ V(ENTRY, EntryFrame) \ - V(ENTRY_CONSTRUCT, EntryConstructFrame) \ + V(CONSTRUCT_ENTRY, ConstructEntryFrame) \ V(EXIT, ExitFrame) \ V(JAVA_SCRIPT, JavaScriptFrame) \ V(OPTIMIZED, OptimizedFrame) \ @@ -109,6 +94,7 @@ class StackHandler BASE_EMBEDDED { V(WASM_TO_JS, WasmToJsFrame) \ V(JS_TO_WASM, JsToWasmFrame) \ V(WASM_INTERPRETER_ENTRY, WasmInterpreterEntryFrame) \ + V(C_WASM_ENTRY, CWasmEntryFrame) \ V(INTERPRETED, InterpretedFrame) \ V(STUB, StubFrame) \ V(BUILTIN_CONTINUATION, BuiltinContinuationFrame) \ @@ -119,309 +105,6 @@ class StackHandler BASE_EMBEDDED { V(BUILTIN, BuiltinFrame) \ V(BUILTIN_EXIT, BuiltinExitFrame) -// 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] | | | -// |- - - - - - - - -| | | -// 2+cp |Context/Frm. Type| 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 CommonFrameConstants : public AllStatic { - public: - static const int kCallerFPOffset = 0 * kPointerSize; - static const int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize; - static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; - - // Fixed part of the frame consists of return address, caller fp, - // constant pool (if FLAG_enable_embedded_constant_pool), context, and - // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset - // is the last object pointer. - static const int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize; - static const int kFixedSlotCountAboveFp = - kFixedFrameSizeAboveFp / kPointerSize; - static const int kCPSlotSize = - FLAG_enable_embedded_constant_pool ? kPointerSize : 0; - static const int kCPSlotCount = kCPSlotSize / kPointerSize; - static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0; - static const int kContextOrFrameTypeSize = kPointerSize; - static const int kContextOrFrameTypeOffset = - -(kCPSlotSize + kContextOrFrameTypeSize); -}; - -// 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; - static const int kLastObjectOffset = kContextOffset; -}; - -// OptimizedBuiltinFrameConstants are used for TF-generated builtins. They -// always have a context below the saved fp/constant pool and below that the -// JSFunction of the executing function and below that an integer (not a Smi) -// containing the number of arguments passed to the builtin. -// -// 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 | | otherwise, cp = 0 | -// |- - - - - - - - -| | | -// 4+cp | argc | v | -// +-----------------+---- | -// 5+cp | | ^ Callee -// |- - - - - - - - -| | frame slots -// ... | | Frame slots (slot >= 0) -// |- - - - - - - - -| | | -// | | v | -// -----+-----------------+----- <-- stack ptr ------------- -// -class OptimizedBuiltinFrameConstants : public StandardFrameConstants { - public: - static const int kArgCSize = kPointerSize; - static const int kArgCOffset = -3 * kPointerSize - kCPSlotSize; - static const int kFixedFrameSize = kFixedFrameSizeAboveFp - kArgCOffset; - static const int kFixedSlotCount = kFixedFrameSize / kPointerSize; -}; - -// 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; -}; - -#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 { - 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); -}; - -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); -}; - -class InternalFrameConstants : public TypedFrameConstants { - public: - // FP-relative. - static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); - DEFINE_TYPED_FRAME_SIZES(1); -}; - -class FrameDropperFrameConstants : public InternalFrameConstants { - public: - // FP-relative. - static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); - DEFINE_TYPED_FRAME_SIZES(2); -}; - -class ConstructFrameConstants : public TypedFrameConstants { - public: - // FP-relative. - static const int kContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); - static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); - static const int kConstructorOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2); - static const int kNewTargetOrImplicitReceiverOffset = - TYPED_FRAME_PUSHED_VALUE_OFFSET(3); - DEFINE_TYPED_FRAME_SIZES(4); -}; - -class BuiltinContinuationFrameConstants : public TypedFrameConstants { - public: - // FP-relative. - static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); - static const int kBuiltinOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); - static const int kArgCOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2); - DEFINE_TYPED_FRAME_SIZES(2); -}; - -// 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; - static const int kArgcOffset = kTargetOffset + 1 * kPointerSize; -}; - -class InterpreterFrameConstants : public AllStatic { - public: - // Fixed frame includes new.target, bytecode array, and bytecode offset. - static const int kFixedFrameSize = - StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize; - static const int kFixedFrameSizeFromFp = - StandardFrameConstants::kFixedFrameSizeFromFp + 3 * kPointerSize; - - // FP-relative. - static const int kLastParamFromFp = StandardFrameConstants::kCallerSPOffset; - static const int kCallerPCOffsetFromFp = - StandardFrameConstants::kCallerPCOffset; - static const int kNewTargetFromFp = - -StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize; - static const int kBytecodeArrayFromFp = - -StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize; - static const int kBytecodeOffsetFromFp = - -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; - static const int kRegisterFileFromFp = - -StandardFrameConstants::kFixedFrameSizeFromFp - 4 * kPointerSize; - - static const int kExpressionsOffset = kRegisterFileFromFp; - - // Number of fixed slots in addition to a {StandardFrame}. - static const int kExtraSlotCount = - InterpreterFrameConstants::kFixedFrameSize / kPointerSize - - StandardFrameConstants::kFixedFrameSize / kPointerSize; - - // Expression index for {StandardFrame::GetExpressionAddress}. - static const int kBytecodeArrayExpressionIndex = -2; - static const int kBytecodeOffsetExpressionIndex = -1; - static const int kRegisterFileExpressionIndex = 0; -}; - -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; -} - // Abstract base class for all stack frames. class StackFrame BASE_EMBEDDED { public: @@ -510,7 +193,7 @@ class StackFrame BASE_EMBEDDED { // Type testers. bool is_entry() const { return type() == ENTRY; } - bool is_entry_construct() const { return type() == ENTRY_CONSTRUCT; } + bool is_construct_entry() const { return type() == CONSTRUCT_ENTRY; } bool is_exit() const { return type() == EXIT; } bool is_optimized() const { return type() == OPTIMIZED; } bool is_interpreted() const { return type() == INTERPRETED; } @@ -565,11 +248,6 @@ class StackFrame BASE_EMBEDDED { *constant_pool_address() = constant_pool; } - virtual void SetCallerFp(Address caller_fp) = 0; - - // Manually changes value of fp in this object. - void UpdateFp(Address fp) { state_.fp = fp; } - Address* pc_address() const { return state_.pc_address; } Address* constant_pool_address() const { @@ -589,19 +267,8 @@ class StackFrame BASE_EMBEDDED { // This method could be called during marking phase of GC. virtual Code* unchecked_code() const = 0; - // Get the code associated with this frame. - inline Code* LookupCode() const; - - // Get the code object that contains the given pc. - static inline Code* GetContainingCode(Isolate* isolate, Address pc); - - // 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. - static Code* GetSafepointData(Isolate* isolate, - Address pc, - SafepointEntry* safepoint_entry, - unsigned* stack_slots); + // Search for the code associated with this frame. + Code* LookupCode() const; virtual void Iterate(RootVisitor* v) const = 0; static void IteratePc(RootVisitor* v, Address* pc_address, @@ -633,11 +300,6 @@ class StackFrame BASE_EMBEDDED { // 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. static Type ComputeType(const StackFrameIteratorBase* iterator, State* state); @@ -681,7 +343,6 @@ class EntryFrame: public StackFrame { DCHECK(frame->is_entry()); return static_cast<EntryFrame*>(frame); } - void SetCallerFp(Address caller_fp) override; protected: inline explicit EntryFrame(StackFrameIteratorBase* iterator); @@ -698,20 +359,19 @@ class EntryFrame: public StackFrame { friend class StackFrameIteratorBase; }; - -class EntryConstructFrame: public EntryFrame { +class ConstructEntryFrame : public EntryFrame { public: - Type type() const override { return ENTRY_CONSTRUCT; } + Type type() const override { return CONSTRUCT_ENTRY; } Code* unchecked_code() const override; - static EntryConstructFrame* cast(StackFrame* frame) { - DCHECK(frame->is_entry_construct()); - return static_cast<EntryConstructFrame*>(frame); + static ConstructEntryFrame* cast(StackFrame* frame) { + DCHECK(frame->is_construct_entry()); + return static_cast<ConstructEntryFrame*>(frame); } protected: - inline explicit EntryConstructFrame(StackFrameIteratorBase* iterator); + inline explicit ConstructEntryFrame(StackFrameIteratorBase* iterator); private: friend class StackFrameIteratorBase; @@ -730,8 +390,6 @@ class ExitFrame: public StackFrame { // Garbage collection support. void Iterate(RootVisitor* v) const override; - void SetCallerFp(Address caller_fp) override; - static ExitFrame* cast(StackFrame* frame) { DCHECK(frame->is_exit()); return static_cast<ExitFrame*>(frame); @@ -971,8 +629,6 @@ class StandardFrame : public StackFrame { virtual Object* GetParameter(int index) const; virtual int ComputeParametersCount() const; - void SetCallerFp(Address caller_fp) override; - // Check if this frame is a constructor frame invoked through 'new'. virtual bool IsConstructor() const; @@ -980,7 +636,7 @@ class StandardFrame : public StackFrame { // The functions are ordered bottom-to-top (i.e. summaries.last() is the // top-most activation; caller comes before callee). virtual void Summarize( - List<FrameSummary>* frames, + std::vector<FrameSummary>* frames, FrameSummary::Mode mode = FrameSummary::kExactSummary) const; static StandardFrame* cast(StackFrame* frame) { @@ -1033,7 +689,7 @@ class JavaScriptFrame : public StandardFrame { Type type() const override { return JAVA_SCRIPT; } void Summarize( - List<FrameSummary>* frames, + std::vector<FrameSummary>* frames, FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; // Accessors. @@ -1081,9 +737,9 @@ class JavaScriptFrame : public StandardFrame { Code* unchecked_code() const override; // Return a list with {SharedFunctionInfo} objects of this frame. - virtual void GetFunctions(List<SharedFunctionInfo*>* functions) const; + virtual void GetFunctions(std::vector<SharedFunctionInfo*>* functions) const; - void GetFunctions(List<Handle<SharedFunctionInfo>>* functions) const; + void GetFunctions(std::vector<Handle<SharedFunctionInfo>>* functions) const; // Lookup exception handler for current {pc}, returns -1 if none found. Also // returns data associated with the handler site specific to the frame type: @@ -1171,10 +827,10 @@ class OptimizedFrame : public JavaScriptFrame { // Return a list with {SharedFunctionInfo} objects of this frame. // The functions are ordered bottom-to-top (i.e. functions.last() // is the top-most activation) - void GetFunctions(List<SharedFunctionInfo*>* functions) const override; + void GetFunctions(std::vector<SharedFunctionInfo*>* functions) const override; void Summarize( - List<FrameSummary>* frames, + std::vector<FrameSummary>* frames, FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; // Lookup exception handler for current {pc}, returns -1 if none found. @@ -1228,7 +884,7 @@ class InterpretedFrame : public JavaScriptFrame { // Build a list with summaries for this frame including all inlined frames. void Summarize( - List<FrameSummary>* frames, + std::vector<FrameSummary>* frames, FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; static int GetBytecodeOffset(Address fp); @@ -1319,7 +975,7 @@ class WasmCompiledFrame final : public StandardFrame { int position() const override; bool at_to_number_conversion() const; - void Summarize(List<FrameSummary>* frames, + void Summarize(std::vector<FrameSummary>* frames, FrameSummary::Mode mode) const override; static WasmCompiledFrame* cast(StackFrame* frame) { @@ -1348,7 +1004,7 @@ class WasmInterpreterEntryFrame final : public StandardFrame { int index) const override; void Summarize( - List<FrameSummary>* frames, + std::vector<FrameSummary>* frames, FrameSummary::Mode mode = FrameSummary::kExactSummary) const override; // Determine the code for the frame. @@ -1396,6 +1052,17 @@ class JsToWasmFrame : public StubFrame { friend class StackFrameIteratorBase; }; +class CWasmEntryFrame : public StubFrame { + public: + Type type() const override { return C_WASM_ENTRY; } + + protected: + inline explicit CWasmEntryFrame(StackFrameIteratorBase* iterator); + + private: + friend class StackFrameIteratorBase; +}; + class InternalFrame: public StandardFrame { public: Type type() const override { return INTERNAL; } |