| 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 | 866 |
| 867 // Gets called from debug stub when code reaches a breakpoint. | 867 // Gets called from debug stub when code reaches a breakpoint. |
| 868 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { | 868 DEFINE_RUNTIME_ENTRY(BreakpointDynamicHandler, 0) { |
| 869 ASSERT(arguments.ArgCount() == | 869 ASSERT(arguments.ArgCount() == |
| 870 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); | 870 kBreakpointDynamicHandlerRuntimeEntry.argument_count()); |
| 871 ASSERT(isolate->debugger() != NULL); | 871 ASSERT(isolate->debugger() != NULL); |
| 872 isolate->debugger()->SignalBpReached(); | 872 isolate->debugger()->SignalBpReached(); |
| 873 } | 873 } |
| 874 | 874 |
| 875 | 875 |
| 876 DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { |
| 877 ASSERT(arguments.ArgCount() == |
| 878 kSingleStepHandlerRuntimeEntry.argument_count()); |
| 879 ASSERT(isolate->debugger() != NULL); |
| 880 isolate->debugger()->SingleStepCallback(); |
| 881 } |
| 882 |
| 883 |
| 876 static RawFunction* InlineCacheMissHandler( | 884 static RawFunction* InlineCacheMissHandler( |
| 877 const GrowableArray<const Instance*>& args, | 885 const GrowableArray<const Instance*>& args, |
| 878 const ICData& ic_data, | 886 const ICData& ic_data, |
| 879 const Array& args_descriptor_array) { | 887 const Array& args_descriptor_array) { |
| 880 const Instance& receiver = *args[0]; | 888 const Instance& receiver = *args[0]; |
| 881 const Code& target_code = | 889 const Code& target_code = |
| 882 Code::Handle(ResolveCompileInstanceCallTarget(receiver, ic_data)); | 890 Code::Handle(ResolveCompileInstanceCallTarget(receiver, ic_data)); |
| 883 if (target_code.IsNull()) { | 891 if (target_code.IsNull()) { |
| 884 // Let the megamorphic stub handle special cases: NoSuchMethod, | 892 // Let the megamorphic stub handle special cases: NoSuchMethod, |
| 885 // closure calls. | 893 // closure calls. |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 args_descriptor); | 1293 args_descriptor); |
| 1286 } | 1294 } |
| 1287 } | 1295 } |
| 1288 CheckResultError(result); | 1296 CheckResultError(result); |
| 1289 arguments.SetReturn(result); | 1297 arguments.SetReturn(result); |
| 1290 } | 1298 } |
| 1291 | 1299 |
| 1292 | 1300 |
| 1293 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) { | 1301 static bool CanOptimizeFunction(const Function& function, Isolate* isolate) { |
| 1294 const intptr_t kLowInvocationCount = -100000000; | 1302 const intptr_t kLowInvocationCount = -100000000; |
| 1295 if (isolate->debugger()->HasBreakpoint(function)) { | 1303 if (isolate->debugger()->IsStepping() || |
| 1296 // We cannot set breakpoints in optimized code, so do not optimize | 1304 isolate->debugger()->HasBreakpoint(function)) { |
| 1297 // the function. | 1305 // We cannot set breakpoints and single step in optimized code, |
| 1306 // so do not optimize the function. |
| 1298 function.set_usage_counter(0); | 1307 function.set_usage_counter(0); |
| 1299 return false; | 1308 return false; |
| 1300 } | 1309 } |
| 1301 if (function.deoptimization_counter() >= | 1310 if (function.deoptimization_counter() >= |
| 1302 FLAG_deoptimization_counter_threshold) { | 1311 FLAG_deoptimization_counter_threshold) { |
| 1303 if (FLAG_trace_failed_optimization_attempts || | 1312 if (FLAG_trace_failed_optimization_attempts || |
| 1304 FLAG_stop_on_excessive_deoptimization) { | 1313 FLAG_stop_on_excessive_deoptimization) { |
| 1305 OS::PrintErr("Too Many Deoptimizations: %s\n", | 1314 OS::PrintErr("Too Many Deoptimizations: %s\n", |
| 1306 function.ToFullyQualifiedCString()); | 1315 function.ToFullyQualifiedCString()); |
| 1307 if (FLAG_stop_on_excessive_deoptimization) { | 1316 if (FLAG_stop_on_excessive_deoptimization) { |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 // Arg1: Value that is being stored. | 1884 // Arg1: Value that is being stored. |
| 1876 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1885 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1877 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1886 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1878 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1887 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1879 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1888 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1880 | 1889 |
| 1881 field.UpdateCid(value.GetClassId()); | 1890 field.UpdateCid(value.GetClassId()); |
| 1882 } | 1891 } |
| 1883 | 1892 |
| 1884 } // namespace dart | 1893 } // namespace dart |
| OLD | NEW |