diff options
Diffstat (limited to 'src/3rdparty/v8/src/lithium.h')
-rw-r--r-- | src/3rdparty/v8/src/lithium.h | 152 |
1 files changed, 120 insertions, 32 deletions
diff --git a/src/3rdparty/v8/src/lithium.h b/src/3rdparty/v8/src/lithium.h index 2ccbf56..b4eb2bb 100644 --- a/src/3rdparty/v8/src/lithium.h +++ b/src/3rdparty/v8/src/lithium.h @@ -133,13 +133,15 @@ class LUnallocated: public LOperand { // index in the upper bits. static const int kPolicyWidth = 3; static const int kLifetimeWidth = 1; - static const int kVirtualRegisterWidth = 18; + static const int kVirtualRegisterWidth = 15; static const int kPolicyShift = kKindFieldWidth; static const int kLifetimeShift = kPolicyShift + kPolicyWidth; static const int kVirtualRegisterShift = kLifetimeShift + kLifetimeWidth; static const int kFixedIndexShift = kVirtualRegisterShift + kVirtualRegisterWidth; + static const int kFixedIndexWidth = 32 - kFixedIndexShift; + STATIC_ASSERT(kFixedIndexWidth > 5); class PolicyField : public BitField<Policy, kPolicyShift, kPolicyWidth> { }; @@ -154,8 +156,8 @@ class LUnallocated: public LOperand { }; static const int kMaxVirtualRegisters = 1 << kVirtualRegisterWidth; - static const int kMaxFixedIndex = 63; - static const int kMinFixedIndex = -64; + static const int kMaxFixedIndex = (1 << kFixedIndexWidth) - 1; + static const int kMinFixedIndex = -(1 << kFixedIndexWidth); bool HasAnyPolicy() const { return policy() == ANY; @@ -187,8 +189,8 @@ class LUnallocated: public LOperand { value_ = VirtualRegisterField::update(value_, id); } - LUnallocated* CopyUnconstrained() { - LUnallocated* result = new LUnallocated(ANY); + LUnallocated* CopyUnconstrained(Zone* zone) { + LUnallocated* result = new(zone) LUnallocated(ANY); result->set_virtual_register(virtual_register()); return result; } @@ -260,10 +262,10 @@ class LMoveOperands BASE_EMBEDDED { class LConstantOperand: public LOperand { public: - static LConstantOperand* Create(int index) { + static LConstantOperand* Create(int index, Zone* zone) { ASSERT(index >= 0); if (index < kNumCachedOperands) return &cache[index]; - return new LConstantOperand(index); + return new(zone) LConstantOperand(index); } static LConstantOperand* cast(LOperand* op) { @@ -296,10 +298,10 @@ class LArgument: public LOperand { class LStackSlot: public LOperand { public: - static LStackSlot* Create(int index) { + static LStackSlot* Create(int index, Zone* zone) { ASSERT(index >= 0); if (index < kNumCachedOperands) return &cache[index]; - return new LStackSlot(index); + return new(zone) LStackSlot(index); } static LStackSlot* cast(LOperand* op) { @@ -321,10 +323,10 @@ class LStackSlot: public LOperand { class LDoubleStackSlot: public LOperand { public: - static LDoubleStackSlot* Create(int index) { + static LDoubleStackSlot* Create(int index, Zone* zone) { ASSERT(index >= 0); if (index < kNumCachedOperands) return &cache[index]; - return new LDoubleStackSlot(index); + return new(zone) LDoubleStackSlot(index); } static LDoubleStackSlot* cast(LOperand* op) { @@ -346,10 +348,10 @@ class LDoubleStackSlot: public LOperand { class LRegister: public LOperand { public: - static LRegister* Create(int index) { + static LRegister* Create(int index, Zone* zone) { ASSERT(index >= 0); if (index < kNumCachedOperands) return &cache[index]; - return new LRegister(index); + return new(zone) LRegister(index); } static LRegister* cast(LOperand* op) { @@ -371,10 +373,10 @@ class LRegister: public LOperand { class LDoubleRegister: public LOperand { public: - static LDoubleRegister* Create(int index) { + static LDoubleRegister* Create(int index, Zone* zone) { ASSERT(index >= 0); if (index < kNumCachedOperands) return &cache[index]; - return new LDoubleRegister(index); + return new(zone) LDoubleRegister(index); } static LDoubleRegister* cast(LOperand* op) { @@ -396,10 +398,10 @@ class LDoubleRegister: public LOperand { class LParallelMove : public ZoneObject { public: - LParallelMove() : move_operands_(4) { } + explicit LParallelMove(Zone* zone) : move_operands_(4, zone) { } - void AddMove(LOperand* from, LOperand* to) { - move_operands_.Add(LMoveOperands(from, to)); + void AddMove(LOperand* from, LOperand* to, Zone* zone) { + move_operands_.Add(LMoveOperands(from, to), zone); } bool IsRedundant() const; @@ -417,9 +419,9 @@ class LParallelMove : public ZoneObject { class LPointerMap: public ZoneObject { public: - explicit LPointerMap(int position) - : pointer_operands_(8), - untagged_operands_(0), + explicit LPointerMap(int position, Zone* zone) + : pointer_operands_(8, zone), + untagged_operands_(0, zone), position_(position), lithium_position_(-1) { } @@ -438,9 +440,9 @@ class LPointerMap: public ZoneObject { lithium_position_ = pos; } - void RecordPointer(LOperand* op); + void RecordPointer(LOperand* op, Zone* zone); void RemovePointer(LOperand* op); - void RecordUntagged(LOperand* op); + void RecordUntagged(LOperand* op, Zone* zone); void PrintTo(StringStream* stream); private: @@ -455,11 +457,13 @@ class LEnvironment: public ZoneObject { public: LEnvironment(Handle<JSFunction> closure, FrameType frame_type, - int ast_id, + BailoutId ast_id, int parameter_count, int argument_count, int value_count, - LEnvironment* outer) + LEnvironment* outer, + HEnterInlined* entry, + Zone* zone) : closure_(closure), frame_type_(frame_type), arguments_stack_height_(argument_count), @@ -468,18 +472,21 @@ class LEnvironment: public ZoneObject { ast_id_(ast_id), parameter_count_(parameter_count), pc_offset_(-1), - values_(value_count), - is_tagged_(value_count, closure->GetHeap()->isolate()->zone()), + values_(value_count, zone), + is_tagged_(value_count, zone), + is_uint32_(value_count, zone), spilled_registers_(NULL), spilled_double_registers_(NULL), - outer_(outer) { } + outer_(outer), + entry_(entry), + zone_(zone) { } Handle<JSFunction> closure() const { return closure_; } FrameType frame_type() const { return frame_type_; } int arguments_stack_height() const { return arguments_stack_height_; } int deoptimization_index() const { return deoptimization_index_; } int translation_index() const { return translation_index_; } - int ast_id() const { return ast_id_; } + BailoutId ast_id() const { return ast_id_; } int parameter_count() const { return parameter_count_; } int pc_offset() const { return pc_offset_; } LOperand** spilled_registers() const { return spilled_registers_; } @@ -488,18 +495,30 @@ class LEnvironment: public ZoneObject { } const ZoneList<LOperand*>* values() const { return &values_; } LEnvironment* outer() const { return outer_; } + HEnterInlined* entry() { return entry_; } - void AddValue(LOperand* operand, Representation representation) { - values_.Add(operand); + void AddValue(LOperand* operand, + Representation representation, + bool is_uint32) { + values_.Add(operand, zone()); if (representation.IsTagged()) { + ASSERT(!is_uint32); is_tagged_.Add(values_.length() - 1); } + + if (is_uint32) { + is_uint32_.Add(values_.length() - 1); + } } bool HasTaggedValueAt(int index) const { return is_tagged_.Contains(index); } + bool HasUint32ValueAt(int index) const { + return is_uint32_.Contains(index); + } + void Register(int deoptimization_index, int translation_index, int pc_offset) { @@ -520,17 +539,20 @@ class LEnvironment: public ZoneObject { void PrintTo(StringStream* stream); + Zone* zone() const { return zone_; } + private: Handle<JSFunction> closure_; FrameType frame_type_; int arguments_stack_height_; int deoptimization_index_; int translation_index_; - int ast_id_; + BailoutId ast_id_; int parameter_count_; int pc_offset_; ZoneList<LOperand*> values_; BitVector is_tagged_; + BitVector is_uint32_; // Allocation index indexed arrays of spill slot operands for registers // that are also in spill slots at an OSR entry. NULL for environments @@ -539,6 +561,9 @@ class LEnvironment: public ZoneObject { LOperand** spilled_double_registers_; LEnvironment* outer_; + HEnterInlined* entry_; + + Zone* zone_; }; @@ -616,6 +641,69 @@ class DeepIterator BASE_EMBEDDED { }; +class LPlatformChunk; +class LGap; +class LLabel; + +// Superclass providing data and behavior common to all the +// arch-specific LPlatformChunk classes. +class LChunk: public ZoneObject { + public: + static LChunk* NewChunk(HGraph* graph); + + void AddInstruction(LInstruction* instruction, HBasicBlock* block); + LConstantOperand* DefineConstantOperand(HConstant* constant); + HConstant* LookupConstant(LConstantOperand* operand) const; + Representation LookupLiteralRepresentation(LConstantOperand* operand) const; + + int ParameterAt(int index); + int GetParameterStackSlot(int index) const; + int spill_slot_count() const { return spill_slot_count_; } + CompilationInfo* info() const { return info_; } + HGraph* graph() const { return graph_; } + const ZoneList<LInstruction*>* instructions() const { return &instructions_; } + void AddGapMove(int index, LOperand* from, LOperand* to); + LGap* GetGapAt(int index) const; + bool IsGapAt(int index) const; + int NearestGapPos(int index) const; + void MarkEmptyBlocks(); + const ZoneList<LPointerMap*>* pointer_maps() const { return &pointer_maps_; } + LLabel* GetLabel(int block_id) const; + int LookupDestination(int block_id) const; + Label* GetAssemblyLabel(int block_id) const; + + const ZoneList<Handle<JSFunction> >* inlined_closures() const { + return &inlined_closures_; + } + + void AddInlinedClosure(Handle<JSFunction> closure) { + inlined_closures_.Add(closure, zone()); + } + + Zone* zone() const { return info_->zone(); } + + Handle<Code> Codegen(); + + protected: + LChunk(CompilationInfo* info, HGraph* graph) + : spill_slot_count_(0), + info_(info), + graph_(graph), + instructions_(32, graph->zone()), + pointer_maps_(8, graph->zone()), + inlined_closures_(1, graph->zone()) { } + + int spill_slot_count_; + + private: + CompilationInfo* info_; + HGraph* const graph_; + ZoneList<LInstruction*> instructions_; + ZoneList<LPointerMap*> pointer_maps_; + ZoneList<Handle<JSFunction> > inlined_closures_; +}; + + int ElementsKindToShiftSize(ElementsKind elements_kind); |