| 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_block_(-1), | 53 current_block_(-1), |
| 54 current_instruction_(-1), | 54 current_instruction_(-1), |
| 55 instructions_(chunk->instructions()), | 55 instructions_(chunk->instructions()), |
| 56 deoptimizations_(4), | 56 deoptimizations_(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 deoptimization_reloc_size(), | 63 last_lazy_deopt_pc_(0), |
| 64 resolver_(this), | 64 resolver_(this), |
| 65 expected_safepoint_kind_(Safepoint::kSimple) { | 65 expected_safepoint_kind_(Safepoint::kSimple) { |
| 66 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 66 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Simple accessors. | 69 // Simple accessors. |
| 70 MacroAssembler* masm() const { return masm_; } | 70 MacroAssembler* masm() const { return masm_; } |
| 71 CompilationInfo* info() const { return info_; } | 71 CompilationInfo* info() const { return info_; } |
| 72 Isolate* isolate() const { return info_->isolate(); } | 72 Isolate* isolate() const { return info_->isolate(); } |
| 73 Factory* factory() const { return isolate()->factory(); } | 73 Factory* factory() const { return isolate()->factory(); } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 93 void FinishCode(Handle<Code> code); | 93 void FinishCode(Handle<Code> code); |
| 94 | 94 |
| 95 // Deferred code support. | 95 // Deferred code support. |
| 96 void DoDeferredNumberTagD(LNumberTagD* instr); | 96 void DoDeferredNumberTagD(LNumberTagD* instr); |
| 97 void DoDeferredNumberTagI(LNumberTagI* instr); | 97 void DoDeferredNumberTagI(LNumberTagI* instr); |
| 98 void DoDeferredTaggedToI(LTaggedToI* instr); | 98 void DoDeferredTaggedToI(LTaggedToI* instr); |
| 99 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 99 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
| 100 void DoDeferredStackCheck(LStackCheck* instr); | 100 void DoDeferredStackCheck(LStackCheck* instr); |
| 101 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 101 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 102 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 102 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 103 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 103 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 104 Label* map_check); | 104 Label* map_check); |
| 105 | 105 |
| 106 // Parallel move support. | 106 // Parallel move support. |
| 107 void DoParallelMove(LParallelMove* move); | 107 void DoParallelMove(LParallelMove* move); |
| 108 void DoGap(LGap* instr); | 108 void DoGap(LGap* instr); |
| 109 | 109 |
| 110 // Emit frame translation commands for an environment. | 110 // Emit frame translation commands for an environment. |
| 111 void WriteTranslation(LEnvironment* environment, Translation* translation); | 111 void WriteTranslation(LEnvironment* environment, Translation* translation); |
| 112 | 112 |
| 113 void EnsureRelocSpaceForDeoptimization(); | 113 void EnsureRelocSpaceForDeoptimization(); |
| 114 | 114 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 int strict_mode_flag() const { | 133 int strict_mode_flag() const { |
| 134 return info()->is_strict_mode() ? kStrictMode : kNonStrictMode; | 134 return info()->is_strict_mode() ? kStrictMode : kNonStrictMode; |
| 135 } | 135 } |
| 136 | 136 |
| 137 LChunk* chunk() const { return chunk_; } | 137 LChunk* chunk() const { return chunk_; } |
| 138 Scope* scope() const { return scope_; } | 138 Scope* scope() const { return scope_; } |
| 139 HGraph* graph() const { return chunk_->graph(); } | 139 HGraph* graph() const { return chunk_->graph(); } |
| 140 | 140 |
| 141 int GetNextEmittedBlock(int block); | 141 int GetNextEmittedBlock(int block); |
| 142 LInstruction* GetNextInstruction(); | |
| 143 | 142 |
| 144 void EmitClassOfTest(Label* if_true, | 143 void EmitClassOfTest(Label* if_true, |
| 145 Label* if_false, | 144 Label* if_false, |
| 146 Handle<String> class_name, | 145 Handle<String> class_name, |
| 147 Register input, | 146 Register input, |
| 148 Register temporary, | 147 Register temporary, |
| 149 Register temporary2); | 148 Register temporary2); |
| 150 | 149 |
| 151 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 150 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 152 int GetParameterCount() const { return scope()->num_parameters(); } | 151 int GetParameterCount() const { return scope()->num_parameters(); } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 | 197 |
| 199 // Generate a direct call to a known function. Expects the function | 198 // Generate a direct call to a known function. Expects the function |
| 200 // to be in edi. | 199 // to be in edi. |
| 201 void CallKnownFunction(Handle<JSFunction> function, | 200 void CallKnownFunction(Handle<JSFunction> function, |
| 202 int arity, | 201 int arity, |
| 203 LInstruction* instr, | 202 LInstruction* instr, |
| 204 CallKind call_kind); | 203 CallKind call_kind); |
| 205 | 204 |
| 206 void LoadHeapObject(Register result, Handle<HeapObject> object); | 205 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 207 | 206 |
| 208 void RegisterLazyDeoptimization(LInstruction* instr, | 207 void RecordSafepointWithLazyDeopt(LInstruction* instr, |
| 209 SafepointMode safepoint_mode); | 208 SafepointMode safepoint_mode); |
| 210 | 209 |
| 211 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 210 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, |
| 211 Safepoint::DeoptMode mode); |
| 212 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 212 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
| 213 | 213 |
| 214 void AddToTranslation(Translation* translation, | 214 void AddToTranslation(Translation* translation, |
| 215 LOperand* op, | 215 LOperand* op, |
| 216 bool is_tagged); | 216 bool is_tagged); |
| 217 void PopulateDeoptimizationData(Handle<Code> code); | 217 void PopulateDeoptimizationData(Handle<Code> code); |
| 218 int DefineDeoptimizationLiteral(Handle<Object> literal); | 218 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 219 | 219 |
| 220 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 220 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 221 | 221 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 235 void DoMathSqrt(LUnaryMathOperation* instr); | 235 void DoMathSqrt(LUnaryMathOperation* instr); |
| 236 void DoMathPowHalf(LUnaryMathOperation* instr); | 236 void DoMathPowHalf(LUnaryMathOperation* instr); |
| 237 void DoMathLog(LUnaryMathOperation* instr); | 237 void DoMathLog(LUnaryMathOperation* instr); |
| 238 void DoMathCos(LUnaryMathOperation* instr); | 238 void DoMathCos(LUnaryMathOperation* instr); |
| 239 void DoMathSin(LUnaryMathOperation* instr); | 239 void DoMathSin(LUnaryMathOperation* instr); |
| 240 | 240 |
| 241 // Support for recording safepoint and position information. | 241 // Support for recording safepoint and position information. |
| 242 void RecordSafepoint(LPointerMap* pointers, | 242 void RecordSafepoint(LPointerMap* pointers, |
| 243 Safepoint::Kind kind, | 243 Safepoint::Kind kind, |
| 244 int arguments, | 244 int arguments, |
| 245 int deoptimization_index); | 245 Safepoint::DeoptMode mode); |
| 246 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); | 246 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
| 247 void RecordSafepoint(int deoptimization_index); | 247 void RecordSafepoint(Safepoint::DeoptMode mode); |
| 248 void RecordSafepointWithRegisters(LPointerMap* pointers, | 248 void RecordSafepointWithRegisters(LPointerMap* pointers, |
| 249 int arguments, | 249 int arguments, |
| 250 int deoptimization_index); | 250 Safepoint::DeoptMode mode); |
| 251 void RecordPosition(int position); | 251 void RecordPosition(int position); |
| 252 int LastSafepointEnd() { | |
| 253 return static_cast<int>(safepoints_.GetPcAfterGap()); | |
| 254 } | |
| 255 | 252 |
| 256 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 253 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 257 void EmitGoto(int block); | 254 void EmitGoto(int block); |
| 258 void EmitBranch(int left_block, int right_block, Condition cc); | 255 void EmitBranch(int left_block, int right_block, Condition cc); |
| 259 void EmitCmpI(LOperand* left, LOperand* right); | 256 void EmitCmpI(LOperand* left, LOperand* right); |
| 260 void EmitNumberUntagD(Register input, | 257 void EmitNumberUntagD(Register input, |
| 261 XMMRegister result, | 258 XMMRegister result, |
| 262 bool deoptimize_on_undefined, | 259 bool deoptimize_on_undefined, |
| 263 LEnvironment* env); | 260 LEnvironment* env); |
| 264 | 261 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 277 Label* is_object); | 274 Label* is_object); |
| 278 | 275 |
| 279 // Emits optimized code for %_IsConstructCall(). | 276 // Emits optimized code for %_IsConstructCall(). |
| 280 // Caller should branch on equal condition. | 277 // Caller should branch on equal condition. |
| 281 void EmitIsConstructCall(Register temp); | 278 void EmitIsConstructCall(Register temp); |
| 282 | 279 |
| 283 void EmitLoadFieldOrConstantFunction(Register result, | 280 void EmitLoadFieldOrConstantFunction(Register result, |
| 284 Register object, | 281 Register object, |
| 285 Handle<Map> type, | 282 Handle<Map> type, |
| 286 Handle<String> name); | 283 Handle<String> name); |
| 284 void EnsureSpaceForLazyDeopt(); |
| 287 | 285 |
| 288 LChunk* const chunk_; | 286 LChunk* const chunk_; |
| 289 MacroAssembler* const masm_; | 287 MacroAssembler* const masm_; |
| 290 CompilationInfo* const info_; | 288 CompilationInfo* const info_; |
| 291 | 289 |
| 292 int current_block_; | 290 int current_block_; |
| 293 int current_instruction_; | 291 int current_instruction_; |
| 294 const ZoneList<LInstruction*>* instructions_; | 292 const ZoneList<LInstruction*>* instructions_; |
| 295 ZoneList<LEnvironment*> deoptimizations_; | 293 ZoneList<LEnvironment*> deoptimizations_; |
| 296 ZoneList<Handle<Object> > deoptimization_literals_; | 294 ZoneList<Handle<Object> > deoptimization_literals_; |
| 297 int inlined_function_count_; | 295 int inlined_function_count_; |
| 298 Scope* const scope_; | 296 Scope* const scope_; |
| 299 Status status_; | 297 Status status_; |
| 300 TranslationBuffer translations_; | 298 TranslationBuffer translations_; |
| 301 ZoneList<LDeferredCode*> deferred_; | 299 ZoneList<LDeferredCode*> deferred_; |
| 302 int osr_pc_offset_; | 300 int osr_pc_offset_; |
| 303 | 301 int last_lazy_deopt_pc_; |
| 304 struct DeoptimizationRelocSize { | |
| 305 int min_size; | |
| 306 int last_pc_offset; | |
| 307 }; | |
| 308 | |
| 309 DeoptimizationRelocSize deoptimization_reloc_size; | |
| 310 | 302 |
| 311 // Builder that keeps track of safepoints in the code. The table | 303 // Builder that keeps track of safepoints in the code. The table |
| 312 // itself is emitted at the end of the generated code. | 304 // itself is emitted at the end of the generated code. |
| 313 SafepointTableBuilder safepoints_; | 305 SafepointTableBuilder safepoints_; |
| 314 | 306 |
| 315 // Compiler from a set of parallel moves to a sequential list of moves. | 307 // Compiler from a set of parallel moves to a sequential list of moves. |
| 316 LGapResolver resolver_; | 308 LGapResolver resolver_; |
| 317 | 309 |
| 318 Safepoint::Kind expected_safepoint_kind_; | 310 Safepoint::Kind expected_safepoint_kind_; |
| 319 | 311 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 private: | 356 private: |
| 365 LCodeGen* codegen_; | 357 LCodeGen* codegen_; |
| 366 Label entry_; | 358 Label entry_; |
| 367 Label exit_; | 359 Label exit_; |
| 368 Label* external_exit_; | 360 Label* external_exit_; |
| 369 }; | 361 }; |
| 370 | 362 |
| 371 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 372 | 364 |
| 373 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 365 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |