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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 EXPECT_THAT(r.replacement(), | 972 EXPECT_THAT(r.replacement(), |
973 IsCall(_, IsHeapConstant(CodeFactory::StringAdd( | 973 IsCall(_, IsHeapConstant(CodeFactory::StringAdd( |
974 isolate(), STRING_ADD_CHECK_NONE, | 974 isolate(), STRING_ADD_CHECK_NONE, |
975 NOT_TENURED).code()), | 975 NOT_TENURED).code()), |
976 lhs, rhs, context, frame_state0, effect, control)); | 976 lhs, rhs, context, frame_state0, effect, control)); |
977 } | 977 } |
978 } | 978 } |
979 | 979 |
980 | 980 |
981 // ----------------------------------------------------------------------------- | 981 // ----------------------------------------------------------------------------- |
| 982 // JSCreate |
| 983 |
| 984 |
| 985 TEST_F(JSTypedLoweringTest, JSCreate) { |
| 986 Handle<JSFunction> function = isolate()->object_function(); |
| 987 Node* const target = Parameter(Type::Constant(function, graph()->zone())); |
| 988 Node* const context = Parameter(Type::Any()); |
| 989 Node* const effect = graph()->start(); |
| 990 Reduction r = Reduce(graph()->NewNode(javascript()->Create(), target, target, |
| 991 context, effect)); |
| 992 ASSERT_TRUE(r.Changed()); |
| 993 EXPECT_THAT( |
| 994 r.replacement(), |
| 995 IsFinishRegion( |
| 996 IsAllocate(IsNumberConstant(function->initial_map()->instance_size()), |
| 997 IsBeginRegion(effect), _), |
| 998 _)); |
| 999 } |
| 1000 |
| 1001 |
| 1002 // ----------------------------------------------------------------------------- |
982 // JSCreateArguments | 1003 // JSCreateArguments |
983 | 1004 |
984 | 1005 |
985 TEST_F(JSTypedLoweringTest, JSCreateArgumentsViaStub) { | 1006 TEST_F(JSTypedLoweringTest, JSCreateArgumentsViaStub) { |
986 Node* const closure = Parameter(Type::Any()); | 1007 Node* const closure = Parameter(Type::Any()); |
987 Node* const context = UndefinedConstant(); | 1008 Node* const context = UndefinedConstant(); |
988 Node* const effect = graph()->start(); | 1009 Node* const effect = graph()->start(); |
989 Node* const control = graph()->start(); | 1010 Node* const control = graph()->start(); |
990 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); | 1011 Handle<SharedFunctionInfo> shared(isolate()->object_function()->shared()); |
991 Node* const frame_state = FrameState(shared, graph()->start()); | 1012 Node* const frame_state = FrameState(shared, graph()->start()); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 1253 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
1233 frame_state, effect, control); | 1254 frame_state, effect, control); |
1234 Reduction r = Reduce(instanceOf); | 1255 Reduction r = Reduce(instanceOf); |
1235 ASSERT_FALSE(r.Changed()); | 1256 ASSERT_FALSE(r.Changed()); |
1236 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 1257 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
1237 } | 1258 } |
1238 | 1259 |
1239 } // namespace compiler | 1260 } // namespace compiler |
1240 } // namespace internal | 1261 } // namespace internal |
1241 } // namespace v8 | 1262 } // namespace v8 |
OLD | NEW |