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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 graph()->NewNode(javascript()->LoadNamed(language_mode, name, feedback), | 945 graph()->NewNode(javascript()->LoadNamed(language_mode, name, feedback), |
946 receiver, vector, context, EmptyFrameState(), | 946 receiver, vector, context, EmptyFrameState(), |
947 EmptyFrameState(), effect, control)); | 947 EmptyFrameState(), effect, control)); |
948 ASSERT_TRUE(r.Changed()); | 948 ASSERT_TRUE(r.Changed()); |
949 EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(), | 949 EXPECT_THAT(r.replacement(), IsLoadField(AccessBuilder::ForStringLength(), |
950 receiver, effect, control)); | 950 receiver, effect, control)); |
951 } | 951 } |
952 } | 952 } |
953 | 953 |
954 | 954 |
| 955 TEST_F(JSTypedLoweringTest, JSLoadNamedFunctionPrototype) { |
| 956 VectorSlotPair feedback; |
| 957 Handle<Name> name = factory()->prototype_string(); |
| 958 Handle<JSFunction> function = isolate()->object_function(); |
| 959 Handle<JSObject> function_prototype(JSObject::cast(function->prototype())); |
| 960 Node* const receiver = Parameter(Type::Constant(function, zone()), 0); |
| 961 Node* const vector = Parameter(Type::Internal(), 1); |
| 962 Node* const context = Parameter(Type::Internal(), 2); |
| 963 Node* const effect = graph()->start(); |
| 964 Node* const control = graph()->start(); |
| 965 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
| 966 Reduction const r = Reduce( |
| 967 graph()->NewNode(javascript()->LoadNamed(language_mode, name, feedback), |
| 968 receiver, vector, context, EmptyFrameState(), |
| 969 EmptyFrameState(), effect, control)); |
| 970 ASSERT_TRUE(r.Changed()); |
| 971 EXPECT_THAT(r.replacement(), IsHeapConstant(function_prototype)); |
| 972 } |
| 973 } |
| 974 |
| 975 |
955 // ----------------------------------------------------------------------------- | 976 // ----------------------------------------------------------------------------- |
956 // JSAdd | 977 // JSAdd |
957 | 978 |
958 | 979 |
959 TEST_F(JSTypedLoweringTest, JSAddWithString) { | 980 TEST_F(JSTypedLoweringTest, JSAddWithString) { |
960 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { | 981 TRACED_FOREACH(LanguageMode, language_mode, kLanguageModes) { |
961 Node* lhs = Parameter(Type::String(), 0); | 982 Node* lhs = Parameter(Type::String(), 0); |
962 Node* rhs = Parameter(Type::String(), 1); | 983 Node* rhs = Parameter(Type::String(), 1); |
963 Node* context = Parameter(Type::Any(), 2); | 984 Node* context = Parameter(Type::Any(), 2); |
964 Node* frame_state0 = EmptyFrameState(); | 985 Node* frame_state0 = EmptyFrameState(); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, | 1283 Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, |
1263 frame_state, effect, control); | 1284 frame_state, effect, control); |
1264 Reduction r = Reduce(instanceOf); | 1285 Reduction r = Reduce(instanceOf); |
1265 ASSERT_FALSE(r.Changed()); | 1286 ASSERT_FALSE(r.Changed()); |
1266 ASSERT_EQ(instanceOf, dummy->InputAt(0)); | 1287 ASSERT_EQ(instanceOf, dummy->InputAt(0)); |
1267 } | 1288 } |
1268 | 1289 |
1269 } // namespace compiler | 1290 } // namespace compiler |
1270 } // namespace internal | 1291 } // namespace internal |
1271 } // namespace v8 | 1292 } // namespace v8 |
OLD | NEW |