Remove deprecated PrintableUnique.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/543743002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23697 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2014-09-04 13:45:05 +00:00
parent 2b6f5d6a9a
commit 4539e9b936
18 changed files with 93 additions and 180 deletions

View File

@ -900,7 +900,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
if (property->emit_store()) {
VisitForValue(property->value());
Node* value = environment()->Pop();
PrintableUnique<Name> name = MakeUnique(key->AsPropertyName());
Unique<Name> name = MakeUnique(key->AsPropertyName());
Node* store = NewNode(javascript()->StoreNamed(strict_mode(), name),
literal, value);
PrepareFrameState(store, key->id());
@ -1025,7 +1025,7 @@ void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
VisitForValue(property->obj());
Node* object = environment()->Pop();
value = environment()->Pop();
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
Node* store =
NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
@ -1084,7 +1084,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
}
case NAMED_PROPERTY: {
Node* object = environment()->Top();
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
old_value = NewNode(javascript()->LoadNamed(name), object);
PrepareFrameState(old_value, property->LoadId(), kPushOutput);
@ -1120,7 +1120,7 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
}
case NAMED_PROPERTY: {
Node* object = environment()->Pop();
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
Node* store =
NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
@ -1165,8 +1165,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) {
if (expr->key()->IsPropertyName()) {
VisitForValue(expr->obj());
Node* object = environment()->Pop();
PrintableUnique<Name> name =
MakeUnique(expr->key()->AsLiteral()->AsPropertyName());
Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName());
value = NewNode(javascript()->LoadNamed(name), object);
} else {
VisitForValue(expr->obj());
@ -1212,7 +1211,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
VisitForValue(property->obj());
Node* object = environment()->Top();
if (property->key()->IsPropertyName()) {
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
callee_value = NewNode(javascript()->LoadNamed(name), object);
} else {
@ -1302,7 +1301,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
// before arguments are being evaluated.
CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS;
Node* receiver_value = BuildLoadBuiltinsObject();
PrintableUnique<String> unique = MakeUnique(name);
Unique<String> unique = MakeUnique(name);
Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value);
// TODO(jarin): Find/create a bailout id to deoptimize to (crankshaft
// refuses to optimize functions with jsruntime calls).
@ -1385,7 +1384,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: {
VisitForValue(property->obj());
Node* object = environment()->Top();
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
old_value = NewNode(javascript()->LoadNamed(name), object);
PrepareFrameState(old_value, property->LoadId(), kPushOutput);
@ -1427,7 +1426,7 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
}
case NAMED_PROPERTY: {
Node* object = environment()->Pop();
PrintableUnique<Name> name =
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
Node* store =
NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
@ -1746,7 +1745,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
case Variable::UNALLOCATED: {
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
PrintableUnique<Name> name = MakeUnique(variable->name());
Unique<Name> name = MakeUnique(variable->name());
Operator* op = javascript()->LoadNamed(name, contextual_mode);
Node* node = NewNode(op, global);
PrepareFrameState(node, bailout_id, kPushOutput);
@ -1847,7 +1846,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
case Variable::UNALLOCATED: {
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
PrintableUnique<Name> name = MakeUnique(variable->name());
Unique<Name> name = MakeUnique(variable->name());
Operator* op = javascript()->StoreNamed(strict_mode(), name);
Node* store = NewNode(op, global, value);
PrepareFrameState(store, bailout_id);

View File

@ -87,8 +87,8 @@ class ChangeLoweringTest : public GraphTest {
Matcher<Node*> IsAllocateHeapNumber(const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher) {
return IsCall(
_, IsHeapConstant(PrintableUnique<HeapObject>::CreateImmovable(
zone(), CEntryStub(isolate(), 1).GetCode())),
_, IsHeapConstant(Unique<HeapObject>::CreateImmovable(
CEntryStub(isolate(), 1).GetCode())),
IsExternalConstant(ExternalReference(
Runtime::FunctionForId(Runtime::kAllocateHeapNumber), isolate())),
IsInt32Constant(0), IsNumberConstant(0.0), effect_matcher,

View File

@ -138,8 +138,8 @@ class CommonOperatorBuilder {
Operator1<double>(IrOpcode::kNumberConstant, Operator::kPure, 0, 1,
"NumberConstant", value);
}
Operator* HeapConstant(PrintableUnique<Object> value) {
return new (zone_) Operator1<PrintableUnique<Object> >(
Operator* HeapConstant(Unique<Object> value) {
return new (zone_) Operator1<Unique<Object> >(
IrOpcode::kHeapConstant, Operator::kPure, 0, 1, "HeapConstant", value);
}
Operator* Phi(int arguments) {
@ -289,23 +289,23 @@ struct CommonOperatorTraits<ExternalReference> {
};
template <typename T>
struct CommonOperatorTraits<PrintableUnique<T> > {
struct CommonOperatorTraits<Unique<T> > {
static inline bool HasValue(const Operator* op) {
return op->opcode() == IrOpcode::kHeapConstant;
}
static inline PrintableUnique<T> ValueOf(const Operator* op) {
static inline Unique<T> ValueOf(const Operator* op) {
CHECK_EQ(IrOpcode::kHeapConstant, op->opcode());
return OpParameter<PrintableUnique<T> >(op);
return OpParameter<Unique<T> >(op);
}
};
template <typename T>
struct CommonOperatorTraits<Handle<T> > {
static inline bool HasValue(const Operator* op) {
return CommonOperatorTraits<PrintableUnique<T> >::HasValue(op);
return CommonOperatorTraits<Unique<T> >::HasValue(op);
}
static inline Handle<T> ValueOf(const Operator* op) {
return CommonOperatorTraits<PrintableUnique<T> >::ValueOf(op).handle();
return CommonOperatorTraits<Unique<T> >::ValueOf(op).handle();
}
};

View File

@ -128,8 +128,8 @@ class StructuredGraphBuilder : public GraphBuilder {
// Helper to wrap a Handle<T> into a Unique<T>.
template <class T>
PrintableUnique<T> MakeUnique(Handle<T> object) {
return PrintableUnique<T>::CreateUninitialized(zone(), object);
Unique<T> MakeUnique(Handle<T> object) {
return Unique<T>::CreateUninitialized(object);
}
// Support for control flow builders. The concrete type of the environment

View File

@ -19,9 +19,8 @@ namespace internal {
// TODO(bmeurer): Find a new home for these functions.
template <typename T>
inline std::ostream& operator<<(std::ostream& os,
const PrintableUnique<T>& value) {
return os << value.string();
inline std::ostream& operator<<(std::ostream& os, const Unique<T>& value) {
return os << *value.handle();
}
inline std::ostream& operator<<(std::ostream& os,
const ExternalReference& value) {
@ -65,32 +64,32 @@ Node* GraphTest::NumberConstant(double value) {
}
Node* GraphTest::HeapConstant(const PrintableUnique<HeapObject>& value) {
Node* GraphTest::HeapConstant(const Unique<HeapObject>& value) {
return graph()->NewNode(common()->HeapConstant(value));
}
Node* GraphTest::FalseConstant() {
return HeapConstant(PrintableUnique<HeapObject>::CreateImmovable(
zone(), factory()->false_value()));
return HeapConstant(
Unique<HeapObject>::CreateImmovable(factory()->false_value()));
}
Node* GraphTest::TrueConstant() {
return HeapConstant(PrintableUnique<HeapObject>::CreateImmovable(
zone(), factory()->true_value()));
return HeapConstant(
Unique<HeapObject>::CreateImmovable(factory()->true_value()));
}
Matcher<Node*> GraphTest::IsFalseConstant() {
return IsHeapConstant(PrintableUnique<HeapObject>::CreateImmovable(
zone(), factory()->false_value()));
return IsHeapConstant(
Unique<HeapObject>::CreateImmovable(factory()->false_value()));
}
Matcher<Node*> GraphTest::IsTrueConstant() {
return IsHeapConstant(PrintableUnique<HeapObject>::CreateImmovable(
zone(), factory()->true_value()));
return IsHeapConstant(
Unique<HeapObject>::CreateImmovable(factory()->true_value()));
}
namespace {
@ -640,8 +639,8 @@ Matcher<Node*> IsExternalConstant(
Matcher<Node*> IsHeapConstant(
const Matcher<PrintableUnique<HeapObject> >& value_matcher) {
return MakeMatcher(new IsConstantMatcher<PrintableUnique<HeapObject> >(
const Matcher<Unique<HeapObject> >& value_matcher) {
return MakeMatcher(new IsConstantMatcher<Unique<HeapObject> >(
IrOpcode::kHeapConstant, value_matcher));
}

View File

@ -17,7 +17,7 @@ namespace internal {
// Forward declarations.
class HeapObject;
template <class T>
class PrintableUnique;
class Unique;
namespace compiler {
@ -35,7 +35,7 @@ class GraphTest : public TestWithContext, public TestWithZone {
Node* Int32Constant(int32_t value);
Node* Int64Constant(int64_t value);
Node* NumberConstant(double value);
Node* HeapConstant(const PrintableUnique<HeapObject>& value);
Node* HeapConstant(const Unique<HeapObject>& value);
Node* FalseConstant();
Node* TrueConstant();
@ -64,7 +64,7 @@ Matcher<Node*> IsFinish(const Matcher<Node*>& value_matcher,
Matcher<Node*> IsExternalConstant(
const Matcher<ExternalReference>& value_matcher);
Matcher<Node*> IsHeapConstant(
const Matcher<PrintableUnique<HeapObject> >& value_matcher);
const Matcher<Unique<HeapObject> >& value_matcher);
Matcher<Node*> IsFloat64Constant(const Matcher<double>& value_matcher);
Matcher<Node*> IsInt32Constant(const Matcher<int32_t>& value_matcher);
Matcher<Node*> IsInt64Constant(const Matcher<int64_t>& value_matcher);

View File

@ -11,8 +11,7 @@ namespace internal {
namespace compiler {
Node* JSGraph::ImmovableHeapConstant(Handle<Object> object) {
PrintableUnique<Object> unique =
PrintableUnique<Object>::CreateImmovable(zone(), object);
Unique<Object> unique = Unique<Object>::CreateImmovable(object);
return NewNode(common()->HeapConstant(unique));
}
@ -94,7 +93,7 @@ Node* JSGraph::NaNConstant() {
}
Node* JSGraph::HeapConstant(PrintableUnique<Object> value) {
Node* JSGraph::HeapConstant(Unique<Object> value) {
// TODO(turbofan): canonicalize heap constants using Unique<T>
return NewNode(common()->HeapConstant(value));
}
@ -104,13 +103,11 @@ Node* JSGraph::HeapConstant(Handle<Object> value) {
// TODO(titzer): We could also match against the addresses of immortable
// immovables here, even without access to the heap, thus always
// canonicalizing references to them.
// return HeapConstant(
// PrintableUnique<Object>::CreateUninitialized(zone(), value));
// return HeapConstant(Unique<Object>::CreateUninitialized(value));
// TODO(turbofan): This is a work-around to make Unique::HashCode() work for
// value numbering. We need some sane way to compute a unique hash code for
// arbitrary handles here.
PrintableUnique<Object> unique(
zone(), reinterpret_cast<Address>(*value.location()), value);
Unique<Object> unique(reinterpret_cast<Address>(*value.location()), value);
return HeapConstant(unique);
}

View File

@ -42,7 +42,7 @@ class JSGraph : public ZoneObject {
// Creates a HeapConstant node, possibly canonicalized, without inspecting the
// object.
Node* HeapConstant(PrintableUnique<Object> value);
Node* HeapConstant(Unique<Object> value);
// Creates a HeapConstant node, possibly canonicalized, and may access the
// heap to inspect the object.

View File

@ -40,7 +40,7 @@ class ContextAccess {
// Defines the property being loaded from an object by a named load. This is
// used as a parameter by JSLoadNamed operators.
struct LoadNamedParameters {
PrintableUnique<Name> name;
Unique<Name> name;
ContextualMode contextual_mode;
};
@ -55,7 +55,7 @@ struct CallParameters {
// used as a parameter by JSStoreNamed operators.
struct StoreNamedParameters {
StrictMode strict_mode;
PrintableUnique<Name> name;
Unique<Name> name;
};
// Interface for building JavaScript-level operators, e.g. directly from the
@ -124,7 +124,7 @@ class JSOperatorBuilder {
}
Operator* LoadProperty() { BINOP(JSLoadProperty); }
Operator* LoadNamed(PrintableUnique<Name> name,
Operator* LoadNamed(Unique<Name> name,
ContextualMode contextual_mode = NOT_CONTEXTUAL) {
LoadNamedParameters parameters = {name, contextual_mode};
OP1(JSLoadNamed, LoadNamedParameters, parameters, Operator::kNoProperties,
@ -136,7 +136,7 @@ class JSOperatorBuilder {
0);
}
Operator* StoreNamed(StrictMode strict_mode, PrintableUnique<Name> name) {
Operator* StoreNamed(StrictMode strict_mode, Unique<Name> name) {
StoreNamedParameters parameters = {strict_mode, name};
OP1(JSStoreNamed, StoreNamedParameters, parameters, Operator::kNoProperties,
2, 0);
@ -165,9 +165,9 @@ class JSOperatorBuilder {
// TODO(titzer): nail down the static parts of each of these context flavors.
Operator* CreateFunctionContext() { NOPROPS(JSCreateFunctionContext, 1, 1); }
Operator* CreateCatchContext(PrintableUnique<String> name) {
OP1(JSCreateCatchContext, PrintableUnique<String>, name,
Operator::kNoProperties, 1, 1);
Operator* CreateCatchContext(Unique<String> name) {
OP1(JSCreateCatchContext, Unique<String>, name, Operator::kNoProperties, 1,
1);
}
Operator* CreateWithContext() { NOPROPS(JSCreateWithContext, 2, 1); }
Operator* CreateBlockContext() { NOPROPS(JSCreateBlockContext, 2, 1); }

View File

@ -55,8 +55,7 @@ class MachineNodeFactory {
return NEW_NODE_0(COMMON()->Float64Constant(value));
}
Node* HeapConstant(Handle<Object> object) {
PrintableUnique<Object> val =
PrintableUnique<Object>::CreateUninitialized(ZONE(), object);
Unique<Object> val = Unique<Object>::CreateUninitialized(object);
return NEW_NODE_0(COMMON()->HeapConstant(val));
}

View File

@ -94,13 +94,12 @@ typedef FloatMatcher<double> Float64Matcher;
// A pattern matcher for heap object constants.
struct HeapObjectMatcher FINAL
: public ValueMatcher<PrintableUnique<HeapObject> > {
struct HeapObjectMatcher FINAL : public ValueMatcher<Handle<HeapObject> > {
explicit HeapObjectMatcher(Node* node)
: ValueMatcher<PrintableUnique<HeapObject> >(node) {}
: ValueMatcher<Handle<HeapObject> >(node) {}
bool IsKnownGlobal(HeapObject* global) const {
return HasValue() && Value().IsKnownGlobal(global);
bool IsKnownGlobal(Handle<HeapObject> global) const {
return HasValue() && Value().is_identical_to(global);
}
};

View File

@ -178,32 +178,26 @@ struct StaticParameterTraits<double> {
}
};
// Specialization for static parameters of type {PrintableUnique<Object>}.
// Specialization for static parameters of type {Unique<Object>}.
template <>
struct StaticParameterTraits<PrintableUnique<Object> > {
static OStream& PrintTo(OStream& os, PrintableUnique<Object> val) { // NOLINT
return os << val.string();
struct StaticParameterTraits<Unique<Object> > {
static OStream& PrintTo(OStream& os, Unique<Object> val) { // NOLINT
return os << Brief(*val.handle());
}
static int HashCode(PrintableUnique<Object> a) {
static int HashCode(Unique<Object> a) {
return static_cast<int>(a.Hashcode());
}
static bool Equals(PrintableUnique<Object> a, PrintableUnique<Object> b) {
return a == b;
}
static bool Equals(Unique<Object> a, Unique<Object> b) { return a == b; }
};
// Specialization for static parameters of type {PrintableUnique<Name>}.
// Specialization for static parameters of type {Unique<Name>}.
template <>
struct StaticParameterTraits<PrintableUnique<Name> > {
static OStream& PrintTo(OStream& os, PrintableUnique<Name> val) { // NOLINT
return os << val.string();
}
static int HashCode(PrintableUnique<Name> a) {
return static_cast<int>(a.Hashcode());
}
static bool Equals(PrintableUnique<Name> a, PrintableUnique<Name> b) {
return a == b;
struct StaticParameterTraits<Unique<Name> > {
static OStream& PrintTo(OStream& os, Unique<Name> val) { // NOLINT
return os << Brief(*val.handle());
}
static int HashCode(Unique<Name> a) { return static_cast<int>(a.Hashcode()); }
static bool Equals(Unique<Name> a, Unique<Name> b) { return a == b; }
};
#if DEBUG
@ -212,15 +206,15 @@ struct StaticParameterTraits<PrintableUnique<Name> > {
template <>
struct StaticParameterTraits<Handle<Object> > {
static OStream& PrintTo(OStream& os, Handle<Object> val) { // NOLINT
UNREACHABLE(); // Should use PrintableUnique<Object> instead
UNREACHABLE(); // Should use Unique<Object> instead
return os;
}
static int HashCode(Handle<Object> a) {
UNREACHABLE(); // Should use PrintableUnique<Object> instead
UNREACHABLE(); // Should use Unique<Object> instead
return 0;
}
static bool Equals(Handle<Object> a, Handle<Object> b) {
UNREACHABLE(); // Should use PrintableUnique<Object> instead
UNREACHABLE(); // Should use Unique<Object> instead
return false;
}
};
@ -267,7 +261,7 @@ class Operator1 : public Operator {
};
// Type definitions for operators with specific types of parameters.
typedef Operator1<PrintableUnique<Name> > NameOperator;
typedef Operator1<Unique<Name> > NameOperator;
// Helper to extract parameters from Operator1<*> operator.

View File

@ -58,8 +58,8 @@ class RawMachineAssembler : public GraphBuilder,
MachineSignature* machine_sig() const { return machine_sig_; }
Node* UndefinedConstant() {
PrintableUnique<Object> unique = PrintableUnique<Object>::CreateImmovable(
zone(), isolate()->factory()->undefined_value());
Unique<Object> unique = Unique<Object>::CreateImmovable(
isolate()->factory()->undefined_value());
return NewNode(common()->HeapConstant(unique));
}

View File

@ -19,10 +19,10 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
switch (node->opcode()) {
case IrOpcode::kBooleanNot: {
HeapObjectMatcher m(node->InputAt(0));
if (m.IsKnownGlobal(heap()->false_value())) {
if (m.IsKnownGlobal(factory()->false_value())) {
return Replace(jsgraph()->TrueConstant());
}
if (m.IsKnownGlobal(heap()->true_value())) {
if (m.IsKnownGlobal(factory()->true_value())) {
return Replace(jsgraph()->FalseConstant());
}
if (m.IsBooleanNot()) return Replace(m.node()->InputAt(0));
@ -37,8 +37,8 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
case IrOpcode::kChangeBoolToBit: {
HeapObjectMatcher m(node->InputAt(0));
if (m.IsKnownGlobal(heap()->false_value())) return ReplaceInt32(0);
if (m.IsKnownGlobal(heap()->true_value())) return ReplaceInt32(1);
if (m.IsKnownGlobal(factory()->false_value())) return ReplaceInt32(0);
if (m.IsKnownGlobal(factory()->true_value())) return ReplaceInt32(1);
if (m.IsChangeBitToBool()) return Replace(m.node()->InputAt(0));
break;
}
@ -128,8 +128,8 @@ Reduction SimplifiedOperatorReducer::ReplaceNumber(int32_t value) {
Graph* SimplifiedOperatorReducer::graph() const { return jsgraph()->graph(); }
Heap* SimplifiedOperatorReducer::heap() const {
return jsgraph()->isolate()->heap();
Factory* SimplifiedOperatorReducer::factory() const {
return jsgraph()->isolate()->factory();
}
} // namespace compiler

View File

@ -38,7 +38,7 @@ class SimplifiedOperatorReducer FINAL : public Reducer {
Reduction ReplaceNumber(int32_t value);
Graph* graph() const;
Heap* heap() const;
Factory* factory() const;
JSGraph* jsgraph() const { return jsgraph_; }
MachineOperatorBuilder* machine() const { return machine_; }

View File

@ -118,8 +118,6 @@ class Unique {
friend class UniqueSet<T>; // Uses internal details for speed.
template <class U>
friend class Unique; // For comparing raw_address values.
template <class U>
friend class PrintableUnique; // For automatic up casting.
protected:
Unique<T>() : raw_address_(NULL) { }
@ -131,73 +129,6 @@ class Unique {
};
// TODO(danno): At some point if all of the uses of Unique end up using
// PrintableUnique, then we should merge PrintableUnique into Unique and
// predicate generating the printable string on a "am I tracing" check.
template <class T>
class PrintableUnique : public Unique<T> {
public:
// TODO(titzer): make private and introduce a uniqueness scope.
PrintableUnique() : string_("null") {}
// TODO(titzer): make private and introduce a uniqueness scope.
explicit PrintableUnique(Zone* zone, Handle<T> handle) : Unique<T>(handle) {
InitializeString(zone);
}
// TODO(titzer): this is a hack to migrate to Unique<T> incrementally.
PrintableUnique(Zone* zone, Address raw_address, Handle<T> handle)
: Unique<T>(raw_address, handle) {
InitializeString(zone);
}
// Constructor for handling automatic up casting.
// Eg. PrintableUnique<JSFunction> can be passed when PrintableUnique<Object>
// is expected.
template <class S>
PrintableUnique(PrintableUnique<S> uniq) // NOLINT
: Unique<T>(Handle<T>()) {
#ifdef DEBUG
T* a = NULL;
S* b = NULL;
a = b; // Fake assignment to enforce type checks.
USE(a);
#endif
this->raw_address_ = uniq.raw_address_;
this->handle_ = uniq.handle_;
string_ = uniq.string();
}
// TODO(titzer): this is a hack to migrate to Unique<T> incrementally.
static PrintableUnique<T> CreateUninitialized(Zone* zone, Handle<T> handle) {
return PrintableUnique<T>(zone, reinterpret_cast<Address>(NULL), handle);
}
static PrintableUnique<T> CreateImmovable(Zone* zone, Handle<T> handle) {
return PrintableUnique<T>(zone, reinterpret_cast<Address>(*handle), handle);
}
const char* string() const { return string_; }
private:
const char* string_;
void InitializeString(Zone* zone) {
// The stringified version of the parameter must be calculated when the
// Operator is constructed to avoid accessing the heap.
HeapStringAllocator temp_allocator;
StringStream stream(&temp_allocator);
this->handle_->ShortPrint(&stream);
SmartArrayPointer<const char> desc_string = stream.ToCString();
const char* desc_chars = desc_string.get();
int length = static_cast<int>(strlen(desc_chars));
char* desc_copy = zone->NewArray<char>(length + 1);
memcpy(desc_copy, desc_chars, length + 1);
string_ = desc_copy;
}
};
template <typename T>
class UniqueSet FINAL : public ZoneObject {
public:

View File

@ -135,13 +135,13 @@ class TrivialDeoptCodegenTester : public DeoptCodegenTester {
Handle<JSFunction> deopt_function =
NewFunction("function deopt() { %DeoptimizeFunction(foo); }; deopt");
PrintableUnique<Object> deopt_fun_constant =
PrintableUnique<Object>::CreateUninitialized(zone(), deopt_function);
Unique<Object> deopt_fun_constant =
Unique<Object>::CreateUninitialized(deopt_function);
Node* deopt_fun_node = m.NewNode(common.HeapConstant(deopt_fun_constant));
Handle<Context> context(deopt_function->context(), CcTest::i_isolate());
PrintableUnique<Object> context_constant =
PrintableUnique<Object>::CreateUninitialized(zone(), context);
Unique<Object> context_constant =
Unique<Object>::CreateUninitialized(context);
Node* context_node = m.NewNode(common.HeapConstant(context_constant));
bailout_id = GetCallBailoutId();
@ -244,13 +244,13 @@ class TrivialRuntimeDeoptCodegenTester : public DeoptCodegenTester {
CSignature1<Object*, Object*> sig;
RawMachineAssembler m(graph, &sig);
PrintableUnique<Object> this_fun_constant =
PrintableUnique<Object>::CreateUninitialized(zone(), function);
Unique<Object> this_fun_constant =
Unique<Object>::CreateUninitialized(function);
Node* this_fun_node = m.NewNode(common.HeapConstant(this_fun_constant));
Handle<Context> context(function->context(), CcTest::i_isolate());
PrintableUnique<Object> context_constant =
PrintableUnique<Object>::CreateUninitialized(zone(), context);
Unique<Object> context_constant =
Unique<Object>::CreateUninitialized(context);
Node* context_node = m.NewNode(common.HeapConstant(context_constant));
bailout_id = GetCallBailoutId();

View File

@ -680,8 +680,7 @@ TEST(BuildScheduleIfSplitWithEffects) {
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
PrintableUnique<Object> unique_constant =
PrintableUnique<Object>::CreateUninitialized(scope.main_zone(), object);
Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object);
// Manually transcripted code for:
// function turbo_fan_test(a, b, c, y) {
@ -826,8 +825,7 @@ TEST(BuildScheduleSimpleLoop) {
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
PrintableUnique<Object> unique_constant =
PrintableUnique<Object>::CreateUninitialized(scope.main_zone(), object);
Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object);
// Manually transcripted code for:
// function turbo_fan_test(a, b) {
@ -939,8 +937,7 @@ TEST(BuildScheduleComplexLoops) {
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
PrintableUnique<Object> unique_constant =
PrintableUnique<Object>::CreateUninitialized(scope.main_zone(), object);
Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object);
// Manually transcripted code for:
// function turbo_fan_test(a, b, c) {
@ -1187,8 +1184,7 @@ TEST(BuildScheduleBreakAndContinue) {
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
PrintableUnique<Object> unique_constant =
PrintableUnique<Object>::CreateUninitialized(scope.main_zone(), object);
Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object);
// Manually transcripted code for:
// function turbo_fan_test(a, b, c) {
@ -1518,8 +1514,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
PrintableUnique<Object> unique_constant =
PrintableUnique<Object>::CreateUninitialized(scope.main_zone(), object);
Unique<Object> unique_constant = Unique<Object>::CreateUninitialized(object);
// Manually transcripted code for:
// function turbo_fan_test(a, b, c) {