| 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/code_patcher.h" | 9 #include "vm/code_patcher.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| 11 #include "vm/dart_api_impl.h" | 11 #include "vm/dart_api_impl.h" |
| 12 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/debugger.h" | 13 #include "vm/debugger.h" |
| 14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
| 15 #include "vm/exceptions.h" | 15 #include "vm/exceptions.h" |
| 16 #include "vm/flags.h" | 16 #include "vm/flags.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/message.h" | 18 #include "vm/message.h" |
| 19 #include "vm/message_handler.h" | 19 #include "vm/message_handler.h" |
| 20 #include "vm/parser.h" | 20 #include "vm/parser.h" |
| 21 #include "vm/resolver.h" | 21 #include "vm/resolver.h" |
| 22 #include "vm/runtime_entry.h" | 22 #include "vm/runtime_entry.h" |
| 23 #include "vm/stack_frame.h" | 23 #include "vm/stack_frame.h" |
| 24 #include "vm/symbols.h" | 24 #include "vm/symbols.h" |
| 25 #include "vm/thread_registry.h" | 25 #include "vm/thread_registry.h" |
| 26 #include "vm/verifier.h" | 26 #include "vm/verifier.h" |
| 27 | 27 |
| 28 namespace dart { | 28 namespace dart { |
| 29 | 29 |
| 30 DEFINE_FLAG(bool, deoptimize_alot, false, |
| 31 "Deoptimizes all live frames when we are about to return to Dart code from" |
| 32 " native entries."); |
| 33 DEFINE_FLAG(bool, background_compilation, false, |
| 34 "Run optimizing compilation in background"); |
| 30 DEFINE_FLAG(int, max_subtype_cache_entries, 100, | 35 DEFINE_FLAG(int, max_subtype_cache_entries, 100, |
| 31 "Maximum number of subtype cache entries (number of checks cached)."); | 36 "Maximum number of subtype cache entries (number of checks cached)."); |
| 37 DEFINE_FLAG(int, optimization_counter_threshold, 30000, |
| 38 "Function's usage-counter value before it is optimized, -1 means never"); |
| 32 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, | 39 DEFINE_FLAG(int, regexp_optimization_counter_threshold, 1000, |
| 33 "RegExp's usage-counter value before it is optimized, -1 means never"); | 40 "RegExp's usage-counter value before it is optimized, -1 means never"); |
| 34 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); | 41 DEFINE_FLAG(charp, optimization_filter, NULL, "Optimize only named function"); |
| 35 // TODO(srdjan): Remove this flag once background compilation of regular | 42 // TODO(srdjan): Remove this flag once background compilation of regular |
| 36 // expressions is possible. | 43 // expressions is possible. |
| 37 DEFINE_FLAG(bool, regexp_opt_in_background, false, | 44 DEFINE_FLAG(bool, regexp_opt_in_background, false, |
| 38 "Optimize reg-exp functions in background"); | 45 "Optimize reg-exp functions in background"); |
| 39 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, | 46 DEFINE_FLAG(int, reoptimization_counter_threshold, 4000, |
| 40 "Counter threshold before a function gets reoptimized."); | 47 "Counter threshold before a function gets reoptimized."); |
| 41 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, | 48 DEFINE_FLAG(bool, stop_on_excessive_deoptimization, false, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 "Trace IC calls in optimized code."); | 59 "Trace IC calls in optimized code."); |
| 53 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 60 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
| 54 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 61 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
| 55 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 62 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
| 56 | 63 |
| 57 DECLARE_FLAG(int, max_deoptimization_counter_threshold); | 64 DECLARE_FLAG(int, max_deoptimization_counter_threshold); |
| 58 DECLARE_FLAG(bool, enable_inlining_annotations); | 65 DECLARE_FLAG(bool, enable_inlining_annotations); |
| 59 DECLARE_FLAG(bool, trace_compiler); | 66 DECLARE_FLAG(bool, trace_compiler); |
| 60 DECLARE_FLAG(bool, trace_optimizing_compiler); | 67 DECLARE_FLAG(bool, trace_optimizing_compiler); |
| 61 DECLARE_FLAG(int, max_polymorphic_checks); | 68 DECLARE_FLAG(int, max_polymorphic_checks); |
| 69 DECLARE_FLAG(bool, precompilation); |
| 62 | 70 |
| 71 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
| 63 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 72 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
| 64 | 73 |
| 65 DEFINE_FLAG(int, stacktrace_every, 0, | 74 DEFINE_FLAG(int, stacktrace_every, 0, |
| 66 "Compute debugger stacktrace on every N stack overflow checks"); | 75 "Compute debugger stacktrace on every N stack overflow checks"); |
| 67 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 76 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
| 68 "Compute stacktrace in named function on stack overflow checks"); | 77 "Compute stacktrace in named function on stack overflow checks"); |
| 78 DEFINE_FLAG(int, deoptimize_every, 0, |
| 79 "Deoptimize on every N stack overflow checks"); |
| 69 DEFINE_FLAG(charp, deoptimize_filter, NULL, | 80 DEFINE_FLAG(charp, deoptimize_filter, NULL, |
| 70 "Deoptimize in named function on stack overflow checks"); | 81 "Deoptimize in named function on stack overflow checks"); |
| 71 | 82 |
| 72 #ifdef DEBUG | 83 #ifdef DEBUG |
| 73 DEFINE_FLAG(charp, gc_at_instance_allocation, NULL, | 84 DEFINE_FLAG(charp, gc_at_instance_allocation, NULL, |
| 74 "Perform a GC before allocation of instances of " | 85 "Perform a GC before allocation of instances of " |
| 75 "the specified class"); | 86 "the specified class"); |
| 76 #endif | 87 #endif |
| 77 | 88 |
| 78 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { | 89 DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) { |
| (...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 } | 1377 } |
| 1367 if (FLAG_support_debugger && do_stacktrace) { | 1378 if (FLAG_support_debugger && do_stacktrace) { |
| 1368 String& var_name = String::Handle(); | 1379 String& var_name = String::Handle(); |
| 1369 Instance& var_value = Instance::Handle(); | 1380 Instance& var_value = Instance::Handle(); |
| 1370 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); | 1381 DebuggerStackTrace* stack = isolate->debugger()->StackTrace(); |
| 1371 intptr_t num_frames = stack->Length(); | 1382 intptr_t num_frames = stack->Length(); |
| 1372 for (intptr_t i = 0; i < num_frames; i++) { | 1383 for (intptr_t i = 0; i < num_frames; i++) { |
| 1373 ActivationFrame* frame = stack->FrameAt(i); | 1384 ActivationFrame* frame = stack->FrameAt(i); |
| 1374 // Variable locations and number are unknown when precompiling. | 1385 // Variable locations and number are unknown when precompiling. |
| 1375 const int num_vars = | 1386 const int num_vars = |
| 1376 FLAG_precompiled_mode ? 0 : frame->NumLocalVariables(); | 1387 FLAG_precompilation ? 0 : frame->NumLocalVariables(); |
| 1377 TokenPosition unused = TokenPosition::kNoSource; | 1388 TokenPosition unused = TokenPosition::kNoSource; |
| 1378 for (intptr_t v = 0; v < num_vars; v++) { | 1389 for (intptr_t v = 0; v < num_vars; v++) { |
| 1379 frame->VariableAt(v, &var_name, &unused, &unused, &var_value); | 1390 frame->VariableAt(v, &var_name, &unused, &unused, &var_value); |
| 1380 } | 1391 } |
| 1381 } | 1392 } |
| 1382 } | 1393 } |
| 1383 | 1394 |
| 1384 const Error& error = Error::Handle(isolate->HandleInterrupts()); | 1395 const Error& error = Error::Handle(isolate->HandleInterrupts()); |
| 1385 if (!error.IsNull()) { | 1396 if (!error.IsNull()) { |
| 1386 Exceptions::PropagateError(error); | 1397 Exceptions::PropagateError(error); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1901 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
| 1891 const TypedData& new_data = | 1902 const TypedData& new_data = |
| 1892 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1903 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
| 1893 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1904 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
| 1894 typed_data_cell.SetAt(0, new_data); | 1905 typed_data_cell.SetAt(0, new_data); |
| 1895 arguments.SetReturn(new_data); | 1906 arguments.SetReturn(new_data); |
| 1896 } | 1907 } |
| 1897 | 1908 |
| 1898 | 1909 |
| 1899 } // namespace dart | 1910 } // namespace dart |
| OLD | NEW |