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