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/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1336 if (interrupt_bits & Isolate::kVmStatusInterrupt) { | 1336 if (interrupt_bits & Isolate::kVmStatusInterrupt) { |
| 1337 Dart_IsolateInterruptCallback callback = isolate->VmStatsCallback(); | 1337 Dart_IsolateInterruptCallback callback = isolate->VmStatsCallback(); |
| 1338 if (callback) { | 1338 if (callback) { |
| 1339 (*callback)(); | 1339 (*callback)(); |
| 1340 } | 1340 } |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 if (FLAG_use_osr && (interrupt_bits == 0)) { | 1343 if (FLAG_use_osr && (interrupt_bits == 0)) { |
| 1344 DartFrameIterator iterator; | 1344 DartFrameIterator iterator; |
| 1345 StackFrame* frame = iterator.NextFrame(); | 1345 StackFrame* frame = iterator.NextFrame(); |
| 1346 const Function& function = Function::Handle(frame->LookupDartFunction()); | 1346 const Code& code = Code::ZoneHandle(frame->LookupDartCode()); |
| 1347 const Function& function = Function::Handle(code.function()); | |
| 1347 ASSERT(!function.IsNull()); | 1348 ASSERT(!function.IsNull()); |
| 1348 if (!CanOptimizeFunction(function, isolate)) return; | 1349 if (!function.HasCode()) { |
|
Ivan Posva
2013/11/16 00:06:21
Code should not be detachable as it is live on the
zra
2013/11/18 18:54:33
Changed to ASSERT.
| |
| 1350 function.ReattachCode(code); | |
| 1351 } | |
| 1352 if (!CanOptimizeFunction(function, isolate)) { | |
| 1353 return; | |
| 1354 } | |
| 1349 intptr_t osr_id = | 1355 intptr_t osr_id = |
| 1350 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); | 1356 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc()); |
| 1351 if (FLAG_trace_osr) { | 1357 if (FLAG_trace_osr) { |
| 1352 OS::Print("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n", | 1358 OS::Print("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n", |
| 1353 function.ToFullyQualifiedCString(), | 1359 function.ToFullyQualifiedCString(), |
| 1354 osr_id, | 1360 osr_id, |
| 1355 function.usage_counter()); | 1361 function.usage_counter()); |
| 1356 } | 1362 } |
| 1357 | 1363 |
| 1358 const Code& original_code = Code::Handle(function.CurrentCode()); | 1364 const Code& original_code = Code::Handle(function.CurrentCode()); |
| 1365 ASSERT(!original_code.IsNull()); | |
| 1359 const Error& error = | 1366 const Error& error = |
| 1360 Error::Handle(Compiler::CompileOptimizedFunction(function, osr_id)); | 1367 Error::Handle(Compiler::CompileOptimizedFunction(function, osr_id)); |
| 1361 if (!error.IsNull()) Exceptions::PropagateError(error); | 1368 if (!error.IsNull()) { |
| 1369 Exceptions::PropagateError(error); | |
| 1370 } | |
| 1362 | 1371 |
| 1363 const Code& optimized_code = Code::Handle(function.CurrentCode()); | 1372 const Code& optimized_code = Code::Handle(function.CurrentCode()); |
| 1364 // The current code will not be changed in the case that the compiler | 1373 // The current code will not be changed in the case that the compiler |
| 1365 // bailed out during OSR compilation. | 1374 // bailed out during OSR compilation. |
| 1366 if (optimized_code.raw() != original_code.raw()) { | 1375 if (optimized_code.raw() != original_code.raw()) { |
| 1367 // The OSR code does not work for calling the function, so restore the | 1376 // The OSR code does not work for calling the function, so restore the |
| 1368 // unoptimized code. Patch the stack frame to return into the OSR | 1377 // unoptimized code. Patch the stack frame to return into the OSR |
| 1369 // code. | 1378 // code. |
| 1370 uword optimized_entry = | 1379 uword optimized_entry = |
| 1371 Instructions::Handle(optimized_code.instructions()).EntryPoint(); | 1380 Instructions::Handle(optimized_code.instructions()).EntryPoint(); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1701 // of the given value. | 1710 // of the given value. |
| 1702 // Arg0: Field object; | 1711 // Arg0: Field object; |
| 1703 // Arg1: Value that is being stored. | 1712 // Arg1: Value that is being stored. |
| 1704 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1713 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1705 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1714 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1706 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1715 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1707 field.UpdateGuardedCidAndLength(value); | 1716 field.UpdateGuardedCidAndLength(value); |
| 1708 } | 1717 } |
| 1709 | 1718 |
| 1710 } // namespace dart | 1719 } // namespace dart |
| OLD | NEW |