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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/lithium-codegen-ia32.h ('k') | src/mips/lithium-codegen-mips.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 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 ASSERT(ToRegister(instr->left()).is(edx)); 2049 ASSERT(ToRegister(instr->left()).is(edx));
2050 ASSERT(ToRegister(instr->right()).is(eax)); 2050 ASSERT(ToRegister(instr->right()).is(eax));
2051 ASSERT(ToRegister(instr->result()).is(eax)); 2051 ASSERT(ToRegister(instr->result()).is(eax));
2052 2052
2053 BinaryOpStub stub(instr->op(), NO_OVERWRITE); 2053 BinaryOpStub stub(instr->op(), NO_OVERWRITE);
2054 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); 2054 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
2055 __ nop(); // Signals no inlined code. 2055 __ nop(); // Signals no inlined code.
2056 } 2056 }
2057 2057
2058 2058
2059 int LCodeGen::GetNextEmittedBlock(int block) { 2059 int LCodeGen::GetNextEmittedBlock() {
2060 for (int i = block + 1; i < graph()->blocks()->length(); ++i) { 2060 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
2061 LLabel* label = chunk_->GetLabel(i); 2061 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
2062 if (!label->HasReplacement()) return i;
2063 } 2062 }
2064 return -1; 2063 return -1;
2065 } 2064 }
2066 2065
2067 2066
2068 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) { 2067 void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
2069 int next_block = GetNextEmittedBlock(current_block_); 2068 int next_block = GetNextEmittedBlock();
2070 right_block = chunk_->LookupDestination(right_block); 2069 right_block = chunk_->LookupDestination(right_block);
2071 left_block = chunk_->LookupDestination(left_block); 2070 left_block = chunk_->LookupDestination(left_block);
2072 2071
2073 if (right_block == left_block) { 2072 if (right_block == left_block) {
2074 EmitGoto(left_block); 2073 EmitGoto(left_block);
2075 } else if (left_block == next_block) { 2074 } else if (left_block == next_block) {
2076 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block)); 2075 __ j(NegateCondition(cc), chunk_->GetAssemblyLabel(right_block));
2077 } else if (right_block == next_block) { 2076 } else if (right_block == next_block) {
2078 __ j(cc, chunk_->GetAssemblyLabel(left_block)); 2077 __ j(cc, chunk_->GetAssemblyLabel(left_block));
2079 } else { 2078 } else {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 } 2196 }
2198 2197
2199 // We've seen something for the first time -> deopt. 2198 // We've seen something for the first time -> deopt.
2200 DeoptimizeIf(no_condition, instr->environment()); 2199 DeoptimizeIf(no_condition, instr->environment());
2201 } 2200 }
2202 } 2201 }
2203 } 2202 }
2204 2203
2205 2204
2206 void LCodeGen::EmitGoto(int block) { 2205 void LCodeGen::EmitGoto(int block) {
2207 block = chunk_->LookupDestination(block); 2206 int destination = chunk_->LookupDestination(block);
2208 int next_block = GetNextEmittedBlock(current_block_); 2207 if (destination != GetNextEmittedBlock()) {
2209 if (block != next_block) { 2208 __ jmp(chunk_->GetAssemblyLabel(destination));
2210 __ jmp(chunk_->GetAssemblyLabel(block));
2211 } 2209 }
2212 } 2210 }
2213 2211
2214 2212
2215 void LCodeGen::DoGoto(LGoto* instr) { 2213 void LCodeGen::DoGoto(LGoto* instr) {
2216 EmitGoto(instr->block_id()); 2214 EmitGoto(instr->block_id());
2217 } 2215 }
2218 2216
2219 2217
2220 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { 2218 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
(...skipping 4330 matching lines...) Expand 10 before | Expand all | Expand 10 after
6551 FixedArray::kHeaderSize - kPointerSize)); 6549 FixedArray::kHeaderSize - kPointerSize));
6552 __ bind(&done); 6550 __ bind(&done);
6553 } 6551 }
6554 6552
6555 6553
6556 #undef __ 6554 #undef __
6557 6555
6558 } } // namespace v8::internal 6556 } } // namespace v8::internal
6559 6557
6560 #endif // V8_TARGET_ARCH_IA32 6558 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698