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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool IsMarkedAsCall() const { return IsCall(); } | 264 bool IsMarkedAsCall() const { return IsCall(); } |
265 | 265 |
266 virtual bool HasResult() const = 0; | 266 virtual bool HasResult() const = 0; |
267 virtual LOperand* result() const = 0; | 267 virtual LOperand* result() const = 0; |
268 | 268 |
269 LOperand* FirstInput() { return InputAt(0); } | 269 LOperand* FirstInput() { return InputAt(0); } |
270 LOperand* Output() { return HasResult() ? result() : NULL; } | 270 LOperand* Output() { return HasResult() ? result() : NULL; } |
271 | 271 |
272 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 272 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
273 | 273 |
| 274 virtual bool MustSignExtendResult(LPlatformChunk* chunk) const { |
| 275 return false; |
| 276 } |
| 277 |
274 #ifdef DEBUG | 278 #ifdef DEBUG |
275 void VerifyCall(); | 279 void VerifyCall(); |
276 #endif | 280 #endif |
277 | 281 |
278 private: | 282 private: |
279 // Iterator support. | 283 // Iterator support. |
280 friend class InputIterator; | 284 friend class InputIterator; |
281 virtual int InputCount() = 0; | 285 virtual int InputCount() = 0; |
282 virtual LOperand* InputAt(int i) = 0; | 286 virtual LOperand* InputAt(int i) = 0; |
283 | 287 |
(...skipping 15 matching lines...) Expand all Loading... |
299 class LTemplateResultInstruction : public LInstruction { | 303 class LTemplateResultInstruction : public LInstruction { |
300 public: | 304 public: |
301 // Allow 0 or 1 output operands. | 305 // Allow 0 or 1 output operands. |
302 STATIC_ASSERT(R == 0 || R == 1); | 306 STATIC_ASSERT(R == 0 || R == 1); |
303 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 307 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
304 return R != 0 && result() != NULL; | 308 return R != 0 && result() != NULL; |
305 } | 309 } |
306 void set_result(LOperand* operand) { results_[0] = operand; } | 310 void set_result(LOperand* operand) { results_[0] = operand; } |
307 LOperand* result() const { return results_[0]; } | 311 LOperand* result() const { return results_[0]; } |
308 | 312 |
| 313 virtual bool MustSignExtendResult( |
| 314 LPlatformChunk* chunk) const V8_FINAL V8_OVERRIDE; |
| 315 |
309 protected: | 316 protected: |
310 EmbeddedContainer<LOperand*, R> results_; | 317 EmbeddedContainer<LOperand*, R> results_; |
311 }; | 318 }; |
312 | 319 |
313 | 320 |
314 // R = number of result operands (0 or 1). | 321 // R = number of result operands (0 or 1). |
315 // I = number of input operands. | 322 // I = number of input operands. |
316 // T = number of temporary operands. | 323 // T = number of temporary operands. |
317 template<int R, int I, int T> | 324 template<int R, int I, int T> |
318 class LTemplateInstruction : public LTemplateResultInstruction<R> { | 325 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
(...skipping 2300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2619 LOperand* index() { return inputs_[1]; } | 2626 LOperand* index() { return inputs_[1]; } |
2620 | 2627 |
2621 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") | 2628 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
2622 }; | 2629 }; |
2623 | 2630 |
2624 | 2631 |
2625 class LChunkBuilder; | 2632 class LChunkBuilder; |
2626 class LPlatformChunk V8_FINAL : public LChunk { | 2633 class LPlatformChunk V8_FINAL : public LChunk { |
2627 public: | 2634 public: |
2628 LPlatformChunk(CompilationInfo* info, HGraph* graph) | 2635 LPlatformChunk(CompilationInfo* info, HGraph* graph) |
2629 : LChunk(info, graph) { } | 2636 : LChunk(info, graph), |
| 2637 dehoisted_key_ids_(graph->GetMaximumValueID(), graph->zone()) { } |
2630 | 2638 |
2631 int GetNextSpillIndex(RegisterKind kind); | 2639 int GetNextSpillIndex(RegisterKind kind); |
2632 LOperand* GetNextSpillSlot(RegisterKind kind); | 2640 LOperand* GetNextSpillSlot(RegisterKind kind); |
| 2641 BitVector* GetDehoistedKeyIds() { return &dehoisted_key_ids_; } |
| 2642 bool IsDehoistedKey(HValue* value) { |
| 2643 return dehoisted_key_ids_.Contains(value->id()); |
| 2644 } |
| 2645 |
| 2646 private: |
| 2647 BitVector dehoisted_key_ids_; |
2633 }; | 2648 }; |
2634 | 2649 |
2635 | 2650 |
2636 class LChunkBuilder V8_FINAL : public LChunkBuilderBase { | 2651 class LChunkBuilder V8_FINAL : public LChunkBuilderBase { |
2637 public: | 2652 public: |
2638 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) | 2653 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
2639 : LChunkBuilderBase(graph->zone()), | 2654 : LChunkBuilderBase(graph->zone()), |
2640 chunk_(NULL), | 2655 chunk_(NULL), |
2641 info_(info), | 2656 info_(info), |
2642 graph_(graph), | 2657 graph_(graph), |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2788 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
2774 | 2789 |
2775 void VisitInstruction(HInstruction* current); | 2790 void VisitInstruction(HInstruction* current); |
2776 | 2791 |
2777 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2792 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
2778 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2793 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
2779 LInstruction* DoArithmeticD(Token::Value op, | 2794 LInstruction* DoArithmeticD(Token::Value op, |
2780 HArithmeticBinaryOperation* instr); | 2795 HArithmeticBinaryOperation* instr); |
2781 LInstruction* DoArithmeticT(Token::Value op, | 2796 LInstruction* DoArithmeticT(Token::Value op, |
2782 HBinaryOperation* instr); | 2797 HBinaryOperation* instr); |
| 2798 void FindDehoistedKeyDefinitions(HValue* candidate); |
2783 | 2799 |
2784 LPlatformChunk* chunk_; | 2800 LPlatformChunk* chunk_; |
2785 CompilationInfo* info_; | 2801 CompilationInfo* info_; |
2786 HGraph* const graph_; | 2802 HGraph* const graph_; |
2787 Status status_; | 2803 Status status_; |
2788 HInstruction* current_instruction_; | 2804 HInstruction* current_instruction_; |
2789 HBasicBlock* current_block_; | 2805 HBasicBlock* current_block_; |
2790 HBasicBlock* next_block_; | 2806 HBasicBlock* next_block_; |
2791 LAllocator* allocator_; | 2807 LAllocator* allocator_; |
2792 | 2808 |
2793 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2809 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2794 }; | 2810 }; |
2795 | 2811 |
2796 #undef DECLARE_HYDROGEN_ACCESSOR | 2812 #undef DECLARE_HYDROGEN_ACCESSOR |
2797 #undef DECLARE_CONCRETE_INSTRUCTION | 2813 #undef DECLARE_CONCRETE_INSTRUCTION |
2798 | 2814 |
2799 } } // namespace v8::int | 2815 } } // namespace v8::int |
2800 | 2816 |
2801 #endif // V8_X64_LITHIUM_X64_H_ | 2817 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |