| 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); | 889 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); |
| 890 Reduction r = Reduce(graph()->NewNode( | 890 Reduction r = Reduce(graph()->NewNode( |
| 891 javascript()->LoadNamed(name, feedback), global, context, | 891 javascript()->LoadNamed(name, feedback), global, context, |
| 892 EmptyFrameState(), EmptyFrameState(), effect, control)); | 892 EmptyFrameState(), EmptyFrameState(), effect, control)); |
| 893 | 893 |
| 894 ASSERT_TRUE(r.Changed()); | 894 ASSERT_TRUE(r.Changed()); |
| 895 EXPECT_THAT(r.replacement(), matches[i]); | 895 EXPECT_THAT(r.replacement(), matches[i]); |
| 896 } | 896 } |
| 897 } | 897 } |
| 898 | 898 |
| 899 |
| 900 // ----------------------------------------------------------------------------- |
| 901 // JSLoadDynamicGlobal |
| 902 |
| 903 |
| 904 TEST_F(JSTypedLoweringTest, JSLoadDynamicGlobal) { |
| 905 Node* const context = Parameter(Type::Any()); |
| 906 Node* const frame_state = EmptyFrameState(); |
| 907 Node* const effect = graph()->start(); |
| 908 Node* const control = graph()->start(); |
| 909 Handle<String> name = factory()->object_string(); |
| 910 VectorSlotPair feedback(Handle<TypeFeedbackVector>::null(), |
| 911 FeedbackVectorICSlot::Invalid()); |
| 912 for (int i = 0; i < DynamicGlobalAccess::kMaxCheckDepth; ++i) { |
| 913 uint32_t bitset = 1 << i; // Only single check. |
| 914 Reduction r = Reduce(graph()->NewNode( |
| 915 javascript()->LoadDynamicGlobal(name, bitset, feedback, NOT_CONTEXTUAL), |
| 916 context, context, frame_state, frame_state, effect, control)); |
| 917 ASSERT_TRUE(r.Changed()); |
| 918 EXPECT_THAT( |
| 919 r.replacement(), |
| 920 IsPhi(kMachAnyTagged, _, _, |
| 921 IsMerge(IsIfTrue(IsBranch( |
| 922 IsObjectIsSmi(IsLoadContext( |
| 923 ContextAccess(i, Context::EXTENSION_INDEX, false), |
| 924 context)), |
| 925 control)), |
| 926 _))); |
| 927 } |
| 928 } |
| 929 |
| 899 #if V8_TURBOFAN_TARGET | 930 #if V8_TURBOFAN_TARGET |
| 900 | 931 |
| 901 // ----------------------------------------------------------------------------- | 932 // ----------------------------------------------------------------------------- |
| 902 // JSAdd | 933 // JSAdd |
| 903 | 934 |
| 904 | 935 |
| 905 TEST_F(JSTypedLoweringTest, JSAddWithString) { | 936 TEST_F(JSTypedLoweringTest, JSAddWithString) { |
| 906 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 937 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
| 907 Node* lhs = Parameter(Type::String(), 0); | 938 Node* lhs = Parameter(Type::String(), 0); |
| 908 Node* rhs = Parameter(Type::String(), 1); | 939 Node* rhs = Parameter(Type::String(), 1); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 EXPECT_THAT(r.replacement(), | 1049 EXPECT_THAT(r.replacement(), |
| 1019 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1050 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1020 Context::MIN_CONTEXT_SLOTS)), | 1051 Context::MIN_CONTEXT_SLOTS)), |
| 1021 effect, control), | 1052 effect, control), |
| 1022 _)); | 1053 _)); |
| 1023 } | 1054 } |
| 1024 | 1055 |
| 1025 } // namespace compiler | 1056 } // namespace compiler |
| 1026 } // namespace internal | 1057 } // namespace internal |
| 1027 } // namespace v8 | 1058 } // namespace v8 |
| OLD | NEW |