Reviewers: Toon Verwaest,
Message:
Committed patchset #1 manually as r14349 (presubmit successful).
Description:
Simplified LCodeGen::GetNextEmittedBlock and LCodeGen::EmitGoto a bit.
GetNextEmittedBlock is always called with the same argument (an instance
variable), so let's remove it. In EmitGoto, avoid assignment to an argument.
This CL is split off another CL for easier reviewing.
Committed: http://code.google.com/p/v8/source/detail?r=14349
Please review this at https://codereview.chromium.org/14246031/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/lithium-codegen-arm.h
M src/arm/lithium-codegen-arm.cc
M src/ia32/lithium-codegen-ia32.h
M src/ia32/lithium-codegen-ia32.cc
M src/mips/lithium-codegen-mips.h
M src/mips/lithium-codegen-mips.cc
M src/x64/lithium-codegen-x64.h
M src/x64/lithium-codegen-x64.cc
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
c6ba51770331417db3b30847214692805a4708ea..e22067807d26f2fa0bff947f427857dc57be6115
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -2183,17 +2183,16 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
}
-int LCodeGen::GetNextEmittedBlock(int block) {
- for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
- LLabel* label = chunk_->GetLabel(i);
- if (!label->HasReplacement()) return i;
+int LCodeGen::GetNextEmittedBlock() {
+ for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
+ if (!chunk_->GetLabel(i)->HasReplacement()) return i;
}
return -1;
}
void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
- int next_block = GetNextEmittedBlock(current_block_);
+ int next_block = GetNextEmittedBlock();
right_block = chunk_->LookupDestination(right_block);
left_block = chunk_->LookupDestination(left_block);
@@ -2330,10 +2329,9 @@ void LCodeGen::DoBranch(LBranch* instr) {
void LCodeGen::EmitGoto(int block) {
- block = chunk_->LookupDestination(block);
- int next_block = GetNextEmittedBlock(current_block_);
- if (block != next_block) {
- __ jmp(chunk_->GetAssemblyLabel(block));
+ int destination = chunk_->LookupDestination(block);
+ if (destination != GetNextEmittedBlock()) {
+ __ jmp(chunk_->GetAssemblyLabel(destination));
}
}
Index: src/arm/lithium-codegen-arm.h
diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h
index
5f720a904b04123f8c68d3b559442f47e42fff7b..c1041326b4b3b0aa73feecabd0fb91ff0aa0f63d
100644
--- a/src/arm/lithium-codegen-arm.h
+++ b/src/arm/lithium-codegen-arm.h
@@ -201,7 +201,7 @@ class LCodeGen BASE_EMBEDDED {
Register scratch0() { return r9; }
DwVfpRegister double_scratch0() { return kScratchDoubleReg; }
- int GetNextEmittedBlock(int block);
+ int GetNextEmittedBlock();
LInstruction* GetNextInstruction();
void EmitClassOfTest(Label* if_true,
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
665c85e827a015d76d0216f1be3a5c85f2419702..221882ca043e1c9d6f3b7d6f205287fac22995c5
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -2056,17 +2056,16 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
}
-int LCodeGen::GetNextEmittedBlock(int block) {
- for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
- LLabel* label = chunk_->GetLabel(i);
- if (!label->HasReplacement()) return i;
+int LCodeGen::GetNextEmittedBlock() {
+ for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
+ if (!chunk_->GetLabel(i)->HasReplacement()) return i;
}
return -1;
}
void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
- int next_block = GetNextEmittedBlock(current_block_);
+ int next_block = GetNextEmittedBlock();
right_block = chunk_->LookupDestination(right_block);
left_block = chunk_->LookupDestination(left_block);
@@ -2204,10 +2203,9 @@ void LCodeGen::DoBranch(LBranch* instr) {
void LCodeGen::EmitGoto(int block) {
- block = chunk_->LookupDestination(block);
- int next_block = GetNextEmittedBlock(current_block_);
- if (block != next_block) {
- __ jmp(chunk_->GetAssemblyLabel(block));
+ int destination = chunk_->LookupDestination(block);
+ if (destination != GetNextEmittedBlock()) {
+ __ jmp(chunk_->GetAssemblyLabel(destination));
}
}
Index: src/ia32/lithium-codegen-ia32.h
diff --git a/src/ia32/lithium-codegen-ia32.h
b/src/ia32/lithium-codegen-ia32.h
index
3e1bc359d296acd5cd9dd71e5f38d41f72de7b6c..a59b36827c4b807a02115aa50f6c42e356205ccd
100644
--- a/src/ia32/lithium-codegen-ia32.h
+++ b/src/ia32/lithium-codegen-ia32.h
@@ -191,7 +191,7 @@ class LCodeGen BASE_EMBEDDED {
Scope* scope() const { return scope_; }
HGraph* graph() const { return chunk_->graph(); }
- int GetNextEmittedBlock(int block);
+ int GetNextEmittedBlock();
void EmitClassOfTest(Label* if_true,
Label* if_false,
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
77949313e129d4155277f55a5c193b8523b1677c..bf227a2f9158f6d433e418d2241c2d7cad464d04
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -1756,10 +1756,9 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
}
-int LCodeGen::GetNextEmittedBlock(int block) {
- for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
- LLabel* label = chunk_->GetLabel(i);
- if (!label->HasReplacement()) return i;
+int LCodeGen::GetNextEmittedBlock() {
+ for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
+ if (!chunk_->GetLabel(i)->HasReplacement()) return i;
}
return -1;
}
@@ -1767,7 +1766,7 @@ int LCodeGen::GetNextEmittedBlock(int block) {
void LCodeGen::EmitBranch(int left_block, int right_block,
Condition cc, Register src1, const Operand&
src2) {
- int next_block = GetNextEmittedBlock(current_block_);
+ int next_block = GetNextEmittedBlock();
right_block = chunk_->LookupDestination(right_block);
left_block = chunk_->LookupDestination(left_block);
if (right_block == left_block) {
@@ -1786,7 +1785,7 @@ void LCodeGen::EmitBranch(int left_block, int
right_block,
void LCodeGen::EmitBranchF(int left_block, int right_block,
Condition cc, FPURegister src1, FPURegister
src2) {
- int next_block = GetNextEmittedBlock(current_block_);
+ int next_block = GetNextEmittedBlock();
right_block = chunk_->LookupDestination(right_block);
left_block = chunk_->LookupDestination(left_block);
if (right_block == left_block) {
@@ -1916,10 +1915,9 @@ void LCodeGen::DoBranch(LBranch* instr) {
void LCodeGen::EmitGoto(int block) {
- block = chunk_->LookupDestination(block);
- int next_block = GetNextEmittedBlock(current_block_);
- if (block != next_block) {
- __ jmp(chunk_->GetAssemblyLabel(block));
+ int destination = chunk_->LookupDestination(block);
+ if (destination != GetNextEmittedBlock()) {
+ __ jmp(chunk_->GetAssemblyLabel(destination));
}
}
Index: src/mips/lithium-codegen-mips.h
diff --git a/src/mips/lithium-codegen-mips.h
b/src/mips/lithium-codegen-mips.h
index
9634aa65857ea6352e168bad59445cac1ce7c217..0dbfe65a40dbe85827d5ffbb7ffc822902942e1e
100644
--- a/src/mips/lithium-codegen-mips.h
+++ b/src/mips/lithium-codegen-mips.h
@@ -196,7 +196,7 @@ class LCodeGen BASE_EMBEDDED {
Register scratch1() { return kLithiumScratchReg2; }
DoubleRegister double_scratch0() { return kLithiumScratchDouble; }
- int GetNextEmittedBlock(int block);
+ int GetNextEmittedBlock();
LInstruction* GetNextInstruction();
void EmitClassOfTest(Label* if_true,
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
3e8fd5c72fb582ac662e6be50f6172ff97f91739..21b0fcdd3be357b20ccb853003dcc7d640bf9c73
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -1822,17 +1822,16 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) {
}
-int LCodeGen::GetNextEmittedBlock(int block) {
- for (int i = block + 1; i < graph()->blocks()->length(); ++i) {
- LLabel* label = chunk_->GetLabel(i);
- if (!label->HasReplacement()) return i;
+int LCodeGen::GetNextEmittedBlock() {
+ for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
+ if (!chunk_->GetLabel(i)->HasReplacement()) return i;
}
return -1;
}
void LCodeGen::EmitBranch(int left_block, int right_block, Condition cc) {
- int next_block = GetNextEmittedBlock(current_block_);
+ int next_block = GetNextEmittedBlock();
right_block = chunk_->LookupDestination(right_block);
left_block = chunk_->LookupDestination(left_block);
@@ -1962,10 +1961,9 @@ void LCodeGen::DoBranch(LBranch* instr) {
void LCodeGen::EmitGoto(int block) {
- block = chunk_->LookupDestination(block);
- int next_block = GetNextEmittedBlock(current_block_);
- if (block != next_block) {
- __ jmp(chunk_->GetAssemblyLabel(block));
+ int destination = chunk_->LookupDestination(block);
+ if (destination != GetNextEmittedBlock()) {
+ __ jmp(chunk_->GetAssemblyLabel(destination));
}
}
Index: src/x64/lithium-codegen-x64.h
diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h
index
3cad2cc91d3e5417b28e4174a8208a9a4f14b875..a988a7af0cfdc3543f4223f68ad6903027118d8f
100644
--- a/src/x64/lithium-codegen-x64.h
+++ b/src/x64/lithium-codegen-x64.h
@@ -162,7 +162,7 @@ class LCodeGen BASE_EMBEDDED {
Scope* scope() const { return scope_; }
HGraph* graph() const { return chunk_->graph(); }
- int GetNextEmittedBlock(int block);
+ int GetNextEmittedBlock();
void EmitClassOfTest(Label* if_true,
Label* if_false,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.