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

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

Issue 1146963002: Add %GetCallerJSFunction intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge with ToT Created 5 years, 7 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 return isolate->heap()->ToBoolean(FLAG_harmony_tostring); 409 return isolate->heap()->ToBoolean(FLAG_harmony_tostring);
410 } 410 }
411 411
412 412
413 RUNTIME_FUNCTION(Runtime_GetTypeFeedbackVector) { 413 RUNTIME_FUNCTION(Runtime_GetTypeFeedbackVector) {
414 SealHandleScope shs(isolate); 414 SealHandleScope shs(isolate);
415 DCHECK(args.length() == 1); 415 DCHECK(args.length() == 1);
416 CONVERT_ARG_CHECKED(JSFunction, function, 0); 416 CONVERT_ARG_CHECKED(JSFunction, function, 0);
417 return function->shared()->feedback_vector(); 417 return function->shared()->feedback_vector();
418 } 418 }
419
420
421 RUNTIME_FUNCTION(Runtime_GetCallerJSFunction) {
422 SealHandleScope shs(isolate);
423 DCHECK(args.length() == 0);
424 JavaScriptFrameIterator it(isolate);
425 int frames_to_count = 2;
426 int function_index = 0;
427 List<JSFunction*> functions(FLAG_max_inlining_levels + 1);
428 while (frames_to_count-- != 0) {
429 if (function_index == 0) {
430 functions.Rewind(0);
431 it.frame()->GetFunctions(&functions);
432 it.Advance();
433 function_index = functions.length() - 1;
434 } else {
435 function_index--;
436 }
437 }
438 return functions[function_index];
439 }
419 } // namespace internal 440 } // namespace internal
420 } // namespace v8 441 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698