Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: src/ia32/lithium-codegen-ia32.h

Issue 20781007: Add X87 implementations for Integer32ToDouble, DoubleToI, DoubleToSmi (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 inlined_function_count_(0), 61 inlined_function_count_(0),
62 scope_(info->scope()), 62 scope_(info->scope()),
63 status_(UNUSED), 63 status_(UNUSED),
64 translations_(info->zone()), 64 translations_(info->zone()),
65 deferred_(8, info->zone()), 65 deferred_(8, info->zone()),
66 dynamic_frame_alignment_(false), 66 dynamic_frame_alignment_(false),
67 support_aligned_spilled_doubles_(false), 67 support_aligned_spilled_doubles_(false),
68 osr_pc_offset_(-1), 68 osr_pc_offset_(-1),
69 last_lazy_deopt_pc_(0), 69 last_lazy_deopt_pc_(0),
70 frame_is_built_(false), 70 frame_is_built_(false),
71 x87_stack_depth_(0), 71 x87_stack_(assembler),
72 safepoints_(info->zone()), 72 safepoints_(info->zone()),
73 resolver_(this), 73 resolver_(this),
74 expected_safepoint_kind_(Safepoint::kSimple) { 74 expected_safepoint_kind_(Safepoint::kSimple) {
75 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 75 PopulateDeoptimizationLiteralsWithInlinedFunctions();
76 } 76 }
77 77
78 // Simple accessors. 78 // Simple accessors.
79 MacroAssembler* masm() const { return masm_; } 79 MacroAssembler* masm() const { return masm_; }
80 CompilationInfo* info() const { return info_; } 80 CompilationInfo* info() const { return info_; }
81 Isolate* isolate() const { return info_->isolate(); } 81 Isolate* isolate() const { return info_->isolate(); }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 double ToDouble(LConstantOperand* op) const; 115 double ToDouble(LConstantOperand* op) const;
116 116
117 // Support for non-sse2 (x87) floating point stack handling. 117 // Support for non-sse2 (x87) floating point stack handling.
118 // These functions maintain the mapping of physical stack registers to our 118 // These functions maintain the mapping of physical stack registers to our
119 // virtual registers between instructions. 119 // virtual registers between instructions.
120 enum X87OperandType { kX87DoubleOperand, kX87FloatOperand, kX87IntOperand }; 120 enum X87OperandType { kX87DoubleOperand, kX87FloatOperand, kX87IntOperand };
121 121
122 void X87Mov(X87Register reg, Operand src, 122 void X87Mov(X87Register reg, Operand src,
123 X87OperandType operand = kX87DoubleOperand); 123 X87OperandType operand = kX87DoubleOperand);
124 void X87Mov(Operand src, X87Register reg); 124 void X87Mov(Operand src, X87Register reg,
125 X87OperandType operand = kX87DoubleOperand);
125 126
126 void X87PrepareBinaryOp( 127 void X87PrepareBinaryOp(
127 X87Register left, X87Register right, X87Register result); 128 X87Register left, X87Register right, X87Register result);
128 129
129 void X87LoadForUsage(X87Register reg); 130 void X87LoadForUsage(X87Register reg);
130 void X87PrepareToWrite(X87Register reg); 131 void X87PrepareToWrite(X87Register reg) { x87_stack_.PrepareToWrite(reg); }
131 void X87CommitWrite(X87Register reg); 132 void X87CommitWrite(X87Register reg) { x87_stack_.CommitWrite(reg); }
133
134 void X87Fxch(X87Register reg, int other_slot = 0) {
135 x87_stack_.Fxch(reg, other_slot);
136 }
137
138 bool X87StackEmpty() {
139 return x87_stack_.depth() == 0;
140 }
132 141
133 Handle<Object> ToHandle(LConstantOperand* op) const; 142 Handle<Object> ToHandle(LConstantOperand* op) const;
134 143
135 // The operand denoting the second word (the one with a higher address) of 144 // The operand denoting the second word (the one with a higher address) of
136 // a double stack slot. 145 // a double stack slot.
137 Operand HighOperand(LOperand* op); 146 Operand HighOperand(LOperand* op);
138 147
139 // Try to generate code for the entire chunk, but it may fail if the 148 // Try to generate code for the entire chunk, but it may fail if the
140 // chunk contains constructs we cannot handle. Returns true if the 149 // chunk contains constructs we cannot handle. Returns true if the
141 // code generation attempt succeeded. 150 // code generation attempt succeeded.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 void DoStoreKeyedExternalArray(LStoreKeyed* instr); 400 void DoStoreKeyedExternalArray(LStoreKeyed* instr);
392 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); 401 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
393 void DoStoreKeyedFixedArray(LStoreKeyed* instr); 402 void DoStoreKeyedFixedArray(LStoreKeyed* instr);
394 403
395 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); 404 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment);
396 405
397 // Emits code for pushing either a tagged constant, a (non-double) 406 // Emits code for pushing either a tagged constant, a (non-double)
398 // register, or a stack slot operand. 407 // register, or a stack slot operand.
399 void EmitPushTaggedOperand(LOperand* operand); 408 void EmitPushTaggedOperand(LOperand* operand);
400 409
401 void X87Fxch(X87Register reg, int other_slot = 0);
402 void X87Fld(Operand src, X87OperandType opts); 410 void X87Fld(Operand src, X87OperandType opts);
403 void X87Free(X87Register reg);
404 411
405 void FlushX87StackIfNecessary(LInstruction* instr);
406 void EmitFlushX87ForDeopt(); 412 void EmitFlushX87ForDeopt();
407 bool X87StackContains(X87Register reg); 413 void FlushX87StackIfNecessary(LInstruction* instr) {
408 int X87ArrayIndex(X87Register reg); 414 x87_stack_.FlushIfNecessary(instr, this);
409 int x87_st2idx(int pos); 415 }
416 friend class LGapResolver;
410 417
411 Zone* zone_; 418 Zone* zone_;
412 LPlatformChunk* const chunk_; 419 LPlatformChunk* const chunk_;
413 MacroAssembler* const masm_; 420 MacroAssembler* const masm_;
414 CompilationInfo* const info_; 421 CompilationInfo* const info_;
415 422
416 int current_block_; 423 int current_block_;
417 int current_instruction_; 424 int current_instruction_;
418 const ZoneList<LInstruction*>* instructions_; 425 const ZoneList<LInstruction*>* instructions_;
419 ZoneList<LEnvironment*> deoptimizations_; 426 ZoneList<LEnvironment*> deoptimizations_;
420 ZoneList<Deoptimizer::JumpTableEntry> jump_table_; 427 ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
421 ZoneList<Handle<Object> > deoptimization_literals_; 428 ZoneList<Handle<Object> > deoptimization_literals_;
422 int inlined_function_count_; 429 int inlined_function_count_;
423 Scope* const scope_; 430 Scope* const scope_;
424 Status status_; 431 Status status_;
425 TranslationBuffer translations_; 432 TranslationBuffer translations_;
426 ZoneList<LDeferredCode*> deferred_; 433 ZoneList<LDeferredCode*> deferred_;
427 bool dynamic_frame_alignment_; 434 bool dynamic_frame_alignment_;
428 bool support_aligned_spilled_doubles_; 435 bool support_aligned_spilled_doubles_;
429 int osr_pc_offset_; 436 int osr_pc_offset_;
430 int last_lazy_deopt_pc_; 437 int last_lazy_deopt_pc_;
431 bool frame_is_built_; 438 bool frame_is_built_;
432 X87Register x87_stack_[X87Register::kNumAllocatableRegisters]; 439
433 int x87_stack_depth_; 440 class X87Stack {
441 public:
442 explicit X87Stack(MacroAssembler* masm) : stack_depth_(0), masm_(masm) { }
443 explicit X87Stack(const X87Stack& other)
444 : stack_depth_(0), masm_(other.masm_) {
445 stack_depth_ = other.stack_depth_;
446 for (int i = 0; i < stack_depth_; i++) {
447 stack_[i] = other.stack_[i];
448 }
449 }
450 bool operator==(const X87Stack& other) const {
451 if (stack_depth_ != other.stack_depth_) return false;
452 for (int i = 0; i < stack_depth_; i++) {
453 if (!stack_[i].is(other.stack_[i])) return false;
454 }
455 return true;
456 }
457 bool Contains(X87Register reg);
458 void Fxch(X87Register reg, int other_slot = 0);
459 void Free(X87Register reg);
460 void PrepareToWrite(X87Register reg);
461 void CommitWrite(X87Register reg);
462 void FlushIfNecessary(LInstruction* instr, LCodeGen* cgen);
463 int depth() const { return stack_depth_; }
464 void pop() { stack_depth_--; }
465 void push(X87Register reg) {
466 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters);
467 stack_[stack_depth_] = reg;
468 stack_depth_++;
469 }
470
471 MacroAssembler* masm() const { return masm_; }
472
473 private:
474 int ArrayIndex(X87Register reg);
475 int st2idx(int pos);
476 X87Register stack_[X87Register::kNumAllocatableRegisters];
477 int stack_depth_;
478 MacroAssembler* const masm_;
479 };
480 X87Stack x87_stack_;
434 481
435 // Builder that keeps track of safepoints in the code. The table 482 // Builder that keeps track of safepoints in the code. The table
436 // itself is emitted at the end of the generated code. 483 // itself is emitted at the end of the generated code.
437 SafepointTableBuilder safepoints_; 484 SafepointTableBuilder safepoints_;
438 485
439 // Compiler from a set of parallel moves to a sequential list of moves. 486 // Compiler from a set of parallel moves to a sequential list of moves.
440 LGapResolver resolver_; 487 LGapResolver resolver_;
441 488
442 Safepoint::Kind expected_safepoint_kind_; 489 Safepoint::Kind expected_safepoint_kind_;
443 490
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 LCodeGen* codegen_; 541 LCodeGen* codegen_;
495 Label entry_; 542 Label entry_;
496 Label exit_; 543 Label exit_;
497 Label* external_exit_; 544 Label* external_exit_;
498 int instruction_index_; 545 int instruction_index_;
499 }; 546 };
500 547
501 } } // namespace v8::internal 548 } } // namespace v8::internal
502 549
503 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ 550 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « no previous file | src/ia32/lithium-codegen-ia32.cc » ('j') | src/ia32/lithium-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698