| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 dynamic_frame_alignment_(false), | 61 dynamic_frame_alignment_(false), |
| 62 deferred_(8), | 62 deferred_(8), |
| 63 osr_pc_offset_(-1), | 63 osr_pc_offset_(-1), |
| 64 deoptimization_reloc_size(), | |
| 65 resolver_(this), | 64 resolver_(this), |
| 66 expected_safepoint_kind_(Safepoint::kSimple) { | 65 expected_safepoint_kind_(Safepoint::kSimple) { |
| 67 PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 66 PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 68 } | 67 } |
| 69 | 68 |
| 70 // Simple accessors. | 69 // Simple accessors. |
| 71 MacroAssembler* masm() const { return masm_; } | 70 MacroAssembler* masm() const { return masm_; } |
| 72 CompilationInfo* info() const { return info_; } | 71 CompilationInfo* info() const { return info_; } |
| 73 Isolate* isolate() const { return info_->isolate(); } | 72 Isolate* isolate() const { return info_->isolate(); } |
| 74 Factory* factory() const { return isolate()->factory(); } | 73 Factory* factory() const { return isolate()->factory(); } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 void FinishCode(Handle<Code> code); | 93 void FinishCode(Handle<Code> code); |
| 95 | 94 |
| 96 // Deferred code support. | 95 // Deferred code support. |
| 97 void DoDeferredNumberTagD(LNumberTagD* instr); | 96 void DoDeferredNumberTagD(LNumberTagD* instr); |
| 98 void DoDeferredNumberTagI(LNumberTagI* instr); | 97 void DoDeferredNumberTagI(LNumberTagI* instr); |
| 99 void DoDeferredTaggedToI(LTaggedToI* instr); | 98 void DoDeferredTaggedToI(LTaggedToI* instr); |
| 100 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); | 99 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); |
| 101 void DoDeferredStackCheck(LStackCheck* instr); | 100 void DoDeferredStackCheck(LStackCheck* instr); |
| 102 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); | 101 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); |
| 103 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); | 102 void DoDeferredStringCharFromCode(LStringCharFromCode* instr); |
| 104 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, | 103 void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, |
| 105 Label* map_check); | 104 Label* map_check); |
| 106 | 105 |
| 107 // Parallel move support. | 106 // Parallel move support. |
| 108 void DoParallelMove(LParallelMove* move); | 107 void DoParallelMove(LParallelMove* move); |
| 109 void DoGap(LGap* instr); | 108 void DoGap(LGap* instr); |
| 110 | 109 |
| 111 // Emit frame translation commands for an environment. | 110 // Emit frame translation commands for an environment. |
| 112 void WriteTranslation(LEnvironment* environment, Translation* translation); | 111 void WriteTranslation(LEnvironment* environment, Translation* translation); |
| 113 | 112 |
| 114 void EnsureRelocSpaceForDeoptimization(); | 113 void EnsureRelocSpaceForDeoptimization(); |
| 115 | 114 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 137 bool dynamic_frame_alignment() const { return dynamic_frame_alignment_; } | 136 bool dynamic_frame_alignment() const { return dynamic_frame_alignment_; } |
| 138 void set_dynamic_frame_alignment(bool value) { | 137 void set_dynamic_frame_alignment(bool value) { |
| 139 dynamic_frame_alignment_ = value; | 138 dynamic_frame_alignment_ = value; |
| 140 } | 139 } |
| 141 | 140 |
| 142 LChunk* chunk() const { return chunk_; } | 141 LChunk* chunk() const { return chunk_; } |
| 143 Scope* scope() const { return scope_; } | 142 Scope* scope() const { return scope_; } |
| 144 HGraph* graph() const { return chunk_->graph(); } | 143 HGraph* graph() const { return chunk_->graph(); } |
| 145 | 144 |
| 146 int GetNextEmittedBlock(int block); | 145 int GetNextEmittedBlock(int block); |
| 147 LInstruction* GetNextInstruction(); | |
| 148 | 146 |
| 149 void EmitClassOfTest(Label* if_true, | 147 void EmitClassOfTest(Label* if_true, |
| 150 Label* if_false, | 148 Label* if_false, |
| 151 Handle<String> class_name, | 149 Handle<String> class_name, |
| 152 Register input, | 150 Register input, |
| 153 Register temporary, | 151 Register temporary, |
| 154 Register temporary2); | 152 Register temporary2); |
| 155 | 153 |
| 156 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } | 154 int GetStackSlotCount() const { return chunk()->spill_slot_count(); } |
| 157 int GetParameterCount() const { return scope()->num_parameters(); } | 155 int GetParameterCount() const { return scope()->num_parameters(); } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 201 |
| 204 // Generate a direct call to a known function. Expects the function | 202 // Generate a direct call to a known function. Expects the function |
| 205 // to be in edi. | 203 // to be in edi. |
| 206 void CallKnownFunction(Handle<JSFunction> function, | 204 void CallKnownFunction(Handle<JSFunction> function, |
| 207 int arity, | 205 int arity, |
| 208 LInstruction* instr, | 206 LInstruction* instr, |
| 209 CallKind call_kind); | 207 CallKind call_kind); |
| 210 | 208 |
| 211 void LoadHeapObject(Register result, Handle<HeapObject> object); | 209 void LoadHeapObject(Register result, Handle<HeapObject> object); |
| 212 | 210 |
| 213 void RegisterLazyDeoptimization(LInstruction* instr, | 211 void RecordSafepointWithLazyDeopt(LInstruction* instr, |
| 214 SafepointMode safepoint_mode); | 212 SafepointMode safepoint_mode); |
| 215 | 213 |
| 216 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); | 214 void RegisterEnvironmentForDeoptimization(LEnvironment* environment, |
| 215 Safepoint::DeoptMode mode); |
| 217 void DeoptimizeIf(Condition cc, LEnvironment* environment); | 216 void DeoptimizeIf(Condition cc, LEnvironment* environment); |
| 218 | 217 |
| 219 void AddToTranslation(Translation* translation, | 218 void AddToTranslation(Translation* translation, |
| 220 LOperand* op, | 219 LOperand* op, |
| 221 bool is_tagged); | 220 bool is_tagged); |
| 222 void PopulateDeoptimizationData(Handle<Code> code); | 221 void PopulateDeoptimizationData(Handle<Code> code); |
| 223 int DefineDeoptimizationLiteral(Handle<Object> literal); | 222 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 224 | 223 |
| 225 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 224 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 226 | 225 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 241 void DoMathSqrt(LUnaryMathOperation* instr); | 240 void DoMathSqrt(LUnaryMathOperation* instr); |
| 242 void DoMathPowHalf(LUnaryMathOperation* instr); | 241 void DoMathPowHalf(LUnaryMathOperation* instr); |
| 243 void DoMathLog(LUnaryMathOperation* instr); | 242 void DoMathLog(LUnaryMathOperation* instr); |
| 244 void DoMathCos(LUnaryMathOperation* instr); | 243 void DoMathCos(LUnaryMathOperation* instr); |
| 245 void DoMathSin(LUnaryMathOperation* instr); | 244 void DoMathSin(LUnaryMathOperation* instr); |
| 246 | 245 |
| 247 // Support for recording safepoint and position information. | 246 // Support for recording safepoint and position information. |
| 248 void RecordSafepoint(LPointerMap* pointers, | 247 void RecordSafepoint(LPointerMap* pointers, |
| 249 Safepoint::Kind kind, | 248 Safepoint::Kind kind, |
| 250 int arguments, | 249 int arguments, |
| 251 int deoptimization_index); | 250 Safepoint::DeoptMode mode); |
| 252 void RecordSafepoint(LPointerMap* pointers, int deoptimization_index); | 251 void RecordSafepoint(LPointerMap* pointers, Safepoint::DeoptMode mode); |
| 253 void RecordSafepoint(int deoptimization_index); | 252 void RecordSafepoint(Safepoint::DeoptMode mode); |
| 254 void RecordSafepointWithRegisters(LPointerMap* pointers, | 253 void RecordSafepointWithRegisters(LPointerMap* pointers, |
| 255 int arguments, | 254 int arguments, |
| 256 int deoptimization_index); | 255 Safepoint::DeoptMode mode); |
| 257 void RecordPosition(int position); | 256 void RecordPosition(int position); |
| 258 int LastSafepointEnd() { | |
| 259 return static_cast<int>(safepoints_.GetPcAfterGap()); | |
| 260 } | |
| 261 | 257 |
| 262 static Condition TokenToCondition(Token::Value op, bool is_unsigned); | 258 static Condition TokenToCondition(Token::Value op, bool is_unsigned); |
| 263 void EmitGoto(int block); | 259 void EmitGoto(int block); |
| 264 void EmitBranch(int left_block, int right_block, Condition cc); | 260 void EmitBranch(int left_block, int right_block, Condition cc); |
| 265 void EmitNumberUntagD(Register input, | 261 void EmitNumberUntagD(Register input, |
| 266 XMMRegister result, | 262 XMMRegister result, |
| 267 bool deoptimize_on_undefined, | 263 bool deoptimize_on_undefined, |
| 268 LEnvironment* env); | 264 LEnvironment* env); |
| 269 | 265 |
| 270 // Emits optimized code for typeof x == "y". Modifies input register. | 266 // Emits optimized code for typeof x == "y". Modifies input register. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 ZoneList<LEnvironment*> deoptimizations_; | 298 ZoneList<LEnvironment*> deoptimizations_; |
| 303 ZoneList<Handle<Object> > deoptimization_literals_; | 299 ZoneList<Handle<Object> > deoptimization_literals_; |
| 304 int inlined_function_count_; | 300 int inlined_function_count_; |
| 305 Scope* const scope_; | 301 Scope* const scope_; |
| 306 Status status_; | 302 Status status_; |
| 307 bool dynamic_frame_alignment_; | 303 bool dynamic_frame_alignment_; |
| 308 TranslationBuffer translations_; | 304 TranslationBuffer translations_; |
| 309 ZoneList<LDeferredCode*> deferred_; | 305 ZoneList<LDeferredCode*> deferred_; |
| 310 int osr_pc_offset_; | 306 int osr_pc_offset_; |
| 311 | 307 |
| 312 struct DeoptimizationRelocSize { | |
| 313 int min_size; | |
| 314 int last_pc_offset; | |
| 315 }; | |
| 316 | |
| 317 DeoptimizationRelocSize deoptimization_reloc_size; | |
| 318 | |
| 319 // Builder that keeps track of safepoints in the code. The table | 308 // Builder that keeps track of safepoints in the code. The table |
| 320 // itself is emitted at the end of the generated code. | 309 // itself is emitted at the end of the generated code. |
| 321 SafepointTableBuilder safepoints_; | 310 SafepointTableBuilder safepoints_; |
| 322 | 311 |
| 323 // Compiler from a set of parallel moves to a sequential list of moves. | 312 // Compiler from a set of parallel moves to a sequential list of moves. |
| 324 LGapResolver resolver_; | 313 LGapResolver resolver_; |
| 325 | 314 |
| 326 Safepoint::Kind expected_safepoint_kind_; | 315 Safepoint::Kind expected_safepoint_kind_; |
| 327 | 316 |
| 328 class PushSafepointRegistersScope BASE_EMBEDDED { | 317 class PushSafepointRegistersScope BASE_EMBEDDED { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 LCodeGen* codegen_; | 366 LCodeGen* codegen_; |
| 378 Label entry_; | 367 Label entry_; |
| 379 Label exit_; | 368 Label exit_; |
| 380 Label* external_exit_; | 369 Label* external_exit_; |
| 381 int instruction_index_; | 370 int instruction_index_; |
| 382 }; | 371 }; |
| 383 | 372 |
| 384 } } // namespace v8::internal | 373 } } // namespace v8::internal |
| 385 | 374 |
| 386 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 375 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |