| 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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 CodeFactory::FastCloneShallowObject(isolate(), 6).code()), | 1049 CodeFactory::FastCloneShallowObject(isolate(), 6).code()), |
| 1050 input0, input1, input2, _, context, frame_state, effect, control)); | 1050 input0, input1, input2, _, context, frame_state, effect, control)); |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 | 1053 |
| 1054 // ----------------------------------------------------------------------------- | 1054 // ----------------------------------------------------------------------------- |
| 1055 // JSCreateFunctionContext | 1055 // JSCreateFunctionContext |
| 1056 | 1056 |
| 1057 | 1057 |
| 1058 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { | 1058 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { |
| 1059 if (!FLAG_turbo_allocate) return; | |
| 1060 Node* const closure = Parameter(Type::Any()); | 1059 Node* const closure = Parameter(Type::Any()); |
| 1061 Node* const context = Parameter(Type::Any()); | 1060 Node* const context = Parameter(Type::Any()); |
| 1062 Node* const effect = graph()->start(); | 1061 Node* const effect = graph()->start(); |
| 1063 Node* const control = graph()->start(); | 1062 Node* const control = graph()->start(); |
| 1064 Reduction const r = | 1063 Reduction const r = |
| 1065 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure, | 1064 Reduce(graph()->NewNode(javascript()->CreateFunctionContext(8), closure, |
| 1066 context, effect, control)); | 1065 context, effect, control)); |
| 1067 ASSERT_TRUE(r.Changed()); | 1066 ASSERT_TRUE(r.Changed()); |
| 1068 EXPECT_THAT(r.replacement(), | 1067 EXPECT_THAT(r.replacement(), |
| 1069 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1068 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1087 CodeFactory::FastNewContext(isolate(), 32).code()), | 1086 CodeFactory::FastNewContext(isolate(), 32).code()), |
| 1088 closure, context, effect, control)); | 1087 closure, context, effect, control)); |
| 1089 } | 1088 } |
| 1090 | 1089 |
| 1091 | 1090 |
| 1092 // ----------------------------------------------------------------------------- | 1091 // ----------------------------------------------------------------------------- |
| 1093 // JSCreateWithContext | 1092 // JSCreateWithContext |
| 1094 | 1093 |
| 1095 | 1094 |
| 1096 TEST_F(JSTypedLoweringTest, JSCreateWithContext) { | 1095 TEST_F(JSTypedLoweringTest, JSCreateWithContext) { |
| 1097 if (!FLAG_turbo_allocate) return; | |
| 1098 Node* const object = Parameter(Type::Receiver()); | 1096 Node* const object = Parameter(Type::Receiver()); |
| 1099 Node* const closure = Parameter(Type::Any()); | 1097 Node* const closure = Parameter(Type::Any()); |
| 1100 Node* const context = Parameter(Type::Any()); | 1098 Node* const context = Parameter(Type::Any()); |
| 1101 Node* const frame_state = EmptyFrameState(); | 1099 Node* const frame_state = EmptyFrameState(); |
| 1102 Node* const effect = graph()->start(); | 1100 Node* const effect = graph()->start(); |
| 1103 Node* const control = graph()->start(); | 1101 Node* const control = graph()->start(); |
| 1104 Reduction r = | 1102 Reduction r = |
| 1105 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, | 1103 Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, |
| 1106 closure, context, frame_state, effect, control)); | 1104 closure, context, frame_state, effect, control)); |
| 1107 ASSERT_TRUE(r.Changed()); | 1105 ASSERT_TRUE(r.Changed()); |
| 1108 EXPECT_THAT(r.replacement(), | 1106 EXPECT_THAT(r.replacement(), |
| 1109 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 1107 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 1110 Context::MIN_CONTEXT_SLOTS)), | 1108 Context::MIN_CONTEXT_SLOTS)), |
| 1111 IsBeginRegion(effect), control), | 1109 IsBeginRegion(effect), control), |
| 1112 _)); | 1110 _)); |
| 1113 } | 1111 } |
| 1114 | 1112 |
| 1115 } // namespace compiler | 1113 } // namespace compiler |
| 1116 } // namespace internal | 1114 } // namespace internal |
| 1117 } // namespace v8 | 1115 } // namespace v8 |
| OLD | NEW |