OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 | 594 |
595 return output.GetResult(); | 595 return output.GetResult(); |
596 } | 596 } |
597 | 597 |
598 | 598 |
599 static void CompileScriptForTracker(Isolate* isolate, Handle<Script> script) { | 599 static void CompileScriptForTracker(Isolate* isolate, Handle<Script> script) { |
600 // TODO(635): support extensions. | 600 // TODO(635): support extensions. |
601 PostponeInterruptsScope postpone(isolate); | 601 PostponeInterruptsScope postpone(isolate); |
602 | 602 |
603 // Build AST. | 603 // Build AST. |
604 CompilationInfo info(script); | 604 ZoneCompilationInfo info(script); |
605 info.MarkAsGlobal(); | 605 info.MarkAsGlobal(); |
606 // Parse and don't allow skipping lazy functions. | 606 // Parse and don't allow skipping lazy functions. |
607 if (ParserApi::Parse(&info, kNoParsingFlags)) { | 607 if (ParserApi::Parse(&info, kNoParsingFlags)) { |
608 // Compile the code. | 608 // Compile the code. |
609 LiveEditFunctionTracker tracker(info.isolate(), info.function()); | 609 LiveEditFunctionTracker tracker(info.isolate(), info.function()); |
610 if (Compiler::MakeCodeForLiveEdit(&info)) { | 610 if (Compiler::MakeCodeForLiveEdit(&info)) { |
611 ASSERT(!info.code().is_null()); | 611 ASSERT(!info.code().is_null()); |
612 tracker.RecordRootFunctionInfo(info.code()); | 612 tracker.RecordRootFunctionInfo(info.code()); |
613 } else { | 613 } else { |
614 info.isolate()->StackOverflow(); | 614 info.isolate()->StackOverflow(); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 } | 886 } |
887 | 887 |
888 Handle<JSArray> result_; | 888 Handle<JSArray> result_; |
889 int len_; | 889 int len_; |
890 int current_parent_index_; | 890 int current_parent_index_; |
891 }; | 891 }; |
892 | 892 |
893 | 893 |
894 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, | 894 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, |
895 Handle<String> source) { | 895 Handle<String> source) { |
896 Isolate* isolate = Isolate::Current(); | 896 Isolate* isolate = Isolate::Current(); |
danno
2012/06/19 20:09:53
Why again is it OK to remove the zone scope? Seems
sanjoy
2012/06/19 20:56:40
CompileScriptForTracker creates a CompilationInfoW
| |
897 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); | |
898 | 897 |
899 FunctionInfoListener listener; | 898 FunctionInfoListener listener; |
900 Handle<Object> original_source = Handle<Object>(script->source()); | 899 Handle<Object> original_source = Handle<Object>(script->source()); |
901 script->set_source(*source); | 900 script->set_source(*source); |
902 isolate->set_active_function_info_listener(&listener); | 901 isolate->set_active_function_info_listener(&listener); |
903 CompileScriptForTracker(isolate, script); | 902 CompileScriptForTracker(isolate, script); |
904 isolate->set_active_function_info_listener(NULL); | 903 isolate->set_active_function_info_listener(NULL); |
905 script->set_source(*original_source); | 904 script->set_source(*original_source); |
906 | 905 |
907 return *(listener.GetResult()); | 906 return *(listener.GetResult()); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1587 Handle<JSArray> m_shared_info_array; | 1586 Handle<JSArray> m_shared_info_array; |
1588 Handle<JSArray> m_result; | 1587 Handle<JSArray> m_result; |
1589 }; | 1588 }; |
1590 | 1589 |
1591 // Drops all call frame matched by target and all frames above them. | 1590 // Drops all call frame matched by target and all frames above them. |
1592 template<typename TARGET> | 1591 template<typename TARGET> |
1593 static const char* DropActivationsInActiveThreadImpl( | 1592 static const char* DropActivationsInActiveThreadImpl( |
1594 TARGET& target, bool do_drop, Zone* zone) { | 1593 TARGET& target, bool do_drop, Zone* zone) { |
1595 Isolate* isolate = Isolate::Current(); | 1594 Isolate* isolate = Isolate::Current(); |
1596 Debug* debug = isolate->debug(); | 1595 Debug* debug = isolate->debug(); |
1597 ZoneScope scope(isolate, DELETE_ON_EXIT); | 1596 ZoneScope scope(zone, DELETE_ON_EXIT); |
1598 Vector<StackFrame*> frames = CreateStackMap(zone); | 1597 Vector<StackFrame*> frames = CreateStackMap(zone); |
1599 | 1598 |
1600 | 1599 |
1601 int top_frame_index = -1; | 1600 int top_frame_index = -1; |
1602 int frame_index = 0; | 1601 int frame_index = 0; |
1603 for (; frame_index < frames.length(); frame_index++) { | 1602 for (; frame_index < frames.length(); frame_index++) { |
1604 StackFrame* frame = frames[frame_index]; | 1603 StackFrame* frame = frames[frame_index]; |
1605 if (frame->id() == debug->break_frame_id()) { | 1604 if (frame->id() == debug->break_frame_id()) { |
1606 top_frame_index = frame_index; | 1605 top_frame_index = frame_index; |
1607 break; | 1606 break; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1869 | 1868 |
1870 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1869 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
1871 return false; | 1870 return false; |
1872 } | 1871 } |
1873 | 1872 |
1874 #endif // ENABLE_DEBUGGER_SUPPORT | 1873 #endif // ENABLE_DEBUGGER_SUPPORT |
1875 | 1874 |
1876 | 1875 |
1877 | 1876 |
1878 } } // namespace v8::internal | 1877 } } // namespace v8::internal |
OLD | NEW |