| 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 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 UNREACHABLE(); | 1430 UNREACHABLE(); |
| 1431 } | 1431 } |
| 1432 ASSERT(frame->IsDartFrame()); | 1432 ASSERT(frame->IsDartFrame()); |
| 1433 const Code& caller_code = Code::Handle(frame->LookupDartCode()); | 1433 const Code& caller_code = Code::Handle(frame->LookupDartCode()); |
| 1434 ASSERT(caller_code.is_optimized()); | 1434 ASSERT(caller_code.is_optimized()); |
| 1435 const Function& target_function = Function::Handle( | 1435 const Function& target_function = Function::Handle( |
| 1436 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); | 1436 caller_code.GetStaticCallTargetFunctionAt(frame->pc())); |
| 1437 const Code& target_code = Code::Handle( | 1437 const Code& target_code = Code::Handle( |
| 1438 caller_code.GetStaticCallTargetCodeAt(frame->pc())); | 1438 caller_code.GetStaticCallTargetCodeAt(frame->pc())); |
| 1439 ASSERT(!target_code.IsNull()); | 1439 ASSERT(!target_code.IsNull()); |
| 1440 // Since there was a reference to the target_code in the caller_code, it is | 1440 if (!target_function.HasCode()) { |
| 1441 // not possible for the target_function's code to be disconnected. | 1441 // If target code was unoptimized than the code must have been kept |
| 1442 // connected to the function. |
| 1443 ASSERT(target_code.is_optimized()); |
| 1444 const Error& error = |
| 1445 Error::Handle(Compiler::CompileFunction(target_function)); |
| 1446 if (!error.IsNull()) { |
| 1447 Exceptions::PropagateError(error); |
| 1448 } |
| 1449 } |
| 1442 ASSERT(target_function.HasCode()); | 1450 ASSERT(target_function.HasCode()); |
| 1443 ASSERT(target_function.raw() == target_code.function()); | 1451 ASSERT(target_function.raw() == target_code.function()); |
| 1444 | 1452 |
| 1445 const Code& current_target_code = Code::Handle(target_function.CurrentCode()); | 1453 const Code& current_target_code = Code::Handle(target_function.CurrentCode()); |
| 1446 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, | 1454 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, |
| 1447 current_target_code.EntryPoint()); | 1455 current_target_code.EntryPoint()); |
| 1448 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code); | 1456 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code); |
| 1449 if (FLAG_trace_patching) { | 1457 if (FLAG_trace_patching) { |
| 1450 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", | 1458 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", |
| 1451 frame->pc(), | 1459 frame->pc(), |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 // of the given value. | 1687 // of the given value. |
| 1680 // Arg0: Field object; | 1688 // Arg0: Field object; |
| 1681 // Arg1: Value that is being stored. | 1689 // Arg1: Value that is being stored. |
| 1682 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1690 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1683 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1691 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1684 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1692 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1685 field.UpdateGuardedCidAndLength(value); | 1693 field.UpdateGuardedCidAndLength(value); |
| 1686 } | 1694 } |
| 1687 | 1695 |
| 1688 } // namespace dart | 1696 } // namespace dart |
| OLD | NEW |