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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1411 if (frame->IsEntryFrame()) { | 1411 if (frame->IsEntryFrame()) { |
1412 // Since function's current code is always unpatched, the entry frame always | 1412 // Since function's current code is always unpatched, the entry frame always |
1413 // calls to unpatched code. | 1413 // calls to unpatched code. |
1414 UNREACHABLE(); | 1414 UNREACHABLE(); |
1415 } | 1415 } |
1416 ASSERT(frame->IsDartFrame()); | 1416 ASSERT(frame->IsDartFrame()); |
1417 const Code& caller_code = Code::Handle(frame->LookupDartCode()); | 1417 const Code& caller_code = Code::Handle(frame->LookupDartCode()); |
1418 ASSERT(caller_code.is_optimized()); | 1418 ASSERT(caller_code.is_optimized()); |
1419 const Function& target_function = Function::Handle( | 1419 const Function& target_function = Function::Handle( |
1420 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); | 1420 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); |
1421 const Code& target_code = Code::Handle(target_function.CurrentCode()); | 1421 |
1422 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, | 1422 // Check whether the code object has been detached from the target function. |
1423 target_code.EntryPoint()); | 1423 // If it has been detached, reattach it. |
1424 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); | 1424 Code& target_code = Code::Handle(); |
1425 if (target_function.CurrentCode() == Code::null()) { | |
srdjan
2013/10/23 15:58:13
if (target_function.HasCode()) {
.... old code: p
zra
2013/10/23 17:39:37
Done.
| |
1426 ASSERT(target_function.unoptimized_code() == Code::null()); | |
1427 target_code ^= caller_code.GetStaticCallTargetCodeAt(frame->pc()); | |
srdjan
2013/10/23 15:58:13
ASSERT(!target_code.is_optimized())
zra
2013/10/23 17:39:37
Done.
| |
1428 ASSERT(target_code.raw() != Code::null()); | |
srdjan
2013/10/23 15:58:13
ASSERT(!target_code.IsNull())
zra
2013/10/23 17:39:37
Done.
| |
1429 target_function.ReattachCode(target_code); | |
1430 } else { | |
1431 target_code ^= target_function.CurrentCode(); | |
1432 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, | |
1433 target_code.EntryPoint()); | |
1434 caller_code.SetStaticCallTargetCodeAt(frame->pc(), target_code); | |
1435 } | |
1425 if (FLAG_trace_patching) { | 1436 if (FLAG_trace_patching) { |
1426 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", | 1437 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", |
1427 frame->pc(), | 1438 frame->pc(), |
1428 Function::Handle(target_code.function()).ToFullyQualifiedCString(), | 1439 Function::Handle(target_code.function()).ToFullyQualifiedCString(), |
1429 target_code.EntryPoint()); | 1440 target_code.EntryPoint()); |
1430 } | 1441 } |
1431 arguments.SetReturn(target_code); | 1442 arguments.SetReturn(target_code); |
1432 } | 1443 } |
1433 | 1444 |
1434 | 1445 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1703 field.UpdateCid(cid); | 1714 field.UpdateCid(cid); |
1704 intptr_t list_length = Field::kNoFixedLength; | 1715 intptr_t list_length = Field::kNoFixedLength; |
1705 if ((field.guarded_cid() != kDynamicCid) && | 1716 if ((field.guarded_cid() != kDynamicCid) && |
1706 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { | 1717 field.is_final() && RawObject::IsBuiltinListClassId(cid)) { |
1707 list_length = GetListLength(value); | 1718 list_length = GetListLength(value); |
1708 } | 1719 } |
1709 field.UpdateLength(list_length); | 1720 field.UpdateLength(list_length); |
1710 } | 1721 } |
1711 | 1722 |
1712 } // namespace dart | 1723 } // namespace dart |
OLD | NEW |