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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); | 875 Unique<Name> name = Unique<Name>::CreateImmovable(names[i]); |
874 Reduction r = | 876 Reduction r = |
875 Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), global, | 877 Reduce(graph()->NewNode(javascript()->LoadNamed(name, feedback), global, |
876 context, EmptyFrameState(), effect, control)); | 878 context, EmptyFrameState(), effect, control)); |
877 | 879 |
878 ASSERT_TRUE(r.Changed()); | 880 ASSERT_TRUE(r.Changed()); |
879 EXPECT_THAT(r.replacement(), matches[i]); | 881 EXPECT_THAT(r.replacement(), matches[i]); |
880 } | 882 } |
881 } | 883 } |
882 | 884 |
| 885 |
| 886 // ----------------------------------------------------------------------------- |
| 887 // JSCreateClosure |
| 888 |
| 889 |
| 890 TEST_F(JSTypedLoweringTest, JSCreateClosure) { |
| 891 Node* const context = UndefinedConstant(); |
| 892 Node* const effect = graph()->start(); |
| 893 Node* const control = graph()->start(); |
| 894 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
| 895 Reduction r = |
| 896 Reduce(graph()->NewNode(javascript()->CreateClosure(shared, NOT_TENURED), |
| 897 context, context, effect, control)); |
| 898 ASSERT_TRUE(r.Changed()); |
| 899 EXPECT_THAT( |
| 900 r.replacement(), |
| 901 IsCall(_, |
| 902 IsHeapConstant(Unique<HeapObject>::CreateImmovable( |
| 903 CodeFactory::FastNewClosure(isolate(), shared->language_mode(), |
| 904 shared->kind()).code())), |
| 905 IsHeapConstant(Unique<HeapObject>::CreateImmovable(shared)), |
| 906 effect, control)); |
| 907 } |
| 908 |
883 } // namespace compiler | 909 } // namespace compiler |
884 } // namespace internal | 910 } // namespace internal |
885 } // namespace v8 | 911 } // namespace v8 |
OLD | NEW |