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

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

Issue 14246031: Simplified LCodeGen::GetNextEmittedBlock and LCodeGen::EmitGoto a bit. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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-codegen-arm.h ('k') | src/ia32/lithium-codegen-ia32.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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 2176
2177 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 2177 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
2178 // Block literal pool emission to ensure nop indicating no inlined smi code 2178 // Block literal pool emission to ensure nop indicating no inlined smi code
2179 // is in the correct position. 2179 // is in the correct position.
2180 Assembler::BlockConstPoolScope block_const_pool(masm()); 2180 Assembler::BlockConstPoolScope block_const_pool(masm());
2181 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 2181 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2182 __ nop(); // Signals no inlined code. 2182 __ nop(); // Signals no inlined code.
2183 } 2183 }
2184 2184
2185 2185
2186 int LCodeGen::GetNextEmittedBlock(int block) { 2186 int LCodeGen::GetNextEmittedBlock() {
2187 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { 2187 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2188 LLabel* label = chunk_->GetLabel(i); 2188 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2189 if (!label->HasReplacement()) return i;
2190 } 2189 }
2191 return -1; 2190 return -1;
2192 } 2191 }
2193 2192
2194 2193
2195 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) { 2194 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
2196 int next_block = GetNextEmittedBlock(current_block_); 2195 int next_block = GetNextEmittedBlock();
2197 right_block = chunk_->LookupDestination(right_block); 2196 right_block = chunk_->LookupDestination(right_block);
2198 left_block = chunk_->LookupDestination(left_block); 2197 left_block = chunk_->LookupDestination(left_block);
2199 2198
2200 if (right_block == left_block) { 2199 if (right_block == left_block) {
2201 EmitGoto(left_block); 2200 EmitGoto(left_block);
2202 } else if (left_block == next_block) { 2201 } else if (left_block == next_block) {
2203 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 2202 __ b(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
2204 } else if (right_block == next_block) { 2203 } else if (right_block == next_block) {
2205 __ b(cc, chunk_->GetAssemblyLabel(left_block)); 2204 __ b(cc, chunk_->GetAssemblyLabel(left_block));
2206 } else { 2205 } else {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 } 2322 }
2324 2323
2325 // We've seen something for the first time -> deopt. 2324 // We've seen something for the first time -> deopt.
2326 DeoptimizeIf(al, instr->environment()); 2325 DeoptimizeIf(al, instr->environment());
2327 } 2326 }
2328 } 2327 }
2329 } 2328 }
2330 2329
2331 2330
2332 void LCodeGen::EmitGoto(int block) { 2331 void LCodeGen::EmitGoto(int block) {
2333 block = chunk_->LookupDestination(block); 2332 int destination = chunk_->LookupDestination(block);
2334 int next_block = GetNextEmittedBlock(current_block_); 2333 if (destination != GetNextEmittedBlock()) {
2335 if (block != next_block) { 2334 __ jmp(chunk_->GetAssemblyLabel(destination));
2336 __ jmp(chunk_->GetAssemblyLabel(block));
2337 } 2335 }
2338 } 2336 }
2339 2337
2340 2338
2341 void LCodeGen::DoGoto(LGoto* instr) { 2339 void LCodeGen::DoGoto(LGoto* instr) {
2342 EmitGoto(instr->block_id()); 2340 EmitGoto(instr->block_id());
2343 } 2341 }
2344 2342
2345 2343
2346 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { 2344 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
(...skipping 3661 matching lines...) Expand 10 before | Expand all | Expand 10 after
6008 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6006 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
6009 __ ldr(result, FieldMemOperand(scratch, 6007 __ ldr(result, FieldMemOperand(scratch,
6010 FixedArray::kHeaderSize - kPointerSize)); 6008 FixedArray::kHeaderSize - kPointerSize));
6011 __ bind(&done); 6009 __ bind(&done);
6012 } 6010 }
6013 6011
6014 6012
6015 #undef __ 6013 #undef __
6016 6014
6017 } } // namespace v8::internal 6015 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698