Chromium Code Reviews| Index: src/deoptimizer.h |
| diff --git a/src/deoptimizer.h b/src/deoptimizer.h |
| index 284676c36eeef1152ef3731d716240b5058aeb25..b1ea5d38987ccb9fca23f27ac50595624b1b6857 100644 |
| --- a/src/deoptimizer.h |
| +++ b/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,6 +264,8 @@ class Deoptimizer : public Malloced { |
| int count_; |
| }; |
| + int ConvertJSFrameIndexToFrameIndex(int jsframe_index); |
| + |
| private: |
| static const int kNumberOfEntries = 4096; |
| @@ -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,6 +436,9 @@ class FrameDescription { |
| void SetContinuation(intptr_t pc) { continuation_ = pc; } |
| + StackFrame::Type GetType() const { return type_; } |
|
Kevin Millikin (Chromium)
2012/01/24 00:08:54
Type and Kind are too generic (kind was before).
Vyacheslav Egorov (Chromium)
2012/01/24 08:49:20
Done.
|
| + void SetType(StackFrame::Type type) { type_ = type; } |
| + |
| #ifdef DEBUG |
| Code::Kind GetKind() const { return kind_; } |
| void SetKind(Code::Kind kind) { kind_ = kind; } |
| @@ -432,13 +448,13 @@ class FrameDescription { |
| 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 +497,7 @@ class FrameDescription { |
| intptr_t top_; |
| intptr_t pc_; |
| intptr_t fp_; |
| + StackFrame::Type type_; |
| Smi* state_; |
| #ifdef DEBUG |
| Code::Kind kind_; |
| @@ -499,6 +516,8 @@ class FrameDescription { |
| return reinterpret_cast<intptr_t*>( |
| reinterpret_cast<Address>(this) + frame_content_offset() + offset); |
| } |
| + |
| + int ComputeFixedSize(); |
| }; |
| @@ -541,7 +560,8 @@ class Translation BASE_EMBEDDED { |
| public: |
| enum Opcode { |
| BEGIN, |
| - FRAME, |
| + JS_FRAME, |
| + ARGUMENTS_ADAPTOR_FRAME, |
| REGISTER, |
| INT32_REGISTER, |
| DOUBLE_REGISTER, |
| @@ -556,17 +576,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 +678,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 +701,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 +715,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. |