| 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)); | 626 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)); |
| 627 const Instructions& instrs = | 627 const Instructions& instrs = |
| 628 Instructions::Handle(caller_code.instructions()); | 628 Instructions::Handle(caller_code.instructions()); |
| 629 { | 629 { |
| 630 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 630 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
| 631 CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code, | 631 CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code, |
| 632 target_code.EntryPoint()); | 632 target_code.EntryPoint()); |
| 633 caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code); | 633 caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code); |
| 634 } | 634 } |
| 635 if (FLAG_trace_patching) { | 635 if (FLAG_trace_patching) { |
| 636 OS::PrintErr("PatchStaticCall: patching from %#" Px " to '%s' %#" Px "\n", | 636 OS::PrintErr("PatchStaticCall: patching caller pc %#" Px "" |
| 637 " to '%s' new entry point %#" Px " (%s)\n", |
| 637 caller_frame->pc(), | 638 caller_frame->pc(), |
| 638 target_function.ToFullyQualifiedCString(), | 639 target_function.ToFullyQualifiedCString(), |
| 639 target_code.EntryPoint()); | 640 target_code.EntryPoint(), |
| 641 target_code.is_optimized() ? "optimized" : "unoptimized"); |
| 640 } | 642 } |
| 641 arguments.SetReturn(target_code); | 643 arguments.SetReturn(target_code); |
| 642 } | 644 } |
| 643 | 645 |
| 644 | 646 |
| 645 // Result of an invoke may be an unhandled exception, in which case we | 647 // Result of an invoke may be an unhandled exception, in which case we |
| 646 // rethrow it. | 648 // rethrow it. |
| 647 static void CheckResultError(const Object& result) { | 649 static void CheckResultError(const Object& result) { |
| 648 if (result.IsError()) { | 650 if (result.IsError()) { |
| 649 Exceptions::PropagateError(Error::Cast(result)); | 651 Exceptions::PropagateError(Error::Cast(result)); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 isolate, target_function.CurrentCode()); | 1288 isolate, target_function.CurrentCode()); |
| 1287 const Instructions& instrs = Instructions::Handle( | 1289 const Instructions& instrs = Instructions::Handle( |
| 1288 isolate, caller_code.instructions()); | 1290 isolate, caller_code.instructions()); |
| 1289 { | 1291 { |
| 1290 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); | 1292 WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size()); |
| 1291 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, | 1293 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, |
| 1292 current_target_code.EntryPoint()); | 1294 current_target_code.EntryPoint()); |
| 1293 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code); | 1295 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code); |
| 1294 } | 1296 } |
| 1295 if (FLAG_trace_patching) { | 1297 if (FLAG_trace_patching) { |
| 1296 OS::PrintErr("FixCallersTarget: patching from %#" Px " to '%s' %#" Px "\n", | 1298 OS::PrintErr("FixCallersTarget: caller %#" Px " " |
| 1299 "target '%s' %#" Px " -> %#" Px "\n", |
| 1297 frame->pc(), | 1300 frame->pc(), |
| 1298 target_function.ToFullyQualifiedCString(), | 1301 target_function.ToFullyQualifiedCString(), |
| 1302 target_code.EntryPoint(), |
| 1299 current_target_code.EntryPoint()); | 1303 current_target_code.EntryPoint()); |
| 1300 } | 1304 } |
| 1301 arguments.SetReturn(current_target_code); | 1305 arguments.SetReturn(current_target_code); |
| 1302 } | 1306 } |
| 1303 | 1307 |
| 1304 | 1308 |
| 1305 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { | 1309 const char* DeoptReasonToCString(ICData::DeoptReasonId deopt_reason) { |
| 1306 switch (deopt_reason) { | 1310 switch (deopt_reason) { |
| 1307 #define DEOPT_REASON_TO_TEXT(name) case ICData::kDeopt##name: return #name; | 1311 #define DEOPT_REASON_TO_TEXT(name) case ICData::kDeopt##name: return #name; |
| 1308 DEOPT_REASONS(DEOPT_REASON_TO_TEXT) | 1312 DEOPT_REASONS(DEOPT_REASON_TO_TEXT) |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1530 // of the given value. | 1534 // of the given value. |
| 1531 // Arg0: Field object; | 1535 // Arg0: Field object; |
| 1532 // Arg1: Value that is being stored. | 1536 // Arg1: Value that is being stored. |
| 1533 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1537 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1534 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1538 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1535 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1539 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1536 field.RecordStore(value); | 1540 field.RecordStore(value); |
| 1537 } | 1541 } |
| 1538 | 1542 |
| 1539 } // namespace dart | 1543 } // namespace dart |
| OLD | NEW |