diff options
Diffstat (limited to 'deps/v8/src/deoptimizer.h')
-rw-r--r-- | deps/v8/src/deoptimizer.h | 68 |
1 files changed, 48 insertions, 20 deletions
diff --git a/deps/v8/src/deoptimizer.h b/deps/v8/src/deoptimizer.h index 284676c36e..e2cf05367b 100644 --- a/deps/v8/src/deoptimizer.h +++ b/deps/v8/src/deoptimizer.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: @@ -119,6 +119,9 @@ class Deoptimizer : public Malloced { int output_count() const { return output_count_; } + // Number of created JS frames. Not all created frames are necessarily JS. + int jsframe_count() const { return jsframe_count_; } + static Deoptimizer* New(JSFunction* function, BailoutType type, unsigned bailout_id, @@ -131,7 +134,7 @@ class Deoptimizer : public Malloced { // The returned object with information on the optimized frame needs to be // freed before another one can be generated. static DeoptimizedFrameInfo* DebuggerInspectableFrame(JavaScriptFrame* frame, - int frame_index, + int jsframe_index, Isolate* isolate); static void DeleteDebuggerInspectableFrame(DeoptimizedFrameInfo* info, Isolate* isolate); @@ -196,7 +199,11 @@ class Deoptimizer : public Malloced { void MaterializeHeapNumbers(); #ifdef ENABLE_DEBUGGER_SUPPORT void MaterializeHeapNumbersForDebuggerInspectableFrame( - Address top, uint32_t size, DeoptimizedFrameInfo* info); + Address parameters_top, + uint32_t parameters_size, + Address expressions_top, + uint32_t expressions_size, + DeoptimizedFrameInfo* info); #endif static void ComputeOutputFrames(Deoptimizer* deoptimizer); @@ -257,8 +264,10 @@ class Deoptimizer : public Malloced { int count_; }; + int ConvertJSFrameIndexToFrameIndex(int jsframe_index); + private: - static const int kNumberOfEntries = 4096; + static const int kNumberOfEntries = 8192; Deoptimizer(Isolate* isolate, JSFunction* function, @@ -271,7 +280,9 @@ class Deoptimizer : public Malloced { void DoComputeOutputFrames(); void DoComputeOsrOutputFrame(); - void DoComputeFrame(TranslationIterator* iterator, int frame_index); + void DoComputeJSFrame(TranslationIterator* iterator, int frame_index); + void DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator, + int frame_index); void DoTranslateCommand(TranslationIterator* iterator, int frame_index, unsigned output_offset); @@ -319,6 +330,8 @@ class Deoptimizer : public Malloced { FrameDescription* input_; // Number of output frames. int output_count_; + // Number of output js frames. + int jsframe_count_; // Array of output frame descriptions. FrameDescription** output_; @@ -362,7 +375,7 @@ class FrameDescription { JSFunction* GetFunction() const { return function_; } - unsigned GetOffsetFromSlotIndex(Deoptimizer* deoptimizer, int slot_index); + unsigned GetOffsetFromSlotIndex(int slot_index); intptr_t GetFrameSlot(unsigned offset) { return *GetFrameSlotPointer(offset); @@ -423,22 +436,20 @@ class FrameDescription { void SetContinuation(intptr_t pc) { continuation_ = pc; } -#ifdef DEBUG - Code::Kind GetKind() const { return kind_; } - void SetKind(Code::Kind kind) { kind_ = kind; } -#endif + StackFrame::Type GetFrameType() const { return type_; } + void SetFrameType(StackFrame::Type type) { type_ = type; } // Get the incoming arguments count. int ComputeParametersCount(); // Get a parameter value for an unoptimized frame. - Object* GetParameter(Deoptimizer* deoptimizer, int index); + Object* GetParameter(int index); // Get the expression stack height for a unoptimized frame. - unsigned GetExpressionCount(Deoptimizer* deoptimizer); + unsigned GetExpressionCount(); // Get the expression stack value for an unoptimized frame. - Object* GetExpression(Deoptimizer* deoptimizer, int index); + Object* GetExpression(int index); static int registers_offset() { return OFFSET_OF(FrameDescription, registers_); @@ -481,6 +492,7 @@ class FrameDescription { intptr_t top_; intptr_t pc_; intptr_t fp_; + StackFrame::Type type_; Smi* state_; #ifdef DEBUG Code::Kind kind_; @@ -499,6 +511,8 @@ class FrameDescription { return reinterpret_cast<intptr_t*>( reinterpret_cast<Address>(this) + frame_content_offset() + offset); } + + int ComputeFixedSize(); }; @@ -541,7 +555,8 @@ class Translation BASE_EMBEDDED { public: enum Opcode { BEGIN, - FRAME, + JS_FRAME, + ARGUMENTS_ADAPTOR_FRAME, REGISTER, INT32_REGISTER, DOUBLE_REGISTER, @@ -556,17 +571,19 @@ class Translation BASE_EMBEDDED { DUPLICATE }; - Translation(TranslationBuffer* buffer, int frame_count) + Translation(TranslationBuffer* buffer, int frame_count, int jsframe_count) : buffer_(buffer), index_(buffer->CurrentIndex()) { buffer_->Add(BEGIN); buffer_->Add(frame_count); + buffer_->Add(jsframe_count); } int index() const { return index_; } // Commands. - void BeginFrame(int node_id, int literal_id, unsigned height); + void BeginJSFrame(int node_id, int literal_id, unsigned height); + void BeginArgumentsAdaptorFrame(int literal_id, unsigned height); void StoreRegister(Register reg); void StoreInt32Register(Register reg); void StoreDoubleRegister(DoubleRegister reg); @@ -656,9 +673,10 @@ class SlotRef BASE_EMBEDDED { } } - static void ComputeSlotMappingForArguments(JavaScriptFrame* frame, - int inlined_frame_index, - Vector<SlotRef>* args_slots); + static Vector<SlotRef> ComputeSlotMappingForArguments( + JavaScriptFrame* frame, + int inlined_frame_index, + int formal_parameter_count); private: Address addr_; @@ -678,6 +696,12 @@ class SlotRef BASE_EMBEDDED { static SlotRef ComputeSlotForNextArgument(TranslationIterator* iterator, DeoptimizationInputData* data, JavaScriptFrame* frame); + + static void ComputeSlotsForArguments( + Vector<SlotRef>* args_slots, + TranslationIterator* iterator, + DeoptimizationInputData* data, + JavaScriptFrame* frame); }; @@ -686,9 +710,13 @@ class SlotRef BASE_EMBEDDED { // needs to inspect a frame that is part of an optimized frame. The // internally used FrameDescription objects are not GC safe so for use // by the debugger frame information is copied to an object of this type. +// Represents parameters in unadapted form so their number might mismatch +// formal parameter count. class DeoptimizedFrameInfo : public Malloced { public: - DeoptimizedFrameInfo(Deoptimizer* deoptimizer, int frame_index); + DeoptimizedFrameInfo(Deoptimizer* deoptimizer, + int frame_index, + bool has_arguments_adaptor); virtual ~DeoptimizedFrameInfo(); // GC support. |