OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <set> | 5 #include <set> |
6 | 6 |
7 #include "vm/kernel_to_il.h" | 7 #include "vm/kernel_to_il.h" |
8 | 8 |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 | 944 |
945 | 945 |
946 Fragment FlowGraphBuilder::AllocateContext(int size) { | 946 Fragment FlowGraphBuilder::AllocateContext(int size) { |
947 AllocateContextInstr* allocate = | 947 AllocateContextInstr* allocate = |
948 new (Z) AllocateContextInstr(TokenPosition::kNoSource, size); | 948 new (Z) AllocateContextInstr(TokenPosition::kNoSource, size); |
949 Push(allocate); | 949 Push(allocate); |
950 return Fragment(allocate); | 950 return Fragment(allocate); |
951 } | 951 } |
952 | 952 |
953 | 953 |
954 Fragment FlowGraphBuilder::AllocateObject(const dart::Class& klass, | 954 Fragment FlowGraphBuilder::AllocateObject(TokenPosition position, |
| 955 const dart::Class& klass, |
955 intptr_t argument_count) { | 956 intptr_t argument_count) { |
956 ArgumentArray arguments = GetArguments(argument_count); | 957 ArgumentArray arguments = GetArguments(argument_count); |
957 AllocateObjectInstr* allocate = | 958 AllocateObjectInstr* allocate = |
958 new (Z) AllocateObjectInstr(TokenPosition::kNoSource, klass, arguments); | 959 new (Z) AllocateObjectInstr(position, klass, arguments); |
959 Push(allocate); | 960 Push(allocate); |
960 return Fragment(allocate); | 961 return Fragment(allocate); |
961 } | 962 } |
962 | 963 |
963 | 964 |
964 Fragment FlowGraphBuilder::AllocateObject(const dart::Class& klass, | 965 Fragment FlowGraphBuilder::AllocateObject(const dart::Class& klass, |
965 const Function& closure_function) { | 966 const Function& closure_function) { |
966 ArgumentArray arguments = new (Z) ZoneGrowableArray<PushArgumentInstr*>(Z, 0); | 967 ArgumentArray arguments = new (Z) ZoneGrowableArray<PushArgumentInstr*>(Z, 0); |
967 AllocateObjectInstr* allocate = | 968 AllocateObjectInstr* allocate = |
968 new (Z) AllocateObjectInstr(TokenPosition::kNoSource, klass, arguments); | 969 new (Z) AllocateObjectInstr(TokenPosition::kNoSource, klass, arguments); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 klass.LookupConstructorAllowPrivate(H.DartSymbol("_TypeError._create"))); | 1552 klass.LookupConstructorAllowPrivate(H.DartSymbol("_TypeError._create"))); |
1552 ASSERT(!constructor.IsNull()); | 1553 ASSERT(!constructor.IsNull()); |
1553 | 1554 |
1554 const dart::String& url = H.DartString( | 1555 const dart::String& url = H.DartString( |
1555 parsed_function_->function().ToLibNamePrefixedQualifiedCString(), | 1556 parsed_function_->function().ToLibNamePrefixedQualifiedCString(), |
1556 Heap::kOld); | 1557 Heap::kOld); |
1557 | 1558 |
1558 Fragment instructions; | 1559 Fragment instructions; |
1559 | 1560 |
1560 // Create instance of _FallThroughError | 1561 // Create instance of _FallThroughError |
1561 instructions += AllocateObject(klass, 0); | 1562 instructions += AllocateObject(TokenPosition::kNoSource, klass, 0); |
1562 LocalVariable* instance = MakeTemporary(); | 1563 LocalVariable* instance = MakeTemporary(); |
1563 | 1564 |
1564 // Call _TypeError._create constructor. | 1565 // Call _TypeError._create constructor. |
1565 instructions += LoadLocal(instance); | 1566 instructions += LoadLocal(instance); |
1566 instructions += PushArgument(); // this | 1567 instructions += PushArgument(); // this |
1567 | 1568 |
1568 instructions += Constant(url); | 1569 instructions += Constant(url); |
1569 instructions += PushArgument(); // url | 1570 instructions += PushArgument(); // url |
1570 | 1571 |
1571 instructions += NullConstant(); | 1572 instructions += NullConstant(); |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2739 thread->clear_sticky_error(); | 2740 thread->clear_sticky_error(); |
2740 return error.raw(); | 2741 return error.raw(); |
2741 } | 2742 } |
2742 } | 2743 } |
2743 | 2744 |
2744 | 2745 |
2745 } // namespace kernel | 2746 } // namespace kernel |
2746 } // namespace dart | 2747 } // namespace dart |
2747 | 2748 |
2748 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 2749 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |