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" |
7 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
8 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
9 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
11 #include "vm/debugger.h" | 12 #include "vm/debugger.h" |
12 #include "vm/exceptions.h" | 13 #include "vm/exceptions.h" |
13 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
14 #include "vm/message.h" | 15 #include "vm/message.h" |
15 #include "vm/resolver.h" | 16 #include "vm/resolver.h" |
16 #include "vm/runtime_entry.h" | 17 #include "vm/runtime_entry.h" |
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 // Find the node id of the deoptimization point and find the continuation | 1280 // Find the node id of the deoptimization point and find the continuation |
1280 // pc in the unoptimized code. | 1281 // pc in the unoptimized code. |
1281 // Since both unoptimized and optimized code have the same layout, we need only | 1282 // Since both unoptimized and optimized code have the same layout, we need only |
1282 // to patch the pc of the Dart frame and to disable/enable appropriate code. | 1283 // to patch the pc of the Dart frame and to disable/enable appropriate code. |
1283 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) { | 1284 DEFINE_RUNTIME_ENTRY(Deoptimize, 1) { |
1284 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); | 1285 ASSERT(arguments.Count() == kDeoptimizeRuntimeEntry.argument_count()); |
1285 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0)); | 1286 const Smi& deoptimization_reason_id = Smi::CheckedHandle(arguments.At(0)); |
1286 DartFrameIterator iterator; | 1287 DartFrameIterator iterator; |
1287 DartFrame* caller_frame = iterator.NextFrame(); | 1288 DartFrame* caller_frame = iterator.NextFrame(); |
1288 ASSERT(caller_frame != NULL); | 1289 ASSERT(caller_frame != NULL); |
1289 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); | 1290 CodeIndexTable* ci_table = isolate->code_index_table(); |
| 1291 const Code& optimized_code = |
| 1292 Code::Handle(ci_table->LookupCode(caller_frame->pc())); |
1290 const Function& function = Function::Handle(optimized_code.function()); | 1293 const Function& function = Function::Handle(optimized_code.function()); |
1291 ASSERT(!function.IsNull()); | 1294 ASSERT(!function.IsNull()); |
1292 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); | 1295 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
1293 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); | 1296 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); |
1294 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); | 1297 ASSERT(!unoptimized_code.IsNull() && !unoptimized_code.is_optimized()); |
1295 const PcDescriptors& descriptors = | 1298 const PcDescriptors& descriptors = |
1296 PcDescriptors::Handle(optimized_code.pc_descriptors()); | 1299 PcDescriptors::Handle(optimized_code.pc_descriptors()); |
1297 ASSERT(!descriptors.IsNull()); | 1300 ASSERT(!descriptors.IsNull()); |
1298 // Locate node id at deoptimization point inside optimized code. | 1301 // Locate node id at deoptimization point inside optimized code. |
1299 intptr_t deopt_node_id = AstNode::kNoId; | 1302 intptr_t deopt_node_id = AstNode::kNoId; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 } | 1432 } |
1430 } | 1433 } |
1431 } | 1434 } |
1432 // The cache is null terminated, therefore the loop above should never | 1435 // The cache is null terminated, therefore the loop above should never |
1433 // terminate by itself. | 1436 // terminate by itself. |
1434 UNREACHABLE(); | 1437 UNREACHABLE(); |
1435 return Code::null(); | 1438 return Code::null(); |
1436 } | 1439 } |
1437 | 1440 |
1438 } // namespace dart | 1441 } // namespace dart |
OLD | NEW |