diff options
| author | Ben Murdoch <benm@google.com> | 2012-04-12 10:51:47 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2012-04-16 16:41:38 +0100 |
| commit | 3ef787dbeca8a5fb1086949cda830dccee07bfbd (patch) | |
| tree | 0a22edd97aa148abffdd405c585b22213fccbc82 /src/frames.h | |
| parent | 85b71799222b55eb5dd74ea26efe0c64ab655c8c (diff) | |
| download | android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.gz android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.tar.bz2 android_external_v8-3ef787dbeca8a5fb1086949cda830dccee07bfbd.zip | |
Merge V8 at 3.9.24.13
Bug: 5688872
Change-Id: Id0aa8d23375030494d3189c31774059c0f5398fc
Diffstat (limited to 'src/frames.h')
| -rw-r--r-- | src/frames.h | 108 |
1 files changed, 60 insertions, 48 deletions
diff --git a/src/frames.h b/src/frames.h index fed11c4f..90715551 100644 --- a/src/frames.h +++ b/src/frames.h @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -49,47 +49,54 @@ class StackFrameIterator; class ThreadLocalTop; class Isolate; -class PcToCodeCache { +class InnerPointerToCodeCache { public: - struct PcToCodeCacheEntry { - Address pc; + struct InnerPointerToCodeCacheEntry { + Address inner_pointer; Code* code; SafepointEntry safepoint_entry; }; - explicit PcToCodeCache(Isolate* isolate) : isolate_(isolate) { + explicit InnerPointerToCodeCache(Isolate* isolate) : isolate_(isolate) { Flush(); } - Code* GcSafeFindCodeForPc(Address pc); - Code* GcSafeCastToCode(HeapObject* object, Address pc); + Code* GcSafeFindCodeForInnerPointer(Address inner_pointer); + Code* GcSafeCastToCode(HeapObject* object, Address inner_pointer); void Flush() { memset(&cache_[0], 0, sizeof(cache_)); } - PcToCodeCacheEntry* GetCacheEntry(Address pc); + InnerPointerToCodeCacheEntry* GetCacheEntry(Address inner_pointer); private: - PcToCodeCacheEntry* cache(int index) { return &cache_[index]; } + InnerPointerToCodeCacheEntry* cache(int index) { return &cache_[index]; } Isolate* isolate_; - static const int kPcToCodeCacheSize = 1024; - PcToCodeCacheEntry cache_[kPcToCodeCacheSize]; + static const int kInnerPointerToCodeCacheSize = 1024; + InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize]; - DISALLOW_COPY_AND_ASSIGN(PcToCodeCache); + DISALLOW_COPY_AND_ASSIGN(InnerPointerToCodeCache); }; class StackHandler BASE_EMBEDDED { public: - enum State { - ENTRY, - TRY_CATCH, - TRY_FINALLY + 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; @@ -106,16 +113,16 @@ class StackHandler BASE_EMBEDDED { static inline StackHandler* FromAddress(Address address); // Testers - bool is_entry() { return state() == ENTRY; } - bool is_try_catch() { return state() == TRY_CATCH; } - bool is_try_finally() { return state() == TRY_FINALLY; } + inline bool is_js_entry() const; + inline bool is_catch() const; + inline bool is_finally() const; private: // Accessors. - inline State state() const; + inline Kind kind() const; inline Object** context_address() const; - inline Address* pc_address() const; + inline Object** code_address() const; DISALLOW_IMPLICIT_CONSTRUCTORS(StackHandler); }; @@ -139,7 +146,10 @@ class StackFrame BASE_EMBEDDED { enum Type { NONE = 0, STACK_FRAME_TYPE_LIST(DECLARE_TYPE) - NUMBER_OF_TYPES + 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 }; #undef DECLARE_TYPE @@ -215,9 +225,7 @@ class StackFrame BASE_EMBEDDED { virtual Code* unchecked_code() const = 0; // Get the code associated with this frame. - Code* LookupCode() const { - return GetContainingCode(isolate(), pc()); - } + inline Code* LookupCode() const; // Get the code object that contains the given pc. static inline Code* GetContainingCode(Isolate* isolate, Address pc); @@ -233,6 +241,11 @@ class StackFrame BASE_EMBEDDED { virtual void Iterate(ObjectVisitor* v) const = 0; static void IteratePc(ObjectVisitor* v, Address* pc_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 + // profiler's stashed return address. + static void SetReturnAddressLocationResolver( + ReturnAddressLocationResolver resolver); // Printing support. enum PrintMode { OVERVIEW, DETAILS }; @@ -299,7 +312,7 @@ class EntryFrame: public StackFrame { virtual void SetCallerFp(Address caller_fp); protected: - explicit EntryFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } + inline explicit EntryFrame(StackFrameIterator* iterator); // The caller stack pointer for entry frames is always zero. The // real information about the caller frame is available through the @@ -326,8 +339,7 @@ class EntryConstructFrame: public EntryFrame { } protected: - explicit EntryConstructFrame(StackFrameIterator* iterator) - : EntryFrame(iterator) { } + inline explicit EntryConstructFrame(StackFrameIterator* iterator); private: friend class StackFrameIterator; @@ -361,7 +373,7 @@ class ExitFrame: public StackFrame { static void FillState(Address fp, Address sp, State* state); protected: - explicit ExitFrame(StackFrameIterator* iterator) : StackFrame(iterator) { } + inline explicit ExitFrame(StackFrameIterator* iterator); virtual Address GetCallerStackPointer() const; @@ -394,8 +406,7 @@ class StandardFrame: public StackFrame { } protected: - explicit StandardFrame(StackFrameIterator* iterator) - : StackFrame(iterator) { } + inline explicit StandardFrame(StackFrameIterator* iterator); virtual void ComputeCallerState(State* state) const; @@ -513,9 +524,10 @@ class JavaScriptFrame: public StandardFrame { return static_cast<JavaScriptFrame*>(frame); } + static void PrintTop(FILE* file, bool print_args, bool print_line_number); + protected: - explicit JavaScriptFrame(StackFrameIterator* iterator) - : StandardFrame(iterator) { } + inline explicit JavaScriptFrame(StackFrameIterator* iterator); virtual Address GetCallerStackPointer() const; @@ -552,8 +564,7 @@ class OptimizedFrame : public JavaScriptFrame { DeoptimizationInputData* GetDeoptimizationData(int* deopt_index); protected: - explicit OptimizedFrame(StackFrameIterator* iterator) - : JavaScriptFrame(iterator) { } + inline explicit OptimizedFrame(StackFrameIterator* iterator); private: friend class StackFrameIterator; @@ -581,12 +592,9 @@ class ArgumentsAdaptorFrame: public JavaScriptFrame { int index) const; protected: - explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator) - : JavaScriptFrame(iterator) { } + inline explicit ArgumentsAdaptorFrame(StackFrameIterator* iterator); - virtual int GetNumberOfIncomingArguments() const { - return Smi::cast(GetExpression(0))->value(); - } + virtual int GetNumberOfIncomingArguments() const; virtual Address GetCallerStackPointer() const; @@ -611,8 +619,7 @@ class InternalFrame: public StandardFrame { } protected: - explicit InternalFrame(StackFrameIterator* iterator) - : StandardFrame(iterator) { } + inline explicit InternalFrame(StackFrameIterator* iterator); virtual Address GetCallerStackPointer() const; @@ -633,8 +640,7 @@ class ConstructFrame: public InternalFrame { } protected: - explicit ConstructFrame(StackFrameIterator* iterator) - : InternalFrame(iterator) { } + inline explicit ConstructFrame(StackFrameIterator* iterator); private: friend class StackFrameIterator; @@ -710,20 +716,26 @@ class JavaScriptFrameIteratorTemp BASE_EMBEDDED { inline explicit JavaScriptFrameIteratorTemp(Isolate* isolate); + inline JavaScriptFrameIteratorTemp(Isolate* isolate, ThreadLocalTop* top); + // Skip frames until the frame with the given id is reached. explicit JavaScriptFrameIteratorTemp(StackFrame::Id id) { AdvanceToId(id); } inline JavaScriptFrameIteratorTemp(Isolate* isolate, StackFrame::Id id); - JavaScriptFrameIteratorTemp(Address fp, Address sp, - Address low_bound, Address high_bound) : + JavaScriptFrameIteratorTemp(Address fp, + Address sp, + Address low_bound, + Address high_bound) : iterator_(fp, sp, low_bound, high_bound) { if (!done()) Advance(); } JavaScriptFrameIteratorTemp(Isolate* isolate, - Address fp, Address sp, - Address low_bound, Address high_bound) : + Address fp, + Address sp, + Address low_bound, + Address high_bound) : iterator_(isolate, fp, sp, low_bound, high_bound) { if (!done()) Advance(); } |
