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_;
192 bool is_exit()
const {
return type() == EXIT; }
200 Type type = this->type();
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();
582 friend class StackFrameIterator;
594 virtual Code* unchecked_code()
const;
597 ASSERT(frame->is_arguments_adaptor());
609 virtual int GetNumberOfIncomingArguments()
const;
611 virtual Address GetCallerStackPointer()
const;
614 friend class StackFrameIterator;
623 virtual void Iterate(ObjectVisitor* v)
const;
626 virtual Code* unchecked_code()
const;
629 ASSERT(frame->is_internal());
636 virtual Address GetCallerStackPointer()
const;
639 friend class StackFrameIterator;
647 virtual Type
type()
const {
return CONSTRUCT; }
650 ASSERT(frame->is_construct());
658 friend class StackFrameIterator;
666 StackFrameIterator();
669 explicit StackFrameIterator(
Isolate* isolate);
672 StackFrameIterator(
Isolate* isolate, ThreadLocalTop* t);
694 #define DECLARE_SINGLETON(ignore, type) type type##_;
696 #undef DECLARE_SINGLETON
698 StackHandler* handler_;
699 ThreadLocalTop* thread_;
702 void (StackFrameIterator::*advance_)();
704 StackHandler* handler()
const {
710 StackFrame* SingletonFor(StackFrame::Type type, StackFrame::State* state);
712 StackFrame* SingletonFor(StackFrame::Type type);
714 void AdvanceWithHandler();
715 void AdvanceWithoutHandler();
718 friend class SafeStackFrameIterator;
724 template<
typename Iterator>
729 inline explicit JavaScriptFrameIteratorTemp(
Isolate* isolate);
731 inline JavaScriptFrameIteratorTemp(
Isolate* isolate, ThreadLocalTop* top);
736 inline JavaScriptFrameIteratorTemp(
Isolate* isolate, StackFrame::Id
id);
742 iterator_(fp, sp, low_bound, high_bound) {
743 if (!done()) Advance();
751 iterator_(isolate, fp, sp, low_bound, high_bound) {
752 if (!done()) Advance();
757 bool done()
const {
return iterator_.done(); }
763 void AdvanceToArgumentsFrame();
769 inline void AdvanceToId(StackFrame::Id
id);
795 SafeStackFrameIterator(
Isolate* isolate,
800 ASSERT(is_working_iterator_);
801 return iterator_.frame();
804 bool done()
const {
return iteration_done_ ?
true : iterator_.done(); }
809 static bool is_active(
Isolate* isolate);
813 return low_bound <= addr && addr <= high_bound;
817 class StackAddressValidator {
820 : low_bound_(low_bound), high_bound_(high_bound) { }
821 bool IsValid(
Address addr)
const {
822 return IsWithinBounds(low_bound_, high_bound_, addr);
829 class ExitFrameValidator {
831 explicit ExitFrameValidator(
const StackAddressValidator& validator)
832 : validator_(validator) { }
834 : validator_(low_bound, high_bound) { }
837 StackAddressValidator validator_;
840 bool IsValidStackAddress(
Address addr)
const {
841 return stack_validator_.IsValid(addr);
843 bool CanIterateHandles(
StackFrame* frame, StackHandler* handler);
846 static bool IsValidTop(Isolate* isolate,
856 explicit ActiveCountMaintainer(Isolate* isolate);
857 ~ActiveCountMaintainer();
862 ActiveCountMaintainer maintainer_;
863 StackAddressValidator stack_validator_;
864 const bool is_valid_top_;
865 const bool is_valid_fp_;
866 const bool is_working_iterator_;
867 bool iteration_done_;
868 StackFrameIterator iterator_;
872 typedef JavaScriptFrameIteratorTemp<SafeStackFrameIterator>
892 StackFrameIterator iterator_;
902 #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)
bool is_java_script() const
virtual Type type() const
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra 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 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
SafepointEntry safepoint_entry
virtual bool is_standard() const
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 use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
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