Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 UNREACHABLE(); | 1334 UNREACHABLE(); |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) { | 1337 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) { |
| 1338 ASSERT(FLAG_use_osr); | 1338 ASSERT(FLAG_use_osr); |
| 1339 DartFrameIterator iterator; | 1339 DartFrameIterator iterator; |
| 1340 StackFrame* frame = iterator.NextFrame(); | 1340 StackFrame* frame = iterator.NextFrame(); |
| 1341 ASSERT(frame != NULL); | 1341 ASSERT(frame != NULL); |
| 1342 const Code& code = Code::ZoneHandle(frame->LookupDartCode()); | 1342 const Code& code = Code::ZoneHandle(frame->LookupDartCode()); |
| 1343 ASSERT(!code.IsNull()); | 1343 ASSERT(!code.IsNull()); |
| 1344 ASSERT(!code.is_optimized()); | |
| 1344 const Function& function = Function::Handle(code.function()); | 1345 const Function& function = Function::Handle(code.function()); |
| 1345 ASSERT(!function.IsNull()); | 1346 ASSERT(!function.IsNull()); |
| 1346 // Since the code is referenced from the frame and the ZoneHandle, | 1347 // Since the code is referenced from the frame and the ZoneHandle, |
| 1347 // it cannot have been removed from the function. | 1348 // it cannot have been removed from the function. |
| 1348 ASSERT(function.HasCode()); | 1349 ASSERT(function.HasCode()); |
| 1349 // Don't do OSR on intrinsified functions: The intrinsic code expects to be | 1350 // Don't do OSR on intrinsified functions: The intrinsic code expects to be |
| 1350 // called like a regular function and can't be entered via OSR. | 1351 // called like a regular function and can't be entered via OSR. |
| 1351 if (!Compiler::CanOptimizeFunction(thread, function) || | 1352 if (!Compiler::CanOptimizeFunction(thread, function) || |
| 1352 function.is_intrinsic()) { | 1353 function.is_intrinsic()) { |
| 1353 return; | 1354 return; |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1356 // The unoptimized code is on the stack and should never be detached from | 1357 // The unoptimized code is on the stack and should never be detached from |
| 1357 // the function at this point. | 1358 // the function at this point. |
| 1358 ASSERT(function.unoptimized_code() != Object::null()); | 1359 ASSERT(function.unoptimized_code() != Object::null()); |
| 1359 intptr_t osr_id = | 1360 intptr_t osr_id = |
| 1360 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); | 1361 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); |
| 1361 ASSERT(osr_id != Compiler::kNoOSRDeoptId); | 1362 if (osr_id == Compiler::kNoOSRDeoptId) { |
| 1363 // The unoptimized code can have been reset to the lazy-compile stub | |
|
rmacnak
2016/07/06 17:31:57
As discussed offline, this should be
if (frame.co
| |
| 1364 // by an isolate reload. We can't do OSR in this invocation. | |
| 1365 ASSERT(function.unoptimized_code() == | |
| 1366 StubCode::LazyCompile_entry()->code()); | |
| 1367 return; | |
| 1368 } | |
| 1362 if (FLAG_trace_osr) { | 1369 if (FLAG_trace_osr) { |
| 1363 OS::Print("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n", | 1370 OS::Print("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n", |
| 1364 function.ToFullyQualifiedCString(), | 1371 function.ToFullyQualifiedCString(), |
| 1365 osr_id, | 1372 osr_id, |
| 1366 function.usage_counter()); | 1373 function.usage_counter()); |
| 1367 } | 1374 } |
| 1368 | 1375 |
| 1369 const Code& original_code = Code::Handle(function.CurrentCode()); | 1376 const Code& original_code = Code::Handle(function.CurrentCode()); |
| 1370 // Since the code is referenced from the frame and the ZoneHandle, | 1377 // Since the code is referenced from the frame and the ZoneHandle, |
| 1371 // it cannot have been removed from the function. | 1378 // it cannot have been removed from the function. |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1882 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1889 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1883 const TypedData& new_data = | 1890 const TypedData& new_data = |
| 1884 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1891 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1885 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1892 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1886 typed_data_cell.SetAt(0, new_data); | 1893 typed_data_cell.SetAt(0, new_data); |
| 1887 arguments.SetReturn(new_data); | 1894 arguments.SetReturn(new_data); |
| 1888 } | 1895 } |
| 1889 | 1896 |
| 1890 | 1897 |
| 1891 } // namespace dart | 1898 } // namespace dart |
| OLD | NEW |