Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/frames.h b/src/frames.h
index 03d53dd..674d7da 100644
--- a/src/frames.h
+++ b/src/frames.h
@@ -66,113 +66,134 @@
};
+// Every try-block pushes the context register.
+class TryBlockConstant : public AllStatic {
+ public:
+ static const int kElementCount = 1;
+};
+
+
class StackHandlerConstants : public AllStatic {
public:
- static const int kNextOffset = 0 * kPointerSize;
- static const int kCodeOffset = 1 * kPointerSize;
- static const int kStateOffset = 2 * kPointerSize;
-#if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
- static const int kStateIntOffset = kStateOffset;
-#else
- static const int kStateIntOffset = kStateOffset + kIntSize;
-#endif
- static const int kContextOffset = 3 * kPointerSize;
- static const int kFPOffset = 4 * kPointerSize;
+ static const int kNextOffset = 0 * kPointerSize;
- static const int kSize = kFPOffset + kFPOnStackSize;
+ static const int kSize = kNextOffset + kPointerSize;
static const int kSlotCount = kSize >> kPointerSizeLog2;
};
class StackHandler BASE_EMBEDDED {
public:
- enum Kind {
- JS_ENTRY,
- CATCH,
- FINALLY,
- LAST_KIND = FINALLY
- };
-
- static const int kKindWidth = 2;
- STATIC_ASSERT(LAST_KIND < (1 << kKindWidth));
- static const int kIndexWidth = 32 - kKindWidth;
- class KindField: public BitField<StackHandler::Kind, 0, kKindWidth> {};
- class IndexField: public BitField<unsigned, kKindWidth, kIndexWidth> {};
-
// Get the address of this stack handler.
inline Address address() const;
// Get the next stack handler in the chain.
inline StackHandler* next() const;
- // Tells whether the given address is inside this handler.
- inline bool includes(Address address) const;
-
- // Garbage collection support.
- inline void Iterate(ObjectVisitor* v, Code* holder) const;
-
// Conversion support.
static inline StackHandler* FromAddress(Address address);
- // Testers
- inline bool is_js_entry() const;
- inline bool is_catch() const;
- inline bool is_finally() const;
-
- // Generator support to preserve stack handlers.
- void Unwind(Isolate* isolate, FixedArray* array, int offset,
- int previous_handler_offset) const;
- int Rewind(Isolate* isolate, FixedArray* array, int offset, Address fp);
-
private:
- // Accessors.
- inline Kind kind() const;
- inline unsigned index() const;
-
- inline Object** constant_pool_address() const;
- inline Object** context_address() const;
- inline Object** code_address() const;
- inline void SetFp(Address slot, Address fp);
-
DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler);
};
#define STACK_FRAME_TYPE_LIST(V) \
- V(ENTRY, EntryFrame) \
- V(ENTRY_CONSTRUCT, EntryConstructFrame) \
- V(EXIT, ExitFrame) \
- V(JAVA_SCRIPT, JavaScriptFrame) \
- V(OPTIMIZED, OptimizedFrame) \
- V(STUB, StubFrame) \
+ V(ENTRY, EntryFrame) \
+ V(ENTRY_CONSTRUCT, EntryConstructFrame) \
+ V(EXIT, ExitFrame) \
+ V(JAVA_SCRIPT, JavaScriptFrame) \
+ V(OPTIMIZED, OptimizedFrame) \
+ V(INTERPRETED, InterpretedFrame) \
+ V(STUB, StubFrame) \
V(STUB_FAILURE_TRAMPOLINE, StubFailureTrampolineFrame) \
- V(INTERNAL, InternalFrame) \
- V(CONSTRUCT, ConstructFrame) \
- V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame)
+ V(INTERNAL, InternalFrame) \
+ V(CONSTRUCT, ConstructFrame) \
+ V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame)
class StandardFrameConstants : public AllStatic {
public:
// Fixed part of the frame consists of return address, caller fp,
- // constant pool (if FLAG_enable_ool_constant_pool), context, and function.
- // StandardFrame::IterateExpressions assumes that kLastObjectOffset is the
- // last object pointer.
+ // constant pool (if FLAG_enable_embedded_constant_pool), context, and
+ // function. StandardFrame::IterateExpressions assumes that kLastObjectOffset
+ // is the last object pointer.
static const int kCPSlotSize =
- FLAG_enable_ool_constant_pool ? kPointerSize : 0;
+ FLAG_enable_embedded_constant_pool ? kPointerSize : 0;
static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
- static const int kFixedFrameSize = kPCOnStackSize + kFPOnStackSize +
- kFixedFrameSizeFromFp;
- static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize;
- static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize;
- static const int kContextOffset = -1 * kPointerSize - kCPSlotSize;
- static const int kConstantPoolOffset = FLAG_enable_ool_constant_pool ?
- -1 * kPointerSize : 0;
- static const int kCallerFPOffset = 0 * kPointerSize;
- static const int kCallerPCOffset = +1 * kFPOnStackSize;
- static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
+ static const int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize;
+ static const int kFixedFrameSize =
+ kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
+ static const int kFixedSlotCountAboveFp =
+ kFixedFrameSizeAboveFp / kPointerSize;
+ static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
+ static const int kCPSlotCount = kCPSlotSize / kPointerSize;
+ static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize;
+ static const int kMarkerOffset = -2 * kPointerSize - kCPSlotSize;
+ static const int kContextOffset = -1 * kPointerSize - kCPSlotSize;
+ static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0;
+ static const int kCallerFPOffset = 0 * kPointerSize;
+ static const int kCallerPCOffset = +1 * kFPOnStackSize;
+ static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
- static const int kLastObjectOffset = FLAG_enable_ool_constant_pool ?
- kConstantPoolOffset : kContextOffset;
+ static const int kLastObjectOffset = kContextOffset;
+};
+
+
+class ArgumentsAdaptorFrameConstants : public AllStatic {
+ public:
+ // FP-relative.
+ static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
+
+ static const int kFrameSize =
+ StandardFrameConstants::kFixedFrameSize + kPointerSize;
+};
+
+
+class InternalFrameConstants : public AllStatic {
+ public:
+ // FP-relative.
+ static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
+};
+
+
+class ConstructFrameConstants : public AllStatic {
+ public:
+ // FP-relative.
+ static const int kImplicitReceiverOffset =
+ StandardFrameConstants::kExpressionsOffset - 3 * kPointerSize;
+ static const int kLengthOffset =
+ StandardFrameConstants::kExpressionsOffset - 2 * kPointerSize;
+ static const int kAllocationSiteOffset =
+ StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
+ static const int kCodeOffset =
+ StandardFrameConstants::kExpressionsOffset - 0 * kPointerSize;
+
+ static const int kFrameSize =
+ StandardFrameConstants::kFixedFrameSize + 4 * kPointerSize;
+};
+
+
+class InterpreterFrameConstants : public AllStatic {
+ public:
+ // Fixed frame includes new.target and bytecode offset.
+ static const int kFixedFrameSize =
+ StandardFrameConstants::kFixedFrameSize + 2 * kPointerSize;
+ static const int kFixedFrameSizeFromFp =
+ StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize;
+
+ // FP-relative.
+ static const int kRegisterFilePointerFromFp =
+ -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize;
+
+ // Register file pointer relative.
+ static const int kLastParamFromRegisterPointer =
+ StandardFrameConstants::kFixedFrameSize + 3 * kPointerSize;
+
+ static const int kBytecodeOffsetFromRegisterPointer = 1 * kPointerSize;
+ static const int kNewTargetFromRegisterPointer = 2 * kPointerSize;
+ static const int kFunctionFromRegisterPointer = 3 * kPointerSize;
+ static const int kContextFromRegisterPointer = 4 * kPointerSize;
};
@@ -238,7 +259,8 @@
bool is_java_script() const {
Type type = this->type();
- return (type == JAVA_SCRIPT) || (type == OPTIMIZED);
+ return (type == JAVA_SCRIPT) || (type == OPTIMIZED) ||
+ (type == INTERPRETED);
}
// Accessors.
@@ -255,8 +277,8 @@
void set_pc(Address pc) { *pc_address() = pc; }
Address constant_pool() const { return *constant_pool_address(); }
- void set_constant_pool(ConstantPoolArray* constant_pool) {
- *constant_pool_address() = reinterpret_cast<Address>(constant_pool);
+ void set_constant_pool(Address constant_pool) {
+ *constant_pool_address() = constant_pool;
}
virtual void SetCallerFp(Address caller_fp) = 0;
@@ -273,8 +295,8 @@
// Get the id of this stack frame.
Id id() const { return static_cast<Id>(OffsetFrom(caller_sp())); }
- // Checks if this frame includes any stack handlers.
- bool HasHandler() const;
+ // Get the top handler from the current stack iterator.
+ inline StackHandler* top_handler() const;
// Get the type of this frame.
virtual Type type() const = 0;
@@ -298,7 +320,8 @@
unsigned* stack_slots);
virtual void Iterate(ObjectVisitor* v) const = 0;
- static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder);
+ static void IteratePc(ObjectVisitor* v, Address* pc_address,
+ Address* constant_pool_address, Code* holder);
// Sets a callback function for return-address rewriting profilers
// to resolve the location of a return address to the location of the
@@ -309,7 +332,6 @@
// Resolves pc_address through the resolution address function if one is set.
static inline Address* ResolveReturnAddressLocation(Address* pc_address);
-
// Printing support.
enum PrintMode { OVERVIEW, DETAILS };
virtual void Print(StringStream* accumulator,
@@ -330,9 +352,6 @@
PrintMode mode,
int index);
- // Get the top handler from the current stack iterator.
- inline StackHandler* top_handler() const;
-
// Compute the stack frame type for the given state.
static Type ComputeType(const StackFrameIteratorBase* iterator, State* state);
@@ -368,18 +387,18 @@
// Entry frames are used to enter JavaScript execution from C.
class EntryFrame: public StackFrame {
public:
- virtual Type type() const { return ENTRY; }
+ Type type() const override { return ENTRY; }
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
// Garbage collection support.
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
static EntryFrame* cast(StackFrame* frame) {
DCHECK(frame->is_entry());
return static_cast<EntryFrame*>(frame);
}
- virtual void SetCallerFp(Address caller_fp);
+ void SetCallerFp(Address caller_fp) override;
protected:
inline explicit EntryFrame(StackFrameIteratorBase* iterator);
@@ -387,11 +406,11 @@
// 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.
- virtual Address GetCallerStackPointer() const { return 0; }
+ Address GetCallerStackPointer() const override { return 0; }
private:
- virtual void ComputeCallerState(State* state) const;
- virtual Type GetCallerState(State* state) const;
+ void ComputeCallerState(State* state) const override;
+ Type GetCallerState(State* state) const override;
friend class StackFrameIteratorBase;
};
@@ -399,9 +418,9 @@
class EntryConstructFrame: public EntryFrame {
public:
- virtual Type type() const { return ENTRY_CONSTRUCT; }
+ Type type() const override { return ENTRY_CONSTRUCT; }
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
static EntryConstructFrame* cast(StackFrame* frame) {
DCHECK(frame->is_entry_construct());
@@ -419,17 +438,16 @@
// Exit frames are used to exit JavaScript execution and go to C.
class ExitFrame: public StackFrame {
public:
- virtual Type type() const { return EXIT; }
+ Type type() const override { return EXIT; }
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
Object*& code_slot() const;
- Object*& constant_pool_slot() const;
// Garbage collection support.
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
- virtual void SetCallerFp(Address caller_fp);
+ void SetCallerFp(Address caller_fp) override;
static ExitFrame* cast(StackFrame* frame) {
DCHECK(frame->is_exit());
@@ -446,10 +464,10 @@
protected:
inline explicit ExitFrame(StackFrameIteratorBase* iterator);
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
private:
- virtual void ComputeCallerState(State* state) const;
+ void ComputeCallerState(State* state) const override;
friend class StackFrameIteratorBase;
};
@@ -458,7 +476,7 @@
class StandardFrame: public StackFrame {
public:
// Testers.
- virtual bool is_standard() const { return true; }
+ bool is_standard() const override { return true; }
// Accessors.
inline Object* context() const;
@@ -469,7 +487,7 @@
int ComputeExpressionsCount() const;
static Object* GetExpression(Address fp, int index);
- virtual void SetCallerFp(Address caller_fp);
+ void SetCallerFp(Address caller_fp) override;
static StandardFrame* cast(StackFrame* frame) {
DCHECK(frame->is_standard());
@@ -479,7 +497,7 @@
protected:
inline explicit StandardFrame(StackFrameIteratorBase* iterator);
- virtual void ComputeCallerState(State* state) const;
+ void ComputeCallerState(State* state) const override;
// Accessors.
inline Address caller_fp() const;
@@ -501,10 +519,6 @@
Address GetExpressionAddress(int n) const;
static Address GetExpressionAddress(Address fp, int n);
- // Determines if the n'th expression stack element is in a stack
- // handler or not. Requires traversing all handlers in this frame.
- bool IsExpressionInsideHandler(int n) const;
-
// Determines if the standard frame for the given frame pointer is
// an arguments adaptor frame.
static inline bool IsArgumentsAdaptorFrame(Address fp);
@@ -524,16 +538,9 @@
class FrameSummary BASE_EMBEDDED {
public:
- FrameSummary(Object* receiver,
- JSFunction* function,
- Code* code,
- int offset,
- bool is_constructor)
- : receiver_(receiver, function->GetIsolate()),
- function_(function),
- code_(code),
- offset_(offset),
- is_constructor_(is_constructor) { }
+ FrameSummary(Object* receiver, JSFunction* function, Code* code, int offset,
+ bool is_constructor);
+
Handle<Object> receiver() { return receiver_; }
Handle<JSFunction> function() { return function_; }
Handle<Code> code() { return code_; }
@@ -554,7 +561,7 @@
class JavaScriptFrame: public StandardFrame {
public:
- virtual Type type() const { return JAVA_SCRIPT; }
+ Type type() const override { return JAVA_SCRIPT; }
// Accessors.
inline JSFunction* function() const;
@@ -573,9 +580,9 @@
inline Object* GetOperand(int index) const;
inline int ComputeOperandsCount() const;
- // Generator support to preserve operand stack and stack handlers.
- void SaveOperandStack(FixedArray* store, int* stack_handler_index) const;
- void RestoreOperandStack(FixedArray* store, int stack_handler_index);
+ // Generator support to preserve operand stack.
+ void SaveOperandStack(FixedArray* store) const;
+ void RestoreOperandStack(FixedArray* store);
// Debugger access.
void SetParameterValue(int index, Object* value) const;
@@ -583,6 +590,10 @@
// Check if this frame is a constructor frame invoked through 'new'.
bool IsConstructor() const;
+ // Determines whether this frame includes inlined activations. To get details
+ // about the inlined frames use {GetFunctions} and {Summarize}.
+ bool HasInlinedFrames() const;
+
// 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.
@@ -590,25 +601,26 @@
int GetArgumentsLength() const;
// Garbage collection support.
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
// Printing support.
- virtual void Print(StringStream* accumulator,
- PrintMode mode,
- int index) const;
+ void Print(StringStream* accumulator, PrintMode mode,
+ int index) const override;
// Determine the code for the frame.
- virtual Code* unchecked_code() const;
-
- // Returns the levels of inlining for this frame.
- virtual int GetInlineCount() { return 1; }
+ Code* unchecked_code() const override;
// Return a list with JSFunctions of this frame.
- virtual void GetFunctions(List<JSFunction*>* functions);
+ virtual void GetFunctions(List<JSFunction*>* functions) const;
// Build a list with summaries for this frame including all inlined frames.
virtual void Summarize(List<FrameSummary>* frames);
+ // Lookup exception handler for current {pc}, returns -1 if none found. Also
+ // returns the expected number of stack slots at the handler site.
+ virtual int LookupExceptionHandlerInTable(
+ int* stack_slots, HandlerTable::CatchPrediction* prediction);
+
// Architecture-specific register description.
static Register fp_register();
static Register context_register();
@@ -629,7 +641,7 @@
protected:
inline explicit JavaScriptFrame(StackFrameIteratorBase* iterator);
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
virtual int GetNumberOfIncomingArguments() const;
@@ -646,18 +658,18 @@
class StubFrame : public StandardFrame {
public:
- virtual Type type() const { return STUB; }
+ Type type() const override { return STUB; }
// GC support.
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
// Determine the code for the frame.
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
protected:
inline explicit StubFrame(StackFrameIteratorBase* iterator);
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
virtual int GetNumberOfIncomingArguments() const;
@@ -667,28 +679,44 @@
class OptimizedFrame : public JavaScriptFrame {
public:
- virtual Type type() const { return OPTIMIZED; }
+ Type type() const override { return OPTIMIZED; }
// GC support.
- virtual void Iterate(ObjectVisitor* v) const;
-
- virtual int GetInlineCount();
+ void Iterate(ObjectVisitor* v) const override;
// Return a list with JSFunctions of this frame.
// The functions are ordered bottom-to-top (i.e. functions.last()
// is the top-most activation)
- virtual void GetFunctions(List<JSFunction*>* functions);
+ void GetFunctions(List<JSFunction*>* functions) const override;
- virtual void Summarize(List<FrameSummary>* frames);
+ void Summarize(List<FrameSummary>* frames) override;
- DeoptimizationInputData* GetDeoptimizationData(int* deopt_index);
+ // Lookup exception handler for current {pc}, returns -1 if none found. Also
+ // returns the expected number of stack slots at the handler site.
+ int LookupExceptionHandlerInTable(
+ int* stack_slots, HandlerTable::CatchPrediction* prediction) override;
+
+ DeoptimizationInputData* GetDeoptimizationData(int* deopt_index) const;
+
+ static int StackSlotOffsetRelativeToFp(int slot_index);
protected:
inline explicit OptimizedFrame(StackFrameIteratorBase* iterator);
private:
- JSFunction* LiteralAt(FixedArray* literal_array, int literal_id);
+ friend class StackFrameIteratorBase;
+ Object* StackSlotAt(int index) const;
+};
+
+
+class InterpretedFrame : public JavaScriptFrame {
+ Type type() const override { return INTERPRETED; }
+
+ protected:
+ inline explicit InterpretedFrame(StackFrameIteratorBase* iterator);
+
+ private:
friend class StackFrameIteratorBase;
};
@@ -698,10 +726,10 @@
// match the formal number of parameters.
class ArgumentsAdaptorFrame: public JavaScriptFrame {
public:
- virtual Type type() const { return ARGUMENTS_ADAPTOR; }
+ Type type() const override { return ARGUMENTS_ADAPTOR; }
// Determine the code for the frame.
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
static ArgumentsAdaptorFrame* cast(StackFrame* frame) {
DCHECK(frame->is_arguments_adaptor());
@@ -709,16 +737,15 @@
}
// Printing support.
- virtual void Print(StringStream* accumulator,
- PrintMode mode,
- int index) const;
+ void Print(StringStream* accumulator, PrintMode mode,
+ int index) const override;
protected:
inline explicit ArgumentsAdaptorFrame(StackFrameIteratorBase* iterator);
- virtual int GetNumberOfIncomingArguments() const;
+ int GetNumberOfIncomingArguments() const override;
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
private:
friend class StackFrameIteratorBase;
@@ -727,13 +754,13 @@
class InternalFrame: public StandardFrame {
public:
- virtual Type type() const { return INTERNAL; }
+ Type type() const override { return INTERNAL; }
// Garbage collection support.
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
// Determine the code for the frame.
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
static InternalFrame* cast(StackFrame* frame) {
DCHECK(frame->is_internal());
@@ -743,7 +770,7 @@
protected:
inline explicit InternalFrame(StackFrameIteratorBase* iterator);
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
private:
friend class StackFrameIteratorBase;
@@ -760,13 +787,13 @@
static const int kCallerStackParameterCountFrameOffset =
StandardFrameConstants::kMarkerOffset - 2 * kPointerSize;
- virtual Type type() const { return STUB_FAILURE_TRAMPOLINE; }
+ Type type() const override { return STUB_FAILURE_TRAMPOLINE; }
// Get the code associated with this frame.
// This method could be called during marking phase of GC.
- virtual Code* unchecked_code() const;
+ Code* unchecked_code() const override;
- virtual void Iterate(ObjectVisitor* v) const;
+ void Iterate(ObjectVisitor* v) const override;
// Architecture-specific register description.
static Register fp_register();
@@ -777,7 +804,7 @@
inline explicit StubFailureTrampolineFrame(
StackFrameIteratorBase* iterator);
- virtual Address GetCallerStackPointer() const;
+ Address GetCallerStackPointer() const override;
private:
friend class StackFrameIteratorBase;
@@ -788,7 +815,7 @@
// function invocations through 'new'.
class ConstructFrame: public InternalFrame {
public:
- virtual Type type() const { return CONSTRUCT; }
+ Type type() const override { return CONSTRUCT; }
static ConstructFrame* cast(StackFrame* frame) {
DCHECK(frame->is_construct());
@@ -941,6 +968,7 @@
// zone memory.
Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
-} } // namespace v8::internal
+} // namespace internal
+} // namespace v8
#endif // V8_FRAMES_H_