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

Unified Diff: src/compiler/simplified-operator.h

Issue 516853002: Preliminary lowering of typed array loads in TF. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixups after rebase. Created 6 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/compiler/pipeline.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.h
diff --git a/src/compiler/simplified-operator.h b/src/compiler/simplified-operator.h
index a048b62d95806a71df44625841f86a34ea188c9f..c2ca942bef565caa4bdda5691885fef7e95c5990 100644
--- a/src/compiler/simplified-operator.h
+++ b/src/compiler/simplified-operator.h
@@ -94,6 +94,55 @@ inline const ElementAccess ElementAccessOf(Operator* op) {
}
+// This access helper provides a set of static methods constructing commonly
+// used FieldAccess and ElementAccess descriptors.
+class Access : public AllStatic {
+ public:
+ // Provides access to JSObject::elements() field.
+ static FieldAccess ForJSObjectElements() {
+ return {kTaggedBase, JSObject::kElementsOffset, Handle<Name>(),
+ Type::Internal(), kMachAnyTagged};
+ }
+
+ // Provides access to ExternalArray::external_pointer() field.
+ static FieldAccess ForExternalArrayPointer() {
+ return {kTaggedBase, ExternalArray::kExternalPointerOffset, Handle<Name>(),
+ Type::UntaggedPtr(), kMachPtr};
+ }
+
+ // Provides access to Fixed{type}TypedArray and External{type}Array elements.
+ static ElementAccess ForTypedArrayElement(ExternalArrayType type,
+ bool is_external) {
+ BaseTaggedness taggedness = is_external ? kUntaggedBase : kTaggedBase;
+ int header_size = is_external ? 0 : FixedTypedArrayBase::kDataOffset;
+ switch (type) {
+ case kExternalInt8Array:
+ return {taggedness, header_size, Type::Signed32(), kMachInt8};
+ case kExternalUint8Array:
+ case kExternalUint8ClampedArray:
+ return {taggedness, header_size, Type::Unsigned32(), kMachUint8};
+ case kExternalInt16Array:
+ return {taggedness, header_size, Type::Signed32(), kMachInt16};
+ case kExternalUint16Array:
+ return {taggedness, header_size, Type::Unsigned32(), kMachUint16};
+ case kExternalInt32Array:
+ return {taggedness, header_size, Type::Signed32(), kMachInt32};
+ case kExternalUint32Array:
+ return {taggedness, header_size, Type::Unsigned32(), kMachUint32};
+ case kExternalFloat32Array:
+ return {taggedness, header_size, Type::Number(), kRepFloat32};
+ case kExternalFloat64Array:
+ return {taggedness, header_size, Type::Number(), kRepFloat64};
+ }
+ UNREACHABLE();
+ return {kUntaggedBase, 0, Type::None(), kMachNone};
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Access);
+};
+
+
// Interface for building simplified operators, which represent the
// medium-level operations of V8, including adding numbers, allocating objects,
// indexing into objects and arrays, etc.
« no previous file with comments | « src/compiler/pipeline.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698