OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // in any other time this class is very cheap. | 60 // in any other time this class is very cheap. |
61 // | 61 // |
62 // The primary interest of the Tracker is to record function scope structures | 62 // The primary interest of the Tracker is to record function scope structures |
63 // in order to analyze whether function code maybe safely patched (with new | 63 // in order to analyze whether function code maybe safely patched (with new |
64 // code successfully reading existing data from function scopes). The Tracker | 64 // code successfully reading existing data from function scopes). The Tracker |
65 // also collects compiled function codes. | 65 // also collects compiled function codes. |
66 class LiveEditFunctionTracker { | 66 class LiveEditFunctionTracker { |
67 public: | 67 public: |
68 explicit LiveEditFunctionTracker(FunctionLiteral* fun); | 68 explicit LiveEditFunctionTracker(FunctionLiteral* fun); |
69 ~LiveEditFunctionTracker(); | 69 ~LiveEditFunctionTracker(); |
70 void RecordFunctionCode(Handle<Code> code); | 70 void RecordFunctionInfo(Handle<SharedFunctionInfo> info, |
71 void RecordFunctionScope(Scope* scope); | 71 FunctionLiteral* lit); |
| 72 void RecordRootFunctionInfo(Handle<Code> code); |
72 | 73 |
73 static bool IsActive(); | 74 static bool IsActive(); |
74 }; | 75 }; |
75 | 76 |
76 #ifdef ENABLE_DEBUGGER_SUPPORT | 77 #ifdef ENABLE_DEBUGGER_SUPPORT |
77 | 78 |
78 class LiveEdit : AllStatic { | 79 class LiveEdit : AllStatic { |
79 public: | 80 public: |
80 static JSArray* GatherCompileInfo(Handle<Script> script, | 81 static JSArray* GatherCompileInfo(Handle<Script> script, |
81 Handle<String> source); | 82 Handle<String> source); |
82 | 83 |
83 static void WrapSharedFunctionInfos(Handle<JSArray> array); | 84 static void WrapSharedFunctionInfos(Handle<JSArray> array); |
84 | 85 |
85 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, | 86 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, |
86 Handle<JSArray> shared_info_array); | 87 Handle<JSArray> shared_info_array); |
87 | 88 |
88 static void RelinkFunctionToScript(Handle<JSArray> shared_info_array, | 89 // Updates script field in FunctionSharedInfo. |
89 Handle<Script> script_handle); | 90 static void SetFunctionScript(Handle<JSValue> function_wrapper, |
| 91 Handle<Object> script_handle); |
90 | 92 |
91 // Returns an array of pairs (new source position, breakpoint_object/array) | 93 static void PatchFunctionPositions( |
92 // so that JS side could update positions in breakpoint objects. | |
93 static Handle<JSArray> PatchFunctionPositions( | |
94 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array); | 94 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array); |
95 | 95 |
| 96 // For a script updates its source field. If old_script_name is provided |
| 97 // (i.e. is a String), also creates a copy of the script with its original |
| 98 // source and sends notification to debugger. |
| 99 static Object* ChangeScriptSource(Handle<Script> original_script, |
| 100 Handle<String> new_source, |
| 101 Handle<Object> old_script_name); |
| 102 |
| 103 // In a code of a parent function replaces original function as embedded |
| 104 // object with a substitution one. |
| 105 static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared, |
| 106 Handle<JSValue> orig_function_shared, |
| 107 Handle<JSValue> subst_function_shared); |
| 108 |
96 // Checks listed functions on stack and return array with corresponding | 109 // Checks listed functions on stack and return array with corresponding |
97 // FunctionPatchabilityStatus statuses; extra array element may | 110 // FunctionPatchabilityStatus statuses; extra array element may |
98 // contain general error message. Modifies the current stack and | 111 // contain general error message. Modifies the current stack and |
99 // has restart the lowest found frames and drops all other frames above | 112 // has restart the lowest found frames and drops all other frames above |
100 // if possible and if do_drop is true. | 113 // if possible and if do_drop is true. |
101 static Handle<JSArray> CheckAndDropActivations( | 114 static Handle<JSArray> CheckAndDropActivations( |
102 Handle<JSArray> shared_info_array, bool do_drop); | 115 Handle<JSArray> shared_info_array, bool do_drop); |
103 | 116 |
104 // A copy of this is in liveedit-debugger.js. | 117 // A copy of this is in liveedit-debugger.js. |
105 enum FunctionPatchabilityStatus { | 118 enum FunctionPatchabilityStatus { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 static void CalculateDifference(Input* input, | 161 static void CalculateDifference(Input* input, |
149 Output* result_writer); | 162 Output* result_writer); |
150 }; | 163 }; |
151 | 164 |
152 #endif // ENABLE_DEBUGGER_SUPPORT | 165 #endif // ENABLE_DEBUGGER_SUPPORT |
153 | 166 |
154 | 167 |
155 } } // namespace v8::internal | 168 } } // namespace v8::internal |
156 | 169 |
157 #endif /* V*_LIVEEDIT_H_ */ | 170 #endif /* V*_LIVEEDIT_H_ */ |
OLD | NEW |