Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/runtime/runtime-test.cc

Issue 2757993002: [runtime] Add function for printing type profile. (Closed)
Patch Set: Delete unused variable. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/assembler-inl.h" 10 #include "src/assembler-inl.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 151
152 RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) { 152 RUNTIME_FUNCTION(Runtime_IsConcurrentRecompilationSupported) {
153 SealHandleScope shs(isolate); 153 SealHandleScope shs(isolate);
154 DCHECK_EQ(0, args.length()); 154 DCHECK_EQ(0, args.length());
155 return isolate->heap()->ToBoolean( 155 return isolate->heap()->ToBoolean(
156 isolate->concurrent_recompilation_enabled()); 156 isolate->concurrent_recompilation_enabled());
157 } 157 }
158 158
159 RUNTIME_FUNCTION(Runtime_PrintTypeProfile) {
160 HandleScope scope(isolate);
Yang 2017/03/20 08:48:45 Let's DCHECK that args.length() is 1.
Franzi 2017/03/20 10:09:56 Done.
161 if (!FLAG_type_profile) {
162 return isolate->heap()->undefined_value();
163 }
164
165 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
166 if (!function_object->IsJSFunction()) {
Yang 2017/03/20 08:48:45 You can omit this type check if you define functio
Franzi 2017/03/20 10:09:56 Done.
167 return isolate->heap()->undefined_value();
168 }
169 Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
170
171 if (function->has_feedback_vector()) {
172 FeedbackVector* vector = function->feedback_vector();
173
174 Object* function_name = vector->shared_function_info()->name();
175 PrintF("Function: %s\n", String::cast(function_name)->ToCString().get());
176
177 FeedbackMetadataIterator iter(vector->metadata());
178 while (iter.HasNext()) {
179 FeedbackSlot slot = iter.Next();
180 FeedbackSlotKind kind = iter.kind();
181 if (kind == FeedbackSlotKind::kTypeProfile) {
182 CollectTypeProfileNexus nexus(vector, slot);
183 nexus.Print();
184 PrintF("\n");
185 return isolate->heap()->undefined_value();
Yang 2017/03/20 08:48:45 Do you really want to return after the first TypeP
Franzi 2017/03/20 10:09:56 Yes! Sorry, I discussed offline with Michi that we
186 }
187 }
188 }
189 return isolate->heap()->undefined_value();
190 }
159 191
160 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { 192 RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
161 HandleScope scope(isolate); 193 HandleScope scope(isolate);
162 194
163 // This function is used by fuzzers, ignore calls with bogus arguments count. 195 // This function is used by fuzzers, ignore calls with bogus arguments count.
164 if (args.length() != 1 && args.length() != 2) { 196 if (args.length() != 1 && args.length() != 2) {
165 return isolate->heap()->undefined_value(); 197 return isolate->heap()->undefined_value();
166 } 198 }
167 199
168 // This function is used by fuzzers to get coverage for optimizations 200 // This function is used by fuzzers to get coverage for optimizations
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 isolate->IncrementWaitCountForTesting(); 984 isolate->IncrementWaitCountForTesting();
953 return isolate->heap()->undefined_value(); 985 return isolate->heap()->undefined_value();
954 } 986 }
955 987
956 RUNTIME_FUNCTION(Runtime_DecrementWaitCount) { 988 RUNTIME_FUNCTION(Runtime_DecrementWaitCount) {
957 isolate->DecrementWaitCountForTesting(); 989 isolate->DecrementWaitCountForTesting();
958 return isolate->heap()->undefined_value(); 990 return isolate->heap()->undefined_value();
959 } 991 }
960 } // namespace internal 992 } // namespace internal
961 } // namespace v8 993 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698