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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 bool IsMarkedAsCall() const { return IsCall(); } | 259 bool IsMarkedAsCall() const { return IsCall(); } |
260 | 260 |
261 virtual bool HasResult() const = 0; | 261 virtual bool HasResult() const = 0; |
262 virtual LOperand* result() const = 0; | 262 virtual LOperand* result() const = 0; |
263 | 263 |
264 LOperand* FirstInput() { return InputAt(0); } | 264 LOperand* FirstInput() { return InputAt(0); } |
265 LOperand* Output() { return HasResult() ? result() : NULL; } | 265 LOperand* Output() { return HasResult() ? result() : NULL; } |
266 | 266 |
267 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 267 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
268 | 268 |
| 269 virtual bool MustSignExtendResult(LPlatformChunk* chunk) const { |
| 270 return false; |
| 271 } |
| 272 |
269 #ifdef DEBUG | 273 #ifdef DEBUG |
270 void VerifyCall(); | 274 void VerifyCall(); |
271 #endif | 275 #endif |
272 | 276 |
273 private: | 277 private: |
274 // Iterator support. | 278 // Iterator support. |
275 friend class InputIterator; | 279 friend class InputIterator; |
276 virtual int InputCount() = 0; | 280 virtual int InputCount() = 0; |
277 virtual LOperand* InputAt(int i) = 0; | 281 virtual LOperand* InputAt(int i) = 0; |
278 | 282 |
(...skipping 15 matching lines...) Expand all Loading... |
294 class LTemplateResultInstruction : public LInstruction { | 298 class LTemplateResultInstruction : public LInstruction { |
295 public: | 299 public: |
296 // Allow 0 or 1 output operands. | 300 // Allow 0 or 1 output operands. |
297 STATIC_ASSERT(R == 0 || R == 1); | 301 STATIC_ASSERT(R == 0 || R == 1); |
298 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { | 302 virtual bool HasResult() const V8_FINAL V8_OVERRIDE { |
299 return R != 0 && result() != NULL; | 303 return R != 0 && result() != NULL; |
300 } | 304 } |
301 void set_result(LOperand* operand) { results_[0] = operand; } | 305 void set_result(LOperand* operand) { results_[0] = operand; } |
302 LOperand* result() const { return results_[0]; } | 306 LOperand* result() const { return results_[0]; } |
303 | 307 |
| 308 virtual bool MustSignExtendResult( |
| 309 LPlatformChunk* chunk) const V8_FINAL V8_OVERRIDE; |
| 310 |
304 protected: | 311 protected: |
305 EmbeddedContainer<LOperand*, R> results_; | 312 EmbeddedContainer<LOperand*, R> results_; |
306 }; | 313 }; |
307 | 314 |
308 | 315 |
309 // R = number of result operands (0 or 1). | 316 // R = number of result operands (0 or 1). |
310 // I = number of input operands. | 317 // I = number of input operands. |
311 // T = number of temporary operands. | 318 // T = number of temporary operands. |
312 template<int R, int I, int T> | 319 template<int R, int I, int T> |
313 class LTemplateInstruction : public LTemplateResultInstruction<R> { | 320 class LTemplateInstruction : public LTemplateResultInstruction<R> { |
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 LOperand* index() { return inputs_[1]; } | 2503 LOperand* index() { return inputs_[1]; } |
2497 | 2504 |
2498 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") | 2505 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex, "load-field-by-index") |
2499 }; | 2506 }; |
2500 | 2507 |
2501 | 2508 |
2502 class LChunkBuilder; | 2509 class LChunkBuilder; |
2503 class LPlatformChunk V8_FINAL : public LChunk { | 2510 class LPlatformChunk V8_FINAL : public LChunk { |
2504 public: | 2511 public: |
2505 LPlatformChunk(CompilationInfo* info, HGraph* graph) | 2512 LPlatformChunk(CompilationInfo* info, HGraph* graph) |
2506 : LChunk(info, graph) { } | 2513 : LChunk(info, graph), |
| 2514 dehoisted_key_ids_(graph->GetMaximumValueID(), graph->zone()) { } |
2507 | 2515 |
2508 int GetNextSpillIndex(RegisterKind kind); | 2516 int GetNextSpillIndex(RegisterKind kind); |
2509 LOperand* GetNextSpillSlot(RegisterKind kind); | 2517 LOperand* GetNextSpillSlot(RegisterKind kind); |
| 2518 BitVector* GetDehoistedKeyIds() { return &dehoisted_key_ids_; } |
| 2519 bool IsDehoistedKey(HValue* value) { |
| 2520 return dehoisted_key_ids_.Contains(value->id()); |
| 2521 } |
| 2522 |
| 2523 private: |
| 2524 BitVector dehoisted_key_ids_; |
2510 }; | 2525 }; |
2511 | 2526 |
2512 | 2527 |
2513 class LChunkBuilder V8_FINAL : public LChunkBuilderBase { | 2528 class LChunkBuilder V8_FINAL : public LChunkBuilderBase { |
2514 public: | 2529 public: |
2515 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) | 2530 LChunkBuilder(CompilationInfo* info, HGraph* graph, LAllocator* allocator) |
2516 : LChunkBuilderBase(graph->zone()), | 2531 : LChunkBuilderBase(graph->zone()), |
2517 chunk_(NULL), | 2532 chunk_(NULL), |
2518 info_(info), | 2533 info_(info), |
2519 graph_(graph), | 2534 graph_(graph), |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2644 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); | 2659 CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY); |
2645 | 2660 |
2646 void VisitInstruction(HInstruction* current); | 2661 void VisitInstruction(HInstruction* current); |
2647 | 2662 |
2648 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); | 2663 void DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block); |
2649 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); | 2664 LInstruction* DoShift(Token::Value op, HBitwiseBinaryOperation* instr); |
2650 LInstruction* DoArithmeticD(Token::Value op, | 2665 LInstruction* DoArithmeticD(Token::Value op, |
2651 HArithmeticBinaryOperation* instr); | 2666 HArithmeticBinaryOperation* instr); |
2652 LInstruction* DoArithmeticT(Token::Value op, | 2667 LInstruction* DoArithmeticT(Token::Value op, |
2653 HBinaryOperation* instr); | 2668 HBinaryOperation* instr); |
| 2669 void FindDehoistedKeyDefinitions(HValue* candidate); |
2654 | 2670 |
2655 LPlatformChunk* chunk_; | 2671 LPlatformChunk* chunk_; |
2656 CompilationInfo* info_; | 2672 CompilationInfo* info_; |
2657 HGraph* const graph_; | 2673 HGraph* const graph_; |
2658 Status status_; | 2674 Status status_; |
2659 HInstruction* current_instruction_; | 2675 HInstruction* current_instruction_; |
2660 HBasicBlock* current_block_; | 2676 HBasicBlock* current_block_; |
2661 HBasicBlock* next_block_; | 2677 HBasicBlock* next_block_; |
2662 LAllocator* allocator_; | 2678 LAllocator* allocator_; |
2663 LInstruction* instruction_pending_deoptimization_environment_; | 2679 LInstruction* instruction_pending_deoptimization_environment_; |
2664 BailoutId pending_deoptimization_ast_id_; | 2680 BailoutId pending_deoptimization_ast_id_; |
2665 | 2681 |
2666 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2682 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2667 }; | 2683 }; |
2668 | 2684 |
2669 #undef DECLARE_HYDROGEN_ACCESSOR | 2685 #undef DECLARE_HYDROGEN_ACCESSOR |
2670 #undef DECLARE_CONCRETE_INSTRUCTION | 2686 #undef DECLARE_CONCRETE_INSTRUCTION |
2671 | 2687 |
2672 } } // namespace v8::int | 2688 } } // namespace v8::int |
2673 | 2689 |
2674 #endif // V8_X64_LITHIUM_X64_H_ | 2690 #endif // V8_X64_LITHIUM_X64_H_ |
OLD | NEW |