| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 56         deoptimizations_(4, info->zone()), | 56         deoptimizations_(4, info->zone()), | 
| 57         jump_table_(4, info->zone()), | 57         jump_table_(4, info->zone()), | 
| 58         deoptimization_literals_(8, info->zone()), | 58         deoptimization_literals_(8, info->zone()), | 
| 59         inlined_function_count_(0), | 59         inlined_function_count_(0), | 
| 60         scope_(info->scope()), | 60         scope_(info->scope()), | 
| 61         status_(UNUSED), | 61         status_(UNUSED), | 
| 62         translations_(info->zone()), | 62         translations_(info->zone()), | 
| 63         deferred_(8, info->zone()), | 63         deferred_(8, info->zone()), | 
| 64         osr_pc_offset_(-1), | 64         osr_pc_offset_(-1), | 
| 65         last_lazy_deopt_pc_(0), | 65         last_lazy_deopt_pc_(0), | 
| 66         frame_is_built_(false), |  | 
| 67         safepoints_(info->zone()), | 66         safepoints_(info->zone()), | 
| 68         resolver_(this), | 67         resolver_(this), | 
| 69         expected_safepoint_kind_(Safepoint::kSimple) { | 68         expected_safepoint_kind_(Safepoint::kSimple) { | 
| 70     PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 69     PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 
| 71   } | 70   } | 
| 72 | 71 | 
| 73   // Simple accessors. | 72   // Simple accessors. | 
| 74   MacroAssembler* masm() const { return masm_; } | 73   MacroAssembler* masm() const { return masm_; } | 
| 75   CompilationInfo* info() const { return info_; } | 74   CompilationInfo* info() const { return info_; } | 
| 76   Isolate* isolate() const { return info_->isolate(); } | 75   Isolate* isolate() const { return info_->isolate(); } | 
| 77   Factory* factory() const { return isolate()->factory(); } | 76   Factory* factory() const { return isolate()->factory(); } | 
| 78   Heap* heap() const { return isolate()->heap(); } | 77   Heap* heap() const { return isolate()->heap(); } | 
| 79   Zone* zone() const { return zone_; } | 78   Zone* zone() const { return zone_; } | 
| 80 | 79 | 
| 81   bool NeedsEagerFrame() const { |  | 
| 82     return GetStackSlotCount() > 0 || |  | 
| 83         info()->is_non_deferred_calling() || |  | 
| 84         !info()->IsStub(); |  | 
| 85   } |  | 
| 86   bool NeedsDeferredFrame() const { |  | 
| 87     return !NeedsEagerFrame() && info()->is_deferred_calling(); |  | 
| 88   } |  | 
| 89 |  | 
| 90   // Support for converting LOperands to assembler types. | 80   // Support for converting LOperands to assembler types. | 
| 91   Register ToRegister(LOperand* op) const; | 81   Register ToRegister(LOperand* op) const; | 
| 92   XMMRegister ToDoubleRegister(LOperand* op) const; | 82   XMMRegister ToDoubleRegister(LOperand* op) const; | 
| 93   bool IsInteger32Constant(LConstantOperand* op) const; | 83   bool IsInteger32Constant(LConstantOperand* op) const; | 
| 94   int ToInteger32(LConstantOperand* op) const; | 84   int ToInteger32(LConstantOperand* op) const; | 
| 95   double ToDouble(LConstantOperand* op) const; | 85   double ToDouble(LConstantOperand* op) const; | 
| 96   bool IsTaggedConstant(LConstantOperand* op) const; | 86   bool IsTaggedConstant(LConstantOperand* op) const; | 
| 97   Handle<Object> ToHandle(LConstantOperand* op) const; | 87   Handle<Object> ToHandle(LConstantOperand* op) const; | 
| 98   Operand ToOperand(LOperand* op) const; | 88   Operand ToOperand(LOperand* op) const; | 
| 99 | 89 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 113   void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 103   void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 
| 114   void DoDeferredStackCheck(LStackCheck* instr); | 104   void DoDeferredStackCheck(LStackCheck* instr); | 
| 115   void DoDeferredRandom(LRandom* instr); | 105   void DoDeferredRandom(LRandom* instr); | 
| 116   void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 106   void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 
| 117   void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 107   void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 
| 118   void DoDeferredAllocateObject(LAllocateObject* instr); | 108   void DoDeferredAllocateObject(LAllocateObject* instr); | 
| 119   void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 109   void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 
| 120                                        Label* map_check); | 110                                        Label* map_check); | 
| 121 | 111 | 
| 122   void DoCheckMapCommon(Register reg, Handle<Map> map, | 112   void DoCheckMapCommon(Register reg, Handle<Map> map, | 
| 123                         CompareMapMode mode, LInstruction* instr); | 113                         CompareMapMode mode, LEnvironment* env); | 
| 124 | 114 | 
| 125 // Parallel move support. | 115 // Parallel move support. | 
| 126   void DoParallelMove(LParallelMove* move); | 116   void DoParallelMove(LParallelMove* move); | 
| 127   void DoGap(LGap* instr); | 117   void DoGap(LGap* instr); | 
| 128 | 118 | 
| 129   // Emit frame translation commands for an environment. | 119   // Emit frame translation commands for an environment. | 
| 130   void WriteTranslation(LEnvironment* environment, | 120   void WriteTranslation(LEnvironment* environment, | 
| 131                         Translation* translation, | 121                         Translation* translation, | 
| 132                         int* arguments_index, | 122                         int* arguments_index, | 
| 133                         int* arguments_count); | 123                         int* arguments_count); | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 161   int GetNextEmittedBlock(int block); | 151   int GetNextEmittedBlock(int block); | 
| 162 | 152 | 
| 163   void EmitClassOfTest(Label* if_true, | 153   void EmitClassOfTest(Label* if_true, | 
| 164                        Label* if_false, | 154                        Label* if_false, | 
| 165                        Handle<String> class_name, | 155                        Handle<String> class_name, | 
| 166                        Register input, | 156                        Register input, | 
| 167                        Register temporary, | 157                        Register temporary, | 
| 168                        Register scratch); | 158                        Register scratch); | 
| 169 | 159 | 
| 170   int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 160   int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 
| 171   int GetParameterCount() const { return info()->num_parameters(); } | 161   int GetParameterCount() const { return scope()->num_parameters(); } | 
| 172 | 162 | 
| 173   void Abort(const char* reason); | 163   void Abort(const char* reason); | 
| 174   void Comment(const char* format, ...); | 164   void Comment(const char* format, ...); | 
| 175 | 165 | 
| 176   void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 166   void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } | 
| 177 | 167 | 
| 178   // Code generation passes.  Returns true if code generation should | 168   // Code generation passes.  Returns true if code generation should | 
| 179   // continue. | 169   // continue. | 
| 180   bool GeneratePrologue(); | 170   bool GeneratePrologue(); | 
| 181   bool GenerateBody(); | 171   bool GenerateBody(); | 
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 330   void EmitPushTaggedOperand(LOperand* operand); | 320   void EmitPushTaggedOperand(LOperand* operand); | 
| 331 | 321 | 
| 332   // Emits optimized code to deep-copy the contents of statically known | 322   // Emits optimized code to deep-copy the contents of statically known | 
| 333   // object graphs (e.g. object literal boilerplate). | 323   // object graphs (e.g. object literal boilerplate). | 
| 334   void EmitDeepCopy(Handle<JSObject> object, | 324   void EmitDeepCopy(Handle<JSObject> object, | 
| 335                     Register result, | 325                     Register result, | 
| 336                     Register source, | 326                     Register source, | 
| 337                     int* offset); | 327                     int* offset); | 
| 338 | 328 | 
| 339   struct JumpTableEntry { | 329   struct JumpTableEntry { | 
| 340     inline JumpTableEntry(Address entry, bool frame, bool is_lazy) | 330     explicit inline JumpTableEntry(Address entry) | 
| 341         : label(), | 331         : label(), | 
| 342           address(entry), | 332           address(entry) { } | 
| 343           needs_frame(frame), |  | 
| 344           is_lazy_deopt(is_lazy) { } |  | 
| 345     Label label; | 333     Label label; | 
| 346     Address address; | 334     Address address; | 
| 347     bool needs_frame; |  | 
| 348     bool is_lazy_deopt; |  | 
| 349   }; | 335   }; | 
| 350 | 336 | 
| 351   void EnsureSpaceForLazyDeopt(int space_needed); | 337   void EnsureSpaceForLazyDeopt(int space_needed); | 
| 352   void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 338   void DoLoadKeyedExternalArray(LLoadKeyed* instr); | 
| 353   void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 339   void DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr); | 
| 354   void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 340   void DoLoadKeyedFixedArray(LLoadKeyed* instr); | 
| 355   void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 341   void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 
| 356   void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 342   void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 
| 357   void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 343   void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 
| 358 | 344 | 
| 359   Zone* zone_; | 345   Zone* zone_; | 
| 360   LPlatformChunk* const chunk_; | 346   LPlatformChunk* const chunk_; | 
| 361   MacroAssembler* const masm_; | 347   MacroAssembler* const masm_; | 
| 362   CompilationInfo* const info_; | 348   CompilationInfo* const info_; | 
| 363 | 349 | 
| 364   int current_block_; | 350   int current_block_; | 
| 365   int current_instruction_; | 351   int current_instruction_; | 
| 366   const ZoneList<LInstruction*>* instructions_; | 352   const ZoneList<LInstruction*>* instructions_; | 
| 367   ZoneList<LEnvironment*> deoptimizations_; | 353   ZoneList<LEnvironment*> deoptimizations_; | 
| 368   ZoneList<JumpTableEntry> jump_table_; | 354   ZoneList<JumpTableEntry> jump_table_; | 
| 369   ZoneList<Handle<Object> > deoptimization_literals_; | 355   ZoneList<Handle<Object> > deoptimization_literals_; | 
| 370   int inlined_function_count_; | 356   int inlined_function_count_; | 
| 371   Scope* const scope_; | 357   Scope* const scope_; | 
| 372   Status status_; | 358   Status status_; | 
| 373   TranslationBuffer translations_; | 359   TranslationBuffer translations_; | 
| 374   ZoneList<LDeferredCode*> deferred_; | 360   ZoneList<LDeferredCode*> deferred_; | 
| 375   int osr_pc_offset_; | 361   int osr_pc_offset_; | 
| 376   int last_lazy_deopt_pc_; | 362   int last_lazy_deopt_pc_; | 
| 377   bool frame_is_built_; |  | 
| 378 | 363 | 
| 379   // Builder that keeps track of safepoints in the code. The table | 364   // Builder that keeps track of safepoints in the code. The table | 
| 380   // itself is emitted at the end of the generated code. | 365   // itself is emitted at the end of the generated code. | 
| 381   SafepointTableBuilder safepoints_; | 366   SafepointTableBuilder safepoints_; | 
| 382 | 367 | 
| 383   // Compiler from a set of parallel moves to a sequential list of moves. | 368   // Compiler from a set of parallel moves to a sequential list of moves. | 
| 384   LGapResolver resolver_; | 369   LGapResolver resolver_; | 
| 385 | 370 | 
| 386   Safepoint::Kind expected_safepoint_kind_; | 371   Safepoint::Kind expected_safepoint_kind_; | 
| 387 | 372 | 
| 388   class PushSafepointRegistersScope BASE_EMBEDDED { | 373   class PushSafepointRegistersScope BASE_EMBEDDED { | 
| 389    public: | 374    public: | 
| 390     explicit PushSafepointRegistersScope(LCodeGen* codegen) | 375     explicit PushSafepointRegistersScope(LCodeGen* codegen) | 
| 391         : codegen_(codegen) { | 376         : codegen_(codegen) { | 
| 392       ASSERT(codegen_->info()->is_calling()); |  | 
| 393       ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 377       ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kSimple); | 
| 394       codegen_->masm_->PushSafepointRegisters(); | 378       codegen_->masm_->PushSafepointRegisters(); | 
| 395       codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 379       codegen_->expected_safepoint_kind_ = Safepoint::kWithRegisters; | 
| 396     } | 380     } | 
| 397 | 381 | 
| 398     ~PushSafepointRegistersScope() { | 382     ~PushSafepointRegistersScope() { | 
| 399       ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); | 383       ASSERT(codegen_->expected_safepoint_kind_ == Safepoint::kWithRegisters); | 
| 400       codegen_->masm_->PopSafepointRegisters(); | 384       codegen_->masm_->PopSafepointRegisters(); | 
| 401       codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 385       codegen_->expected_safepoint_kind_ = Safepoint::kSimple; | 
| 402     } | 386     } | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 438   LCodeGen* codegen_; | 422   LCodeGen* codegen_; | 
| 439   Label entry_; | 423   Label entry_; | 
| 440   Label exit_; | 424   Label exit_; | 
| 441   Label* external_exit_; | 425   Label* external_exit_; | 
| 442   int instruction_index_; | 426   int instruction_index_; | 
| 443 }; | 427 }; | 
| 444 | 428 | 
| 445 } }  // namespace v8::internal | 429 } }  // namespace v8::internal | 
| 446 | 430 | 
| 447 #endif  // V8_X64_LITHIUM_CODEGEN_X64_H_ | 431 #endif  // V8_X64_LITHIUM_CODEGEN_X64_H_ | 
| OLD | NEW | 
|---|