OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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" | |
8 #include "vm/code_patcher.h" | 7 #include "vm/code_patcher.h" |
9 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
10 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
11 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
12 #include "vm/debugger.h" | 11 #include "vm/debugger.h" |
13 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
14 #include "vm/object_store.h" | 13 #include "vm/object_store.h" |
15 #include "vm/message.h" | 14 #include "vm/message.h" |
16 #include "vm/resolver.h" | 15 #include "vm/resolver.h" |
17 #include "vm/runtime_entry.h" | 16 #include "vm/runtime_entry.h" |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 // Find the node id of the deoptimization point and find the continuation | 1260 // Find the node id of the deoptimization point and find the continuation |
1262 // pc in the unoptimized code. | 1261 // pc in the unoptimized code. |
1263 // Since both unoptimized and optimized code have the same layout, we need only | 1262 // Since both unoptimized and optimized code have the same layout, we need only |
1264 // to patch the pc of the Dart frame and to disable/enable appropriate code. | 1263 // to patch the pc of the Dart frame and to disable/enable appropriate code. |
1265 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) { | 1264 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) { |
1266 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); | 1265 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); |
1267 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0)); | 1266 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0)); |
1268 DartFrameIterator iterator; | 1267 DartFrameIterator iterator; |
1269 DartFrame* caller_frame = iterator.NextFrame(); | 1268 DartFrame* caller_frame = iterator.NextFrame(); |
1270 ASSERT(caller_frame != NULL); | 1269 ASSERT(caller_frame != NULL); |
1271 CodeIndexTable* ci_table = isolate->code_index_table(); | 1270 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); |
1272 const Code& optimized_code = | |
1273 Code::Handle(ci_table->LookupCode(caller_frame->pc())); | |
1274 const Function& function = Function::Handle(optimized_code.function()); | 1271 const Function& function = Function::Handle(optimized_code.function()); |
1275 ASSERT(!function.IsNull()); | 1272 ASSERT(!function.IsNull()); |
1276 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); | 1273 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
1277 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); | 1274 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); |
1278 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); | 1275 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); |
1279 const PcDescriptors& descriptors = | 1276 const PcDescriptors& descriptors = |
1280 PcDescriptors::Handle(optimized_code.pc_descriptors()); | 1277 PcDescriptors::Handle(optimized_code.pc_descriptors()); |
1281 ASSERT(!descriptors.IsNull()); | 1278 ASSERT(!descriptors.IsNull()); |
1282 // Locate node id at deoptimization point inside optimized code. | 1279 // Locate node id at deoptimization point inside optimized code. |
1283 intptr_t deopt_node_id = AstNode::kNoId; | 1280 intptr_t deopt_node_id = AstNode::kNoId; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 } | 1410 } |
1414 } | 1411 } |
1415 } | 1412 } |
1416 // The cache is null terminated, therefore the loop above should never | 1413 // The cache is null terminated, therefore the loop above should never |
1417 // terminate by itself. | 1414 // terminate by itself. |
1418 UNREACHABLE(); | 1415 UNREACHABLE(); |
1419 return Code::null(); | 1416 return Code::null(); |
1420 } | 1417 } |
1421 | 1418 |
1422 } // namespace dart | 1419 } // namespace dart |
OLD | NEW |