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/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
8 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
9 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
10 #include "src/compiler/node-properties.h" | 11 #include "src/compiler/node-properties.h" |
11 #include "src/compiler/operator-properties.h" | 12 #include "src/compiler/operator-properties.h" |
12 #include "test/unittests/compiler/compiler-test-utils.h" | 13 #include "test/unittests/compiler/compiler-test-utils.h" |
13 #include "test/unittests/compiler/graph-unittest.h" | 14 #include "test/unittests/compiler/graph-unittest.h" |
14 #include "test/unittests/compiler/node-test-utils.h" | 15 #include "test/unittests/compiler/node-test-utils.h" |
15 #include "testing/gmock-support.h" | 16 #include "testing/gmock-support.h" |
16 | 17 |
| 18 using testing::_; |
17 using testing::BitEq; | 19 using testing::BitEq; |
18 using testing::IsNaN; | 20 using testing::IsNaN; |
19 | 21 |
20 | 22 |
21 namespace v8 { | 23 namespace v8 { |
22 namespace internal { | 24 namespace internal { |
23 namespace compiler { | 25 namespace compiler { |
24 | 26 |
25 namespace { | 27 namespace { |
26 | 28 |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
864 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); | 866 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); |
865 Reduction r = | 867 Reduction r = |
866 Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), global, | 868 Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), global, |
867 context, EmptyFrameState(), effect, control)); | 869 context, EmptyFrameState(), effect, control)); |
868 | 870 |
869 ASSERT_TRUE(r.Changed()); | 871 ASSERT_TRUE(r.Changed()); |
870 EXPECT_THAT(r.replacement(), matches[i]); | 872 EXPECT_THAT(r.replacement(), matches[i]); |
871 } | 873 } |
872 } | 874 } |
873 | 875 |
| 876 |
| 877 // ----------------------------------------------------------------------------- |
| 878 // JSCreateClosure |
| 879 |
| 880 |
| 881 TEST_F(JSTypedLoweringTest, JSCreateClosure) { |
| 882 Node* const context = UndefinedConstant(); |
| 883 Node* const effect = graph()->start(); |
| 884 Node* const control = graph()->start(); |
| 885 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
| 886 Reduction r = |
| 887 Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), |
| 888 context, context, effect, control)); |
| 889 ASSERT_TRUE(r.Changed()); |
| 890 EXPECT_THAT( |
| 891 r.replacement(), |
| 892 IsCall(_, |
| 893 IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
| 894 CodeFactory::FastNewClosure(isolate(), shared->language_mode(), |
| 895 shared->kind()).code())), |
| 896 IsHeapConstant(Unique<HeapObject>::CreateImmovable(shared)), |
| 897 effect, control)); |
| 898 } |
| 899 |
874 } // namespace compiler | 900 } // namespace compiler |
875 } // namespace internal | 901 } // namespace internal |
876 } // namespace v8 | 902 } // namespace v8 |
OLD | NEW |