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

Side by Side Diff: src/x64/codegen-x64.cc

Issue 150022: Fix build on x64 after compare stub change. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 4119 matching lines...) Expand 10 before | Expand all | Expand 10 after
4130 // TODO(1241834): Fetch the position from the variable instead of using 4130 // TODO(1241834): Fetch the position from the variable instead of using
4131 // no position. 4131 // no position.
4132 Property property(&global, &key, RelocInfo::kNoPosition); 4132 Property property(&global, &key, RelocInfo::kNoPosition);
4133 Load(&property); 4133 Load(&property);
4134 } else { 4134 } else {
4135 Load(x, INSIDE_TYPEOF); 4135 Load(x, INSIDE_TYPEOF);
4136 } 4136 }
4137 } 4137 }
4138 4138
4139 4139
4140 class CompareStub: public CodeStub {
4141 public:
4142 CompareStub(Condition cc, bool strict) : cc_(cc), strict_(strict) { }
4143
4144 void Generate(MacroAssembler* masm);
4145
4146 private:
4147 Condition cc_;
4148 bool strict_;
4149
4150 Major MajorKey() { return Compare; }
4151
4152 int MinorKey() {
4153 // Encode the three parameters in a unique 16 bit value.
4154 ASSERT(static_cast<int>(cc_) < (1 << 15));
4155 return (static_cast<int>(cc_) << 1) | (strict_ ? 1 : 0);
4156 }
4157
4158 // Branch to the label if the given object isn't a symbol.
4159 void BranchIfNonSymbol(MacroAssembler* masm,
4160 Label* label,
4161 Register object);
4162
4163 #ifdef DEBUG
4164 void Print() {
4165 PrintF("CompareStub (cc %d), (strict %s)\n",
4166 static_cast<int>(cc_),
4167 strict_ ? "true" : "false");
4168 }
4169 #endif
4170 };
4171
4172
4173 void CodeGenerator::Comparison(Condition cc, 4140 void CodeGenerator::Comparison(Condition cc,
4174 bool strict, 4141 bool strict,
4175 ControlDestination* dest) { 4142 ControlDestination* dest) {
4176 // Strict only makes sense for equality comparisons. 4143 // Strict only makes sense for equality comparisons.
4177 ASSERT(!strict || cc == equal); 4144 ASSERT(!strict || cc == equal);
4178 4145
4179 Result left_side; 4146 Result left_side;
4180 Result right_side; 4147 Result right_side;
4181 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order. 4148 // Implement '>' and '<=' by reversal to obtain ECMA-262 conversion order.
4182 if (cc == greater || cc == less_equal) { 4149 if (cc == greater || cc == less_equal) {
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 __ movq(rax, Immediate(-1)); 5624 __ movq(rax, Immediate(-1));
5658 __ ret(2 * kPointerSize); 5625 __ ret(2 * kPointerSize);
5659 5626
5660 __ bind(&above_lbl); 5627 __ bind(&above_lbl);
5661 __ movq(rax, Immediate(1)); 5628 __ movq(rax, Immediate(1));
5662 __ ret(2 * kPointerSize); // rax, rdx were pushed 5629 __ ret(2 * kPointerSize); // rax, rdx were pushed
5663 5630
5664 // Fast negative check for symbol-to-symbol equality. 5631 // Fast negative check for symbol-to-symbol equality.
5665 __ bind(&check_for_symbols); 5632 __ bind(&check_for_symbols);
5666 if (cc_ == equal) { 5633 if (cc_ == equal) {
5667 BranchIfNonSymbol(masm, &call_builtin, rax); 5634 BranchIfNonSymbol(masm, &call_builtin, rax, kScratchRegister);
5668 BranchIfNonSymbol(masm, &call_builtin, rdx); 5635 BranchIfNonSymbol(masm, &call_builtin, rdx, kScratchRegister);
5669 5636
5670 // We've already checked for object identity, so if both operands 5637 // We've already checked for object identity, so if both operands
5671 // are symbols they aren't equal. Register rax already holds a 5638 // are symbols they aren't equal. Register rax already holds a
5672 // non-zero value, which indicates not equal, so just return. 5639 // non-zero value, which indicates not equal, so just return.
5673 __ ret(2 * kPointerSize); 5640 __ ret(2 * kPointerSize);
5674 } 5641 }
5675 5642
5676 __ bind(&call_builtin); 5643 __ bind(&call_builtin);
5677 // must swap argument order 5644 // must swap argument order
5678 __ pop(rcx); 5645 __ pop(rcx);
(...skipping 22 matching lines...) Expand all
5701 __ push(rcx); 5668 __ push(rcx);
5702 5669
5703 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) 5670 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
5704 // tagged as a small integer. 5671 // tagged as a small integer.
5705 __ InvokeBuiltin(builtin, JUMP_FUNCTION); 5672 __ InvokeBuiltin(builtin, JUMP_FUNCTION);
5706 } 5673 }
5707 5674
5708 5675
5709 void CompareStub::BranchIfNonSymbol(MacroAssembler* masm, 5676 void CompareStub::BranchIfNonSymbol(MacroAssembler* masm,
5710 Label* label, 5677 Label* label,
5711 Register object) { 5678 Register object,
5679 Register scratch) {
5712 __ testl(object, Immediate(kSmiTagMask)); 5680 __ testl(object, Immediate(kSmiTagMask));
5713 __ j(zero, label); 5681 __ j(zero, label);
5714 __ movq(kScratchRegister, FieldOperand(object, HeapObject::kMapOffset)); 5682 __ movq(scratch, FieldOperand(object, HeapObject::kMapOffset));
5715 __ movzxbq(kScratchRegister, 5683 __ movzxbq(scratch,
5716 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset)); 5684 FieldOperand(scratch, Map::kInstanceTypeOffset));
5717 __ and_(kScratchRegister, Immediate(kIsSymbolMask | kIsNotStringMask)); 5685 __ and_(scratch, Immediate(kIsSymbolMask | kIsNotStringMask));
5718 __ cmpb(kScratchRegister, Immediate(kSymbolTag | kStringTag)); 5686 __ cmpb(scratch, Immediate(kSymbolTag | kStringTag));
5719 __ j(not_equal, label); 5687 __ j(not_equal, label);
5720 } 5688 }
5721 5689
5722 5690
5723 // Call the function just below TOS on the stack with the given 5691 // Call the function just below TOS on the stack with the given
5724 // arguments. The receiver is the TOS. 5692 // arguments. The receiver is the TOS.
5725 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args, 5693 void CodeGenerator::CallWithArguments(ZoneList<Expression*>* args,
5726 int position) { 5694 int position) {
5727 // Push the arguments ("left-to-right") on the stack. 5695 // Push the arguments ("left-to-right") on the stack.
5728 int arg_count = args->length(); 5696 int arg_count = args->length();
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
6814 int CompareStub::MinorKey() { 6782 int CompareStub::MinorKey() {
6815 // Encode the two parameters in a unique 16 bit value. 6783 // Encode the two parameters in a unique 16 bit value.
6816 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 6784 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
6817 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 6785 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
6818 } 6786 }
6819 6787
6820 6788
6821 #undef __ 6789 #undef __
6822 6790
6823 } } // namespace v8::internal 6791 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698