| 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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 IsPhi(kMachAnyTagged, _, _, | 920 IsPhi(kMachAnyTagged, _, _, |
| 921 IsMerge(IsIfTrue(IsBranch( | 921 IsMerge(IsIfTrue(IsBranch( |
| 922 IsObjectIsSmi(IsLoadContext( | 922 IsObjectIsSmi(IsLoadContext( |
| 923 ContextAccess(i, Context::EXTENSION_INDEX, false), | 923 ContextAccess(i, Context::EXTENSION_INDEX, false), |
| 924 context)), | 924 context)), |
| 925 control)), | 925 control)), |
| 926 _))); | 926 _))); |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 | 929 |
| 930 |
| 931 // ----------------------------------------------------------------------------- |
| 932 // JSLoadDynamicContext |
| 933 |
| 934 |
| 935 TEST_F(JSTypedLoweringTest, JSLoadDynamicContext) { |
| 936 Node* const context = Parameter(Type::Any()); |
| 937 Node* const frame_state = EmptyFrameState(); |
| 938 Node* const effect = graph()->start(); |
| 939 Node* const control = graph()->start(); |
| 940 Handle<String> name = factory()->object_string(); |
| 941 for (int i = 0; i < DynamicContextAccess::kMaxCheckDepth; ++i) { |
| 942 uint32_t bitset = 1 << i; // Only single check. |
| 943 Reduction r = Reduce( |
| 944 graph()->NewNode(javascript()->LoadDynamicContext(name, bitset, 23, 42), |
| 945 context, context, frame_state, effect, control)); |
| 946 ASSERT_TRUE(r.Changed()); |
| 947 EXPECT_THAT( |
| 948 r.replacement(), |
| 949 IsPhi(kMachAnyTagged, |
| 950 IsLoadContext(ContextAccess(23, 42, false), context), _, |
| 951 IsMerge( |
| 952 IsIfTrue(IsBranch( |
| 953 IsReferenceEqual( |
| 954 Type::Tagged(), |
| 955 IsLoadContext( |
| 956 ContextAccess(i, Context::EXTENSION_INDEX, false), |
| 957 context), |
| 958 IsNumberConstant(BitEq(0.0))), |
| 959 control)), |
| 960 _))); |
| 961 } |
| 962 } |
| 963 |
| 930 #if V8_TURBOFAN_TARGET | 964 #if V8_TURBOFAN_TARGET |
| 931 | 965 |
| 932 // ----------------------------------------------------------------------------- | 966 // ----------------------------------------------------------------------------- |
| 933 // JSAdd | 967 // JSAdd |
| 934 | 968 |
| 935 | 969 |
| 936 TEST_F(JSTypedLoweringTest, JSAddWithString) { | 970 TEST_F(JSTypedLoweringTest, JSAddWithString) { |
| 937 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 971 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
| 938 Node* lhs = Parameter(Type::String(), 0); | 972 Node* lhs = Parameter(Type::String(), 0); |
| 939 Node* rhs = Parameter(Type::String(), 1); | 973 Node* rhs = Parameter(Type::String(), 1); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 EXPECT_THAT(r.replacement(), | 1083 EXPECT_THAT(r.replacement(), |
| 1050 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1084 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1051 Context::MIN_CONTEXT_SLOTS)), | 1085 Context::MIN_CONTEXT_SLOTS)), |
| 1052 effect, control), | 1086 effect, control), |
| 1053 _)); | 1087 _)); |
| 1054 } | 1088 } |
| 1055 | 1089 |
| 1056 } // namespace compiler | 1090 } // namespace compiler |
| 1057 } // namespace internal | 1091 } // namespace internal |
| 1058 } // namespace v8 | 1092 } // namespace v8 |
| OLD | NEW |