Chromium Code Reviews| Index: test/unittests/compiler/js-typed-lowering-unittest.cc |
| diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc |
| index 8bb5798bd2fe6bbc591f81746ed9e4ca4e981512..c4a610f13973df6cf5f8e26047480cc58df90230 100644 |
| --- a/test/unittests/compiler/js-typed-lowering-unittest.cc |
| +++ b/test/unittests/compiler/js-typed-lowering-unittest.cc |
| @@ -852,6 +852,43 @@ TEST_F(JSTypedLoweringTest, JSStorePropertyToExternalTypedArrayWithSafeKey) { |
| } |
| } |
| + |
| +TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) { |
| + Handle<String> names[] = { |
| + Handle<String>(isolate()->heap()->undefined_string(), isolate()), |
| + Handle<String>(isolate()->heap()->infinity_string(), isolate()), |
| + Handle<String>(isolate()->heap()->nan_string(), isolate()) // -- |
| + }; |
| + Matcher<Node*> matches[] = { |
| + IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
| + Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))), |
| + IsNumberConstant(std::numeric_limits<double>::infinity()), |
| + IsNumberConstant(IsNaN()) // -- |
| + }; |
| + |
| + VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), |
| + FeedbackVectorICSlot::Invalid()); |
| + Node* global = Parameter(Type::GlobalObject()); |
| + Node* context = UndefinedConstant(); |
| + Node* effect = graph()->start(); |
| + Node* control = graph()->start(); |
| + |
| + for (size_t i = 0; i < arraysize(names); i++) { |
| + Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); |
| + Node* node = graph()->NewNode(javascript()->LoadNamed(name, feedback), |
| + global, context); |
| + if (FLAG_turbo_deoptimization) { |
| + node->AppendInput(zone(), UndefinedConstant()); |
|
Michael Starzinger
2015/04/13 15:04:29
nit: s/UndefinedConstant/EmptyFrameState/
titzer
2015/04/13 15:23:27
Done.
|
| + } |
| + node->AppendInput(zone(), effect); |
| + node->AppendInput(zone(), control); |
| + |
| + Reduction r = Reduce(node); |
| + |
| + EXPECT_THAT(r.replacement(), matches[i]); |
| + } |
| +} |
| + |
| } // namespace compiler |
| } // namespace internal |
| } // namespace v8 |