50 class StackFrameIterator;
70 memset(&cache_[0], 0,
sizeof(cache_));
76 InnerPointerToCodeCacheEntry* cache(
int index) {
return &cache_[index]; }
80 static const int kInnerPointerToCodeCacheSize = 1024;
81 InnerPointerToCodeCacheEntry cache_[kInnerPointerToCodeCacheSize];
96 static const int kKindWidth = 2;
98 static const int kIndexWidth = 32 - kKindWidth;
103 inline Address address()
const;
106 inline StackHandler* next()
const;
109 inline bool includes(
Address address)
const;
112 inline void Iterate(ObjectVisitor* v,
Code* holder)
const;
115 static inline StackHandler* FromAddress(
Address address);
118 inline bool is_js_entry()
const;
119 inline bool is_catch()
const;
120 inline bool is_finally()
const;
124 inline Kind kind()
const;
126 inline Object** context_address()
const;
127 inline Object** code_address()
const;
133 #define STACK_FRAME_TYPE_LIST(V) \
134 V(ENTRY, EntryFrame) \
135 V(ENTRY_CONSTRUCT, EntryConstructFrame) \
137 V(JAVA_SCRIPT, JavaScriptFrame) \
138 V(OPTIMIZED, OptimizedFrame) \
139 V(INTERNAL, InternalFrame) \
140 V(CONSTRUCT, ConstructFrame) \
141 V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame)
147 #define DECLARE_TYPE(type, ignore) type,
170 INNER_JSENTRY_FRAME = 0,
171 OUTERMOST_JSENTRY_FRAME = 1
184 this->state_ = original.state_;
185 this->iterator_ =
NULL;
186 this->isolate_ = original.isolate_;
201 return (type == JAVA_SCRIPT) || (type == OPTIMIZED);
217 virtual void SetCallerFp(
Address caller_fp) = 0;
228 bool HasHandler()
const;
231 virtual Type
type()
const = 0;
235 virtual Code* unchecked_code()
const = 0;
238 inline Code* LookupCode()
const;
248 SafepointEntry* safepoint_entry,
249 unsigned* stack_slots);
251 virtual void Iterate(ObjectVisitor* v)
const = 0;
252 static void IteratePc(ObjectVisitor* v,
Address* pc_address,
Code* holder);
257 static void SetReturnAddressLocationResolver(
267 inline explicit StackFrame(StackFrameIterator* iterator);
273 virtual Address GetCallerStackPointer()
const = 0;
281 inline StackHandler* top_handler()
const;
284 static Type ComputeType(
Isolate* isolate, State* state);
287 const StackFrameIterator* iterator_;
292 virtual void ComputeCallerState(State* state)
const = 0;
295 virtual Type GetCallerState(State* state)
const;
297 static const intptr_t kIsolateTag = 1;
299 friend class StackFrameIterator;
300 friend class StackHandlerIterator;
301 friend class SafeStackFrameIterator;
311 virtual Type
type()
const {
return ENTRY; }
313 virtual Code* unchecked_code()
const;
316 virtual void Iterate(ObjectVisitor* v)
const;
319 ASSERT(frame->is_entry());
322 virtual void SetCallerFp(
Address caller_fp);
325 inline explicit EntryFrame(StackFrameIterator* iterator);
333 virtual void ComputeCallerState(State* state)
const;
334 virtual Type GetCallerState(State* state)
const;
336 friend class StackFrameIterator;
342 virtual Type
type()
const {
return ENTRY_CONSTRUCT; }
344 virtual Code* unchecked_code()
const;
347 ASSERT(frame->is_entry_construct());
355 friend class StackFrameIterator;
362 virtual Type
type()
const {
return EXIT; }
364 virtual Code* unchecked_code()
const;
366 Object*& code_slot()
const;
369 virtual void Iterate(ObjectVisitor* v)
const;
371 virtual void SetCallerFp(
Address caller_fp);
381 static Type GetStateForFramePointer(
Address fp, State* state);
386 inline explicit ExitFrame(StackFrameIterator* iterator);
388 virtual Address GetCallerStackPointer()
const;
391 virtual void ComputeCallerState(State* state)
const;
393 friend class StackFrameIterator;
403 inline Object* context()
const;
406 inline Object* GetExpression(
int index)
const;
407 inline void SetExpression(
int index,
Object* value);
408 int ComputeExpressionsCount()
const;
411 virtual void SetCallerFp(
Address caller_fp);
414 ASSERT(frame->is_standard());
421 virtual void ComputeCallerState(State* state)
const;
424 inline Address caller_fp()
const;
425 inline Address caller_pc()
const;
433 void IterateExpressions(ObjectVisitor* v)
const;
436 Address GetExpressionAddress(
int n)
const;
441 bool IsExpressionInsideHandler(
int n)
const;
445 static inline bool IsArgumentsAdaptorFrame(
Address fp);
449 static inline bool IsConstructFrame(
Address fp);
453 friend class StackFrameIterator;
464 : receiver_(receiver),
468 is_constructor_(is_constructor) { }
483 bool is_constructor_;
489 virtual Type
type()
const {
return JAVA_SCRIPT; }
492 inline Object*
function()
const;
493 inline Object* receiver()
const;
494 inline void set_receiver(
Object* value);
497 inline Address GetParameterSlot(
int index)
const;
498 inline Object* GetParameter(
int index)
const;
500 return GetNumberOfIncomingArguments();
504 bool IsConstructor()
const;
509 inline bool has_adapted_arguments()
const;
510 int GetArgumentsLength()
const;
513 virtual void Iterate(ObjectVisitor* v)
const;
521 virtual Code* unchecked_code()
const;
533 ASSERT(frame->is_java_script());
537 static void PrintTop(FILE* file,
bool print_args,
bool print_line_number);
542 virtual Address GetCallerStackPointer()
const;
544 virtual int GetNumberOfIncomingArguments()
const;
548 void IterateArguments(ObjectVisitor* v)
const;
551 inline Object* function_slot_object()
const;
553 friend class StackFrameIterator;
560 virtual Type
type()
const {
return OPTIMIZED; }
563 virtual void Iterate(ObjectVisitor* v)
const;
565 virtual int GetInlineCount();
580 friend class StackFrameIterator;
592 virtual Code* unchecked_code()
const;
595 ASSERT(frame->is_arguments_adaptor());
607 virtual int GetNumberOfIncomingArguments()
const;
609 virtual Address GetCallerStackPointer()
const;
612 friend class StackFrameIterator;
621 virtual void Iterate(ObjectVisitor* v)
const;
624 virtual Code* unchecked_code()
const;
627 ASSERT(frame->is_internal());
634 virtual Address GetCallerStackPointer()
const;
637 friend class StackFrameIterator;
645 virtual Type
type()
const {
return CONSTRUCT; }
648 ASSERT(frame->is_construct());
656 friend class StackFrameIterator;
664 StackFrameIterator();
667 explicit StackFrameIterator(
Isolate* isolate);
670 StackFrameIterator(
Isolate* isolate, ThreadLocalTop* t);
692 #define DECLARE_SINGLETON(ignore, type) type type##_;
694 #undef DECLARE_SINGLETON
696 StackHandler* handler_;
697 ThreadLocalTop* thread_;
700 void (StackFrameIterator::*advance_)();
702 StackHandler* handler()
const {
708 StackFrame* SingletonFor(StackFrame::Type
type, StackFrame::State* state);
712 void AdvanceWithHandler();
713 void AdvanceWithoutHandler();
716 friend class SafeStackFrameIterator;
722 template<
typename Iterator>
727 inline explicit JavaScriptFrameIteratorTemp(
Isolate* isolate);
729 inline JavaScriptFrameIteratorTemp(
Isolate* isolate, ThreadLocalTop* top);
734 inline JavaScriptFrameIteratorTemp(
Isolate* isolate, StackFrame::Id
id);
740 iterator_(fp, sp, low_bound, high_bound) {
741 if (!done()) Advance();
749 iterator_(isolate, fp, sp, low_bound, high_bound) {
750 if (!done()) Advance();
755 bool done()
const {
return iterator_.done(); }
761 void AdvanceToArgumentsFrame();
767 inline void AdvanceToId(StackFrame::Id
id);
793 SafeStackFrameIterator(
Isolate* isolate,
798 ASSERT(is_working_iterator_);
799 return iterator_.frame();
802 bool done()
const {
return iteration_done_ ?
true : iterator_.done(); }
807 static bool is_active(
Isolate* isolate);
811 return low_bound <= addr && addr <= high_bound;
815 class StackAddressValidator {
818 : low_bound_(low_bound), high_bound_(high_bound) { }
819 bool IsValid(
Address addr)
const {
820 return IsWithinBounds(low_bound_, high_bound_, addr);
827 class ExitFrameValidator {
829 explicit ExitFrameValidator(
const StackAddressValidator& validator)
830 : validator_(validator) { }
832 : validator_(low_bound, high_bound) { }
835 StackAddressValidator validator_;
838 bool IsValidStackAddress(
Address addr)
const {
839 return stack_validator_.IsValid(addr);
841 bool CanIterateHandles(
StackFrame* frame, StackHandler* handler);
844 static bool IsValidTop(Isolate* isolate,
854 explicit ActiveCountMaintainer(Isolate* isolate);
855 ~ActiveCountMaintainer();
860 ActiveCountMaintainer maintainer_;
861 StackAddressValidator stack_validator_;
862 const bool is_valid_top_;
863 const bool is_valid_fp_;
864 const bool is_working_iterator_;
865 bool iteration_done_;
866 StackFrameIterator iterator_;
870 typedef JavaScriptFrameIteratorTemp<SafeStackFrameIterator>
890 StackFrameIterator iterator_;
900 #endif // V8_FRAMES_H_
virtual Type type() const
Code * GcSafeCastToCode(HeapObject *object, Address inner_pointer)
static bool IsWithinBounds(Address low_bound, Address high_bound, Address addr)
static EntryFrame * cast(StackFrame *frame)
int NumRegs(RegList reglist)
virtual bool is_standard() const
void UpdateFp(Address fp)
static StandardFrame * cast(StackFrame *frame)
InnerPointerToCodeCache(Isolate *isolate)
JavaScriptFrameIteratorTemp(Isolate *isolate, Address fp, Address sp, Address low_bound, Address high_bound)
#define ASSERT(condition)
static ConstructFrame * cast(StackFrame *frame)
v8::Handle< v8::Value > Print(const v8::Arguments &args)
static InternalFrame * cast(StackFrame *frame)
StackFrame * frame() const
JavaScriptFrameIteratorTemp()
Vector< StackFrame * > CreateStackMap(Zone *zone)
bool is_optimized() const
int ComputeParametersCount() const
virtual Type type() const
bool is_construct() const
#define STACK_FRAME_TYPE_LIST(V)
#define DECLARE_TYPE(type, ignore)
Handle< Object > receiver()
int JSCallerSavedCode(int n)
virtual Type type() const
HANDLE HANDLE LPSTACKFRAME64 StackFrame
#define DECLARE_SINGLETON(ignore, type)
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
virtual void Print(StringStream *accumulator, PrintMode mode, int index) const
Address * pc_address() const
bool is_arguments_adaptor() const
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName)
FrameSummary(Object *receiver, JSFunction *function, Code *code, int offset, bool is_constructor)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
JavaScriptFrameIteratorTemp< SafeStackFrameIterator > SafeJavaScriptFrameIterator
virtual Type type() const
virtual Type type() const
virtual Type type() const
static JavaScriptFrame * cast(StackFrame *frame)
static ExitFrame * cast(StackFrame *frame)
Address caller_sp() const
Isolate * isolate() const
void SetUpJSCallerSavedCodeData()
JavaScriptFrameIteratorTemp< StackFrameIterator > JavaScriptFrameIterator
InnerPointerToCodeCacheEntry * GetCacheEntry(Address inner_pointer)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
bool is_java_script() const
virtual Type type() const
SafepointEntry safepoint_entry
virtual bool is_standard() const
bool is_entry_construct() const
JavaScriptFrameIteratorTemp(Address fp, Address sp, Address low_bound, Address high_bound)
StackFrame(const StackFrame &original)
Code * GcSafeFindCodeForInnerPointer(Address inner_pointer)
static EntryConstructFrame * cast(StackFrame *frame)
virtual int GetInlineCount()
static ArgumentsAdaptorFrame * cast(StackFrame *frame)
virtual Address GetCallerStackPointer() const
JavaScriptFrameIteratorTemp(StackFrame::Id id)
virtual Type type() const