OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 | 127 |
128 LUnallocated(Policy policy, Lifetime lifetime) : LOperand(UNALLOCATED, 0) { | 128 LUnallocated(Policy policy, Lifetime lifetime) : LOperand(UNALLOCATED, 0) { |
129 Initialize(policy, 0, lifetime); | 129 Initialize(policy, 0, lifetime); |
130 } | 130 } |
131 | 131 |
132 // The superclass has a KindField. Some policies have a signed fixed | 132 // The superclass has a KindField. Some policies have a signed fixed |
133 // index in the upper bits. | 133 // index in the upper bits. |
134 static const int kPolicyWidth = 3; | 134 static const int kPolicyWidth = 3; |
135 static const int kLifetimeWidth = 1; | 135 static const int kLifetimeWidth = 1; |
136 static const int kVirtualRegisterWidth = 15; | 136 static const int kVirtualRegisterWidth = 18; |
137 | 137 |
138 static const int kPolicyShift = kKindFieldWidth; | 138 static const int kPolicyShift = kKindFieldWidth; |
139 static const int kLifetimeShift = kPolicyShift + kPolicyWidth; | 139 static const int kLifetimeShift = kPolicyShift + kPolicyWidth; |
140 static const int kVirtualRegisterShift = kLifetimeShift + kLifetimeWidth; | 140 static const int kVirtualRegisterShift = kLifetimeShift + kLifetimeWidth; |
141 static const int kFixedIndexShift = | 141 static const int kFixedIndexShift = |
142 kVirtualRegisterShift + kVirtualRegisterWidth; | 142 kVirtualRegisterShift + kVirtualRegisterWidth; |
143 static const int kFixedIndexWidth = 32 - kFixedIndexShift; | |
144 STATIC_ASSERT(kFixedIndexWidth > 5); | |
145 | 143 |
146 class PolicyField : public BitField<Policy, kPolicyShift, kPolicyWidth> { }; | 144 class PolicyField : public BitField<Policy, kPolicyShift, kPolicyWidth> { }; |
147 | 145 |
148 class LifetimeField | 146 class LifetimeField |
149 : public BitField<Lifetime, kLifetimeShift, kLifetimeWidth> { | 147 : public BitField<Lifetime, kLifetimeShift, kLifetimeWidth> { |
150 }; | 148 }; |
151 | 149 |
152 class VirtualRegisterField | 150 class VirtualRegisterField |
153 : public BitField<unsigned, | 151 : public BitField<unsigned, |
154 kVirtualRegisterShift, | 152 kVirtualRegisterShift, |
155 kVirtualRegisterWidth> { | 153 kVirtualRegisterWidth> { |
156 }; | 154 }; |
157 | 155 |
158 static const int kMaxVirtualRegisters = 1 << kVirtualRegisterWidth; | 156 static const int kMaxVirtualRegisters = 1 << kVirtualRegisterWidth; |
159 static const int kMaxFixedIndex = (1 << kFixedIndexWidth) - 1; | 157 static const int kMaxFixedIndex = 63; |
160 static const int kMinFixedIndex = -(1 << kFixedIndexWidth); | 158 static const int kMinFixedIndex = -64; |
161 | 159 |
162 bool HasAnyPolicy() const { | 160 bool HasAnyPolicy() const { |
163 return policy() == ANY; | 161 return policy() == ANY; |
164 } | 162 } |
165 bool HasFixedPolicy() const { | 163 bool HasFixedPolicy() const { |
166 return policy() == FIXED_REGISTER || | 164 return policy() == FIXED_REGISTER || |
167 policy() == FIXED_DOUBLE_REGISTER || | 165 policy() == FIXED_DOUBLE_REGISTER || |
168 policy() == FIXED_SLOT; | 166 policy() == FIXED_SLOT; |
169 } | 167 } |
170 bool HasRegisterPolicy() const { | 168 bool HasRegisterPolicy() const { |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 453 |
456 class LEnvironment: public ZoneObject { | 454 class LEnvironment: public ZoneObject { |
457 public: | 455 public: |
458 LEnvironment(Handle<JSFunction> closure, | 456 LEnvironment(Handle<JSFunction> closure, |
459 FrameType frame_type, | 457 FrameType frame_type, |
460 BailoutId ast_id, | 458 BailoutId ast_id, |
461 int parameter_count, | 459 int parameter_count, |
462 int argument_count, | 460 int argument_count, |
463 int value_count, | 461 int value_count, |
464 LEnvironment* outer, | 462 LEnvironment* outer, |
465 HEnterInlined* entry, | |
466 Zone* zone) | 463 Zone* zone) |
467 : closure_(closure), | 464 : closure_(closure), |
468 frame_type_(frame_type), | 465 frame_type_(frame_type), |
469 arguments_stack_height_(argument_count), | 466 arguments_stack_height_(argument_count), |
470 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), | 467 deoptimization_index_(Safepoint::kNoDeoptimizationIndex), |
471 translation_index_(-1), | 468 translation_index_(-1), |
472 ast_id_(ast_id), | 469 ast_id_(ast_id), |
473 parameter_count_(parameter_count), | 470 parameter_count_(parameter_count), |
474 pc_offset_(-1), | 471 pc_offset_(-1), |
475 values_(value_count, zone), | 472 values_(value_count, zone), |
476 is_tagged_(value_count, zone), | 473 is_tagged_(value_count, zone), |
477 is_uint32_(value_count, zone), | 474 is_uint32_(value_count, zone), |
478 spilled_registers_(NULL), | 475 spilled_registers_(NULL), |
479 spilled_double_registers_(NULL), | 476 spilled_double_registers_(NULL), |
480 outer_(outer), | 477 outer_(outer), |
481 entry_(entry), | |
482 zone_(zone) { } | 478 zone_(zone) { } |
483 | 479 |
484 Handle<JSFunction> closure() const { return closure_; } | 480 Handle<JSFunction> closure() const { return closure_; } |
485 FrameType frame_type() const { return frame_type_; } | 481 FrameType frame_type() const { return frame_type_; } |
486 int arguments_stack_height() const { return arguments_stack_height_; } | 482 int arguments_stack_height() const { return arguments_stack_height_; } |
487 int deoptimization_index() const { return deoptimization_index_; } | 483 int deoptimization_index() const { return deoptimization_index_; } |
488 int translation_index() const { return translation_index_; } | 484 int translation_index() const { return translation_index_; } |
489 BailoutId ast_id() const { return ast_id_; } | 485 BailoutId ast_id() const { return ast_id_; } |
490 int parameter_count() const { return parameter_count_; } | 486 int parameter_count() const { return parameter_count_; } |
491 int pc_offset() const { return pc_offset_; } | 487 int pc_offset() const { return pc_offset_; } |
492 LOperand** spilled_registers() const { return spilled_registers_; } | 488 LOperand** spilled_registers() const { return spilled_registers_; } |
493 LOperand** spilled_double_registers() const { | 489 LOperand** spilled_double_registers() const { |
494 return spilled_double_registers_; | 490 return spilled_double_registers_; |
495 } | 491 } |
496 const ZoneList<LOperand*>* values() const { return &values_; } | 492 const ZoneList<LOperand*>* values() const { return &values_; } |
497 LEnvironment* outer() const { return outer_; } | 493 LEnvironment* outer() const { return outer_; } |
498 HEnterInlined* entry() { return entry_; } | |
499 | 494 |
500 void AddValue(LOperand* operand, | 495 void AddValue(LOperand* operand, |
501 Representation representation, | 496 Representation representation, |
502 bool is_uint32) { | 497 bool is_uint32) { |
503 values_.Add(operand, zone()); | 498 values_.Add(operand, zone()); |
504 if (representation.IsTagged()) { | 499 if (representation.IsTagged()) { |
505 ASSERT(!is_uint32); | 500 ASSERT(!is_uint32); |
506 is_tagged_.Add(values_.length() - 1); | 501 is_tagged_.Add(values_.length() - 1); |
507 } | 502 } |
508 | 503 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 BitVector is_tagged_; | 549 BitVector is_tagged_; |
555 BitVector is_uint32_; | 550 BitVector is_uint32_; |
556 | 551 |
557 // Allocation index indexed arrays of spill slot operands for registers | 552 // Allocation index indexed arrays of spill slot operands for registers |
558 // that are also in spill slots at an OSR entry. NULL for environments | 553 // that are also in spill slots at an OSR entry. NULL for environments |
559 // that do not correspond to an OSR entry. | 554 // that do not correspond to an OSR entry. |
560 LOperand** spilled_registers_; | 555 LOperand** spilled_registers_; |
561 LOperand** spilled_double_registers_; | 556 LOperand** spilled_double_registers_; |
562 | 557 |
563 LEnvironment* outer_; | 558 LEnvironment* outer_; |
564 HEnterInlined* entry_; | |
565 | 559 |
566 Zone* zone_; | 560 Zone* zone_; |
567 }; | 561 }; |
568 | 562 |
569 | 563 |
570 // Iterates over the non-null, non-constant operands in an environment. | 564 // Iterates over the non-null, non-constant operands in an environment. |
571 class ShallowIterator BASE_EMBEDDED { | 565 class ShallowIterator BASE_EMBEDDED { |
572 public: | 566 public: |
573 explicit ShallowIterator(LEnvironment* env) | 567 explicit ShallowIterator(LEnvironment* env) |
574 : env_(env), | 568 : env_(env), |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 ZoneList<Handle<JSFunction> > inlined_closures_; | 697 ZoneList<Handle<JSFunction> > inlined_closures_; |
704 }; | 698 }; |
705 | 699 |
706 | 700 |
707 int ElementsKindToShiftSize(ElementsKind elements_kind); | 701 int ElementsKindToShiftSize(ElementsKind elements_kind); |
708 | 702 |
709 | 703 |
710 } } // namespace v8::internal | 704 } } // namespace v8::internal |
711 | 705 |
712 #endif // V8_LITHIUM_H_ | 706 #endif // V8_LITHIUM_H_ |
OLD | NEW |