Commit 815bab9f authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by V8 LUCI CQ

Revert "[compiler] Remove one ObjectRef constructor"

This reverts commit 59bb4325.

Reason for revert: 4683d6fe broke TSAN, reverting all its dependencies first (including this)
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN/36744/overview


Original change's description:
> [compiler] Remove one ObjectRef constructor
>
> Remove the handle-taking ObjectRef constructor in favor of
> (Try)MakeRef as bottleneck.
>
> Bug: v8:7790
> Change-Id: I3cc3a1dcef4bac53a91c573d1a532332b88c6eb4
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2883664
> Commit-Queue: Georg Neis <neis@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#74593}

Bug: v8:7790
Change-Id: Ifdecf93a3a8c09a3da7118a269fc66c2ae0f1a09
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2901988Reviewed-by: 's avatarSathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran  <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74618}
parent 60652b98
...@@ -1594,7 +1594,7 @@ void BytecodeGraphBuilder::VisitLdaSmi() { ...@@ -1594,7 +1594,7 @@ void BytecodeGraphBuilder::VisitLdaSmi() {
} }
void BytecodeGraphBuilder::VisitLdaConstant() { void BytecodeGraphBuilder::VisitLdaConstant() {
ObjectRef object = MakeRef(broker(), GetConstantForIndexOperand(0)); ObjectRef object(broker(), GetConstantForIndexOperand(0));
Node* node = jsgraph()->Constant(object); Node* node = jsgraph()->Constant(object);
environment()->BindAccumulator(node); environment()->BindAccumulator(node);
} }
...@@ -1826,7 +1826,7 @@ void BytecodeGraphBuilder::VisitStaCurrentContextSlot() { ...@@ -1826,7 +1826,7 @@ void BytecodeGraphBuilder::VisitStaCurrentContextSlot() {
void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) { void BytecodeGraphBuilder::BuildLdaLookupSlot(TypeofMode typeof_mode) {
PrepareEagerCheckpoint(); PrepareEagerCheckpoint();
Node* name = Node* name =
jsgraph()->Constant(MakeRef(broker(), GetConstantForIndexOperand(0))); jsgraph()->Constant(ObjectRef(broker(), GetConstantForIndexOperand(0)));
const Operator* op = const Operator* op =
javascript()->CallRuntime(typeof_mode == TypeofMode::kNotInside javascript()->CallRuntime(typeof_mode == TypeofMode::kNotInside
? Runtime::kLoadLookupSlot ? Runtime::kLoadLookupSlot
...@@ -1978,8 +1978,8 @@ void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) { ...@@ -1978,8 +1978,8 @@ void BytecodeGraphBuilder::BuildLdaLookupContextSlot(TypeofMode typeof_mode) {
// Slow path, do a runtime load lookup. // Slow path, do a runtime load lookup.
set_environment(slow_environment); set_environment(slow_environment);
{ {
Node* name = Node* name = jsgraph()->Constant(
jsgraph()->Constant(MakeRef(broker(), GetConstantForIndexOperand(0))); ObjectRef(broker(), GetConstantForIndexOperand(0)));
const Operator* op = const Operator* op =
javascript()->CallRuntime(typeof_mode == TypeofMode::kNotInside javascript()->CallRuntime(typeof_mode == TypeofMode::kNotInside
...@@ -2061,7 +2061,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlot() { ...@@ -2061,7 +2061,7 @@ void BytecodeGraphBuilder::VisitStaLookupSlot() {
PrepareEagerCheckpoint(); PrepareEagerCheckpoint();
Node* value = environment()->LookupAccumulator(); Node* value = environment()->LookupAccumulator();
Node* name = Node* name =
jsgraph()->Constant(MakeRef(broker(), GetConstantForIndexOperand(0))); jsgraph()->Constant(ObjectRef(broker(), GetConstantForIndexOperand(0)));
int bytecode_flags = bytecode_iterator().GetFlagOperand(1); int bytecode_flags = bytecode_iterator().GetFlagOperand(1);
LanguageMode language_mode = static_cast<LanguageMode>( LanguageMode language_mode = static_cast<LanguageMode>(
interpreter::StoreLookupSlotFlags::LanguageModeBit::decode( interpreter::StoreLookupSlotFlags::LanguageModeBit::decode(
...@@ -2981,7 +2981,7 @@ void BytecodeGraphBuilder::VisitThrowReferenceErrorIfHole() { ...@@ -2981,7 +2981,7 @@ void BytecodeGraphBuilder::VisitThrowReferenceErrorIfHole() {
Node* check_for_hole = NewNode(simplified()->ReferenceEqual(), accumulator, Node* check_for_hole = NewNode(simplified()->ReferenceEqual(), accumulator,
jsgraph()->TheHoleConstant()); jsgraph()->TheHoleConstant());
Node* name = Node* name =
jsgraph()->Constant(MakeRef(broker(), GetConstantForIndexOperand(0))); jsgraph()->Constant(ObjectRef(broker(), GetConstantForIndexOperand(0)));
BuildHoleCheckAndThrow(check_for_hole, BuildHoleCheckAndThrow(check_for_hole,
Runtime::kThrowAccessedUninitializedVariable, name); Runtime::kThrowAccessedUninitializedVariable, name);
} }
......
...@@ -497,7 +497,7 @@ ObjectRef GetOwnFastDataPropertyFromHeap(JSHeapBroker* broker, ...@@ -497,7 +497,7 @@ ObjectRef GetOwnFastDataPropertyFromHeap(JSHeapBroker* broker,
FieldIndex field_index) { FieldIndex field_index) {
Handle<Object> constant = Handle<Object> constant =
JSObject::FastPropertyAt(receiver, representation, field_index); JSObject::FastPropertyAt(receiver, representation, field_index);
return MakeRef(broker, constant); return ObjectRef(broker, constant);
} }
ObjectRef GetOwnDictionaryPropertyFromHeap(JSHeapBroker* broker, ObjectRef GetOwnDictionaryPropertyFromHeap(JSHeapBroker* broker,
...@@ -505,7 +505,7 @@ ObjectRef GetOwnDictionaryPropertyFromHeap(JSHeapBroker* broker, ...@@ -505,7 +505,7 @@ ObjectRef GetOwnDictionaryPropertyFromHeap(JSHeapBroker* broker,
InternalIndex dict_index) { InternalIndex dict_index) {
Handle<Object> constant = Handle<Object> constant =
JSObject::DictionaryPropertyAt(receiver, dict_index); JSObject::DictionaryPropertyAt(receiver, dict_index);
return MakeRef(broker, constant); return ObjectRef(broker, constant);
} }
} // namespace } // namespace
...@@ -3783,8 +3783,8 @@ Maybe<double> ObjectRef::OddballToNumber() const { ...@@ -3783,8 +3783,8 @@ Maybe<double> ObjectRef::OddballToNumber() const {
switch (type) { switch (type) {
case OddballType::kBoolean: { case OddballType::kBoolean: {
ObjectRef true_ref = MakeRef<Object>( ObjectRef true_ref(broker(),
broker(), broker()->isolate()->factory()->true_value()); broker()->isolate()->factory()->true_value());
return this->equals(true_ref) ? Just(1.0) : Just(0.0); return this->equals(true_ref) ? Just(1.0) : Just(0.0);
break; break;
} }
...@@ -3967,6 +3967,13 @@ base::Optional<ObjectRef> SourceTextModuleRef::import_meta() const { ...@@ -3967,6 +3967,13 @@ base::Optional<ObjectRef> SourceTextModuleRef::import_meta() const {
data()->AsSourceTextModule()->GetImportMeta(broker())); data()->AsSourceTextModule()->GetImportMeta(broker()));
} }
ObjectRef::ObjectRef(JSHeapBroker* broker, Handle<Object> object,
bool check_type)
: broker_(broker) {
CHECK_NE(broker->mode(), JSHeapBroker::kRetired);
data_ = broker->GetOrCreateData(object);
}
namespace { namespace {
OddballType GetOddballType(Isolate* isolate, Map map) { OddballType GetOddballType(Isolate* isolate, Map map) {
......
...@@ -160,11 +160,12 @@ struct ref_traits<Object> { ...@@ -160,11 +160,12 @@ struct ref_traits<Object> {
class V8_EXPORT_PRIVATE ObjectRef { class V8_EXPORT_PRIVATE ObjectRef {
public: public:
ObjectRef(JSHeapBroker* broker, Handle<Object> object,
bool check_type = true);
ObjectRef(JSHeapBroker* broker, ObjectData* data, bool check_type = true) ObjectRef(JSHeapBroker* broker, ObjectData* data, bool check_type = true)
: data_(data), broker_(broker) { : data_(data), broker_(broker) {
CHECK_NOT_NULL(data_); CHECK_NOT_NULL(data_);
} }
Handle<Object> object() const; Handle<Object> object() const;
bool equals(const ObjectRef& other) const; bool equals(const ObjectRef& other) const;
......
...@@ -1103,7 +1103,7 @@ MinimorphicLoadPropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo( ...@@ -1103,7 +1103,7 @@ MinimorphicLoadPropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo(
if (policy == SerializationPolicy::kAssumeSerialized) { if (policy == SerializationPolicy::kAssumeSerialized) {
TRACE_BROKER_MISSING(this, "MinimorphicLoadPropertyAccessInfo for slot " TRACE_BROKER_MISSING(this, "MinimorphicLoadPropertyAccessInfo for slot "
<< source.index() << " " << source.index() << " "
<< MakeRef<Object>(this, source.vector)); << ObjectRef(this, source.vector));
return MinimorphicLoadPropertyAccessInfo::Invalid(); return MinimorphicLoadPropertyAccessInfo::Invalid();
} }
...@@ -1113,7 +1113,7 @@ MinimorphicLoadPropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo( ...@@ -1113,7 +1113,7 @@ MinimorphicLoadPropertyAccessInfo JSHeapBroker::GetPropertyAccessInfo(
if (is_concurrent_inlining_) { if (is_concurrent_inlining_) {
TRACE(this, "Storing MinimorphicLoadPropertyAccessInfo for " TRACE(this, "Storing MinimorphicLoadPropertyAccessInfo for "
<< source.index() << " " << source.index() << " "
<< MakeRef<Object>(this, source.vector)); << ObjectRef(this, source.vector));
minimorphic_property_access_infos_.insert({source, access_info}); minimorphic_property_access_infos_.insert({source, access_info});
} }
return access_info; return access_info;
......
...@@ -594,7 +594,6 @@ base::Optional<typename ref_traits<T>::ref_type> TryMakeRef( ...@@ -594,7 +594,6 @@ base::Optional<typename ref_traits<T>::ref_type> TryMakeRef(
JSHeapBroker* broker, Handle<T> object, GetOrCreateDataFlags flags = {}) { JSHeapBroker* broker, Handle<T> object, GetOrCreateDataFlags flags = {}) {
ObjectData* data = broker->TryGetOrCreateData(object, flags); ObjectData* data = broker->TryGetOrCreateData(object, flags);
if (data == nullptr) { if (data == nullptr) {
DCHECK_EQ(flags & kCrashOnError, 0);
TRACE_BROKER_MISSING(broker, "ObjectData for " << Brief(*object)); TRACE_BROKER_MISSING(broker, "ObjectData for " << Brief(*object));
return {}; return {};
} }
...@@ -604,14 +603,14 @@ base::Optional<typename ref_traits<T>::ref_type> TryMakeRef( ...@@ -604,14 +603,14 @@ base::Optional<typename ref_traits<T>::ref_type> TryMakeRef(
template <class T, template <class T,
typename = std::enable_if_t<std::is_convertible<T*, Object*>::value>> typename = std::enable_if_t<std::is_convertible<T*, Object*>::value>>
typename ref_traits<T>::ref_type MakeRef(JSHeapBroker* broker, T object) { typename ref_traits<T>::ref_type MakeRef(JSHeapBroker* broker, T object) {
return TryMakeRef(broker, object, kCrashOnError).value(); return TryMakeRef(broker, object).value();
} }
template <class T, template <class T,
typename = std::enable_if_t<std::is_convertible<T*, Object*>::value>> typename = std::enable_if_t<std::is_convertible<T*, Object*>::value>>
typename ref_traits<T>::ref_type MakeRef(JSHeapBroker* broker, typename ref_traits<T>::ref_type MakeRef(JSHeapBroker* broker,
Handle<T> object) { Handle<T> object) {
return TryMakeRef(broker, object, kCrashOnError).value(); return TryMakeRef(broker, object).value();
} }
template <class T, template <class T,
......
...@@ -1469,7 +1469,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -1469,7 +1469,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
if (m.HasResolvedValue()) { if (m.HasResolvedValue()) {
ObjectRef object = m.Ref(broker()); ObjectRef object = m.Ref(broker());
if (object.IsJSFunction() && if (object.IsJSFunction() &&
name.equals(MakeRef(broker(), factory()->prototype_string()))) { name.equals(ObjectRef(broker(), factory()->prototype_string()))) {
// Optimize "prototype" property of functions. // Optimize "prototype" property of functions.
JSFunctionRef function = object.AsJSFunction(); JSFunctionRef function = object.AsJSFunction();
if (!function.serialized()) return NoChange(); if (!function.serialized()) return NoChange();
...@@ -1484,7 +1484,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { ...@@ -1484,7 +1484,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
ReplaceWithValue(node, value); ReplaceWithValue(node, value);
return Replace(value); return Replace(value);
} else if (object.IsString() && } else if (object.IsString() &&
name.equals(MakeRef(broker(), factory()->length_string()))) { name.equals(ObjectRef(broker(), factory()->length_string()))) {
// Constant-fold "length" property on constant strings. // Constant-fold "length" property on constant strings.
if (!object.AsString().length().has_value()) return NoChange(); if (!object.AsString().length().has_value()) return NoChange();
Node* value = jsgraph()->Constant(object.AsString().length().value()); Node* value = jsgraph()->Constant(object.AsString().length().value());
...@@ -2210,7 +2210,7 @@ Node* JSNativeContextSpecialization::InlinePropertyGetterCall( ...@@ -2210,7 +2210,7 @@ Node* JSNativeContextSpecialization::InlinePropertyGetterCall(
Node* receiver, ConvertReceiverMode receiver_mode, Node* context, Node* receiver, ConvertReceiverMode receiver_mode, Node* context,
Node* frame_state, Node** effect, Node** control, Node* frame_state, Node** effect, Node** control,
ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info) { ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info) {
ObjectRef constant = MakeRef(broker(), access_info.constant()); ObjectRef constant(broker(), access_info.constant());
if (access_info.IsDictionaryProtoAccessorConstant()) { if (access_info.IsDictionaryProtoAccessorConstant()) {
// For fast mode holders we recorded dependencies in BuildPropertyLoad. // For fast mode holders we recorded dependencies in BuildPropertyLoad.
...@@ -2234,7 +2234,7 @@ Node* JSNativeContextSpecialization::InlinePropertyGetterCall( ...@@ -2234,7 +2234,7 @@ Node* JSNativeContextSpecialization::InlinePropertyGetterCall(
} else { } else {
Node* holder = access_info.holder().is_null() Node* holder = access_info.holder().is_null()
? receiver ? receiver
: jsgraph()->Constant(MakeRef( : jsgraph()->Constant(ObjectRef(
broker(), access_info.holder().ToHandleChecked())); broker(), access_info.holder().ToHandleChecked()));
value = InlineApiCall(receiver, holder, frame_state, nullptr, effect, value = InlineApiCall(receiver, holder, frame_state, nullptr, effect,
control, constant.AsFunctionTemplateInfo()); control, constant.AsFunctionTemplateInfo());
...@@ -2255,7 +2255,7 @@ void JSNativeContextSpecialization::InlinePropertySetterCall( ...@@ -2255,7 +2255,7 @@ void JSNativeContextSpecialization::InlinePropertySetterCall(
Node* receiver, Node* value, Node* context, Node* frame_state, Node* receiver, Node* value, Node* context, Node* frame_state,
Node** effect, Node** control, ZoneVector<Node*>* if_exceptions, Node** effect, Node** control, ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info) { PropertyAccessInfo const& access_info) {
ObjectRef constant = MakeRef(broker(), access_info.constant()); ObjectRef constant(broker(), access_info.constant());
Node* target = jsgraph()->Constant(constant); Node* target = jsgraph()->Constant(constant);
// Introduce the call to the setter function. // Introduce the call to the setter function.
if (constant.IsJSFunction()) { if (constant.IsJSFunction()) {
...@@ -2269,7 +2269,7 @@ void JSNativeContextSpecialization::InlinePropertySetterCall( ...@@ -2269,7 +2269,7 @@ void JSNativeContextSpecialization::InlinePropertySetterCall(
} else { } else {
Node* holder = access_info.holder().is_null() Node* holder = access_info.holder().is_null()
? receiver ? receiver
: jsgraph()->Constant(MakeRef( : jsgraph()->Constant(ObjectRef(
broker(), access_info.holder().ToHandleChecked())); broker(), access_info.holder().ToHandleChecked()));
InlineApiCall(receiver, holder, frame_state, value, effect, control, InlineApiCall(receiver, holder, frame_state, value, effect, control,
constant.AsFunctionTemplateInfo()); constant.AsFunctionTemplateInfo());
...@@ -2366,8 +2366,8 @@ JSNativeContextSpecialization::BuildPropertyLoad( ...@@ -2366,8 +2366,8 @@ JSNativeContextSpecialization::BuildPropertyLoad(
InlinePropertyGetterCall(receiver, receiver_mode, context, frame_state, InlinePropertyGetterCall(receiver, receiver_mode, context, frame_state,
&effect, &control, if_exceptions, access_info); &effect, &control, if_exceptions, access_info);
} else if (access_info.IsModuleExport()) { } else if (access_info.IsModuleExport()) {
Node* cell = Node* cell = jsgraph()->Constant(
jsgraph()->Constant(MakeRef(broker(), access_info.constant()).AsCell()); ObjectRef(broker(), access_info.constant()).AsCell());
value = effect = value = effect =
graph()->NewNode(simplified()->LoadField(AccessBuilder::ForCellValue()), graph()->NewNode(simplified()->LoadField(AccessBuilder::ForCellValue()),
cell, effect, control); cell, effect, control);
......
...@@ -127,7 +127,7 @@ Node* PropertyAccessBuilder::ResolveHolder( ...@@ -127,7 +127,7 @@ Node* PropertyAccessBuilder::ResolveHolder(
PropertyAccessInfo const& access_info, Node* lookup_start_object) { PropertyAccessInfo const& access_info, Node* lookup_start_object) {
Handle<JSObject> holder; Handle<JSObject> holder;
if (access_info.holder().ToHandle(&holder)) { if (access_info.holder().ToHandle(&holder)) {
return jsgraph()->Constant(MakeRef(broker(), holder)); return jsgraph()->Constant(ObjectRef(broker(), holder));
} }
return lookup_start_object; return lookup_start_object;
} }
......
...@@ -680,23 +680,29 @@ Reduction TypedOptimization::ReduceTypeOf(Node* node) { ...@@ -680,23 +680,29 @@ Reduction TypedOptimization::ReduceTypeOf(Node* node) {
Type const type = NodeProperties::GetType(input); Type const type = NodeProperties::GetType(input);
Factory* const f = factory(); Factory* const f = factory();
if (type.Is(Type::Boolean())) { if (type.Is(Type::Boolean())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->boolean_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->boolean_string())));
} else if (type.Is(Type::Number())) { } else if (type.Is(Type::Number())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->number_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->number_string())));
} else if (type.Is(Type::String())) { } else if (type.Is(Type::String())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->string_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->string_string())));
} else if (type.Is(Type::BigInt())) { } else if (type.Is(Type::BigInt())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->bigint_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->bigint_string())));
} else if (type.Is(Type::Symbol())) { } else if (type.Is(Type::Symbol())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->symbol_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->symbol_string())));
} else if (type.Is(Type::OtherUndetectableOrUndefined())) { } else if (type.Is(Type::OtherUndetectableOrUndefined())) {
return Replace( return Replace(
jsgraph()->Constant(MakeRef(broker(), f->undefined_string()))); jsgraph()->Constant(ObjectRef(broker(), f->undefined_string())));
} else if (type.Is(Type::NonCallableOrNull())) { } else if (type.Is(Type::NonCallableOrNull())) {
return Replace(jsgraph()->Constant(MakeRef(broker(), f->object_string()))); return Replace(
jsgraph()->Constant(ObjectRef(broker(), f->object_string())));
} else if (type.Is(Type::Function())) { } else if (type.Is(Type::Function())) {
return Replace( return Replace(
jsgraph()->Constant(MakeRef(broker(), f->function_string()))); jsgraph()->Constant(ObjectRef(broker(), f->function_string())));
} }
return NoChange(); return NoChange();
} }
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include <iomanip> #include <iomanip>
#include "src/compiler/js-heap-broker.h"
#include "src/handles/handles-inl.h" #include "src/handles/handles-inl.h"
#include "src/objects/instance-type.h" #include "src/objects/instance-type.h"
#include "src/objects/objects-inl.h" #include "src/objects/objects-inl.h"
...@@ -838,7 +837,7 @@ Type Type::Constant(double value, Zone* zone) { ...@@ -838,7 +837,7 @@ Type Type::Constant(double value, Zone* zone) {
} }
Type Type::Constant(JSHeapBroker* broker, Handle<i::Object> value, Zone* zone) { Type Type::Constant(JSHeapBroker* broker, Handle<i::Object> value, Zone* zone) {
ObjectRef ref = MakeRef(broker, value); ObjectRef ref(broker, value);
if (ref.IsSmi()) { if (ref.IsSmi()) {
return Constant(static_cast<double>(ref.AsSmi()), zone); return Constant(static_cast<double>(ref.AsSmi()), zone);
} }
......
...@@ -191,8 +191,8 @@ TEST(HeapNumbers) { ...@@ -191,8 +191,8 @@ TEST(HeapNumbers) {
Handle<Object> num = T.factory()->NewNumber(value); Handle<Object> num = T.factory()->NewNumber(value);
Handle<HeapNumber> heap = T.factory()->NewHeapNumber(value); Handle<HeapNumber> heap = T.factory()->NewHeapNumber(value);
Node* node1 = T.Constant(value); Node* node1 = T.Constant(value);
Node* node2 = T.Constant(MakeRef(T.broker(), num)); Node* node2 = T.Constant(ObjectRef(T.broker(), num));
Node* node3 = T.Constant(MakeRef(T.broker(), heap)); Node* node3 = T.Constant(ObjectRef(T.broker(), heap));
CHECK_EQ(node1, node2); CHECK_EQ(node1, node2);
CHECK_EQ(node1, node3); CHECK_EQ(node1, node3);
} }
...@@ -202,20 +202,18 @@ TEST(HeapNumbers) { ...@@ -202,20 +202,18 @@ TEST(HeapNumbers) {
TEST(OddballHandle) { TEST(OddballHandle) {
JSConstantCacheTester T; JSConstantCacheTester T;
CHECK_EQ( CHECK_EQ(T.UndefinedConstant(),
T.UndefinedConstant(), T.Constant(ObjectRef(T.broker(), T.factory()->undefined_value())));
T.Constant(MakeRef<Object>(T.broker(), T.factory()->undefined_value()))); CHECK_EQ(T.TheHoleConstant(),
CHECK_EQ( T.Constant(ObjectRef(T.broker(), T.factory()->the_hole_value())));
T.TheHoleConstant(),
T.Constant(MakeRef<Object>(T.broker(), T.factory()->the_hole_value())));
CHECK_EQ(T.TrueConstant(), CHECK_EQ(T.TrueConstant(),
T.Constant(MakeRef<Object>(T.broker(), T.factory()->true_value()))); T.Constant(ObjectRef(T.broker(), T.factory()->true_value())));
CHECK_EQ(T.FalseConstant(), CHECK_EQ(T.FalseConstant(),
T.Constant(MakeRef<Object>(T.broker(), T.factory()->false_value()))); T.Constant(ObjectRef(T.broker(), T.factory()->false_value())));
CHECK_EQ(T.NullConstant(), CHECK_EQ(T.NullConstant(),
T.Constant(MakeRef<Object>(T.broker(), T.factory()->null_value()))); T.Constant(ObjectRef(T.broker(), T.factory()->null_value())));
CHECK_EQ(T.NaNConstant(), CHECK_EQ(T.NaNConstant(),
T.Constant(MakeRef<Object>(T.broker(), T.factory()->nan_value()))); T.Constant(ObjectRef(T.broker(), T.factory()->nan_value())));
} }
......
...@@ -137,9 +137,9 @@ TEST(ReduceJSLoadContext0) { ...@@ -137,9 +137,9 @@ TEST(ReduceJSLoadContext0) {
const int slot = 5; const int slot = 5;
native->set(slot, *expected); native->set(slot, *expected);
Node* const_context = t.jsgraph()->Constant(MakeRef(t.broker(), native)); Node* const_context = t.jsgraph()->Constant(ObjectRef(t.broker(), native));
Node* deep_const_context = Node* deep_const_context =
t.jsgraph()->Constant(MakeRef(t.broker(), subcontext2)); t.jsgraph()->Constant(ObjectRef(t.broker(), subcontext2));
Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
{ {
...@@ -284,7 +284,8 @@ TEST(ReduceJSLoadContext2) { ...@@ -284,7 +284,8 @@ TEST(ReduceJSLoadContext2) {
context_object0->set(Context::EXTENSION_INDEX, *slot_value0); context_object0->set(Context::EXTENSION_INDEX, *slot_value0);
context_object1->set(Context::EXTENSION_INDEX, *slot_value1); context_object1->set(Context::EXTENSION_INDEX, *slot_value1);
Node* context0 = t.jsgraph()->Constant(MakeRef(t.broker(), context_object1)); Node* context0 =
t.jsgraph()->Constant(ObjectRef(t.broker(), context_object1));
Node* context1 = Node* context1 =
t.graph()->NewNode(create_function_context, context0, start, start); t.graph()->NewNode(create_function_context, context0, start, start);
Node* context2 = Node* context2 =
...@@ -441,9 +442,9 @@ TEST(ReduceJSStoreContext0) { ...@@ -441,9 +442,9 @@ TEST(ReduceJSStoreContext0) {
const int slot = 5; const int slot = 5;
native->set(slot, *expected); native->set(slot, *expected);
Node* const_context = t.jsgraph()->Constant(MakeRef(t.broker(), native)); Node* const_context = t.jsgraph()->Constant(ObjectRef(t.broker(), native));
Node* deep_const_context = Node* deep_const_context =
t.jsgraph()->Constant(MakeRef(t.broker(), subcontext2)); t.jsgraph()->Constant(ObjectRef(t.broker(), subcontext2));
Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start); Node* param_context = t.graph()->NewNode(t.common()->Parameter(0), start);
{ {
...@@ -553,7 +554,8 @@ TEST(ReduceJSStoreContext2) { ...@@ -553,7 +554,8 @@ TEST(ReduceJSStoreContext2) {
context_object0->set(Context::EXTENSION_INDEX, *slot_value0); context_object0->set(Context::EXTENSION_INDEX, *slot_value0);
context_object1->set(Context::EXTENSION_INDEX, *slot_value1); context_object1->set(Context::EXTENSION_INDEX, *slot_value1);
Node* context0 = t.jsgraph()->Constant(MakeRef(t.broker(), context_object1)); Node* context0 =
t.jsgraph()->Constant(ObjectRef(t.broker(), context_object1));
Node* context1 = Node* context1 =
t.graph()->NewNode(create_function_context, context0, start, start); t.graph()->NewNode(create_function_context, context0, start, start);
Node* context2 = Node* context2 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment