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

Side by Side Diff: src/runtime.cc

Issue 8403037: Make C++ to JS transition faster by avoiding JavaScriptFrameIterator in SaveContext. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« src/isolate.h ('K') | « src/isolate-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 10681 matching lines...) Expand 10 before | Expand all | Expand 10 after
10692 static const int kFrameDetailsReceiverIndex = 1; 10692 static const int kFrameDetailsReceiverIndex = 1;
10693 static const int kFrameDetailsFunctionIndex = 2; 10693 static const int kFrameDetailsFunctionIndex = 2;
10694 static const int kFrameDetailsArgumentCountIndex = 3; 10694 static const int kFrameDetailsArgumentCountIndex = 3;
10695 static const int kFrameDetailsLocalCountIndex = 4; 10695 static const int kFrameDetailsLocalCountIndex = 4;
10696 static const int kFrameDetailsSourcePositionIndex = 5; 10696 static const int kFrameDetailsSourcePositionIndex = 5;
10697 static const int kFrameDetailsConstructCallIndex = 6; 10697 static const int kFrameDetailsConstructCallIndex = 6;
10698 static const int kFrameDetailsAtReturnIndex = 7; 10698 static const int kFrameDetailsAtReturnIndex = 7;
10699 static const int kFrameDetailsFlagsIndex = 8; 10699 static const int kFrameDetailsFlagsIndex = 8;
10700 static const int kFrameDetailsFirstDynamicIndex = 9; 10700 static const int kFrameDetailsFirstDynamicIndex = 9;
10701 10701
10702
10703 static SaveContext* FindSavedContextForFrame(Isolate* isolate,
10704 JavaScriptFrame* frame) {
10705 SaveContext* save = isolate->save_context();
10706 while (save != NULL && !save->IsAboveFrame(frame)) {
10707 save = save->prev();
10708 }
10709 ASSERT(save != NULL);
10710 return save;
10711 }
10712
10713
10702 // Return an array with frame details 10714 // Return an array with frame details
10703 // args[0]: number: break id 10715 // args[0]: number: break id
10704 // args[1]: number: frame index 10716 // args[1]: number: frame index
10705 // 10717 //
10706 // The array returned contains the following information: 10718 // The array returned contains the following information:
10707 // 0: Frame id 10719 // 0: Frame id
10708 // 1: Receiver 10720 // 1: Receiver
10709 // 2: Function 10721 // 2: Function
10710 // 3: Argument count 10722 // 3: Argument count
10711 // 4: Local count 10723 // 4: Local count
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
10747 if (it.done()) return heap->undefined_value(); 10759 if (it.done()) return heap->undefined_value();
10748 10760
10749 if (it.frame()->is_optimized()) { 10761 if (it.frame()->is_optimized()) {
10750 inlined_frame_index = 10762 inlined_frame_index =
10751 it.frame()->GetInlineCount() - (index - count) - 1; 10763 it.frame()->GetInlineCount() - (index - count) - 1;
10752 } 10764 }
10753 FrameInspector frame_inspector(it.frame(), inlined_frame_index, isolate); 10765 FrameInspector frame_inspector(it.frame(), inlined_frame_index, isolate);
10754 10766
10755 // Traverse the saved contexts chain to find the active context for the 10767 // Traverse the saved contexts chain to find the active context for the
10756 // selected frame. 10768 // selected frame.
10757 SaveContext* save = isolate->save_context(); 10769 SaveContext* save = FindSavedContextForFrame(isolate, it.frame());
10758 while (save != NULL && !save->below(it.frame())) {
10759 save = save->prev();
10760 }
10761 ASSERT(save != NULL);
10762 10770
10763 // Get the frame id. 10771 // Get the frame id.
10764 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate); 10772 Handle<Object> frame_id(WrapFrameId(it.frame()->id()), isolate);
10765 10773
10766 // Find source position. 10774 // Find source position.
10767 int position = 10775 int position =
10768 it.frame()->LookupCode()->SourcePosition(it.frame()->pc()); 10776 it.frame()->LookupCode()->SourcePosition(it.frame()->pc());
10769 10777
10770 // Check for constructor frame. Inlined frames cannot be construct calls. 10778 // Check for constructor frame. Inlined frames cannot be construct calls.
10771 bool inlined_frame = 10779 bool inlined_frame =
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
12029 // Get the frame where the debugging is performed. 12037 // Get the frame where the debugging is performed.
12030 StackFrame::Id id = UnwrapFrameId(wrapped_id); 12038 StackFrame::Id id = UnwrapFrameId(wrapped_id);
12031 JavaScriptFrameIterator it(isolate, id); 12039 JavaScriptFrameIterator it(isolate, id);
12032 JavaScriptFrame* frame = it.frame(); 12040 JavaScriptFrame* frame = it.frame();
12033 Handle<JSFunction> function(JSFunction::cast(frame->function())); 12041 Handle<JSFunction> function(JSFunction::cast(frame->function()));
12034 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info()); 12042 Handle<SerializedScopeInfo> scope_info(function->shared()->scope_info());
12035 ScopeInfo<> sinfo(*scope_info); 12043 ScopeInfo<> sinfo(*scope_info);
12036 12044
12037 // Traverse the saved contexts chain to find the active context for the 12045 // Traverse the saved contexts chain to find the active context for the
12038 // selected frame. 12046 // selected frame.
12039 SaveContext* save = isolate->save_context(); 12047 SaveContext* save = FindSavedContextForFrame(isolate, frame);
12040 while (save != NULL && !save->below(frame)) { 12048
12041 save = save->prev();
12042 }
12043 ASSERT(save != NULL);
12044 SaveContext savex(isolate); 12049 SaveContext savex(isolate);
12045 isolate->set_context(*(save->context())); 12050 isolate->set_context(*(save->context()));
12046 12051
12047 // Create the (empty) function replacing the function on the stack frame for 12052 // Create the (empty) function replacing the function on the stack frame for
12048 // the purpose of evaluating in the context created below. It is important 12053 // the purpose of evaluating in the context created below. It is important
12049 // that this function does not describe any parameters and local variables 12054 // that this function does not describe any parameters and local variables
12050 // in the context. If it does then this will cause problems with the lookup 12055 // in the context. If it does then this will cause problems with the lookup
12051 // in Context::Lookup, where context slots for parameters and local variables 12056 // in Context::Lookup, where context slots for parameters and local variables
12052 // are looked at before the extension object. 12057 // are looked at before the extension object.
12053 Handle<JSFunction> go_between = 12058 Handle<JSFunction> go_between =
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
13526 } else { 13531 } else {
13527 // Handle last resort GC and make sure to allow future allocations 13532 // Handle last resort GC and make sure to allow future allocations
13528 // to grow the heap without causing GCs (if possible). 13533 // to grow the heap without causing GCs (if possible).
13529 isolate->counters()->gc_last_resort_from_js()->Increment(); 13534 isolate->counters()->gc_last_resort_from_js()->Increment();
13530 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13535 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13531 } 13536 }
13532 } 13537 }
13533 13538
13534 13539
13535 } } // namespace v8::internal 13540 } } // namespace v8::internal
OLDNEW
« src/isolate.h ('K') | « src/isolate-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698