| 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 Zone zone(isolate); |
| 605 CompilationInfo info(script, &zone); |
| 606 ZoneScope scope(&zone, DELETE_ON_EXIT); |
| 605 info.MarkAsGlobal(); | 607 info.MarkAsGlobal(); |
| 606 // Parse and don't allow skipping lazy functions. | 608 // Parse and don't allow skipping lazy functions. |
| 607 if (ParserApi::Parse(&info, kNoParsingFlags)) { | 609 if (ParserApi::Parse(&info, kNoParsingFlags)) { |
| 608 // Compile the code. | 610 // Compile the code. |
| 609 LiveEditFunctionTracker tracker(info.isolate(), info.function()); | 611 LiveEditFunctionTracker tracker(info.isolate(), info.function()); |
| 610 if (Compiler::MakeCodeForLiveEdit(&info)) { | 612 if (Compiler::MakeCodeForLiveEdit(&info)) { |
| 611 ASSERT(!info.code().is_null()); | 613 ASSERT(!info.code().is_null()); |
| 612 tracker.RecordRootFunctionInfo(info.code()); | 614 tracker.RecordRootFunctionInfo(info.code()); |
| 613 } else { | 615 } else { |
| 614 info.isolate()->StackOverflow(); | 616 info.isolate()->StackOverflow(); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 889 |
| 888 Handle<JSArray> result_; | 890 Handle<JSArray> result_; |
| 889 int len_; | 891 int len_; |
| 890 int current_parent_index_; | 892 int current_parent_index_; |
| 891 }; | 893 }; |
| 892 | 894 |
| 893 | 895 |
| 894 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, | 896 JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script, |
| 895 Handle<String> source) { | 897 Handle<String> source) { |
| 896 Isolate* isolate = Isolate::Current(); | 898 Isolate* isolate = Isolate::Current(); |
| 897 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); | |
| 898 | 899 |
| 899 FunctionInfoListener listener; | 900 FunctionInfoListener listener; |
| 900 Handle<Object> original_source = Handle<Object>(script->source()); | 901 Handle<Object> original_source = Handle<Object>(script->source()); |
| 901 script->set_source(*source); | 902 script->set_source(*source); |
| 902 isolate->set_active_function_info_listener(&listener); | 903 isolate->set_active_function_info_listener(&listener); |
| 903 CompileScriptForTracker(isolate, script); | 904 CompileScriptForTracker(isolate, script); |
| 904 isolate->set_active_function_info_listener(NULL); | 905 isolate->set_active_function_info_listener(NULL); |
| 905 script->set_source(*original_source); | 906 script->set_source(*original_source); |
| 906 | 907 |
| 907 return *(listener.GetResult()); | 908 return *(listener.GetResult()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 }; | 987 }; |
| 987 | 988 |
| 988 | 989 |
| 989 // Finds all references to original and replaces them with substitution. | 990 // Finds all references to original and replaces them with substitution. |
| 990 static void ReplaceCodeObject(Code* original, Code* substitution) { | 991 static void ReplaceCodeObject(Code* original, Code* substitution) { |
| 991 ASSERT(!HEAP->InNewSpace(substitution)); | 992 ASSERT(!HEAP->InNewSpace(substitution)); |
| 992 | 993 |
| 993 HeapIterator iterator; | 994 HeapIterator iterator; |
| 994 AssertNoAllocation no_allocations_please; | 995 AssertNoAllocation no_allocations_please; |
| 995 | 996 |
| 997 Zone* zone = Isolate::Current()->runtime_zone(); |
| 996 // A zone scope for ReferenceCollectorVisitor. | 998 // A zone scope for ReferenceCollectorVisitor. |
| 997 ZoneScope scope(Isolate::Current(), DELETE_ON_EXIT); | 999 ZoneScope scope(zone, DELETE_ON_EXIT); |
| 998 | 1000 |
| 999 ReferenceCollectorVisitor visitor(original, Isolate::Current()->zone()); | 1001 ReferenceCollectorVisitor visitor(original, zone); |
| 1000 | 1002 |
| 1001 // Iterate over all roots. Stack frames may have pointer into original code, | 1003 // Iterate over all roots. Stack frames may have pointer into original code, |
| 1002 // so temporary replace the pointers with offset numbers | 1004 // so temporary replace the pointers with offset numbers |
| 1003 // in prologue/epilogue. | 1005 // in prologue/epilogue. |
| 1004 { | 1006 { |
| 1005 HEAP->IterateStrongRoots(&visitor, VISIT_ALL); | 1007 HEAP->IterateStrongRoots(&visitor, VISIT_ALL); |
| 1006 } | 1008 } |
| 1007 | 1009 |
| 1008 // Now iterate over all pointers of all objects, including code_target | 1010 // Now iterate over all pointers of all objects, including code_target |
| 1009 // implicit pointers. | 1011 // implicit pointers. |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1595 return !frame->is_exit(); | 1597 return !frame->is_exit(); |
| 1596 } | 1598 } |
| 1597 | 1599 |
| 1598 // Fills result array with statuses of functions. Modifies the stack | 1600 // Fills result array with statuses of functions. Modifies the stack |
| 1599 // removing all listed function if possible and if do_drop is true. | 1601 // removing all listed function if possible and if do_drop is true. |
| 1600 static const char* DropActivationsInActiveThread( | 1602 static const char* DropActivationsInActiveThread( |
| 1601 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop, | 1603 Handle<JSArray> shared_info_array, Handle<JSArray> result, bool do_drop, |
| 1602 Zone* zone) { | 1604 Zone* zone) { |
| 1603 Isolate* isolate = Isolate::Current(); | 1605 Isolate* isolate = Isolate::Current(); |
| 1604 Debug* debug = isolate->debug(); | 1606 Debug* debug = isolate->debug(); |
| 1605 ZoneScope scope(isolate, DELETE_ON_EXIT); | 1607 ZoneScope scope(zone, DELETE_ON_EXIT); |
| 1606 Vector<StackFrame*> frames = CreateStackMap(zone); | 1608 Vector<StackFrame*> frames = CreateStackMap(zone); |
| 1607 | 1609 |
| 1608 int array_len = Smi::cast(shared_info_array->length())->value(); | 1610 int array_len = Smi::cast(shared_info_array->length())->value(); |
| 1609 | 1611 |
| 1610 int top_frame_index = -1; | 1612 int top_frame_index = -1; |
| 1611 int frame_index = 0; | 1613 int frame_index = 0; |
| 1612 for (; frame_index < frames.length(); frame_index++) { | 1614 for (; frame_index < frames.length(); frame_index++) { |
| 1613 StackFrame* frame = frames[frame_index]; | 1615 StackFrame* frame = frames[frame_index]; |
| 1614 if (frame->id() == debug->break_frame_id()) { | 1616 if (frame->id() == debug->break_frame_id()) { |
| 1615 top_frame_index = frame_index; | 1617 top_frame_index = frame_index; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 | 1828 |
| 1827 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1829 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 1828 return false; | 1830 return false; |
| 1829 } | 1831 } |
| 1830 | 1832 |
| 1831 #endif // ENABLE_DEBUGGER_SUPPORT | 1833 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1832 | 1834 |
| 1833 | 1835 |
| 1834 | 1836 |
| 1835 } } // namespace v8::internal | 1837 } } // namespace v8::internal |
| OLD | NEW |