Commit 1021ed85 authored by bmeurer's avatar bmeurer Committed by Commit bot

[ubsan] Fix HeapObjectMatcher to avoid invalid casts.

BUG=v8:3809
LOG=n
R=svenpanne@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#29147}
parent 733a2463
...@@ -3590,7 +3590,7 @@ Node* AstGraphBuilder::BuildToBoolean(Node* input) { ...@@ -3590,7 +3590,7 @@ Node* AstGraphBuilder::BuildToBoolean(Node* input) {
case IrOpcode::kNumberConstant: case IrOpcode::kNumberConstant:
return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0)); return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0));
case IrOpcode::kHeapConstant: { case IrOpcode::kHeapConstant: {
Handle<Object> object = HeapObjectMatcher<Object>(input).Value().handle(); Handle<HeapObject> object = HeapObjectMatcher(input).Value().handle();
return jsgraph_->BooleanConstant(object->BooleanValue()); return jsgraph_->BooleanConstant(object->BooleanValue());
} }
case IrOpcode::kJSEqual: case IrOpcode::kJSEqual:
......
...@@ -31,7 +31,7 @@ Decision DecideCondition(Node* const cond) { ...@@ -31,7 +31,7 @@ Decision DecideCondition(Node* const cond) {
return mcond.Value() ? Decision::kTrue : Decision::kFalse; return mcond.Value() ? Decision::kTrue : Decision::kFalse;
} }
case IrOpcode::kHeapConstant: { case IrOpcode::kHeapConstant: {
HeapObjectMatcher<HeapObject> mcond(cond); HeapObjectMatcher mcond(cond);
return mcond.Value().handle()->BooleanValue() ? Decision::kTrue return mcond.Value().handle()->BooleanValue() ? Decision::kTrue
: Decision::kFalse; : Decision::kFalse;
} }
......
This diff is collapsed.
...@@ -24,7 +24,7 @@ class JSCallReduction { ...@@ -24,7 +24,7 @@ class JSCallReduction {
// constant callee being a well-known builtin with a BuiltinFunctionId. // constant callee being a well-known builtin with a BuiltinFunctionId.
bool HasBuiltinFunctionId() { bool HasBuiltinFunctionId() {
if (node_->opcode() != IrOpcode::kJSCallFunction) return false; if (node_->opcode() != IrOpcode::kJSCallFunction) return false;
HeapObjectMatcher<Object> m(NodeProperties::GetValueInput(node_, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0));
if (!m.HasValue() || !m.Value().handle()->IsJSFunction()) return false; if (!m.HasValue() || !m.Value().handle()->IsJSFunction()) return false;
Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle()); Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle());
return function->shared()->HasBuiltinFunctionId(); return function->shared()->HasBuiltinFunctionId();
...@@ -33,7 +33,7 @@ class JSCallReduction { ...@@ -33,7 +33,7 @@ class JSCallReduction {
// Retrieves the BuiltinFunctionId as described above. // Retrieves the BuiltinFunctionId as described above.
BuiltinFunctionId GetBuiltinFunctionId() { BuiltinFunctionId GetBuiltinFunctionId() {
DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode()); DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode());
HeapObjectMatcher<Object> m(NodeProperties::GetValueInput(node_, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node_, 0));
Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle()); Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle());
return function->shared()->builtin_function_id(); return function->shared()->builtin_function_id();
} }
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
#include "src/compiler/js-context-specialization.h" #include "src/compiler/js-context-specialization.h"
#include "src/compiler/common-operator.h" #include "src/compiler/common-operator.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-operator.h" #include "src/compiler/js-operator.h"
#include "src/compiler/node-matchers.h" #include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
#include "src/contexts.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -27,7 +29,7 @@ Reduction JSContextSpecializer::Reduce(Node* node) { ...@@ -27,7 +29,7 @@ Reduction JSContextSpecializer::Reduce(Node* node) {
Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode());
HeapObjectMatcher<Context> m(NodeProperties::GetValueInput(node, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
// If the context is not constant, no reduction can occur. // If the context is not constant, no reduction can occur.
if (!m.HasValue()) { if (!m.HasValue()) {
return NoChange(); return NoChange();
...@@ -36,9 +38,9 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { ...@@ -36,9 +38,9 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
const ContextAccess& access = ContextAccessOf(node->op()); const ContextAccess& access = ContextAccessOf(node->op());
// Find the right parent context. // Find the right parent context.
Context* context = *m.Value().handle(); Handle<Context> context = Handle<Context>::cast(m.Value().handle());
for (size_t i = access.depth(); i > 0; --i) { for (size_t i = access.depth(); i > 0; --i) {
context = context->previous(); context = handle(context->previous(), isolate());
} }
// If the access itself is mutable, only fold-in the parent. // If the access itself is mutable, only fold-in the parent.
...@@ -50,13 +52,11 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { ...@@ -50,13 +52,11 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
const Operator* op = jsgraph_->javascript()->LoadContext( const Operator* op = jsgraph_->javascript()->LoadContext(
0, access.index(), access.immutable()); 0, access.index(), access.immutable());
node->set_op(op); node->set_op(op);
Handle<Object> context_handle = node->ReplaceInput(0, jsgraph_->Constant(context));
Handle<Object>(context, jsgraph_->isolate());
node->ReplaceInput(0, jsgraph_->Constant(context_handle));
return Changed(node); return Changed(node);
} }
Handle<Object> value = Handle<Object>( Handle<Object> value =
context->get(static_cast<int>(access.index())), jsgraph_->isolate()); handle(context->get(static_cast<int>(access.index())), isolate());
// Even though the context slot is immutable, the context might have escaped // Even though the context slot is immutable, the context might have escaped
// before the function to which it belongs has initialized the slot. // before the function to which it belongs has initialized the slot.
...@@ -78,7 +78,7 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) { ...@@ -78,7 +78,7 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) { Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode());
HeapObjectMatcher<Context> m(NodeProperties::GetValueInput(node, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
// If the context is not constant, no reduction can occur. // If the context is not constant, no reduction can occur.
if (!m.HasValue()) { if (!m.HasValue()) {
return NoChange(); return NoChange();
...@@ -92,20 +92,24 @@ Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) { ...@@ -92,20 +92,24 @@ Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
} }
// Find the right parent context. // Find the right parent context.
Context* context = *m.Value().handle(); Handle<Context> context = Handle<Context>::cast(m.Value().handle());
for (size_t i = access.depth(); i > 0; --i) { for (size_t i = access.depth(); i > 0; --i) {
context = context->previous(); context = handle(context->previous(), isolate());
} }
const Operator* op = jsgraph_->javascript()->StoreContext(0, access.index()); node->set_op(javascript()->StoreContext(0, access.index()));
node->set_op(op); node->ReplaceInput(0, jsgraph_->Constant(context));
Handle<Object> new_context_handle =
Handle<Object>(context, jsgraph_->isolate());
node->ReplaceInput(0, jsgraph_->Constant(new_context_handle));
return Changed(node); return Changed(node);
} }
Isolate* JSContextSpecializer::isolate() const { return jsgraph()->isolate(); }
JSOperatorBuilder* JSContextSpecializer::javascript() const {
return jsgraph()->javascript();
}
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
...@@ -6,13 +6,16 @@ ...@@ -6,13 +6,16 @@
#define V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ #define V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_
#include "src/compiler/graph-reducer.h" #include "src/compiler/graph-reducer.h"
#include "src/compiler/js-graph.h"
#include "src/contexts.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace compiler { namespace compiler {
// Forward declarations.
class JSGraph;
class JSOperatorBuilder;
// Specializes a given JSGraph to a given context, potentially constant folding // Specializes a given JSGraph to a given context, potentially constant folding
// some {LoadContext} nodes or strength reducing some {StoreContext} nodes. // some {LoadContext} nodes or strength reducing some {StoreContext} nodes.
class JSContextSpecializer : public AdvancedReducer { class JSContextSpecializer : public AdvancedReducer {
...@@ -27,10 +30,17 @@ class JSContextSpecializer : public AdvancedReducer { ...@@ -27,10 +30,17 @@ class JSContextSpecializer : public AdvancedReducer {
Reduction ReduceJSStoreContext(Node* node); Reduction ReduceJSStoreContext(Node* node);
private: private:
JSGraph* jsgraph_; Isolate* isolate() const;
JSOperatorBuilder* javascript() const;
JSGraph* jsgraph() const { return jsgraph_; }
JSGraph* const jsgraph_;
DISALLOW_COPY_AND_ASSIGN(JSContextSpecializer);
}; };
}
} } // namespace compiler
} // namespace v8::internal::compiler } // namespace internal
} // namespace v8
#endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_ #endif // V8_COMPILER_JS_CONTEXT_SPECIALIZATION_H_
...@@ -238,11 +238,12 @@ Reduction JSInliner::Reduce(Node* node) { ...@@ -238,11 +238,12 @@ Reduction JSInliner::Reduce(Node* node) {
if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange(); if (node->opcode() != IrOpcode::kJSCallFunction) return NoChange();
JSCallFunctionAccessor call(node); JSCallFunctionAccessor call(node);
HeapObjectMatcher<JSFunction> match(call.jsfunction()); HeapObjectMatcher match(call.jsfunction());
if (!match.HasValue()) return NoChange(); if (!match.HasValue()) return NoChange();
Handle<JSFunction> function = match.Value().handle(); if (!match.Value().handle()->IsJSFunction()) return NoChange();
if (!function->IsJSFunction()) return NoChange(); Handle<JSFunction> function =
Handle<JSFunction>::cast(match.Value().handle());
if (mode_ == kRestrictedInlining && !function->shared()->force_inline()) { if (mode_ == kRestrictedInlining && !function->shared()->force_inline()) {
return NoChange(); return NoChange();
} }
......
...@@ -179,11 +179,12 @@ Reduction JSIntrinsicLowering::ReduceHeapObjectGetMap(Node* node) { ...@@ -179,11 +179,12 @@ Reduction JSIntrinsicLowering::ReduceHeapObjectGetMap(Node* node) {
Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) { Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) {
if (!FLAG_native_code_counters) return ChangeToUndefined(node); if (!FLAG_native_code_counters) return ChangeToUndefined(node);
HeapObjectMatcher<String> m(NodeProperties::GetValueInput(node, 0)); HeapObjectMatcher m(NodeProperties::GetValueInput(node, 0));
if (!m.HasValue() || !m.Value().handle()->IsString()) { if (!m.HasValue() || !m.Value().handle()->IsString()) {
return ChangeToUndefined(node); return ChangeToUndefined(node);
} }
SmartArrayPointer<char> name = m.Value().handle()->ToCString(); SmartArrayPointer<char> name =
Handle<String>::cast(m.Value().handle())->ToCString();
StatsCounter counter(jsgraph()->isolate(), name.get()); StatsCounter counter(jsgraph()->isolate(), name.get());
if (!counter.Enabled()) return ChangeToUndefined(node); if (!counter.Enabled()) return ChangeToUndefined(node);
......
...@@ -824,7 +824,7 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { ...@@ -824,7 +824,7 @@ Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
Node* key = NodeProperties::GetValueInput(node, 1); Node* key = NodeProperties::GetValueInput(node, 1);
Node* base = NodeProperties::GetValueInput(node, 0); Node* base = NodeProperties::GetValueInput(node, 0);
Type* key_type = NodeProperties::GetBounds(key).upper; Type* key_type = NodeProperties::GetBounds(key).upper;
HeapObjectMatcher<Object> mbase(base); HeapObjectMatcher mbase(base);
if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) {
Handle<JSTypedArray> const array = Handle<JSTypedArray> const array =
Handle<JSTypedArray>::cast(mbase.Value().handle()); Handle<JSTypedArray>::cast(mbase.Value().handle());
...@@ -871,7 +871,7 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) { ...@@ -871,7 +871,7 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 2); Node* value = NodeProperties::GetValueInput(node, 2);
Type* key_type = NodeProperties::GetBounds(key).upper; Type* key_type = NodeProperties::GetBounds(key).upper;
Type* value_type = NodeProperties::GetBounds(value).upper; Type* value_type = NodeProperties::GetBounds(value).upper;
HeapObjectMatcher<Object> mbase(base); HeapObjectMatcher mbase(base);
if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) {
Handle<JSTypedArray> const array = Handle<JSTypedArray> const array =
Handle<JSTypedArray>::cast(mbase.Value().handle()); Handle<JSTypedArray>::cast(mbase.Value().handle());
...@@ -1132,8 +1132,8 @@ Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) { ...@@ -1132,8 +1132,8 @@ Reduction JSTypedLowering::ReduceJSCreateClosure(Node* node) {
Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode()); DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode());
HeapObjectMatcher<FixedArray> mconst(NodeProperties::GetValueInput(node, 2)); HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2));
int length = mconst.Value().handle()->length(); int length = Handle<FixedArray>::cast(mconst.Value().handle())->length();
int flags = OpParameter<int>(node->op()); int flags = OpParameter<int>(node->op());
// Use the FastCloneShallowArrayStub only for shallow boilerplates up to the // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the
...@@ -1162,9 +1162,9 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { ...@@ -1162,9 +1162,9 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) {
Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) { Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode()); DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode());
HeapObjectMatcher<FixedArray> mconst(NodeProperties::GetValueInput(node, 2)); HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2));
// Constants are pairs, see ObjectLiteral::properties_count(). // Constants are pairs, see ObjectLiteral::properties_count().
int length = mconst.Value().handle()->length() / 2; int length = Handle<FixedArray>::cast(mconst.Value().handle())->length() / 2;
int flags = OpParameter<int>(node->op()); int flags = OpParameter<int>(node->op());
// Use the FastCloneShallowObjectStub only for shallow boilerplates without // Use the FastCloneShallowObjectStub only for shallow boilerplates without
...@@ -1227,9 +1227,10 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { ...@@ -1227,9 +1227,10 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode());
Node* const input = NodeProperties::GetValueInput(node, 0); Node* const input = NodeProperties::GetValueInput(node, 0);
HeapObjectMatcher<ScopeInfo> minput(input); HeapObjectMatcher minput(input);
DCHECK(minput.HasValue()); // TODO(mstarzinger): Make ScopeInfo static. DCHECK(minput.HasValue()); // TODO(mstarzinger): Make ScopeInfo static.
int context_length = minput.Value().handle()->ContextLength(); int context_length =
Handle<ScopeInfo>::cast(minput.Value().handle())->ContextLength();
if (FLAG_turbo_allocate && context_length < kBlockContextAllocationLimit) { if (FLAG_turbo_allocate && context_length < kBlockContextAllocationLimit) {
// JSCreateBlockContext(s:scope[length < limit], f) // JSCreateBlockContext(s:scope[length < limit], f)
Node* const effect = NodeProperties::GetEffectInput(node); Node* const effect = NodeProperties::GetEffectInput(node);
......
...@@ -152,11 +152,10 @@ typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher; ...@@ -152,11 +152,10 @@ typedef FloatMatcher<double, IrOpcode::kNumberConstant> NumberMatcher;
// A pattern matcher for heap object constants. // A pattern matcher for heap object constants.
template <typename T>
struct HeapObjectMatcher final struct HeapObjectMatcher final
: public ValueMatcher<Unique<T>, IrOpcode::kHeapConstant> { : public ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant> {
explicit HeapObjectMatcher(Node* node) explicit HeapObjectMatcher(Node* node)
: ValueMatcher<Unique<T>, IrOpcode::kHeapConstant>(node) {} : ValueMatcher<Unique<HeapObject>, IrOpcode::kHeapConstant>(node) {}
}; };
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "src/compiler/js-context-specialization.h" #include "src/compiler/js-context-specialization.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-operator.h" #include "src/compiler/js-operator.h"
#include "src/compiler/node-matchers.h" #include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
...@@ -91,7 +92,7 @@ TEST(ReduceJSLoadContext) { ...@@ -91,7 +92,7 @@ TEST(ReduceJSLoadContext) {
CHECK(r.Changed()); CHECK(r.Changed());
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0); Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode()); CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
HeapObjectMatcher<Context> match(new_context_input); HeapObjectMatcher match(new_context_input);
CHECK_EQ(*native, *match.Value().handle()); CHECK_EQ(*native, *match.Value().handle());
ContextAccess access = OpParameter<ContextAccess>(r.replacement()); ContextAccess access = OpParameter<ContextAccess>(r.replacement());
CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index())); CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index()));
...@@ -107,7 +108,7 @@ TEST(ReduceJSLoadContext) { ...@@ -107,7 +108,7 @@ TEST(ReduceJSLoadContext) {
CHECK(r.Changed()); CHECK(r.Changed());
CHECK(r.replacement() != load); CHECK(r.replacement() != load);
HeapObjectMatcher<Object> match(r.replacement()); HeapObjectMatcher match(r.replacement());
CHECK(match.HasValue()); CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value().handle()); CHECK_EQ(*expected, *match.Value().handle());
} }
...@@ -170,7 +171,7 @@ TEST(ReduceJSStoreContext) { ...@@ -170,7 +171,7 @@ TEST(ReduceJSStoreContext) {
CHECK(r.Changed()); CHECK(r.Changed());
Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0); Node* new_context_input = NodeProperties::GetValueInput(r.replacement(), 0);
CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode()); CHECK_EQ(IrOpcode::kHeapConstant, new_context_input->opcode());
HeapObjectMatcher<Context> match(new_context_input); HeapObjectMatcher match(new_context_input);
CHECK_EQ(*native, *match.Value().handle()); CHECK_EQ(*native, *match.Value().handle());
ContextAccess access = OpParameter<ContextAccess>(r.replacement()); ContextAccess access = OpParameter<ContextAccess>(r.replacement());
CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index())); CHECK_EQ(Context::GLOBAL_EVAL_FUN_INDEX, static_cast<int>(access.index()));
...@@ -245,7 +246,7 @@ TEST(SpecializeToContext) { ...@@ -245,7 +246,7 @@ TEST(SpecializeToContext) {
CHECK_EQ(other_load, other_use->InputAt(0)); CHECK_EQ(other_load, other_use->InputAt(0));
Node* replacement = value_use->InputAt(0); Node* replacement = value_use->InputAt(0);
HeapObjectMatcher<Object> match(replacement); HeapObjectMatcher match(replacement);
CHECK(match.HasValue()); CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value().handle()); CHECK_EQ(*expected, *match.Value().handle());
} }
......
...@@ -69,7 +69,7 @@ class RepresentationChangerTester : public HandleAndZoneScope, ...@@ -69,7 +69,7 @@ class RepresentationChangerTester : public HandleAndZoneScope,
} }
void CheckHeapConstant(Node* n, HeapObject* expected) { void CheckHeapConstant(Node* n, HeapObject* expected) {
HeapObjectMatcher<HeapObject> m(n); HeapObjectMatcher m(n);
CHECK(m.HasValue()); CHECK(m.HasValue());
CHECK_EQ(expected, *m.Value().handle()); CHECK_EQ(expected, *m.Value().handle());
} }
......
...@@ -275,7 +275,7 @@ TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmiWithDeoptimization) { ...@@ -275,7 +275,7 @@ TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmiWithDeoptimization) {
access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
EXPECT_THAT(r.replacement(), load_field_match); EXPECT_THAT(r.replacement(), load_field_match);
HeapObjectMatcher<PropertyCell> cell(cell_capture.value()); HeapObjectMatcher cell(cell_capture.value());
EXPECT_TRUE(cell.HasValue()); EXPECT_TRUE(cell.HasValue());
EXPECT_TRUE(cell.Value().handle()->IsPropertyCell()); EXPECT_TRUE(cell.Value().handle()->IsPropertyCell());
...@@ -327,7 +327,7 @@ TEST_F(JSTypeFeedbackTest, ...@@ -327,7 +327,7 @@ TEST_F(JSTypeFeedbackTest,
access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
EXPECT_THAT(r.replacement(), load_field_match); EXPECT_THAT(r.replacement(), load_field_match);
HeapObjectMatcher<PropertyCell> cell(cell_capture.value()); HeapObjectMatcher cell(cell_capture.value());
EXPECT_TRUE(cell.HasValue()); EXPECT_TRUE(cell.HasValue());
EXPECT_TRUE(cell.Value().handle()->IsPropertyCell()); EXPECT_TRUE(cell.Value().handle()->IsPropertyCell());
......
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