| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches"); | 22 DEFINE_FLAG(bool, inline_cache, true, "enable inline caches"); |
| 23 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); | 23 DEFINE_FLAG(bool, trace_deopt, false, "Trace deoptimization"); |
| 24 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling"); | 24 DEFINE_FLAG(bool, trace_ic, false, "trace IC handling"); |
| 25 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 25 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 26 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls."); | 26 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls."); |
| 27 DECLARE_FLAG(int, deoptimization_counter_threshold); | 27 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 28 DECLARE_FLAG(bool, trace_type_checks); | 28 DECLARE_FLAG(bool, trace_type_checks); |
| 29 | 29 |
| 30 | 30 |
| 31 void CodeGenerator::DescriptorList::AddDescriptor( |
| 32 PcDescriptors::Kind kind, |
| 33 intptr_t pc_offset, |
| 34 intptr_t node_id, |
| 35 intptr_t token_index, |
| 36 intptr_t try_index) { |
| 37 struct PcDesc data; |
| 38 data.pc_offset = pc_offset; |
| 39 data.kind = kind; |
| 40 data.node_id = node_id; |
| 41 data.token_index = token_index; |
| 42 data.try_index = try_index; |
| 43 list_.Add(data); |
| 44 } |
| 45 |
| 46 |
| 47 RawPcDescriptors* CodeGenerator::DescriptorList::FinalizePcDescriptors( |
| 48 uword entry_point) { |
| 49 intptr_t num_descriptors = Length(); |
| 50 const PcDescriptors& descriptors = |
| 51 PcDescriptors::Handle(PcDescriptors::New(num_descriptors)); |
| 52 for (intptr_t i = 0; i < num_descriptors; i++) { |
| 53 descriptors.AddDescriptor(i, |
| 54 (entry_point + PcOffset(i)), |
| 55 Kind(i), |
| 56 NodeId(i), |
| 57 TokenIndex(i), |
| 58 TryIndex(i)); |
| 59 } |
| 60 return descriptors.raw(); |
| 61 } |
| 62 |
| 63 |
| 31 const Array& CodeGenerator::ArgumentsDescriptor( | 64 const Array& CodeGenerator::ArgumentsDescriptor( |
| 32 int num_arguments, | 65 int num_arguments, |
| 33 const Array& optional_arguments_names) { | 66 const Array& optional_arguments_names) { |
| 34 const intptr_t num_named_args = | 67 const intptr_t num_named_args = |
| 35 optional_arguments_names.IsNull() ? 0 : optional_arguments_names.Length(); | 68 optional_arguments_names.IsNull() ? 0 : optional_arguments_names.Length(); |
| 36 const intptr_t num_pos_args = num_arguments - num_named_args; | 69 const intptr_t num_pos_args = num_arguments - num_named_args; |
| 37 | 70 |
| 38 // Build the argument descriptor array, which consists of the total number of | 71 // Build the argument descriptor array, which consists of the total number of |
| 39 // arguments, the number of positional arguments, alphabetically sorted | 72 // arguments, the number of positional arguments, alphabetically sorted |
| 40 // pairs of name/position, and a terminating null. | 73 // pairs of name/position, and a terminating null. |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 } | 1157 } |
| 1125 } | 1158 } |
| 1126 } | 1159 } |
| 1127 // The cache is null terminated, therefore the loop above should never | 1160 // The cache is null terminated, therefore the loop above should never |
| 1128 // terminate by itself. | 1161 // terminate by itself. |
| 1129 UNREACHABLE(); | 1162 UNREACHABLE(); |
| 1130 return Code::null(); | 1163 return Code::null(); |
| 1131 } | 1164 } |
| 1132 | 1165 |
| 1133 } // namespace dart | 1166 } // namespace dart |
| OLD | NEW |