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

Unified Diff: src/ia32/lithium-codegen-ia32.cc

Issue 7608020: Use immediates when possible for HBoundsCheck and HLoadKeyedFastElement (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.h » ('j') | src/x64/lithium-codegen-x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
index c0f4e71caa4a42cd0f2bb7033204762997275960..93299250ae85d51c742653c6145b35fbf4aaaf34 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -2303,15 +2303,19 @@ void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Register elements = ToRegister(instr->elements());
- Register key = ToRegister(instr->key());
Register result = ToRegister(instr->result());
- ASSERT(result.is(elements));
// Load the result.
- __ mov(result, FieldOperand(elements,
- key,
- times_pointer_size,
- FixedArray::kHeaderSize));
+ if (instr->key()->IsConstantOperand()) {
+ int key = ToInteger32(LConstantOperand::cast(instr->key()));
+ __ mov(result, FieldOperand(
+ elements, (key << times_pointer_size) + FixedArray::kHeaderSize));
danno 2011/08/10 11:03:46 overflow check in the spirit of lithium-codegen-ia
Jakob Kummerow 2011/08/10 12:22:48 Done (by using BuildFastArrayOperand).
+ } else {
+ __ mov(result, FieldOperand(elements,
+ ToRegister(instr->key()),
+ times_pointer_size,
+ FixedArray::kHeaderSize));
+ }
// Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) {
@@ -3108,8 +3112,14 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
- __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
- DeoptimizeIf(above_equal, instr->environment());
+ if (instr->index()->IsConstantOperand()) {
+ __ cmp(ToOperand(instr->length()),
+ ToImmediate(LConstantOperand::cast(instr->index())));
+ DeoptimizeIf(below_equal, instr->environment());
danno 2011/08/10 11:03:46 overflow check in the spirit of lithium-codegen-ia
Jakob Kummerow 2011/08/10 12:22:48 As discussed offline, nothing to overflow-check he
+ } else {
+ __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
+ DeoptimizeIf(above_equal, instr->environment());
+ }
}
« no previous file with comments | « no previous file | src/ia32/lithium-ia32.h » ('j') | src/x64/lithium-codegen-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698