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

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

Issue 636893002: [turbofan] Drop broken StaticParameterTraits. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix typo... Created 6 years, 2 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/js-operator.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-operator.cc
diff --git a/src/compiler/js-operator.cc b/src/compiler/js-operator.cc
index a10bcdaf97f2043a67fa0bfe5466d5cc8111b90e..e0ce3de2b3aca08c7076eb852b9e145411d44a4a 100644
--- a/src/compiler/js-operator.cc
+++ b/src/compiler/js-operator.cc
@@ -14,12 +14,56 @@ namespace v8 {
namespace internal {
namespace compiler {
+bool operator==(CallFunctionParameters const& lhs,
+ CallFunctionParameters const& rhs) {
+ return lhs.arity() == rhs.arity() && lhs.flags() == rhs.flags();
+}
+
+
+bool operator!=(CallFunctionParameters const& lhs,
+ CallFunctionParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(CallFunctionParameters const& p) {
+ return base::hash_combine(p.arity(), p.flags());
+}
+
+
+std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) {
+ return os << p.arity() << ", " << p.flags();
+}
+
+
const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode());
return OpParameter<CallFunctionParameters>(op);
}
+bool operator==(CallRuntimeParameters const& lhs,
+ CallRuntimeParameters const& rhs) {
+ return lhs.id() == rhs.id() && lhs.arity() == rhs.arity();
+}
+
+
+bool operator!=(CallRuntimeParameters const& lhs,
+ CallRuntimeParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(CallRuntimeParameters const& p) {
+ return base::hash_combine(p.id(), p.arity());
+}
+
+
+std::ostream& operator<<(std::ostream& os, CallRuntimeParameters const& p) {
+ return os << p.id() << ", " << p.arity();
+}
+
+
const CallRuntimeParameters& CallRuntimeParametersOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSCallRuntime, op->opcode());
return OpParameter<CallRuntimeParameters>(op);
@@ -35,64 +79,90 @@ ContextAccess::ContextAccess(size_t depth, size_t index, bool immutable)
}
-bool operator==(const ContextAccess& lhs, const ContextAccess& rhs) {
+bool operator==(ContextAccess const& lhs, ContextAccess const& rhs) {
return lhs.depth() == rhs.depth() && lhs.index() == rhs.index() &&
lhs.immutable() == rhs.immutable();
}
-bool operator!=(const ContextAccess& lhs, const ContextAccess& rhs) {
+bool operator!=(ContextAccess const& lhs, ContextAccess const& rhs) {
return !(lhs == rhs);
}
-const ContextAccess& ContextAccessOf(const Operator* op) {
+size_t hash_value(ContextAccess const& access) {
+ return base::hash_combine(access.depth(), access.index(), access.immutable());
+}
+
+
+std::ostream& operator<<(std::ostream& os, ContextAccess const& access) {
+ return os << access.depth() << ", " << access.index() << ", "
+ << access.immutable();
+}
+
+
+ContextAccess const& ContextAccessOf(Operator const* op) {
DCHECK(op->opcode() == IrOpcode::kJSLoadContext ||
op->opcode() == IrOpcode::kJSStoreContext);
return OpParameter<ContextAccess>(op);
}
+bool operator==(LoadNamedParameters const& lhs,
+ LoadNamedParameters const& rhs) {
+ return lhs.name() == rhs.name() &&
+ lhs.contextual_mode() == rhs.contextual_mode();
+}
+
+
+bool operator!=(LoadNamedParameters const& lhs,
+ LoadNamedParameters const& rhs) {
+ return !(lhs == rhs);
+}
+
+
+size_t hash_value(LoadNamedParameters const& p) {
+ return base::hash_combine(p.name(), p.contextual_mode());
+}
+
+
+std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) {
+ return os << Brief(*p.name().handle()) << ", " << p.contextual_mode();
+}
+
+
const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode());
return OpParameter<LoadNamedParameters>(op);
}
-const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
- DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode());
- return OpParameter<StoreNamedParameters>(op);
+bool operator==(StoreNamedParameters const& lhs,
+ StoreNamedParameters const& rhs) {
+ return lhs.strict_mode() == rhs.strict_mode() && lhs.name() == rhs.name();
}
-// Specialization for static parameters of type {ContextAccess}.
-template <>
-struct StaticParameterTraits<ContextAccess> {
- static std::ostream& PrintTo(std::ostream& os, const ContextAccess& access) {
- return os << access.depth() << "," << access.index()
- << (access.immutable() ? ",imm" : "");
- }
- static int HashCode(const ContextAccess& access) {
- return static_cast<int>((access.depth() << 16) | (access.index() & 0xffff));
- }
- static bool Equals(const ContextAccess& lhs, const ContextAccess& rhs) {
- return lhs == rhs;
- }
-};
+bool operator!=(StoreNamedParameters const& lhs,
+ StoreNamedParameters const& rhs) {
+ return !(lhs == rhs);
+}
-// Specialization for static parameters of type {Runtime::FunctionId}.
-template <>
-struct StaticParameterTraits<Runtime::FunctionId> {
- static std::ostream& PrintTo(std::ostream& os, Runtime::FunctionId val) {
- const Runtime::Function* f = Runtime::FunctionForId(val);
- return os << (f->name ? f->name : "?Runtime?");
- }
- static int HashCode(Runtime::FunctionId val) { return static_cast<int>(val); }
- static bool Equals(Runtime::FunctionId a, Runtime::FunctionId b) {
- return a == b;
- }
-};
+size_t hash_value(StoreNamedParameters const& p) {
+ return base::hash_combine(p.strict_mode(), p.name());
+}
+
+
+std::ostream& operator<<(std::ostream& os, StoreNamedParameters const& p) {
+ return os << p.strict_mode() << ", " << Brief(*p.name().handle());
+}
+
+
+const StoreNamedParameters& StoreNamedParametersOf(const Operator* op) {
+ DCHECK_EQ(IrOpcode::kJSStoreNamed, op->opcode());
+ return OpParameter<StoreNamedParameters>(op);
+}
#define SHARED_OP_LIST(V) \
@@ -241,9 +311,9 @@ const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) {
const Operator* JSOperatorBuilder::CreateCatchContext(
const Unique<String>& name) {
- return new (zone()) Operator1<Unique<String> >(
- IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, 1, 1,
- "JSCreateCatchContext", name);
+ return new (zone()) Operator1<Unique<String>>(IrOpcode::kJSCreateCatchContext,
+ Operator::kNoProperties, 1, 1,
+ "JSCreateCatchContext", name);
}
} // namespace compiler
« no previous file with comments | « src/compiler/js-operator.h ('k') | src/compiler/machine-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698