Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 4044f7fff130bc71fa0378dc105d10ac7fd044d5..06005cd5cf479d18d410e0285eba2d786ac1574d 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3734,6 +3734,29 @@ HInstruction* HGraphBuilder::BuildLoadKeyedFastElement(HValue* object, |
} |
+HInstruction* HGraphBuilder::BuildLoadKeyedPixelArrayElement(HValue* object, |
+ HValue* key, |
+ Property* expr) { |
+ ASSERT(!expr->key()->IsPropertyName() && expr->IsMonomorphic()); |
+ AddInstruction(new HCheckNonSmi(object)); |
+ Handle<Map> map = expr->GetMonomorphicReceiverType(); |
+ ASSERT(!map->has_fast_elements()); |
+ ASSERT(map->has_pixel_array_elements()); |
+ AddInstruction(new HCheckMap(object, map)); |
+ HLoadElements* elements = new HLoadElements(object); |
+ AddInstruction(elements); |
+ HInstruction* length = AddInstruction(new HPixelArrayLength(elements)); |
+ AddInstruction(new HBoundsCheck(key, length)); |
+ HLoadPixelArrayExternalPointer* external_elements = |
+ new HLoadPixelArrayExternalPointer(elements); |
+ AddInstruction(external_elements); |
+ HLoadPixelArrayElement* pixel_array_value = new HLoadPixelArrayElement( |
Mads Ager (chromium)
2011/02/07 11:36:06
Move everything to a new line?
danno
2011/02/08 09:25:57
Done.
|
+ external_elements, |
+ key); |
+ return pixel_array_value; |
+} |
+ |
+ |
HInstruction* HGraphBuilder::BuildStoreKeyedGeneric(HValue* object, |
HValue* key, |
HValue* value) { |
@@ -3841,12 +3864,17 @@ void HGraphBuilder::VisitProperty(Property* expr) { |
HValue* key = Pop(); |
HValue* obj = Pop(); |
- bool is_fast_elements = expr->IsMonomorphic() && |
- expr->GetMonomorphicReceiverType()->has_fast_elements(); |
- |
- instr = is_fast_elements |
- ? BuildLoadKeyedFastElement(obj, key, expr) |
- : BuildLoadKeyedGeneric(obj, key); |
+ if (expr->IsMonomorphic()) { |
+ Handle<Map> receiver_type(expr->GetMonomorphicReceiverType()); |
+ if (receiver_type->has_pixel_array_elements()) { |
Kevin Millikin (Chromium)
2011/02/07 12:39:08
I guess from the assert above that it's the case t
danno
2011/02/08 09:25:57
Done.
|
+ instr = BuildLoadKeyedPixelArrayElement(obj, key, expr); |
+ } else if (receiver_type->has_fast_elements()) { |
+ instr = BuildLoadKeyedFastElement(obj, key, expr); |
+ } |
+ } |
+ if (instr == NULL) { |
+ instr = BuildLoadKeyedGeneric(obj, key); |
+ } |
} |
instr->set_position(expr->position()); |
ast_context()->ReturnInstruction(instr, expr->id()); |