| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 current_instruction_(-1), | 53 current_instruction_(-1), |
| 54 instructions_(chunk->instructions()), | 54 instructions_(chunk->instructions()), |
| 55 deoptimizations_(4), | 55 deoptimizations_(4), |
| 56 jump_table_(4), | 56 jump_table_(4), |
| 57 deoptimization_literals_(8), | 57 deoptimization_literals_(8), |
| 58 inlined_function_count_(0), | 58 inlined_function_count_(0), |
| 59 scope_(info->scope()), | 59 scope_(info->scope()), |
| 60 status_(UNUSED), | 60 status_(UNUSED), |
| 61 deferred_(8), | 61 deferred_(8), |
| 62 osr_pc_offset_(-1), | 62 osr_pc_offset_(-1), |
| 63 last_lazy_deopt_pc_(0), |
| 63 resolver_(this), | 64 resolver_(this), |
| 64 expected_safepoint_kind_(Safepoint::kSimple) { | 65 expected_safepoint_kind_(Safepoint::kSimple) { |
| 65 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 66 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Simple accessors. | 69 // Simple accessors. |
| 69 MacroAssembler* masm() const { return masm_; } | 70 MacroAssembler* masm() const { return masm_; } |
| 70 CompilationInfo* info() const { return info_; } | 71 CompilationInfo* info() const { return info_; } |
| 71 Isolate* isolate() const { return info_->isolate(); } | 72 Isolate* isolate() const { return info_->isolate(); } |
| 72 Factory* factory() const { return isolate()->factory(); } | 73 Factory* factory() const { return isolate()->factory(); } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 90 // information on it. | 91 // information on it. |
| 91 void FinishCode(Handle<Code> code); | 92 void FinishCode(Handle<Code> code); |
| 92 | 93 |
| 93 // Deferred code support. | 94 // Deferred code support. |
| 94 void DoDeferredNumberTagD(LNumberTagD* instr); | 95 void DoDeferredNumberTagD(LNumberTagD* instr); |
| 95 void DoDeferredTaggedToI(LTaggedToI* instr); | 96 void DoDeferredTaggedToI(LTaggedToI* instr); |
| 96 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 97 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
| 97 void DoDeferredStackCheck(LStackCheck* instr); | 98 void DoDeferredStackCheck(LStackCheck* instr); |
| 98 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 99 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 99 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 100 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 100 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 101 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 101 Label* map_check); | 102 Label* map_check); |
| 102 | 103 |
| 103 // Parallel move support. | 104 // Parallel move support. |
| 104 void DoParallelMove(LParallelMove* move); | 105 void DoParallelMove(LParallelMove* move); |
| 105 void DoGap(LGap* instr); | 106 void DoGap(LGap* instr); |
| 106 | 107 |
| 107 // Emit frame translation commands for an environment. | 108 // Emit frame translation commands for an environment. |
| 108 void WriteTranslation(LEnvironment* environment, Translation* translation); | 109 void WriteTranslation(LEnvironment* environment, Translation* translation); |
| 109 | 110 |
| 110 // Declare methods that deal with the individual node types. | 111 // Declare methods that deal with the individual node types. |
| 111 #define DECLARE_DO(type) void Do##type(L##type* node); | 112 #define DECLARE_DO(type) void Do##type(L##type* node); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 127 | 128 |
| 128 int strict_mode_flag() const { | 129 int strict_mode_flag() const { |
| 129 return info()->is_strict_mode() ? kStrictMode : kNonStrictMode; | 130 return info()->is_strict_mode() ? kStrictMode : kNonStrictMode; |
| 130 } | 131 } |
| 131 | 132 |
| 132 LChunk* chunk() const { return chunk_; } | 133 LChunk* chunk() const { return chunk_; } |
| 133 Scope* scope() const { return scope_; } | 134 Scope* scope() const { return scope_; } |
| 134 HGraph* graph() const { return chunk_->graph(); } | 135 HGraph* graph() const { return chunk_->graph(); } |
| 135 | 136 |
| 136 int GetNextEmittedBlock(int block); | 137 int GetNextEmittedBlock(int block); |
| 137 LInstruction* GetNextInstruction(); | |
| 138 | 138 |
| 139 void EmitClassOfTest(Label* if_true, | 139 void EmitClassOfTest(Label* if_true, |
| 140 Label* if_false, | 140 Label* if_false, |
| 141 Handle<String> class_name, | 141 Handle<String> class_name, |
| 142 Register input, | 142 Register input, |
| 143 Register temporary); | 143 Register temporary); |
| 144 | 144 |
| 145 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 145 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 146 int GetParameterCount() const { return scope()->num_parameters(); } | 146 int GetParameterCount() const { return scope()->num_parameters(); } |
| 147 | 147 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // Generate a direct call to a known function. Expects the function | 193 // Generate a direct call to a known function. Expects the function |
| 194 // to be in edi. | 194 // to be in edi. |
| 195 void CallKnownFunction(Handle<JSFunction> function, | 195 void CallKnownFunction(Handle<JSFunction> function, |
| 196 int arity, | 196 int arity, |
| 197 LInstruction* instr, | 197 LInstruction* instr, |
| 198 CallKind call_kind); | 198 CallKind call_kind); |
| 199 | 199 |
| 200 void LoadHeapObject(Register result, Handle<HeapObject> object); | 200 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 201 | 201 |
| 202 void RegisterLazyDeoptimization(LInstruction* instr, | 202 void RecordSafepointWithLazyDeopt(LInstruction* instr, |
| 203 SafepointMode safepoint_mode, | 203 SafepointMode safepoint_mode, |
| 204 int argc); | 204 int argc); |
| 205 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 205 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, |
| 206 Safepoint::DeoptMode mode); |
| 206 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 207 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
| 207 | 208 |
| 208 void AddToTranslation(Translation* translation, | 209 void AddToTranslation(Translation* translation, |
| 209 LOperand* op, | 210 LOperand* op, |
| 210 bool is_tagged); | 211 bool is_tagged); |
| 211 void PopulateDeoptimizationData(Handle<Code> code); | 212 void PopulateDeoptimizationData(Handle<Code> code); |
| 212 int DefineDeoptimizationLiteral(Handle<Object> literal); | 213 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 213 | 214 |
| 214 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 215 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 215 | 216 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 229 void DoMathSqrt(LUnaryMathOperation* instr); | 230 void DoMathSqrt(LUnaryMathOperation* instr); |
| 230 void DoMathPowHalf(LUnaryMathOperation* instr); | 231 void DoMathPowHalf(LUnaryMathOperation* instr); |
| 231 void DoMathLog(LUnaryMathOperation* instr); | 232 void DoMathLog(LUnaryMathOperation* instr); |
| 232 void DoMathCos(LUnaryMathOperation* instr); | 233 void DoMathCos(LUnaryMathOperation* instr); |
| 233 void DoMathSin(LUnaryMathOperation* instr); | 234 void DoMathSin(LUnaryMathOperation* instr); |
| 234 | 235 |
| 235 // Support for recording safepoint and position information. | 236 // Support for recording safepoint and position information. |
| 236 void RecordSafepoint(LPointerMap* pointers, | 237 void RecordSafepoint(LPointerMap* pointers, |
| 237 Safepoint::Kind kind, | 238 Safepoint::Kind kind, |
| 238 int arguments, | 239 int arguments, |
| 239 int deoptimization_index); | 240 Safepoint::DeoptMode mode); |
| 240 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); | 241 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
| 241 void RecordSafepoint(int deoptimization_index); | 242 void RecordSafepoint(Safepoint::DeoptMode mode); |
| 242 void RecordSafepointWithRegisters(LPointerMap* pointers, | 243 void RecordSafepointWithRegisters(LPointerMap* pointers, |
| 243 int arguments, | 244 int arguments, |
| 244 int deoptimization_index); | 245 Safepoint::DeoptMode mode); |
| 245 void RecordPosition(int position); | 246 void RecordPosition(int position); |
| 246 int LastSafepointEnd() { | |
| 247 return static_cast<int>(safepoints_.GetPcAfterGap()); | |
| 248 } | |
| 249 | 247 |
| 250 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 248 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 251 void EmitGoto(int block); | 249 void EmitGoto(int block); |
| 252 void EmitBranch(int left_block, int right_block, Condition cc); | 250 void EmitBranch(int left_block, int right_block, Condition cc); |
| 253 void EmitCmpI(LOperand* left, LOperand* right); | 251 void EmitCmpI(LOperand* left, LOperand* right); |
| 254 void EmitNumberUntagD(Register input, | 252 void EmitNumberUntagD(Register input, |
| 255 XMMRegister result, | 253 XMMRegister result, |
| 256 bool deoptimize_on_undefined, | 254 bool deoptimize_on_undefined, |
| 257 LEnvironment* env); | 255 LEnvironment* env); |
| 258 | 256 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 283 void EmitPushTaggedOperand(LOperand* operand); | 281 void EmitPushTaggedOperand(LOperand* operand); |
| 284 | 282 |
| 285 struct JumpTableEntry { | 283 struct JumpTableEntry { |
| 286 explicit inline JumpTableEntry(Address entry) | 284 explicit inline JumpTableEntry(Address entry) |
| 287 : label(), | 285 : label(), |
| 288 address(entry) { } | 286 address(entry) { } |
| 289 Label label; | 287 Label label; |
| 290 Address address; | 288 Address address; |
| 291 }; | 289 }; |
| 292 | 290 |
| 291 void EnsureSpaceForLazyDeopt(int space_needed); |
| 292 |
| 293 LChunk* const chunk_; | 293 LChunk* const chunk_; |
| 294 MacroAssembler* const masm_; | 294 MacroAssembler* const masm_; |
| 295 CompilationInfo* const info_; | 295 CompilationInfo* const info_; |
| 296 | 296 |
| 297 int current_block_; | 297 int current_block_; |
| 298 int current_instruction_; | 298 int current_instruction_; |
| 299 const ZoneList<LInstruction*>* instructions_; | 299 const ZoneList<LInstruction*>* instructions_; |
| 300 ZoneList<LEnvironment*> deoptimizations_; | 300 ZoneList<LEnvironment*> deoptimizations_; |
| 301 ZoneList<JumpTableEntry> jump_table_; | 301 ZoneList<JumpTableEntry> jump_table_; |
| 302 ZoneList<Handle<Object> > deoptimization_literals_; | 302 ZoneList<Handle<Object> > deoptimization_literals_; |
| 303 int inlined_function_count_; | 303 int inlined_function_count_; |
| 304 Scope* const scope_; | 304 Scope* const scope_; |
| 305 Status status_; | 305 Status status_; |
| 306 TranslationBuffer translations_; | 306 TranslationBuffer translations_; |
| 307 ZoneList<LDeferredCode*> deferred_; | 307 ZoneList<LDeferredCode*> deferred_; |
| 308 int osr_pc_offset_; | 308 int osr_pc_offset_; |
| 309 int last_lazy_deopt_pc_; |
| 309 | 310 |
| 310 // Builder that keeps track of safepoints in the code. The table | 311 // Builder that keeps track of safepoints in the code. The table |
| 311 // itself is emitted at the end of the generated code. | 312 // itself is emitted at the end of the generated code. |
| 312 SafepointTableBuilder safepoints_; | 313 SafepointTableBuilder safepoints_; |
| 313 | 314 |
| 314 // Compiler from a set of parallel moves to a sequential list of moves. | 315 // Compiler from a set of parallel moves to a sequential list of moves. |
| 315 LGapResolver resolver_; | 316 LGapResolver resolver_; |
| 316 | 317 |
| 317 Safepoint::Kind expected_safepoint_kind_; | 318 Safepoint::Kind expected_safepoint_kind_; |
| 318 | 319 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 private: | 364 private: |
| 364 LCodeGen* codegen_; | 365 LCodeGen* codegen_; |
| 365 Label entry_; | 366 Label entry_; |
| 366 Label exit_; | 367 Label exit_; |
| 367 Label* external_exit_; | 368 Label* external_exit_; |
| 368 }; | 369 }; |
| 369 | 370 |
| 370 } } // namespace v8::internal | 371 } } // namespace v8::internal |
| 371 | 372 |
| 372 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ | 373 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ |
| OLD | NEW |