| 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 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 Type::Tagged(), | 997 Type::Tagged(), |
| 998 IsLoadContext( | 998 IsLoadContext( |
| 999 ContextAccess(i, Context::EXTENSION_INDEX, false), | 999 ContextAccess(i, Context::EXTENSION_INDEX, false), |
| 1000 context), | 1000 context), |
| 1001 IsNumberConstant(BitEq(0.0))), | 1001 IsNumberConstant(BitEq(0.0))), |
| 1002 control)), | 1002 control)), |
| 1003 _))); | 1003 _))); |
| 1004 } | 1004 } |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 #if V8_TURBOFAN_TARGET | |
| 1008 | 1007 |
| 1009 // ----------------------------------------------------------------------------- | 1008 // ----------------------------------------------------------------------------- |
| 1010 // JSAdd | 1009 // JSAdd |
| 1011 | 1010 |
| 1012 | 1011 |
| 1013 TEST_F(JSTypedLoweringTest, JSAddWithString) { | 1012 TEST_F(JSTypedLoweringTest, JSAddWithString) { |
| 1014 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 1013 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
| 1015 Node* lhs = Parameter(Type::String(), 0); | 1014 Node* lhs = Parameter(Type::String(), 0); |
| 1016 Node* rhs = Parameter(Type::String(), 1); | 1015 Node* rhs = Parameter(Type::String(), 1); |
| 1017 Node* context = Parameter(Type::Any(), 2); | 1016 Node* context = Parameter(Type::Any(), 2); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 javascript()->CreateLiteralObject(ObjectLiteral::kShallowProperties), | 1096 javascript()->CreateLiteralObject(ObjectLiteral::kShallowProperties), |
| 1098 input0, input1, input2, context, frame_state, effect, control)); | 1097 input0, input1, input2, context, frame_state, effect, control)); |
| 1099 ASSERT_TRUE(r.Changed()); | 1098 ASSERT_TRUE(r.Changed()); |
| 1100 EXPECT_THAT( | 1099 EXPECT_THAT( |
| 1101 r.replacement(), | 1100 r.replacement(), |
| 1102 IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( | 1101 IsCall(_, IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
| 1103 CodeFactory::FastCloneShallowObject(isolate(), 6).code())), | 1102 CodeFactory::FastCloneShallowObject(isolate(), 6).code())), |
| 1104 input0, input1, input2, _, context, frame_state, effect, control)); | 1103 input0, input1, input2, _, context, frame_state, effect, control)); |
| 1105 } | 1104 } |
| 1106 | 1105 |
| 1107 #endif // V8_TURBOFAN_TARGET | |
| 1108 | |
| 1109 | 1106 |
| 1110 // ----------------------------------------------------------------------------- | 1107 // ----------------------------------------------------------------------------- |
| 1111 // JSCreateWithContext | 1108 // JSCreateWithContext |
| 1112 | 1109 |
| 1113 | 1110 |
| 1114 TEST_F(JSTypedLoweringTest, JSCreateWithContext) { | 1111 TEST_F(JSTypedLoweringTest, JSCreateWithContext) { |
| 1115 FLAG_turbo_allocate = true; | 1112 FLAG_turbo_allocate = true; |
| 1116 Node* const object = Parameter(Type::Receiver()); | 1113 Node* const object = Parameter(Type::Receiver()); |
| 1117 Node* const closure = Parameter(Type::Any()); | 1114 Node* const closure = Parameter(Type::Any()); |
| 1118 Node* const context = Parameter(Type::Any()); | 1115 Node* const context = Parameter(Type::Any()); |
| 1119 Node* const frame_state = EmptyFrameState(); | 1116 Node* const frame_state = EmptyFrameState(); |
| 1120 Node* const effect = graph()->start(); | 1117 Node* const effect = graph()->start(); |
| 1121 Node* const control = graph()->start(); | 1118 Node* const control = graph()->start(); |
| 1122 Reduction r = | 1119 Reduction r = |
| 1123 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, | 1120 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, |
| 1124 closure, context, frame_state, effect, control)); | 1121 closure, context, frame_state, effect, control)); |
| 1125 ASSERT_TRUE(r.Changed()); | 1122 ASSERT_TRUE(r.Changed()); |
| 1126 EXPECT_THAT(r.replacement(), | 1123 EXPECT_THAT(r.replacement(), |
| 1127 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( | 1124 IsFinish(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1128 Context::MIN_CONTEXT_SLOTS)), | 1125 Context::MIN_CONTEXT_SLOTS)), |
| 1129 effect, control), | 1126 effect, control), |
| 1130 _)); | 1127 _)); |
| 1131 } | 1128 } |
| 1132 | 1129 |
| 1133 } // namespace compiler | 1130 } // namespace compiler |
| 1134 } // namespace internal | 1131 } // namespace internal |
| 1135 } // namespace v8 | 1132 } // namespace v8 |
| OLD | NEW |