| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
| 9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 r.replacement(), | 855 r.replacement(), |
| 856 IsStoreElement( | 856 IsStoreElement( |
| 857 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), | 857 access, IsIntPtrConstant(bit_cast<intptr_t>(&backing_store[0])), |
| 858 key, value, effect, control)); | 858 key, value, effect, control)); |
| 859 } | 859 } |
| 860 } | 860 } |
| 861 } | 861 } |
| 862 | 862 |
| 863 | 863 |
| 864 // ----------------------------------------------------------------------------- | 864 // ----------------------------------------------------------------------------- |
| 865 // JSLoadGlobal | |
| 866 | |
| 867 | |
| 868 TEST_F(JSTypedLoweringTest, JSLoadGlobalConstants) { | |
| 869 Handle<String> names[] = { | |
| 870 Handle<String>(isolate()->heap()->undefined_string(), isolate()), | |
| 871 Handle<String>(isolate()->heap()->infinity_string(), isolate()), | |
| 872 Handle<String>(isolate()->heap()->nan_string(), isolate()) // -- | |
| 873 }; | |
| 874 Matcher<Node*> matches[] = { | |
| 875 IsHeapConstant( | |
| 876 Handle<HeapObject>(isolate()->heap()->undefined_value(), isolate())), | |
| 877 IsNumberConstant(std::numeric_limits<double>::infinity()), | |
| 878 IsNumberConstant(IsNaN()) // -- | |
| 879 }; | |
| 880 | |
| 881 VectorSlotPair feedback; | |
| 882 Node* global = UndefinedConstant(); | |
| 883 Node* vector = UndefinedConstant(); | |
| 884 Node* context = UndefinedConstant(); | |
| 885 Node* effect = graph()->start(); | |
| 886 Node* control = graph()->start(); | |
| 887 | |
| 888 for (size_t i = 0; i < arraysize(names); i++) { | |
| 889 Reduction r = Reduce(graph()->NewNode( | |
| 890 javascript()->LoadGlobal(names[i], feedback), context, global, vector, | |
| 891 context, EmptyFrameState(), EmptyFrameState(), effect, control)); | |
| 892 | |
| 893 ASSERT_TRUE(r.Changed()); | |
| 894 EXPECT_THAT(r.replacement(), matches[i]); | |
| 895 } | |
| 896 } | |
| 897 | |
| 898 | |
| 899 // ----------------------------------------------------------------------------- | |
| 900 // JSLoadNamed | 865 // JSLoadNamed |
| 901 | 866 |
| 902 | 867 |
| 903 TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { | 868 TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) { |
| 904 VectorSlotPair feedback; | 869 VectorSlotPair feedback; |
| 905 Handle<Name> name = factory()->length_string(); | 870 Handle<Name> name = factory()->length_string(); |
| 906 Node* const receiver = Parameter(Type::String(), 0); | 871 Node* const receiver = Parameter(Type::String(), 0); |
| 907 Node* const vector = Parameter(Type::Internal(), 1); | 872 Node* const vector = Parameter(Type::Internal(), 1); |
| 908 Node* const context = UndefinedConstant(); | 873 Node* const context = UndefinedConstant(); |
| 909 Node* const effect = graph()->start(); | 874 Node* const effect = graph()->start(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 EXPECT_THAT(r.replacement(), | 1108 EXPECT_THAT(r.replacement(), |
| 1144 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1109 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1145 Context::MIN_CONTEXT_SLOTS)), | 1110 Context::MIN_CONTEXT_SLOTS)), |
| 1146 effect, control), | 1111 effect, control), |
| 1147 _)); | 1112 _)); |
| 1148 } | 1113 } |
| 1149 | 1114 |
| 1150 } // namespace compiler | 1115 } // namespace compiler |
| 1151 } // namespace internal | 1116 } // namespace internal |
| 1152 } // namespace v8 | 1117 } // namespace v8 |
| OLD | NEW |