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

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

Issue 18712002: Convert UnaryOpStub to a HydrogenCodeStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address review 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
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.h » ('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 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 2123
2124 int LCodeGen::GetNextEmittedBlock() const { 2124 int LCodeGen::GetNextEmittedBlock() const {
2125 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 2125 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2126 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 2126 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2127 } 2127 }
2128 return -1; 2128 return -1;
2129 } 2129 }
2130 2130
2131 template<class InstrType> 2131 template<class InstrType>
2132 void LCodeGen::EmitBranch(InstrType instr, Condition cc) { 2132 void LCodeGen::EmitBranch(InstrType instr, Condition cc) {
2133 int left_block = instr->TrueDestination(chunk_);
2133 int right_block = instr->FalseDestination(chunk_); 2134 int right_block = instr->FalseDestination(chunk_);
2134 int left_block = instr->TrueDestination(chunk_);
2135 2135
2136 int next_block = GetNextEmittedBlock(); 2136 int next_block = GetNextEmittedBlock();
2137 2137
2138 if (right_block == left_block) { 2138 if (right_block == left_block || cc == al) {
2139 EmitGoto(left_block); 2139 EmitGoto(left_block);
2140 } else if (left_block == next_block) { 2140 } else if (left_block == next_block) {
2141 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 2141 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
2142 } else if (right_block == next_block) { 2142 } else if (right_block == next_block) {
2143 __ b(cc, chunk_->GetAssemblyLabel(left_block)); 2143 __ b(cc, chunk_->GetAssemblyLabel(left_block));
2144 } else { 2144 } else {
2145 __ b(cc, chunk_->GetAssemblyLabel(left_block)); 2145 __ b(cc, chunk_->GetAssemblyLabel(left_block));
2146 __ b(chunk_->GetAssemblyLabel(right_block)); 2146 __ b(chunk_->GetAssemblyLabel(right_block));
2147 } 2147 }
2148 } 2148 }
2149 2149
2150 2150
2151 void LCodeGen::DoDebugBreak(LDebugBreak* instr) { 2151 void LCodeGen::DoDebugBreak(LDebugBreak* instr) {
2152 __ stop("LBreak"); 2152 __ stop("LBreak");
2153 } 2153 }
2154 2154
2155 2155
2156 void LCodeGen::DoIsNumberAndBranch(LIsNumberAndBranch* instr) {
2157 Representation r = instr->hydrogen()->value()->representation();
2158 if (r.IsSmiOrInteger32() || r.IsDouble()) {
2159 EmitBranch(instr, al);
2160 } else {
2161 ASSERT(r.IsTagged());
2162 Register reg = ToRegister(instr->value());
2163 HType type = instr->hydrogen()->value()->type();
2164 if (type.IsTaggedNumber()) {
2165 EmitBranch(instr, al);
2166 }
2167 __ JumpIfSmi(reg, instr->TrueLabel(chunk_));
2168 __ ldr(scratch0(), FieldMemOperand(reg, HeapObject::kMapOffset));
2169 __ CompareRoot(scratch0(), Heap::kHeapNumberMapRootIndex);
2170 EmitBranch(instr, eq);
2171 }
2172 }
2173
2174
2156 void LCodeGen::DoBranch(LBranch* instr) { 2175 void LCodeGen::DoBranch(LBranch* instr) {
2157 Representation r = instr->hydrogen()->value()->representation(); 2176 Representation r = instr->hydrogen()->value()->representation();
2158 if (r.IsInteger32() || r.IsSmi()) { 2177 if (r.IsInteger32() || r.IsSmi()) {
2159 ASSERT(!info()->IsStub()); 2178 ASSERT(!info()->IsStub());
2160 Register reg = ToRegister(instr->value()); 2179 Register reg = ToRegister(instr->value());
2161 __ cmp(reg, Operand::Zero()); 2180 __ cmp(reg, Operand::Zero());
2162 EmitBranch(instr, ne); 2181 EmitBranch(instr, ne);
2163 } else if (r.IsDouble()) { 2182 } else if (r.IsDouble()) {
2164 ASSERT(!info()->IsStub()); 2183 ASSERT(!info()->IsStub());
2165 DwVfpRegister reg = ToDoubleRegister(instr->value()); 2184 DwVfpRegister reg = ToDoubleRegister(instr->value());
(...skipping 3738 matching lines...) Expand 10 before | Expand all | Expand 10 after
5904 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index)); 5923 __ sub(scratch, result, Operand::PointerOffsetFromSmiKey(index));
5905 __ ldr(result, FieldMemOperand(scratch, 5924 __ ldr(result, FieldMemOperand(scratch,
5906 FixedArray::kHeaderSize - kPointerSize)); 5925 FixedArray::kHeaderSize - kPointerSize));
5907 __ bind(&done); 5926 __ bind(&done);
5908 } 5927 }
5909 5928
5910 5929
5911 #undef __ 5930 #undef __
5912 5931
5913 } } // namespace v8::internal 5932 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698