OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 #else | 110 #else |
111 return FLAG_always_full_compiler; | 111 return FLAG_always_full_compiler; |
112 #endif | 112 #endif |
113 } | 113 } |
114 | 114 |
115 | 115 |
116 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { | 116 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { |
117 int opt_count = function->shared()->opt_count(); | 117 int opt_count = function->shared()->opt_count(); |
118 function->shared()->set_opt_count(opt_count + 1); | 118 function->shared()->set_opt_count(opt_count + 1); |
| 119 if (!FLAG_trace_opt) return; |
| 120 |
119 double ms = static_cast<double>(OS::Ticks() - start) / 1000; | 121 double ms = static_cast<double>(OS::Ticks() - start) / 1000; |
120 if (FLAG_trace_opt) { | 122 PrintF("[optimizing: "); |
121 PrintF("[optimizing: "); | 123 function->PrintName(); |
122 function->PrintName(); | 124 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); |
123 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); | 125 PrintF(" - took %0.3f ms]\n", ms); |
124 PrintF(" - took %0.3f ms]\n", ms); | |
125 } | |
126 if (FLAG_trace_opt_stats) { | |
127 static double compilation_time = 0.0; | |
128 static int compiled_functions = 0; | |
129 static int code_size = 0; | |
130 | |
131 compilation_time += ms; | |
132 compiled_functions++; | |
133 code_size += function->shared()->SourceSize(); | |
134 PrintF("Compiled: %d functions with %d byte source size in %fms.\n", | |
135 compiled_functions, | |
136 code_size, | |
137 compilation_time); | |
138 } | |
139 } | 126 } |
140 | 127 |
141 | 128 |
142 static void AbortAndDisable(CompilationInfo* info) { | 129 static void AbortAndDisable(CompilationInfo* info) { |
143 // Disable optimization for the shared function info and mark the | 130 // Disable optimization for the shared function info and mark the |
144 // code as non-optimizable. The marker on the shared function info | 131 // code as non-optimizable. The marker on the shared function info |
145 // is there because we flush non-optimized code thereby loosing the | 132 // is there because we flush non-optimized code thereby loosing the |
146 // non-optimizable information for the code. When the code is | 133 // non-optimizable information for the code. When the code is |
147 // regenerated and set on the shared function info it is marked as | 134 // regenerated and set on the shared function info it is marked as |
148 // non-optimizable if optimization is disabled for the shared | 135 // non-optimizable if optimization is disabled for the shared |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 *code, | 755 *code, |
769 *name)); | 756 *name)); |
770 OPROFILE(CreateNativeCodeRegion(*name, | 757 OPROFILE(CreateNativeCodeRegion(*name, |
771 code->instruction_start(), | 758 code->instruction_start(), |
772 code->instruction_size())); | 759 code->instruction_size())); |
773 } | 760 } |
774 } | 761 } |
775 } | 762 } |
776 | 763 |
777 } } // namespace v8::internal | 764 } } // namespace v8::internal |
OLD | NEW |