| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 info()->requires_frame(); | 98 info()->requires_frame(); |
| 99 } | 99 } |
| 100 bool NeedsDeferredFrame() const { | 100 bool NeedsDeferredFrame() const { |
| 101 return !NeedsEagerFrame() && info()->is_deferred_calling(); | 101 return !NeedsEagerFrame() && info()->is_deferred_calling(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Support for converting LOperands to assembler types. | 104 // Support for converting LOperands to assembler types. |
| 105 Operand ToOperand(LOperand* op) const; | 105 Operand ToOperand(LOperand* op) const; |
| 106 Register ToRegister(LOperand* op) const; | 106 Register ToRegister(LOperand* op) const; |
| 107 XMMRegister ToDoubleRegister(LOperand* op) const; | 107 XMMRegister ToDoubleRegister(LOperand* op) const; |
| 108 bool IsX87TopOfStack(LOperand* op) const; | 108 X87Register ToX87Register(LOperand* op) const; |
| 109 | 109 |
| 110 bool IsInteger32(LConstantOperand* op) const; | 110 bool IsInteger32(LConstantOperand* op) const; |
| 111 bool IsSmi(LConstantOperand* op) const; | 111 bool IsSmi(LConstantOperand* op) const; |
| 112 Immediate ToInteger32Immediate(LOperand* op) const { | 112 Immediate ToInteger32Immediate(LOperand* op) const { |
| 113 return Immediate(ToInteger32(LConstantOperand::cast(op))); | 113 return Immediate(ToInteger32(LConstantOperand::cast(op))); |
| 114 } | 114 } |
| 115 Immediate ToSmiImmediate(LOperand* op) const { | 115 Immediate ToSmiImmediate(LOperand* op) const { |
| 116 return Immediate(Smi::FromInt(ToInteger32(LConstantOperand::cast(op)))); | 116 return Immediate(Smi::FromInt(ToInteger32(LConstantOperand::cast(op)))); |
| 117 } | 117 } |
| 118 double ToDouble(LConstantOperand* op) const; | 118 double ToDouble(LConstantOperand* op) const; |
| 119 | 119 |
| 120 // Support for non-sse2 (x87) floating point stack handling. | 120 // Support for non-sse2 (x87) floating point stack handling. |
| 121 // These functions maintain the depth of the stack (either 0 or 1) | 121 // These functions maintain the mapping of physical stack registers to our |
| 122 void PushX87DoubleOperand(Operand src); | 122 // virtual registers between instructions. |
| 123 void PushX87FloatOperand(Operand src); | 123 enum X87OperandType { kX87DoubleOperand, kX87FloatOperand, kX87IntOperand }; |
| 124 void ReadX87Operand(Operand dst); | 124 |
| 125 bool X87StackNonEmpty() const { return x87_stack_depth_ > 0; } | 125 void X87Mov(X87Register reg, Operand src, |
| 126 void PopX87(); | 126 X87OperandType operand = kX87DoubleOperand); |
| 127 void CurrentInstructionReturnsX87Result(); | 127 void X87Mov(Operand src, X87Register reg); |
| 128 void FlushX87StackIfNecessary(LInstruction* instr); | 128 |
| 129 void X87PrepareBinaryOp( |
| 130 X87Register left, X87Register right, X87Register result); |
| 131 |
| 132 void X87LoadForUsage(X87Register reg); |
| 133 void X87PrepareToWrite(X87Register reg); |
| 134 void X87CommitWrite(X87Register reg); |
| 129 | 135 |
| 130 Handle<Object> ToHandle(LConstantOperand* op) const; | 136 Handle<Object> ToHandle(LConstantOperand* op) const; |
| 131 | 137 |
| 132 // The operand denoting the second word (the one with a higher address) of | 138 // The operand denoting the second word (the one with a higher address) of |
| 133 // a double stack slot. | 139 // a double stack slot. |
| 134 Operand HighOperand(LOperand* op); | 140 Operand HighOperand(LOperand* op); |
| 135 | 141 |
| 136 // Try to generate code for the entire chunk, but it may fail if the | 142 // Try to generate code for the entire chunk, but it may fail if the |
| 137 // chunk contains constructs we cannot handle. Returns true if the | 143 // chunk contains constructs we cannot handle. Returns true if the |
| 138 // code generation attempt succeeded. | 144 // code generation attempt succeeded. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 bool is_tagged, | 291 bool is_tagged, |
| 286 bool is_uint32); | 292 bool is_uint32); |
| 287 void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code); | 293 void RegisterDependentCodeForEmbeddedMaps(Handle<Code> code); |
| 288 void PopulateDeoptimizationData(Handle<Code> code); | 294 void PopulateDeoptimizationData(Handle<Code> code); |
| 289 int DefineDeoptimizationLiteral(Handle<Object> literal); | 295 int DefineDeoptimizationLiteral(Handle<Object> literal); |
| 290 | 296 |
| 291 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); | 297 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); |
| 292 | 298 |
| 293 Register ToRegister(int index) const; | 299 Register ToRegister(int index) const; |
| 294 XMMRegister ToDoubleRegister(int index) const; | 300 XMMRegister ToDoubleRegister(int index) const; |
| 301 X87Register ToX87Register(int index) const; |
| 295 int ToInteger32(LConstantOperand* op) const; | 302 int ToInteger32(LConstantOperand* op) const; |
| 296 | 303 |
| 297 Operand BuildFastArrayOperand(LOperand* elements_pointer, | 304 Operand BuildFastArrayOperand(LOperand* elements_pointer, |
| 298 LOperand* key, | 305 LOperand* key, |
| 299 Representation key_representation, | 306 Representation key_representation, |
| 300 ElementsKind elements_kind, | 307 ElementsKind elements_kind, |
| 301 uint32_t offset, | 308 uint32_t offset, |
| 302 uint32_t additional_index = 0); | 309 uint32_t additional_index = 0); |
| 303 | 310 |
| 304 void EmitIntegerMathAbs(LMathAbs* instr); | 311 void EmitIntegerMathAbs(LMathAbs* instr); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 324 Register temp, | 331 Register temp, |
| 325 XMMRegister result, | 332 XMMRegister result, |
| 326 bool allow_undefined_as_nan, | 333 bool allow_undefined_as_nan, |
| 327 bool deoptimize_on_minus_zero, | 334 bool deoptimize_on_minus_zero, |
| 328 LEnvironment* env, | 335 LEnvironment* env, |
| 329 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); | 336 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); |
| 330 | 337 |
| 331 void EmitNumberUntagDNoSSE2( | 338 void EmitNumberUntagDNoSSE2( |
| 332 Register input, | 339 Register input, |
| 333 Register temp, | 340 Register temp, |
| 341 X87Register res_reg, |
| 334 bool allow_undefined_as_nan, | 342 bool allow_undefined_as_nan, |
| 335 bool deoptimize_on_minus_zero, | 343 bool deoptimize_on_minus_zero, |
| 336 LEnvironment* env, | 344 LEnvironment* env, |
| 337 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); | 345 NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED); |
| 338 | 346 |
| 339 // Emits optimized code for typeof x == "y". Modifies input register. | 347 // Emits optimized code for typeof x == "y". Modifies input register. |
| 340 // Returns the condition on which a final split to | 348 // Returns the condition on which a final split to |
| 341 // true and false label should be made, to optimize fallthrough. | 349 // true and false label should be made, to optimize fallthrough. |
| 342 Condition EmitTypeofIs(Label* true_label, | 350 Condition EmitTypeofIs(Label* true_label, |
| 343 Label* false_label, | 351 Label* false_label, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void DoStoreKeyedExternalArray(LStoreKeyed* instr); | 393 void DoStoreKeyedExternalArray(LStoreKeyed* instr); |
| 386 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); | 394 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); |
| 387 void DoStoreKeyedFixedArray(LStoreKeyed* instr); | 395 void DoStoreKeyedFixedArray(LStoreKeyed* instr); |
| 388 | 396 |
| 389 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); | 397 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); |
| 390 | 398 |
| 391 // Emits code for pushing either a tagged constant, a (non-double) | 399 // Emits code for pushing either a tagged constant, a (non-double) |
| 392 // register, or a stack slot operand. | 400 // register, or a stack slot operand. |
| 393 void EmitPushTaggedOperand(LOperand* operand); | 401 void EmitPushTaggedOperand(LOperand* operand); |
| 394 | 402 |
| 403 void X87Fxch(X87Register reg, int other_slot = 0); |
| 404 void X87Fld(Operand src, X87OperandType opts); |
| 405 void X87Free(X87Register reg); |
| 406 |
| 407 void FlushX87StackIfNecessary(LInstruction* instr); |
| 408 void EmitFlushX87ForDeopt(); |
| 409 bool X87StackContains(X87Register reg); |
| 410 int X87ArrayIndex(X87Register reg); |
| 411 int x87_st2idx(int pos); |
| 412 |
| 395 Zone* zone_; | 413 Zone* zone_; |
| 396 LPlatformChunk* const chunk_; | 414 LPlatformChunk* const chunk_; |
| 397 MacroAssembler* const masm_; | 415 MacroAssembler* const masm_; |
| 398 CompilationInfo* const info_; | 416 CompilationInfo* const info_; |
| 399 | 417 |
| 400 int current_block_; | 418 int current_block_; |
| 401 int current_instruction_; | 419 int current_instruction_; |
| 402 const ZoneList<LInstruction*>* instructions_; | 420 const ZoneList<LInstruction*>* instructions_; |
| 403 ZoneList<LEnvironment*> deoptimizations_; | 421 ZoneList<LEnvironment*> deoptimizations_; |
| 404 ZoneList<Deoptimizer::JumpTableEntry> jump_table_; | 422 ZoneList<Deoptimizer::JumpTableEntry> jump_table_; |
| 405 ZoneList<Handle<Object> > deoptimization_literals_; | 423 ZoneList<Handle<Object> > deoptimization_literals_; |
| 406 int inlined_function_count_; | 424 int inlined_function_count_; |
| 407 Scope* const scope_; | 425 Scope* const scope_; |
| 408 Status status_; | 426 Status status_; |
| 409 TranslationBuffer translations_; | 427 TranslationBuffer translations_; |
| 410 ZoneList<LDeferredCode*> deferred_; | 428 ZoneList<LDeferredCode*> deferred_; |
| 411 bool dynamic_frame_alignment_; | 429 bool dynamic_frame_alignment_; |
| 412 bool support_aligned_spilled_doubles_; | 430 bool support_aligned_spilled_doubles_; |
| 413 int osr_pc_offset_; | 431 int osr_pc_offset_; |
| 414 int last_lazy_deopt_pc_; | 432 int last_lazy_deopt_pc_; |
| 415 bool frame_is_built_; | 433 bool frame_is_built_; |
| 434 X87Register x87_stack_[X87Register::kNumAllocatableRegisters]; |
| 416 int x87_stack_depth_; | 435 int x87_stack_depth_; |
| 417 | 436 |
| 418 // Builder that keeps track of safepoints in the code. The table | 437 // Builder that keeps track of safepoints in the code. The table |
| 419 // itself is emitted at the end of the generated code. | 438 // itself is emitted at the end of the generated code. |
| 420 SafepointTableBuilder safepoints_; | 439 SafepointTableBuilder safepoints_; |
| 421 | 440 |
| 422 // Compiler from a set of parallel moves to a sequential list of moves. | 441 // Compiler from a set of parallel moves to a sequential list of moves. |
| 423 LGapResolver resolver_; | 442 LGapResolver resolver_; |
| 424 | 443 |
| 425 Safepoint::Kind expected_safepoint_kind_; | 444 Safepoint::Kind expected_safepoint_kind_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 LCodeGen* codegen_; | 496 LCodeGen* codegen_; |
| 478 Label entry_; | 497 Label entry_; |
| 479 Label exit_; | 498 Label exit_; |
| 480 Label* external_exit_; | 499 Label* external_exit_; |
| 481 int instruction_index_; | 500 int instruction_index_; |
| 482 }; | 501 }; |
| 483 | 502 |
| 484 } } // namespace v8::internal | 503 } } // namespace v8::internal |
| 485 | 504 |
| 486 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ | 505 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ |
| OLD | NEW |