| 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 20 matching lines...) Expand all Loading... |
| 31 "Deoptimizes all live frames when we are about to return to Dart code from" | 31 "Deoptimizes all live frames when we are about to return to Dart code from" |
| 32 " native entries."); | 32 " native entries."); |
| 33 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); | 33 DEFINE_FLAG(bool, trace_deoptimization, false, "Trace deoptimization"); |
| 34 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, | 34 DEFINE_FLAG(bool, trace_deoptimization_verbose, false, |
| 35 "Trace deoptimization verbose"); | 35 "Trace deoptimization verbose"); |
| 36 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); | 36 DEFINE_FLAG(bool, trace_ic, false, "Trace IC handling"); |
| 37 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, | 37 DEFINE_FLAG(bool, trace_ic_miss_in_optimized, false, |
| 38 "Trace IC miss in optimized code"); | 38 "Trace IC miss in optimized code"); |
| 39 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 39 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 40 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 40 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 41 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 41 #if defined(TARGET_ARCH_IA32) || \ |
| 42 defined(TARGET_ARCH_X64) || \ |
| 43 defined(TARGET_ARCH_ARM) |
| 42 DEFINE_FLAG(int, optimization_counter_threshold, 3000, | 44 DEFINE_FLAG(int, optimization_counter_threshold, 3000, |
| 43 "Function's usage-counter value before it is optimized, -1 means never"); | 45 "Function's usage-counter value before it is optimized, -1 means never"); |
| 44 #else | 46 #else |
| 45 // TODO(regis): Enable optimization on ARM and MIPS. | 47 // TODO(regis): Enable optimization on MIPS. |
| 46 DEFINE_FLAG(int, optimization_counter_threshold, -1, | 48 DEFINE_FLAG(int, optimization_counter_threshold, -1, |
| 47 "Function's usage-counter value before it is optimized, -1 means never"); | 49 "Function's usage-counter value before it is optimized, -1 means never"); |
| 48 #endif | 50 #endif |
| 49 DECLARE_FLAG(bool, enable_type_checks); | 51 DECLARE_FLAG(bool, enable_type_checks); |
| 50 DECLARE_FLAG(bool, trace_type_checks); | 52 DECLARE_FLAG(bool, trace_type_checks); |
| 51 DECLARE_FLAG(bool, report_usage_count); | 53 DECLARE_FLAG(bool, report_usage_count); |
| 52 DECLARE_FLAG(int, deoptimization_counter_threshold); | 54 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 53 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); | 55 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); |
| 54 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, | 56 DEFINE_FLAG(bool, trace_failed_optimization_attempts, false, |
| 55 "Traces all failed optimization attempts"); | 57 "Traces all failed optimization attempts"); |
| (...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 if (ContainsCid(classes, owner_cid)) { | 1464 if (ContainsCid(classes, owner_cid)) { |
| 1463 DeoptimizeAt(optimized_code, frame->pc()); | 1465 DeoptimizeAt(optimized_code, frame->pc()); |
| 1464 } | 1466 } |
| 1465 } | 1467 } |
| 1466 } | 1468 } |
| 1467 } | 1469 } |
| 1468 | 1470 |
| 1469 | 1471 |
| 1470 // Copy saved registers into the isolate buffer. | 1472 // Copy saved registers into the isolate buffer. |
| 1471 static void CopySavedRegisters(uword saved_registers_address) { | 1473 static void CopySavedRegisters(uword saved_registers_address) { |
| 1474 ASSERT(sizeof(fpu_register_t) == kFpuRegisterSize); |
| 1472 fpu_register_t* fpu_registers_copy = | 1475 fpu_register_t* fpu_registers_copy = |
| 1473 new fpu_register_t[kNumberOfFpuRegisters]; | 1476 new fpu_register_t[kNumberOfFpuRegisters]; |
| 1474 ASSERT(fpu_registers_copy != NULL); | 1477 ASSERT(fpu_registers_copy != NULL); |
| 1475 for (intptr_t i = 0; i < kNumberOfFpuRegisters; i++) { | 1478 for (intptr_t i = 0; i < kNumberOfFpuRegisters; i++) { |
| 1476 fpu_registers_copy[i] = | 1479 fpu_registers_copy[i] = |
| 1477 *reinterpret_cast<fpu_register_t*>(saved_registers_address); | 1480 *reinterpret_cast<fpu_register_t*>(saved_registers_address); |
| 1478 saved_registers_address += kFpuRegisterSize; | 1481 saved_registers_address += kFpuRegisterSize; |
| 1479 } | 1482 } |
| 1480 Isolate::Current()->set_deopt_fpu_registers_copy(fpu_registers_copy); | 1483 Isolate::Current()->set_deopt_fpu_registers_copy(fpu_registers_copy); |
| 1481 | 1484 |
| 1485 ASSERT(sizeof(intptr_t) == kWordSize); |
| 1482 intptr_t* cpu_registers_copy = new intptr_t[kNumberOfCpuRegisters]; | 1486 intptr_t* cpu_registers_copy = new intptr_t[kNumberOfCpuRegisters]; |
| 1483 ASSERT(cpu_registers_copy != NULL); | 1487 ASSERT(cpu_registers_copy != NULL); |
| 1484 for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) { | 1488 for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) { |
| 1485 cpu_registers_copy[i] = | 1489 cpu_registers_copy[i] = |
| 1486 *reinterpret_cast<intptr_t*>(saved_registers_address); | 1490 *reinterpret_cast<intptr_t*>(saved_registers_address); |
| 1487 saved_registers_address += kWordSize; | 1491 saved_registers_address += kWordSize; |
| 1488 } | 1492 } |
| 1489 Isolate::Current()->set_deopt_cpu_registers_copy(cpu_registers_copy); | 1493 Isolate::Current()->set_deopt_cpu_registers_copy(cpu_registers_copy); |
| 1490 } | 1494 } |
| 1491 | 1495 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 ASSERT(top_frame != NULL); | 1724 ASSERT(top_frame != NULL); |
| 1721 const Code& code = Code::Handle(top_frame->LookupDartCode()); | 1725 const Code& code = Code::Handle(top_frame->LookupDartCode()); |
| 1722 const Function& top_function = Function::Handle(code.function()); | 1726 const Function& top_function = Function::Handle(code.function()); |
| 1723 const Script& script = Script::Handle(top_function.script()); | 1727 const Script& script = Script::Handle(top_function.script()); |
| 1724 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); | 1728 const intptr_t token_pos = code.GetTokenIndexOfPC(top_frame->pc()); |
| 1725 intptr_t line, column; | 1729 intptr_t line, column; |
| 1726 script.GetTokenLocation(token_pos, &line, &column); | 1730 script.GetTokenLocation(token_pos, &line, &column); |
| 1727 String& line_string = String::Handle(script.GetLine(line)); | 1731 String& line_string = String::Handle(script.GetLine(line)); |
| 1728 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); | 1732 OS::PrintErr(" Function: %s\n", top_function.ToFullyQualifiedCString()); |
| 1729 OS::PrintErr(" Line %"Pd": '%s'\n", line, line_string.ToCString()); | 1733 OS::PrintErr(" Line %"Pd": '%s'\n", line, line_string.ToCString()); |
| 1734 OS::PrintErr(" Deopt args: %"Pd"\n", deopt_arguments); |
| 1730 } | 1735 } |
| 1731 } | 1736 } |
| 1732 | 1737 |
| 1733 | 1738 |
| 1734 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, | 1739 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 1735 BigintCompare, | 1740 BigintCompare, |
| 1736 RawBigint* left, | 1741 RawBigint* left, |
| 1737 RawBigint* right) { | 1742 RawBigint* right) { |
| 1738 Isolate* isolate = Isolate::Current(); | 1743 Isolate* isolate = Isolate::Current(); |
| 1739 StackZone zone(isolate); | 1744 StackZone zone(isolate); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1767 // Arg1: Value that is being stored. | 1772 // Arg1: Value that is being stored. |
| 1768 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1773 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1769 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1774 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1770 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1775 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1771 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1776 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1772 | 1777 |
| 1773 field.UpdateCid(value.GetClassId()); | 1778 field.UpdateCid(value.GetClassId()); |
| 1774 } | 1779 } |
| 1775 | 1780 |
| 1776 } // namespace dart | 1781 } // namespace dart |
| OLD | NEW |