Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/compiler/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "src/compiler/js-operator.h" | 7 #include "src/compiler/js-operator.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/machine-operator.h" | 9 #include "src/compiler/machine-operator.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 ASSERT_TRUE(r.Changed()); | 845 ASSERT_TRUE(r.Changed()); |
| 846 EXPECT_THAT( | 846 EXPECT_THAT( |
| 847 r.replacement(), | 847 r.replacement(), |
| 848 IsStoreElement( | 848 IsStoreElement( |
| 849 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 849 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 850 key, value, effect, control)); | 850 key, value, effect, control)); |
| 851 } | 851 } |
| 852 } | 852 } |
| 853 } | 853 } |
| 854 | 854 |
| 855 | |
| 856 TEST_F(JSTypedLoweringTest, JSLoadNamedGlobalConstants) { | |
| 857 Handle<String> names[] = { | |
| 858 Handle<String>(isolate()->heap()->undefined_string(), isolate()), | |
| 859 Handle<String>(isolate()->heap()->infinity_string(), isolate()), | |
| 860 Handle<String>(isolate()->heap()->nan_string(), isolate()) // -- | |
| 861 }; | |
| 862 Matcher<Node*> matches[] = { | |
| 863 IsHeapConstant(Unique<HeapObject>::CreateImmovable( | |
| 864 Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate()))), | |
| 865 IsNumberConstant(std::numeric_limits<double>::infinity()), | |
| 866 IsNumberConstant(IsNaN()) // -- | |
| 867 }; | |
| 868 | |
| 869 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), | |
| 870 FeedbackVectorICSlot::Invalid()); | |
| 871 Node* global = Parameter(Type::GlobalObject()); | |
| 872 Node* context = UndefinedConstant(); | |
| 873 Node* effect = graph()->start(); | |
| 874 Node* control = graph()->start(); | |
| 875 | |
| 876 for (size_t i = 0; i < arraysize(names); i++) { | |
| 877 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); | |
| 878 Node* node = graph()->NewNode(javascript()->LoadNamed(name, feedback), | |
| 879 global, context); | |
| 880 if (FLAG_turbo_deoptimization) { | |
| 881 node->AppendInput(zone(), UndefinedConstant()); | |
|
Michael Starzinger
2015/04/13 15:04:29
nit: s/UndefinedConstant/EmptyFrameState/
titzer
2015/04/13 15:23:27
Done.
| |
| 882 } | |
| 883 node->AppendInput(zone(), effect); | |
| 884 node->AppendInput(zone(), control); | |
| 885 | |
| 886 Reduction r = Reduce(node); | |
| 887 | |
| 888 EXPECT_THAT(r.replacement(), matches[i]); | |
| 889 } | |
| 890 } | |
| 891 | |
| 855 } // namespace compiler | 892 } // namespace compiler |
| 856 } // namespace internal | 893 } // namespace internal |
| 857 } // namespace v8 | 894 } // namespace v8 |
| OLD | NEW |