| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 #ifdef ENABLE_DEBUGGER_SUPPORT | 77 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 78 | 78 |
| 79 class LiveEdit : AllStatic { | 79 class LiveEdit : AllStatic { |
| 80 public: | 80 public: |
| 81 static JSArray* GatherCompileInfo(Handle<Script> script, | 81 static JSArray* GatherCompileInfo(Handle<Script> script, |
| 82 Handle<String> source); | 82 Handle<String> source); |
| 83 | 83 |
| 84 static void WrapSharedFunctionInfos(Handle<JSArray> array); | 84 static void WrapSharedFunctionInfos(Handle<JSArray> array); |
| 85 | 85 |
| 86 // Replaces function code. The function mustn't be running anywhere on stack. |
| 87 // The only exception is when stack_manipulation data is provided. |
| 88 // The stack manipulations are performed in this method. It is expected that |
| 89 // as a result the function gets restarted. |
| 90 // \param stack_manipulation_data possibly null handle to stack manipulations |
| 91 // that are to be performed |
| 86 static Object* ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, | 92 static Object* ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, |
| 87 Handle<JSArray> shared_info_array); | 93 Handle<JSArray> shared_info_array, |
| 94 Handle<ByteArray> stack_manipulation_data); |
| 88 | 95 |
| 89 // Updates script field in FunctionSharedInfo. | 96 // Updates script field in FunctionSharedInfo. |
| 90 static void SetFunctionScript(Handle<JSValue> function_wrapper, | 97 static void SetFunctionScript(Handle<JSValue> function_wrapper, |
| 91 Handle<Object> script_handle); | 98 Handle<Object> script_handle); |
| 92 | 99 |
| 93 static Object* PatchFunctionPositions( | 100 static Object* PatchFunctionPositions( |
| 94 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array); | 101 Handle<JSArray> shared_info_array, Handle<JSArray> position_change_array); |
| 95 | 102 |
| 96 // For a script updates its source field. If old_script_name is provided | 103 // 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 | 104 // (i.e. is a String), also creates a copy of the script with its original |
| 98 // source and sends notification to debugger. | 105 // source and sends notification to debugger. |
| 99 static Object* ChangeScriptSource(Handle<Script> original_script, | 106 static Object* ChangeScriptSource(Handle<Script> original_script, |
| 100 Handle<String> new_source, | 107 Handle<String> new_source, |
| 101 Handle<Object> old_script_name); | 108 Handle<Object> old_script_name); |
| 102 | 109 |
| 103 // In a code of a parent function replaces original function as embedded | 110 // In a code of a parent function replaces original function as embedded |
| 104 // object with a substitution one. | 111 // object with a substitution one. |
| 105 static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared, | 112 static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared, |
| 106 Handle<JSValue> orig_function_shared, | 113 Handle<JSValue> orig_function_shared, |
| 107 Handle<JSValue> subst_function_shared); | 114 Handle<JSValue> subst_function_shared); |
| 108 | 115 |
| 109 // Checks listed functions on stack and return array with corresponding | 116 // Checks the listed functions against the current stacks and plans |
| 110 // FunctionPatchabilityStatus statuses; extra array element may | 117 // possible stack manipulations: all frames running listed functions |
| 111 // contain general error message. Modifies the current stack and | 118 // must be removed (dropped) from stack. |
| 112 // has restart the lowest found frames and drops all other frames above | 119 // \param shared_info_array contains array of wrapped shared function |
| 113 // if possible and if do_drop is true. | 120 // infos or undefined elements |
| 114 static Handle<JSArray> CheckAndDropActivations( | 121 // \return array-packed StackManipulationInfo structure |
| 115 Handle<JSArray> shared_info_array, bool do_drop); | 122 static Handle<JSArray> CheckActivations(Handle<JSArray> shared_info_array); |
| 116 | 123 |
| 117 // A copy of this is in liveedit-debugger.js. | 124 // Returns whether the frame is paused at function restarter code. |
| 118 enum FunctionPatchabilityStatus { | 125 static bool IsAtFrameResetPatch(const JavaScriptFrame*); |
| 119 FUNCTION_AVAILABLE_FOR_PATCH = 1, | 126 |
| 120 FUNCTION_BLOCKED_ON_ACTIVE_STACK = 2, | 127 // Returns pointer to entry of function restarted code (the code must |
| 121 FUNCTION_BLOCKED_ON_OTHER_STACK = 3, | 128 // be patched). |
| 122 FUNCTION_BLOCKED_UNDER_NATIVE_CODE = 4, | 129 static Address GetRestarterPatchEntryPoint(Code* code); |
| 123 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5 | |
| 124 }; | |
| 125 | 130 |
| 126 // Compares 2 strings line-by-line and returns diff in form of array of | 131 // Compares 2 strings line-by-line and returns diff in form of array of |
| 127 // triplets (pos1, pos1_end, pos2_end) describing list of diff chunks. | 132 // triplets (pos1, pos1_end, pos2_end) describing list of diff chunks. |
| 128 static Handle<JSArray> CompareStringsLinewise(Handle<String> s1, | 133 static Handle<JSArray> CompareStringsLinewise(Handle<String> s1, |
| 129 Handle<String> s2); | 134 Handle<String> s2); |
| 130 }; | 135 }; |
| 131 | 136 |
| 132 | 137 |
| 133 // A general-purpose comparator between 2 arrays. | 138 // A general-purpose comparator between 2 arrays. |
| 134 class Comparator { | 139 class Comparator { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 160 // Finds the difference between 2 arrays of elements. | 165 // Finds the difference between 2 arrays of elements. |
| 161 static void CalculateDifference(Input* input, | 166 static void CalculateDifference(Input* input, |
| 162 Output* result_writer); | 167 Output* result_writer); |
| 163 }; | 168 }; |
| 164 | 169 |
| 165 #endif // ENABLE_DEBUGGER_SUPPORT | 170 #endif // ENABLE_DEBUGGER_SUPPORT |
| 166 | 171 |
| 167 | 172 |
| 168 } } // namespace v8::internal | 173 } } // namespace v8::internal |
| 169 | 174 |
| 170 #endif /* V*_LIVEEDIT_H_ */ | 175 #endif /* V8_LIVEEDIT_H_ */ |
| OLD | NEW |