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

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: add a test that was still missing in cl 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 | « src/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
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 old_position_(RelocInfo::kNoPosition) { 75 old_position_(RelocInfo::kNoPosition) {
76 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 76 PopulateDeoptimizationLiteralsWithInlinedFunctions();
77 } 77 }
78 78
79 // Simple accessors. 79 // Simple accessors.
80 MacroAssembler* masm() const { return masm_; } 80 MacroAssembler* masm() const { return masm_; }
81 CompilationInfo* info() const { return info_; } 81 CompilationInfo* info() const { return info_; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 double ToDouble(LConstantOperand* op) const; 116 double ToDouble(LConstantOperand* op) const;
117 117
118 // Support for non-sse2 (x87) floating point stack handling. 118 // Support for non-sse2 (x87) floating point stack handling.
119 // These functions maintain the mapping of physical stack registers to our 119 // These functions maintain the mapping of physical stack registers to our
120 // virtual registers between instructions. 120 // virtual registers between instructions.
121 enum X87OperandType { kX87DoubleOperand, kX87FloatOperand, kX87IntOperand }; 121 enum X87OperandType { kX87DoubleOperand, kX87FloatOperand, kX87IntOperand };
122 122
123 void X87Mov(X87Register reg, Operand src, 123 void X87Mov(X87Register reg, Operand src,
124 X87OperandType operand = kX87DoubleOperand); 124 X87OperandType operand = kX87DoubleOperand);
125 void X87Mov(Operand src, X87Register reg); 125 void X87Mov(Operand src, X87Register reg,
126 X87OperandType operand = kX87DoubleOperand);
126 127
127 void X87PrepareBinaryOp( 128 void X87PrepareBinaryOp(
128 X87Register left, X87Register right, X87Register result); 129 X87Register left, X87Register right, X87Register result);
129 130
130 void X87LoadForUsage(X87Register reg); 131 void X87LoadForUsage(X87Register reg);
131 void X87PrepareToWrite(X87Register reg); 132 void X87PrepareToWrite(X87Register reg) { x87_stack_.PrepareToWrite(reg); }
132 void X87CommitWrite(X87Register reg); 133 void X87CommitWrite(X87Register reg) { x87_stack_.CommitWrite(reg); }
134
135 void X87Fxch(X87Register reg, int other_slot = 0) {
136 x87_stack_.Fxch(reg, other_slot);
137 }
138
139 bool X87StackEmpty() {
140 return x87_stack_.depth() == 0;
141 }
133 142
134 Handle<Object> ToHandle(LConstantOperand* op) const; 143 Handle<Object> ToHandle(LConstantOperand* op) const;
135 144
136 // The operand denoting the second word (the one with a higher address) of 145 // The operand denoting the second word (the one with a higher address) of
137 // a double stack slot. 146 // a double stack slot.
138 Operand HighOperand(LOperand* op); 147 Operand HighOperand(LOperand* op);
139 148
140 // Try to generate code for the entire chunk, but it may fail if the 149 // Try to generate code for the entire chunk, but it may fail if the
141 // chunk contains constructs we cannot handle. Returns true if the 150 // chunk contains constructs we cannot handle. Returns true if the
142 // code generation attempt succeeded. 151 // code generation attempt succeeded.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 void DoStoreKeyedExternalArray(LStoreKeyed* instr); 401 void DoStoreKeyedExternalArray(LStoreKeyed* instr);
393 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr); 402 void DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr);
394 void DoStoreKeyedFixedArray(LStoreKeyed* instr); 403 void DoStoreKeyedFixedArray(LStoreKeyed* instr);
395 404
396 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment); 405 void EmitReturn(LReturn* instr, bool dynamic_frame_alignment);
397 406
398 // Emits code for pushing either a tagged constant, a (non-double) 407 // Emits code for pushing either a tagged constant, a (non-double)
399 // register, or a stack slot operand. 408 // register, or a stack slot operand.
400 void EmitPushTaggedOperand(LOperand* operand); 409 void EmitPushTaggedOperand(LOperand* operand);
401 410
402 void X87Fxch(X87Register reg, int other_slot = 0);
403 void X87Fld(Operand src, X87OperandType opts); 411 void X87Fld(Operand src, X87OperandType opts);
404 void X87Free(X87Register reg);
405 412
406 void FlushX87StackIfNecessary(LInstruction* instr);
407 void EmitFlushX87ForDeopt(); 413 void EmitFlushX87ForDeopt();
408 bool X87StackContains(X87Register reg); 414 void FlushX87StackIfNecessary(LInstruction* instr) {
409 int X87ArrayIndex(X87Register reg); 415 x87_stack_.FlushIfNecessary(instr, this);
410 int x87_st2idx(int pos); 416 }
417 friend class LGapResolver;
411 418
412 #ifdef _MSC_VER 419 #ifdef _MSC_VER
413 // On windows, you may not access the stack more than one page below 420 // On windows, you may not access the stack more than one page below
414 // the most recently mapped page. To make the allocated area randomly 421 // the most recently mapped page. To make the allocated area randomly
415 // accessible, we write an arbitrary value to each page in range 422 // accessible, we write an arbitrary value to each page in range
416 // esp + offset - page_size .. esp in turn. 423 // esp + offset - page_size .. esp in turn.
417 void MakeSureStackPagesMapped(int offset); 424 void MakeSureStackPagesMapped(int offset);
418 #endif 425 #endif
419 426
420 Zone* zone_; 427 Zone* zone_;
(...skipping 10 matching lines...) Expand all
431 int inlined_function_count_; 438 int inlined_function_count_;
432 Scope* const scope_; 439 Scope* const scope_;
433 Status status_; 440 Status status_;
434 TranslationBuffer translations_; 441 TranslationBuffer translations_;
435 ZoneList<LDeferredCode*> deferred_; 442 ZoneList<LDeferredCode*> deferred_;
436 bool dynamic_frame_alignment_; 443 bool dynamic_frame_alignment_;
437 bool support_aligned_spilled_doubles_; 444 bool support_aligned_spilled_doubles_;
438 int osr_pc_offset_; 445 int osr_pc_offset_;
439 int last_lazy_deopt_pc_; 446 int last_lazy_deopt_pc_;
440 bool frame_is_built_; 447 bool frame_is_built_;
441 X87Register x87_stack_[X87Register::kNumAllocatableRegisters]; 448
442 int x87_stack_depth_; 449 class X87Stack {
450 public:
451 explicit X87Stack(MacroAssembler* masm) : stack_depth_(0), masm_(masm) { }
452 explicit X87Stack(const X87Stack& other)
453 : stack_depth_(0), masm_(other.masm_) {
454 stack_depth_ = other.stack_depth_;
455 for (int i = 0; i < stack_depth_; i++) {
456 stack_[i] = other.stack_[i];
457 }
458 }
459 bool operator==(const X87Stack& other) const {
460 if (stack_depth_ != other.stack_depth_) return false;
461 for (int i = 0; i < stack_depth_; i++) {
462 if (!stack_[i].is(other.stack_[i])) return false;
463 }
464 return true;
465 }
466 bool Contains(X87Register reg);
467 void Fxch(X87Register reg, int other_slot = 0);
468 void Free(X87Register reg);
469 void PrepareToWrite(X87Register reg);
470 void CommitWrite(X87Register reg);
471 void FlushIfNecessary(LInstruction* instr, LCodeGen* cgen);
472 int depth() const { return stack_depth_; }
473 void pop() { stack_depth_--; }
474 void push(X87Register reg) {
475 ASSERT(stack_depth_ < X87Register::kNumAllocatableRegisters);
476 stack_[stack_depth_] = reg;
477 stack_depth_++;
478 }
479
480 MacroAssembler* masm() const { return masm_; }
481
482 private:
483 int ArrayIndex(X87Register reg);
484 int st2idx(int pos);
485 X87Register stack_[X87Register::kNumAllocatableRegisters];
486 int stack_depth_;
487 MacroAssembler* const masm_;
488 };
489 X87Stack x87_stack_;
443 490
444 // Builder that keeps track of safepoints in the code. The table 491 // Builder that keeps track of safepoints in the code. The table
445 // itself is emitted at the end of the generated code. 492 // itself is emitted at the end of the generated code.
446 SafepointTableBuilder safepoints_; 493 SafepointTableBuilder safepoints_;
447 494
448 // Compiler from a set of parallel moves to a sequential list of moves. 495 // Compiler from a set of parallel moves to a sequential list of moves.
449 LGapResolver resolver_; 496 LGapResolver resolver_;
450 497
451 Safepoint::Kind expected_safepoint_kind_; 498 Safepoint::Kind expected_safepoint_kind_;
452 499
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 LCodeGen* codegen_; 552 LCodeGen* codegen_;
506 Label entry_; 553 Label entry_;
507 Label exit_; 554 Label exit_;
508 Label* external_exit_; 555 Label* external_exit_;
509 int instruction_index_; 556 int instruction_index_;
510 }; 557 };
511 558
512 } } // namespace v8::internal 559 } } // namespace v8::internal
513 560
514 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ 561 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/assembler-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698