| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/compiler/js-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
| 6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
| 7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/js-operator.h" | 9 #include "src/compiler/js-operator.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); | 88 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
| 89 Node* const frame_state = FrameState(shared, graph()->start()); | 89 Node* const frame_state = FrameState(shared, graph()->start()); |
| 90 Reduction r = Reduce(graph()->NewNode( | 90 Reduction r = Reduce(graph()->NewNode( |
| 91 javascript()->CreateArguments(CreateArgumentsType::kUnmappedArguments), | 91 javascript()->CreateArguments(CreateArgumentsType::kUnmappedArguments), |
| 92 closure, context, frame_state, effect, control)); | 92 closure, context, frame_state, effect, control)); |
| 93 ASSERT_TRUE(r.Changed()); | 93 ASSERT_TRUE(r.Changed()); |
| 94 EXPECT_THAT( | 94 EXPECT_THAT( |
| 95 r.replacement(), | 95 r.replacement(), |
| 96 IsCall(_, IsHeapConstant( | 96 IsCall(_, IsHeapConstant( |
| 97 CodeFactory::FastNewStrictArguments(isolate()).code()), | 97 CodeFactory::FastNewStrictArguments(isolate()).code()), |
| 98 closure, context, frame_state, effect, control)); | 98 closure, context, effect, control)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 TEST_F(JSCreateLoweringTest, JSCreateArgumentsRestParameterViaStub) { | 101 TEST_F(JSCreateLoweringTest, JSCreateArgumentsRestParameterViaStub) { |
| 102 Node* const closure = Parameter(Type::Any()); | 102 Node* const closure = Parameter(Type::Any()); |
| 103 Node* const context = UndefinedConstant(); | 103 Node* const context = UndefinedConstant(); |
| 104 Node* const effect = graph()->start(); | 104 Node* const effect = graph()->start(); |
| 105 Node* const control = graph()->start(); | 105 Node* const control = graph()->start(); |
| 106 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); | 106 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
| 107 Node* const frame_state = FrameState(shared, graph()->start()); | 107 Node* const frame_state = FrameState(shared, graph()->start()); |
| 108 Reduction r = Reduce(graph()->NewNode( | 108 Reduction r = Reduce(graph()->NewNode( |
| 109 javascript()->CreateArguments(CreateArgumentsType::kRestParameter), | 109 javascript()->CreateArguments(CreateArgumentsType::kRestParameter), |
| 110 closure, context, frame_state, effect, control)); | 110 closure, context, frame_state, effect, control)); |
| 111 ASSERT_TRUE(r.Changed()); | 111 ASSERT_TRUE(r.Changed()); |
| 112 EXPECT_THAT( | 112 EXPECT_THAT( |
| 113 r.replacement(), | 113 r.replacement(), |
| 114 IsCall(_, IsHeapConstant( | 114 IsCall(_, IsHeapConstant( |
| 115 CodeFactory::FastNewRestParameter(isolate()).code()), | 115 CodeFactory::FastNewRestParameter(isolate()).code()), |
| 116 closure, context, frame_state, effect, control)); | 116 closure, context, effect, control)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TEST_F(JSCreateLoweringTest, JSCreateArgumentsInlinedMapped) { | 119 TEST_F(JSCreateLoweringTest, JSCreateArgumentsInlinedMapped) { |
| 120 Node* const closure = Parameter(Type::Any()); | 120 Node* const closure = Parameter(Type::Any()); |
| 121 Node* const context = UndefinedConstant(); | 121 Node* const context = UndefinedConstant(); |
| 122 Node* const effect = graph()->start(); | 122 Node* const effect = graph()->start(); |
| 123 Node* const control = graph()->start(); | 123 Node* const control = graph()->start(); |
| 124 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); | 124 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
| 125 Node* const frame_state_outer = FrameState(shared, graph()->start()); | 125 Node* const frame_state_outer = FrameState(shared, graph()->start()); |
| 126 Node* const frame_state_inner = FrameState(shared, frame_state_outer); | 126 Node* const frame_state_inner = FrameState(shared, frame_state_outer); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 EXPECT_THAT(r.replacement(), | 245 EXPECT_THAT(r.replacement(), |
| 246 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 246 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 247 Context::MIN_CONTEXT_SLOTS + 1)), | 247 Context::MIN_CONTEXT_SLOTS + 1)), |
| 248 IsBeginRegion(_), control), | 248 IsBeginRegion(_), control), |
| 249 _)); | 249 _)); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace compiler | 252 } // namespace compiler |
| 253 } // namespace internal | 253 } // namespace internal |
| 254 } // namespace v8 | 254 } // namespace v8 |
| OLD | NEW |