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

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

Issue 2509623002: [turbofan] Sparse representation for state values (Closed)
Patch Set: Remove the optimized_out input entirely, return nullptr when iterating Created 4 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
Index: src/compiler/common-operator.cc
diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc
index 9ce6f71a0f9949bb9b4ddc04ee2e76ed1e2f413f..974930d76a74c29c2ca05576b50caae3e35086fb 100644
--- a/src/compiler/common-operator.cc
+++ b/src/compiler/common-operator.cc
@@ -12,6 +12,13 @@
#include "src/handles-inl.h"
#include "src/zone/zone.h"
+namespace std {
+template <typename T, typename S>
+ostream& operator<<(ostream& o, const pair<T, S>& p) {
+ return o << "(" << p.first << ", " << p.second << ")";
+}
+}
+
namespace v8 {
namespace internal {
namespace compiler {
@@ -238,6 +245,12 @@ OsrGuardType OsrGuardTypeOf(Operator const* op) {
ZoneVector<MachineType> const* MachineTypesOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kTypedObjectState ||
op->opcode() == IrOpcode::kTypedStateValues);
+
+ if (op->opcode() == IrOpcode::kTypedStateValues) {
+ const ZoneVector<MachineType>* types =
+ OpParameter<std::pair<const ZoneVector<MachineType>*, uint32_t>>(op)
+ .first;
Jarin 2016/11/16 15:32:42 This is confusing - where is 'types' used? Should
Leszek Swirski 2016/11/17 09:23:04 Whoops, yes it should. Bad rebase. I think the bel
+ }
return OpParameter<const ZoneVector<MachineType>*>(op);
}
@@ -588,13 +601,14 @@ struct CommonOperatorGlobalCache final {
#undef CACHED_PROJECTION
template <int kInputCount>
- struct StateValuesOperator final : public Operator {
+ struct StateValuesOperator final : public Operator1<uint32_t> {
StateValuesOperator()
- : Operator( // --
- IrOpcode::kStateValues, // opcode
- Operator::kPure, // flags
- "StateValues", // name
- kInputCount, 0, 0, 1, 0, 0) {} // counts
+ : Operator1<uint32_t>( // --
+ IrOpcode::kStateValues, // opcode
+ Operator::kPure, // flags
+ "StateValues", // name
+ kInputCount, 0, 0, 1, 0, 0, // counts
+ 0) {} // parameter
};
#define CACHED_STATE_VALUES(input_count) \
StateValuesOperator<input_count> kStateValues##input_count##Operator;
@@ -1000,30 +1014,36 @@ const Operator* CommonOperatorBuilder::BeginRegion(
return nullptr;
}
-const Operator* CommonOperatorBuilder::StateValues(int arguments) {
- switch (arguments) {
+const Operator* CommonOperatorBuilder::StateValues(int arguments,
+ uint32_t bitmask) {
+ if (bitmask == 0) {
+ switch (arguments) {
#define CACHED_STATE_VALUES(arguments) \
case arguments: \
return &cache_.kStateValues##arguments##Operator;
- CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES)
+ CACHED_STATE_VALUES_LIST(CACHED_STATE_VALUES)
#undef CACHED_STATE_VALUES
- default:
- break;
+ default:
+ break;
+ }
}
+
// Uncached.
- return new (zone()) Operator( // --
+ return new (zone()) Operator1<uint32_t>( // --
IrOpcode::kStateValues, Operator::kPure, // opcode
"StateValues", // name
- arguments, 0, 0, 1, 0, 0); // counts
+ arguments, 0, 0, 1, 0, 0, // counts
+ bitmask); // parameter
}
const Operator* CommonOperatorBuilder::TypedStateValues(
- const ZoneVector<MachineType>* types) {
- return new (zone()) Operator1<const ZoneVector<MachineType>*>( // --
- IrOpcode::kTypedStateValues, Operator::kPure, // opcode
- "TypedStateValues", // name
- static_cast<int>(types->size()), 0, 0, 1, 0, 0, // counts
- types); // parameter
+ const ZoneVector<MachineType>* types, uint32_t bitmask) {
+ return new (zone())
+ Operator1<std::pair<const ZoneVector<MachineType>*, uint32_t>>( // --
+ IrOpcode::kTypedStateValues, Operator::kPure, // opcode
+ "TypedStateValues", // name
+ static_cast<int>(types->size()), 0, 0, 1, 0, 0, // counts
+ std::make_pair(types, bitmask)); // parameters
}
const Operator* CommonOperatorBuilder::ObjectState(int pointer_slots) {

Powered by Google App Engine
This is Rietveld 408576698