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

Unified Diff: src/hydrogen-instructions.h

Issue 6656001: Support external arrays in Crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: stub out arm Created 9 years, 9 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
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index c08540f790c6130289dc2c49a916bfe8bf275558..a94cf1c22f79235bde3dcbadce96e0065d364edc 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -129,7 +129,7 @@ class LChunkBuilder;
V(LoadKeyedGeneric) \
V(LoadNamedField) \
V(LoadNamedGeneric) \
- V(LoadPixelArrayElement) \
+ V(LoadKeyedSpecializedArrayElement) \
V(Mod) \
V(Mul) \
V(ObjectLiteral) \
@@ -148,7 +148,7 @@ class LChunkBuilder;
V(StoreContextSlot) \
V(StoreGlobal) \
V(StoreKeyedFastElement) \
- V(StorePixelArrayElement) \
+ V(StoreKeyedSpecializedArrayElement) \
V(StoreKeyedGeneric) \
V(StoreNamedField) \
V(StoreNamedGeneric) \
@@ -170,7 +170,7 @@ class LChunkBuilder;
V(InobjectFields) \
V(BackingStoreFields) \
V(ArrayElements) \
- V(PixelArrayElements) \
+ V(SpecializedArrayElements) \
V(GlobalVars) \
V(Maps) \
V(ArrayLengths) \
@@ -1585,7 +1585,7 @@ class HLoadExternalArrayPointer: public HUnaryOperation {
: HUnaryOperation(value) {
set_representation(Representation::External());
// The result of this instruction is idempotent as long as its inputs don't
- // change. The external array of a pixel array elements object cannot
+ // change. The external array of a specialized array elements object cannot
// change once set, so it's no necessary to introduce any additional
// dependencies on top of the inputs.
SetFlag(kUseGVN);
@@ -3044,13 +3044,20 @@ class HLoadKeyedFastElement: public HBinaryOperation {
};
-class HLoadPixelArrayElement: public HBinaryOperation {
+class HLoadKeyedSpecializedArrayElement: public HBinaryOperation {
public:
- HLoadPixelArrayElement(HValue* external_elements, HValue* key)
- : HBinaryOperation(external_elements, key) {
- set_representation(Representation::Integer32());
- SetFlag(kDependsOnPixelArrayElements);
- // Native code could change the pixel array.
+ HLoadKeyedSpecializedArrayElement(HValue* external_elements,
+ HValue* key,
+ ExternalArrayType array_type)
+ : HBinaryOperation(external_elements, key),
+ array_type_(array_type) {
+ if (array_type == kExternalFloatArray) {
+ set_representation(Representation::Double());
+ } else {
+ set_representation(Representation::Integer32());
+ }
+ SetFlag(kDependsOnSpecializedArrayElements);
+ // Native code could change the specialized array.
SetFlag(kDependsOnCalls);
SetFlag(kUseGVN);
}
@@ -3066,12 +3073,16 @@ class HLoadPixelArrayElement: public HBinaryOperation {
HValue* external_pointer() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
+ ExternalArrayType array_type() const { return array_type_; }
- DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement,
- "load_pixel_array_element")
+ DECLARE_CONCRETE_INSTRUCTION(LoadKeyedSpecializedArrayElement,
+ "load_keyed_specialized_array_element")
protected:
virtual bool DataEquals(HValue* other) { return true; }
Kevin Millikin (Chromium) 2011/03/24 11:21:00 This function needs to compare the two array types
danno 2011/03/24 13:18:38 good catch. done.
+
+ private:
+ ExternalArrayType array_type_;
};
@@ -3206,10 +3217,14 @@ class HStoreKeyedFastElement: public HTemplateInstruction<3> {
};
-class HStorePixelArrayElement: public HTemplateInstruction<3> {
+class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> {
public:
- HStorePixelArrayElement(HValue* external_elements, HValue* key, HValue* val) {
- SetFlag(kChangesPixelArrayElements);
+ HStoreKeyedSpecializedArrayElement(HValue* external_elements,
+ HValue* key,
+ HValue* val,
+ ExternalArrayType array_type)
+ : array_type_(array_type) {
+ SetFlag(kChangesSpecializedArrayElements);
SetOperandAt(0, external_elements);
SetOperandAt(1, key);
SetOperandAt(2, val);
@@ -3221,16 +3236,23 @@ class HStorePixelArrayElement: public HTemplateInstruction<3> {
if (index == 0) {
return Representation::External();
} else {
- return Representation::Integer32();
+ if (index == 2 && array_type() == kExternalFloatArray) {
+ return Representation::Double();
+ } else {
+ return Representation::Integer32();
+ }
}
}
HValue* external_pointer() { return OperandAt(0); }
HValue* key() { return OperandAt(1); }
HValue* value() { return OperandAt(2); }
+ ExternalArrayType array_type() const { return array_type_; }
- DECLARE_CONCRETE_INSTRUCTION(StorePixelArrayElement,
- "store_pixel_array_element")
+ DECLARE_CONCRETE_INSTRUCTION(StoreKeyedSpecializedArrayElement,
+ "store_keyed_specialized_array_element")
+ private:
+ ExternalArrayType array_type_;
};

Powered by Google App Engine
This is Rietveld 408576698