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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_field_guards); | 68 DECLARE_FLAG(bool, trace_field_guards); |
69 DECLARE_FLAG(bool, trace_optimization); | 69 DECLARE_FLAG(bool, trace_optimization); |
70 DECLARE_FLAG(bool, trace_optimizing_compiler); | 70 DECLARE_FLAG(bool, trace_optimizing_compiler); |
71 DECLARE_FLAG(bool, warn_on_javascript_compatibility); | |
72 DECLARE_FLAG(int, max_polymorphic_checks); | 71 DECLARE_FLAG(int, max_polymorphic_checks); |
73 DECLARE_FLAG(bool, precompilation); | 72 DECLARE_FLAG(bool, precompilation); |
74 | 73 |
75 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); | 74 DEFINE_FLAG(bool, use_osr, true, "Use on-stack replacement."); |
76 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); | 75 DEFINE_FLAG(bool, trace_osr, false, "Trace attempts at on-stack replacement."); |
77 | 76 |
78 DEFINE_FLAG(int, stacktrace_every, 0, | 77 DEFINE_FLAG(int, stacktrace_every, 0, |
79 "Compute debugger stacktrace on every N stack overflow checks"); | 78 "Compute debugger stacktrace on every N stack overflow checks"); |
80 DEFINE_FLAG(charp, stacktrace_filter, NULL, | 79 DEFINE_FLAG(charp, stacktrace_filter, NULL, |
81 "Compute stacktrace in named function on stack overflow checks"); | 80 "Compute stacktrace in named function on stack overflow checks"); |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 // Handles inline cache misses by updating the IC data array of the call site. | 883 // Handles inline cache misses by updating the IC data array of the call site. |
885 // Arg0: Receiver object. | 884 // Arg0: Receiver object. |
886 // Arg1: IC data object. | 885 // Arg1: IC data object. |
887 // Returns: target function with compiled code or null. | 886 // Returns: target function with compiled code or null. |
888 // Modifies the instance call to hold the updated IC data array. | 887 // Modifies the instance call to hold the updated IC data array. |
889 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { | 888 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { |
890 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); | 889 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); |
891 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); | 890 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); |
892 GrowableArray<const Instance*> args(1); | 891 GrowableArray<const Instance*> args(1); |
893 args.Add(&receiver); | 892 args.Add(&receiver); |
894 if (FLAG_warn_on_javascript_compatibility) { | |
895 if (receiver.IsDouble() && | |
896 String::Handle(ic_data.target_name()).Equals(Symbols::toString())) { | |
897 const double value = Double::Cast(receiver).value(); | |
898 if (floor(value) == value) { | |
899 Report::JSWarningFromIC(ic_data, | |
900 "string representation of an integral value " | |
901 "of type 'double' has no decimal mark and " | |
902 "no fractional part"); | |
903 } | |
904 } | |
905 } | |
906 const Function& result = | 893 const Function& result = |
907 Function::Handle(InlineCacheMissHandler(args, ic_data)); | 894 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
908 arguments.SetReturn(result); | 895 arguments.SetReturn(result); |
909 } | 896 } |
910 | 897 |
911 | 898 |
912 // Handles inline cache misses by updating the IC data array of the call site. | 899 // Handles inline cache misses by updating the IC data array of the call site. |
913 // Arg0: Receiver object. | 900 // Arg0: Receiver object. |
914 // Arg1: Argument after receiver. | 901 // Arg1: Argument after receiver. |
915 // Arg2: IC data object. | 902 // Arg2: IC data object. |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1920 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 1907 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
1921 const TypedData& new_data = | 1908 const TypedData& new_data = |
1922 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 1909 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
1923 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 1910 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
1924 typed_data_cell.SetAt(0, new_data); | 1911 typed_data_cell.SetAt(0, new_data); |
1925 arguments.SetReturn(new_data); | 1912 arguments.SetReturn(new_data); |
1926 } | 1913 } |
1927 | 1914 |
1928 | 1915 |
1929 } // namespace dart | 1916 } // namespace dart |
OLD | NEW |