| 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/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/js-operator.h" | 10 #include "src/compiler/js-operator.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 UndefinedConstant(), outer_frame_state); | 58 UndefinedConstant(), outer_frame_state); |
| 59 } | 59 } |
| 60 | 60 |
| 61 JSOperatorBuilder* javascript() { return &javascript_; } | 61 JSOperatorBuilder* javascript() { return &javascript_; } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 JSOperatorBuilder javascript_; | 64 JSOperatorBuilder javascript_; |
| 65 CompilationDependencies deps_; | 65 CompilationDependencies deps_; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // ----------------------------------------------------------------------------- |
| 69 // JSCreate |
| 70 |
| 68 TEST_F(JSCreateLoweringTest, JSCreate) { | 71 TEST_F(JSCreateLoweringTest, JSCreate) { |
| 69 Handle<JSFunction> function = isolate()->object_function(); | 72 Handle<JSFunction> function = isolate()->object_function(); |
| 70 Node* const target = Parameter(Type::HeapConstant(function, graph()->zone())); | 73 Node* const target = Parameter(Type::HeapConstant(function, graph()->zone())); |
| 71 Node* const context = Parameter(Type::Any()); | 74 Node* const context = Parameter(Type::Any()); |
| 72 Node* const effect = graph()->start(); | 75 Node* const effect = graph()->start(); |
| 73 Reduction r = Reduce(graph()->NewNode(javascript()->Create(), target, target, | 76 Node* const control = graph()->start(); |
| 74 context, EmptyFrameState(), effect)); | 77 Reduction r = |
| 78 Reduce(graph()->NewNode(javascript()->Create(), target, target, context, |
| 79 EmptyFrameState(), effect, control)); |
| 75 ASSERT_TRUE(r.Changed()); | 80 ASSERT_TRUE(r.Changed()); |
| 76 EXPECT_THAT( | 81 EXPECT_THAT( |
| 77 r.replacement(), | 82 r.replacement(), |
| 78 IsFinishRegion( | 83 IsFinishRegion( |
| 79 IsAllocate(IsNumberConstant(function->initial_map()->instance_size()), | 84 IsAllocate(IsNumberConstant(function->initial_map()->instance_size()), |
| 80 IsBeginRegion(effect), _), | 85 IsBeginRegion(effect), control), |
| 81 _)); | 86 _)); |
| 82 } | 87 } |
| 83 | 88 |
| 84 // ----------------------------------------------------------------------------- | 89 // ----------------------------------------------------------------------------- |
| 85 // JSCreateArguments | 90 // JSCreateArguments |
| 86 | 91 |
| 87 TEST_F(JSCreateLoweringTest, JSCreateArgumentsInlinedMapped) { | 92 TEST_F(JSCreateLoweringTest, JSCreateArgumentsInlinedMapped) { |
| 88 Node* const closure = Parameter(Type::Any()); | 93 Node* const closure = Parameter(Type::Any()); |
| 89 Node* const context = UndefinedConstant(); | 94 Node* const context = UndefinedConstant(); |
| 90 Node* const effect = graph()->start(); | 95 Node* const effect = graph()->start(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 EXPECT_THAT(r.replacement(), | 230 EXPECT_THAT(r.replacement(), |
| 226 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( | 231 IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( |
| 227 Context::MIN_CONTEXT_SLOTS + 1)), | 232 Context::MIN_CONTEXT_SLOTS + 1)), |
| 228 IsBeginRegion(_), control), | 233 IsBeginRegion(_), control), |
| 229 _)); | 234 _)); |
| 230 } | 235 } |
| 231 | 236 |
| 232 } // namespace compiler | 237 } // namespace compiler |
| 233 } // namespace internal | 238 } // namespace internal |
| 234 } // namespace v8 | 239 } // namespace v8 |
| OLD | NEW |