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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, | 59 DEFINE_FLAG(bool, trace_optimized_ic_calls, false, |
60 "Trace IC calls in optimized code."); | 60 "Trace IC calls in optimized code."); |
61 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); | 61 DEFINE_FLAG(bool, trace_patching, false, "Trace patching of code."); |
62 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); | 62 DEFINE_FLAG(bool, trace_runtime_calls, false, "Trace runtime calls"); |
63 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); | 63 DEFINE_FLAG(bool, trace_type_checks, false, "Trace runtime type checks."); |
64 | 64 |
65 DECLARE_FLAG(int, max_deoptimization_counter_threshold); | 65 DECLARE_FLAG(int, max_deoptimization_counter_threshold); |
66 DECLARE_FLAG(bool, enable_inlining_annotations); | 66 DECLARE_FLAG(bool, enable_inlining_annotations); |
67 DECLARE_FLAG(bool, trace_compiler); | 67 DECLARE_FLAG(bool, trace_compiler); |
68 DECLARE_FLAG(bool, trace_optimizing_compiler); | 68 DECLARE_FLAG(bool, trace_optimizing_compiler); |
69 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | |
70 DECLARE_FLAG(int, max_polymorphic_checks); | 69 DECLARE_FLAG(int, max_polymorphic_checks); |
71 DECLARE_FLAG(bool, precompilation); | 70 DECLARE_FLAG(bool, precompilation); |
72 | 71 |
73 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 72 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
74 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 73 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
75 | 74 |
76 DEFINE_FLAG(int, stacktrace_every, 0, | 75 DEFINE_FLAG(int, stacktrace_every, 0, |
77 "Compute debugger stacktrace on every N stack overflow checks"); | 76 "Compute debugger stacktrace on every N stack overflow checks"); |
78 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 77 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
79 "Compute stacktrace in named function on stack overflow checks"); | 78 "Compute stacktrace in named function on stack overflow checks"); |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 // Handles inline cache misses by updating the IC data array of the call site. | 881 // Handles inline cache misses by updating the IC data array of the call site. |
883 // Arg0: Receiver object. | 882 // Arg0: Receiver object. |
884 // Arg1: IC data object. | 883 // Arg1: IC data object. |
885 // Returns: target function with compiled code or null. | 884 // Returns: target function with compiled code or null. |
886 // Modifies the instance call to hold the updated IC data array. | 885 // Modifies the instance call to hold the updated IC data array. |
887 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { | 886 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { |
888 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); | 887 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); |
889 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); | 888 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); |
890 GrowableArray<const Instance*> args(1); | 889 GrowableArray<const Instance*> args(1); |
891 args.Add(&receiver); | 890 args.Add(&receiver); |
892 if (FLAG_warn_on_javascript_compatibility) { | |
893 if (receiver.IsDouble() && | |
894 String::Handle(ic_data.target_name()).Equals(Symbols::toString())) { | |
895 const double value = Double::Cast(receiver).value(); | |
896 if (floor(value) == value) { | |
897 Report::JSWarningFromIC(ic_data, | |
898 "string representation of an integral value " | |
899 "of type 'double' has no decimal mark and " | |
900 "no fractional part"); | |
901 } | |
902 } | |
903 } | |
904 const Function& result = | 891 const Function& result = |
905 Function::Handle(InlineCacheMissHandler(args, ic_data)); | 892 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
906 arguments.SetReturn(result); | 893 arguments.SetReturn(result); |
907 } | 894 } |
908 | 895 |
909 | 896 |
910 // Handles inline cache misses by updating the IC data array of the call site. | 897 // Handles inline cache misses by updating the IC data array of the call site. |
911 // Arg0: Receiver object. | 898 // Arg0: Receiver object. |
912 // Arg1: Argument after receiver. | 899 // Arg1: Argument after receiver. |
913 // Arg2: IC data object. | 900 // Arg2: IC data object. |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1906 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1893 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1907 const TypedData& new_data = | 1894 const TypedData& new_data = |
1908 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1895 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1909 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1896 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1910 typed_data_cell.SetAt(0, new_data); | 1897 typed_data_cell.SetAt(0, new_data); |
1911 arguments.SetReturn(new_data); | 1898 arguments.SetReturn(new_data); |
1912 } | 1899 } |
1913 | 1900 |
1914 | 1901 |
1915 } // namespace dart | 1902 } // namespace dart |
OLD | NEW |