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

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

Issue 768543002: [WIP] TrapHandler 2014/11/27. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/simplified-operator.h ('k') | src/compiler/simplified-operator-reducer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-operator.cc
diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc
index 15b34f9b9be5b62b2a010f34583b52ec12b0af49..bcf92340329840931d577a1eec53e4017caf0a04 100644
--- a/src/compiler/simplified-operator.cc
+++ b/src/compiler/simplified-operator.cc
@@ -57,15 +57,11 @@ std::ostream& operator<<(std::ostream& os, FieldAccess const& access) {
}
-std::ostream& operator<<(std::ostream& os, BoundsCheckMode bounds_check_mode) {
- switch (bounds_check_mode) {
- case kNoBoundsCheck:
- return os << "no bounds check";
- case kTypedArrayBoundsCheck:
- return os << "ignore out of bounds";
- }
- UNREACHABLE();
- return os;
+const FieldAccess& FieldAccessOf(const Operator* op) {
+ DCHECK_NOT_NULL(op);
+ DCHECK(op->opcode() == IrOpcode::kLoadField ||
+ op->opcode() == IrOpcode::kStoreField);
+ return OpParameter<FieldAccess>(op);
}
@@ -90,19 +86,11 @@ size_t hash_value(ElementAccess const& access) {
std::ostream& operator<<(std::ostream& os, ElementAccess const& access) {
os << access.base_is_tagged << ", " << access.header_size << ", ";
access.type->PrintTo(os);
- os << ", " << access.machine_type << ", " << access.bounds_check;
+ os << ", " << access.machine_type;
return os;
}
-const FieldAccess& FieldAccessOf(const Operator* op) {
- DCHECK_NOT_NULL(op);
- DCHECK(op->opcode() == IrOpcode::kLoadField ||
- op->opcode() == IrOpcode::kStoreField);
- return OpParameter<FieldAccess>(op);
-}
-
-
const ElementAccess& ElementAccessOf(const Operator* op) {
DCHECK_NOT_NULL(op);
DCHECK(op->opcode() == IrOpcode::kLoadElement ||
@@ -111,6 +99,70 @@ const ElementAccess& ElementAccessOf(const Operator* op) {
}
+MachineType BufferAccess::machine_type() const {
+ switch (external_array_type()) {
+ case kExternalInt8Array:
+ return kMachInt8;
+ case kExternalUint8Array:
+ case kExternalUint8ClampedArray:
+ return kMachUint8;
+ case kExternalInt16Array:
+ return kMachInt16;
+ case kExternalUint16Array:
+ return kMachUint16;
+ case kExternalInt32Array:
+ return kMachInt32;
+ case kExternalUint32Array:
+ return kMachUint32;
+ case kExternalFloat32Array:
+ return kMachFloat32;
+ case kExternalFloat64Array:
+ return kMachFloat64;
+ }
+ UNREACHABLE();
+ return kMachNone;
+}
+
+
+bool operator==(BufferAccess const& lhs, BufferAccess const& rhs) {
+ return lhs.external_array_type() == rhs.external_array_type() &&
+ lhs.guard_size() == rhs.guard_size();
+}
+
+
+bool operator!=(BufferAccess const& lhs, BufferAccess const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(BufferAccess const& access) {
+ return base::hash_combine(access.external_array_type(), access.guard_size());
+}
+
+
+std::ostream& operator<<(std::ostream& os, BufferAccess const& access) {
+ switch (access.external_array_type()) {
+#define CASE(Type, type, TYPE, c_type, element_size) \
+ case kExternal##Type##Array: \
+ os << #Type; \
+ break;
+ TYPED_ARRAYS(CASE)
+#undef CASE
+ }
+ if (access.guard_size()) {
+ os << "#" << access.guard_size();
+ }
+ return os;
+}
+
+
+BufferAccess const& BufferAccessOf(const Operator* op) {
+ DCHECK(op->opcode() == IrOpcode::kLoadBuffer ||
+ op->opcode() == IrOpcode::kStoreBuffer);
+ return OpParameter<BufferAccess>(op);
+}
+
+
#define PURE_OP_LIST(V) \
V(BooleanNot, Operator::kNoProperties, 1) \
V(BooleanToNumber, Operator::kNoProperties, 1) \
@@ -178,8 +230,10 @@ const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
#define ACCESS_OP_LIST(V) \
V(LoadField, FieldAccess, Operator::kNoWrite, 1, 1, 1) \
V(StoreField, FieldAccess, Operator::kNoRead, 2, 1, 0) \
- V(LoadElement, ElementAccess, Operator::kNoWrite, 3, 0, 1) \
- V(StoreElement, ElementAccess, Operator::kNoRead, 4, 1, 0)
+ V(LoadElement, ElementAccess, Operator::kNoWrite, 2, 1, 1) \
+ V(StoreElement, ElementAccess, Operator::kNoRead, 3, 1, 0) \
+ V(LoadBuffer, BufferAccess, Operator::kNoWrite, 3, 1, 1) \
+ V(StoreBuffer, BufferAccess, Operator::kNoRead, 4, 1, 0)
#define ACCESS(Name, Type, properties, value_input_count, control_input_count, \
@@ -193,6 +247,12 @@ const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) {
ACCESS_OP_LIST(ACCESS)
#undef ACCESS
+
+const Operator* SimplifiedOperatorBuilder::BoundsCheck(size_t guard) {
+ return new (zone()) Operator1<size_t>(IrOpcode::kBoundsCheck, Operator::kPure,
+ "BoundsCheck", 2, 0, 0, 1, 0, 0, guard);
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/simplified-operator.h ('k') | src/compiler/simplified-operator-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698