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

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

Issue 17229005: Convert UnaryOpStub to a HydrogenCodeStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix code stub disass output Created 7 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
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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 __ add(Operand(esp), Immediate(kDoubleSize)); 2060 __ add(Operand(esp), Immediate(kDoubleSize));
2061 break; 2061 break;
2062 } 2062 }
2063 default: 2063 default:
2064 UNREACHABLE(); 2064 UNREACHABLE();
2065 break; 2065 break;
2066 } 2066 }
2067 } 2067 }
2068 2068
2069 2069
2070 void LCodeGen::DoNegateNoSSE2D(LNegateNoSSE2D* instr) {
2071 __ push(Immediate(-1));
2072 __ fild_s(Operand(esp, 0));
2073 __ add(esp, Immediate(kPointerSize));
2074 __ fmulp();
2075 CurrentInstructionReturnsX87Result();
2076 }
2077
2078
2079
2070 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { 2080 void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
2071 ASSERT(ToRegister(instr->context()).is(esi)); 2081 ASSERT(ToRegister(instr->context()).is(esi));
2072 ASSERT(ToRegister(instr->left()).is(edx)); 2082 ASSERT(ToRegister(instr->left()).is(edx));
2073 ASSERT(ToRegister(instr->right()).is(eax)); 2083 ASSERT(ToRegister(instr->right()).is(eax));
2074 ASSERT(ToRegister(instr->result()).is(eax)); 2084 ASSERT(ToRegister(instr->result()).is(eax));
2075 2085
2076 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 2086 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
2077 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 2087 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2078 __ nop(); // Signals no inlined code. 2088 __ nop(); // Signals no inlined code.
2079 } 2089 }
2080 2090
2081 2091
2082 int LCodeGen::GetNextEmittedBlock() const { 2092 int LCodeGen::GetNextEmittedBlock() const {
2083 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 2093 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2084 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 2094 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2085 } 2095 }
2086 return -1; 2096 return -1;
2087 } 2097 }
2088 2098
2089 2099
2090 template<class InstrType> 2100 template<class InstrType>
2091 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 2101 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
2102 int left_block = instr->TrueDestination(chunk_);
2092 int right_block = instr->FalseDestination(chunk_); 2103 int right_block = instr->FalseDestination(chunk_);
2093 int left_block = instr->TrueDestination(chunk_);
2094 2104
2095 int next_block = GetNextEmittedBlock(); 2105 int next_block = GetNextEmittedBlock();
2096 2106
2097 if (right_block == left_block) { 2107 if (right_block == left_block || cc == no_condition) {
2098 EmitGoto(left_block); 2108 EmitGoto(left_block);
2099 } else if (left_block == next_block) { 2109 } else if (left_block == next_block) {
2100 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 2110 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
2101 } else if (right_block == next_block) { 2111 } else if (right_block == next_block) {
2102 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 2112 __ j(cc, chunk_->GetAssemblyLabel(left_block));
2103 } else { 2113 } else {
2104 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 2114 __ j(cc, chunk_->GetAssemblyLabel(left_block));
2105 __ jmp(chunk_->GetAssemblyLabel(right_block)); 2115 __ jmp(chunk_->GetAssemblyLabel(right_block));
2106 } 2116 }
2107 } 2117 }
2108 2118
2109 2119
2120 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
2121 Representation r = instr->hydrogen()->value()->representation();
2122 if (r.IsSmiOrInteger32() || r.IsDouble()) {
2123 EmitBranch(instr, no_condition);
2124 } else {
2125 ASSERT(r.IsTagged());
2126 Register reg = ToRegister(instr->value());
2127 HType type = instr->hydrogen()->value()->type();
2128 if (type.IsTaggedNumber()) {
2129 EmitBranch(instr, no_condition);
2130 }
2131 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2132 __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
2133 factory()->heap_number_map());
2134 EmitBranch(instr, equal);
2135 }
2136 }
2137
2138
2110 void LCodeGen::DoBranch(LBranch* instr) { 2139 void LCodeGen::DoBranch(LBranch* instr) {
2111 Representation r = instr->hydrogen()->value()->representation(); 2140 Representation r = instr->hydrogen()->value()->representation();
2112 if (r.IsSmiOrInteger32()) { 2141 if (r.IsSmiOrInteger32()) {
2113 ASSERT(!info()->IsStub()); 2142 ASSERT(!info()->IsStub());
2114 Register reg = ToRegister(instr->value()); 2143 Register reg = ToRegister(instr->value());
2115 __ test(reg, Operand(reg)); 2144 __ test(reg, Operand(reg));
2116 EmitBranch(instr, not_zero); 2145 EmitBranch(instr, not_zero);
2117 } else if (r.IsDouble()) { 2146 } else if (r.IsDouble()) {
2118 ASSERT(!info()->IsStub()); 2147 ASSERT(!info()->IsStub());
2119 CpuFeatureScope scope(masm(), SSE2); 2148 CpuFeatureScope scope(masm(), SSE2);
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after
6560 FixedArray::kHeaderSize - kPointerSize)); 6589 FixedArray::kHeaderSize - kPointerSize));
6561 __ bind(&done); 6590 __ bind(&done);
6562 } 6591 }
6563 6592
6564 6593
6565 #undef __ 6594 #undef __
6566 6595
6567 } } // namespace v8::internal 6596 } } // namespace v8::internal
6568 6597
6569 #endif // V8_TARGET_ARCH_IA32 6598 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/hydrogen.h ('K') | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698