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

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

Issue 7608020: Use immediates when possible for HBoundsCheck and HLoadKeyedFastElement (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored as suggested 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 | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index ce6a9105f23abac7e1edf923ed559227e7692041..3d85022e135fd97c11ad72faef45813e696dc3ea 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -2305,16 +2305,13 @@ 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.
- __ movq(result, FieldOperand(elements,
- key,
- times_pointer_size,
- FixedArray::kHeaderSize));
+ __ movq(result,
+ BuildFastArrayOperand(instr->elements(), instr->key(),
+ JSObject::FAST_ELEMENTS,
+ FixedArray::kHeaderSize - kHeapObjectTag));
// Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) {
@@ -2348,22 +2345,22 @@ void LCodeGen::DoLoadKeyedFastDoubleElement(
Operand LCodeGen::BuildFastArrayOperand(
- LOperand* external_pointer,
+ LOperand* elements_pointer,
LOperand* key,
JSObject::ElementsKind elements_kind,
uint32_t offset) {
- Register external_pointer_reg = ToRegister(external_pointer);
+ Register elements_pointer_reg = ToRegister(elements_pointer);
int shift_size = ElementsKindToShiftSize(elements_kind);
if (key->IsConstantOperand()) {
int constant_value = ToInteger32(LConstantOperand::cast(key));
if (constant_value & 0xF0000000) {
Abort("array index constant value too big");
}
- return Operand(external_pointer_reg,
+ return Operand(elements_pointer_reg,
constant_value * (1 << shift_size) + offset);
} else {
ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
- return Operand(external_pointer_reg, ToRegister(key),
+ return Operand(elements_pointer_reg, ToRegister(key),
scale_factor, offset);
}
}
@@ -3137,12 +3134,22 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement(
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
- if (instr->length()->IsRegister()) {
- __ cmpq(ToRegister(instr->index()), ToRegister(instr->length()));
+ if (instr->index()->IsConstantOperand()) {
+ if (instr->length()->IsRegister()) {
+ __ cmpq(ToRegister(instr->length()),
+ Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
+ } else {
+ __ cmpq(ToOperand(instr->length()),
+ Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
+ }
} else {
- __ cmpq(ToRegister(instr->index()), ToOperand(instr->length()));
+ if (instr->length()->IsRegister()) {
+ __ cmpq(ToRegister(instr->length()), ToRegister(instr->index()));
+ } else {
+ __ cmpq(ToOperand(instr->length()), ToRegister(instr->index()));
+ }
}
- DeoptimizeIf(above_equal, instr->environment());
+ DeoptimizeIf(below_equal, instr->environment());
}
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698