| 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 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 | 1087 |
| 1088 | 1088 |
| 1089 // ----------------------------------------------------------------------------- | 1089 // ----------------------------------------------------------------------------- |
| 1090 // JSCreateLiteralArray | 1090 // JSCreateLiteralArray |
| 1091 | 1091 |
| 1092 | 1092 |
| 1093 TEST_F(JSTypedLoweringTest, JSCreateLiteralArray) { | 1093 TEST_F(JSTypedLoweringTest, JSCreateLiteralArray) { |
| 1094 Handle<FixedArray> const constant_elements = factory()->NewFixedArray(12); | 1094 Handle<FixedArray> const constant_elements = factory()->NewFixedArray(12); |
| 1095 int const literal_flags = ArrayLiteral::kShallowElements; | 1095 int const literal_flags = ArrayLiteral::kShallowElements; |
| 1096 int const literal_index = 1; | 1096 int const literal_index = 1; |
| 1097 Node* const input = Parameter(0); | 1097 Node* const closure = Parameter(0); |
| 1098 Node* const context = Parameter(1); | 1098 Node* const context = Parameter(1); |
| 1099 Node* const frame_state = EmptyFrameState(); | 1099 Node* const frame_state = EmptyFrameState(); |
| 1100 Node* const effect = graph()->start(); | 1100 Node* const effect = graph()->start(); |
| 1101 Node* const control = graph()->start(); | 1101 Node* const control = graph()->start(); |
| 1102 Reduction const r = Reduce( | 1102 Reduction const r = Reduce( |
| 1103 graph()->NewNode(javascript()->CreateLiteralArray( | 1103 graph()->NewNode(javascript()->CreateLiteralArray( |
| 1104 constant_elements, literal_flags, literal_index), | 1104 constant_elements, literal_flags, literal_index), |
| 1105 input, context, frame_state, effect, control)); | 1105 closure, context, frame_state, effect, control)); |
| 1106 ASSERT_TRUE(r.Changed()); | 1106 ASSERT_TRUE(r.Changed()); |
| 1107 EXPECT_THAT( | 1107 EXPECT_THAT( |
| 1108 r.replacement(), | 1108 r.replacement(), |
| 1109 IsCall(_, IsHeapConstant( | 1109 IsCall(_, IsHeapConstant( |
| 1110 CodeFactory::FastCloneShallowArray(isolate()).code()), | 1110 CodeFactory::FastCloneShallowArray(isolate()).code()), |
| 1111 input, IsNumberConstant(literal_index), | 1111 closure, IsNumberConstant(literal_index), |
| 1112 IsHeapConstant(constant_elements), context, frame_state, effect, | 1112 IsHeapConstant(constant_elements), context, frame_state, effect, |
| 1113 control)); | 1113 control)); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 | 1116 |
| 1117 // ----------------------------------------------------------------------------- | 1117 // ----------------------------------------------------------------------------- |
| 1118 // JSCreateLiteralObject | 1118 // JSCreateLiteralObject |
| 1119 | 1119 |
| 1120 | 1120 |
| 1121 TEST_F(JSTypedLoweringTest, JSCreateLiteralObject) { | 1121 TEST_F(JSTypedLoweringTest, JSCreateLiteralObject) { |
| 1122 Handle<FixedArray> const constant_properties = | 1122 Handle<FixedArray> const constant_properties = |
| 1123 factory()->NewFixedArray(6 * 2); | 1123 factory()->NewFixedArray(6 * 2); |
| 1124 int const literal_flags = ObjectLiteral::kShallowProperties; | 1124 int const literal_flags = ObjectLiteral::kShallowProperties; |
| 1125 int const literal_index = 1; | 1125 int const literal_index = 1; |
| 1126 Node* const input = Parameter(0); | 1126 Node* const closure = Parameter(0); |
| 1127 Node* const context = Parameter(1); | 1127 Node* const context = Parameter(1); |
| 1128 Node* const frame_state = EmptyFrameState(); | 1128 Node* const frame_state = EmptyFrameState(); |
| 1129 Node* const effect = graph()->start(); | 1129 Node* const effect = graph()->start(); |
| 1130 Node* const control = graph()->start(); | 1130 Node* const control = graph()->start(); |
| 1131 Reduction const r = Reduce( | 1131 Reduction const r = Reduce( |
| 1132 graph()->NewNode(javascript()->CreateLiteralObject( | 1132 graph()->NewNode(javascript()->CreateLiteralObject( |
| 1133 constant_properties, literal_flags, literal_index), | 1133 constant_properties, literal_flags, literal_index), |
| 1134 input, context, frame_state, effect, control)); | 1134 closure, context, frame_state, effect, control)); |
| 1135 ASSERT_TRUE(r.Changed()); | 1135 ASSERT_TRUE(r.Changed()); |
| 1136 EXPECT_THAT( | 1136 EXPECT_THAT( |
| 1137 r.replacement(), | 1137 r.replacement(), |
| 1138 IsCall(_, IsHeapConstant( | 1138 IsCall(_, IsHeapConstant( |
| 1139 CodeFactory::FastCloneShallowObject(isolate(), 6).code()), | 1139 CodeFactory::FastCloneShallowObject(isolate(), 6).code()), |
| 1140 input, IsNumberConstant(literal_index), | 1140 closure, IsNumberConstant(literal_index), |
| 1141 IsHeapConstant(constant_properties), _, context, frame_state, | 1141 IsHeapConstant(constant_properties), _, context, frame_state, |
| 1142 effect, control)); | 1142 effect, control)); |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 | 1145 |
| 1146 // ----------------------------------------------------------------------------- | 1146 // ----------------------------------------------------------------------------- |
| 1147 // JSCreateFunctionContext | 1147 // JSCreateFunctionContext |
| 1148 | 1148 |
| 1149 | 1149 |
| 1150 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { | 1150 TEST_F(JSTypedLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 1262 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
| 1263 frame_state, effect, control); | 1263 frame_state, effect, control); |
| 1264 Reduction r = Reduce(instanceOf); | 1264 Reduction r = Reduce(instanceOf); |
| 1265 ASSERT_FALSE(r.Changed()); | 1265 ASSERT_FALSE(r.Changed()); |
| 1266 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 1266 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
| 1267 } | 1267 } |
| 1268 | 1268 |
| 1269 } // namespace compiler | 1269 } // namespace compiler |
| 1270 } // namespace internal | 1270 } // namespace internal |
| 1271 } // namespace v8 | 1271 } // namespace v8 |
| OLD | NEW |