Commit c554faa7 authored by ager@chromium.org's avatar ager@chromium.org

X64: Implement FixedArrayLength, BoundsCheck, LoadElements,

LoadKeyedFastElement in lithium codegen.

Tested locally by hardcoding DoTaggedToI to convert smis to untagged.

Review URL: http://codereview.chromium.org/6312124

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6625 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8cdcbd70
...@@ -668,7 +668,9 @@ void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) { ...@@ -668,7 +668,9 @@ void LCodeGen::DoJSArrayLength(LJSArrayLength* instr) {
void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) { void LCodeGen::DoFixedArrayLength(LFixedArrayLength* instr) {
Abort("Unimplemented: %s", "DoFixedArrayLength"); Register result = ToRegister(instr->result());
Register array = ToRegister(instr->InputAt(0));
__ movq(result, FieldOperand(array, FixedArray::kLengthOffset));
} }
...@@ -1446,7 +1448,19 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { ...@@ -1446,7 +1448,19 @@ void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) {
void LCodeGen::DoLoadElements(LLoadElements* instr) { void LCodeGen::DoLoadElements(LLoadElements* instr) {
Abort("Unimplemented: %s", "DoLoadElements"); ASSERT(instr->result()->Equals(instr->InputAt(0)));
Register reg = ToRegister(instr->InputAt(0));
__ movq(reg, FieldOperand(reg, JSObject::kElementsOffset));
if (FLAG_debug_code) {
NearLabel done;
__ Cmp(FieldOperand(reg, HeapObject::kMapOffset),
Factory::fixed_array_map());
__ j(equal, &done);
__ Cmp(FieldOperand(reg, HeapObject::kMapOffset),
Factory::fixed_cow_array_map());
__ Check(equal, "Check for fast elements failed.");
__ bind(&done);
}
} }
...@@ -1456,7 +1470,20 @@ void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { ...@@ -1456,7 +1470,20 @@ void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
Abort("Unimplemented: %s", "DoLoadKeyedFastElement"); 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));
// Check for the hole value.
__ Cmp(result, Factory::the_hole_value());
DeoptimizeIf(equal, instr->environment());
} }
...@@ -1691,7 +1718,12 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { ...@@ -1691,7 +1718,12 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
Abort("Unimplemented: %s", "DoBoundsCheck"); if (instr->length()->IsRegister()) {
__ cmpq(ToRegister(instr->index()), ToRegister(instr->length()));
} else {
__ cmpq(ToRegister(instr->index()), ToOperand(instr->length()));
}
DeoptimizeIf(above_equal, instr->environment());
} }
......
...@@ -1325,8 +1325,8 @@ LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) { ...@@ -1325,8 +1325,8 @@ LInstruction* LChunkBuilder::DoJSArrayLength(HJSArrayLength* instr) {
LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) { LInstruction* LChunkBuilder::DoFixedArrayLength(HFixedArrayLength* instr) {
Abort("Unimplemented: %s", "DoFixedArrayLength"); LOperand* array = UseRegisterAtStart(instr->value());
return NULL; return DefineAsRegister(new LFixedArrayLength(array));
} }
...@@ -1337,8 +1337,8 @@ LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) { ...@@ -1337,8 +1337,8 @@ LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
Abort("Unimplemented: %s", "DoBoundsCheck"); return AssignEnvironment(new LBoundsCheck(UseRegisterAtStart(instr->index()),
return NULL; Use(instr->length())));
} }
...@@ -1523,15 +1523,19 @@ LInstruction* LChunkBuilder::DoLoadFunctionPrototype( ...@@ -1523,15 +1523,19 @@ LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) { LInstruction* LChunkBuilder::DoLoadElements(HLoadElements* instr) {
Abort("Unimplemented: %s", "DoLoadElements"); LOperand* input = UseRegisterAtStart(instr->value());
return NULL; return DefineSameAsFirst(new LLoadElements(input));
} }
LInstruction* LChunkBuilder::DoLoadKeyedFastElement( LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
HLoadKeyedFastElement* instr) { HLoadKeyedFastElement* instr) {
Abort("Unimplemented: %s", "DoLoadKeyedFastElement"); ASSERT(instr->representation().IsTagged());
return NULL; ASSERT(instr->key()->representation().IsInteger32());
LOperand* obj = UseRegisterAtStart(instr->object());
LOperand* key = UseRegisterAtStart(instr->key());
LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key);
return AssignEnvironment(DefineSameAsFirst(result));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment