| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_DEBUG_LIVEEDIT_H_ | 5 #ifndef V8_DEBUG_LIVEEDIT_H_ |
| 6 #define V8_DEBUG_LIVEEDIT_H_ | 6 #define V8_DEBUG_LIVEEDIT_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 // Live Edit feature implementation. | 9 // Live Edit feature implementation. |
| 10 // User should be able to change script on already running VM. This feature | 10 // User should be able to change script on already running VM. This feature |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 int current_parent_index_; | 67 int current_parent_index_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(LiveEditFunctionTracker); | 69 DISALLOW_COPY_AND_ASSIGN(LiveEditFunctionTracker); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 | 72 |
| 73 class LiveEdit : AllStatic { | 73 class LiveEdit : AllStatic { |
| 74 public: | 74 public: |
| 75 static void InitializeThreadLocal(Debug* debug); | 75 static void InitializeThreadLocal(Debug* debug); |
| 76 | 76 |
| 77 static bool SetAfterBreakTarget(Debug* debug); | |
| 78 | |
| 79 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( | 77 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( |
| 80 Handle<Script> script, | 78 Handle<Script> script, |
| 81 Handle<String> source); | 79 Handle<String> source); |
| 82 | 80 |
| 83 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, | 81 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, |
| 84 Handle<JSArray> shared_info_array); | 82 Handle<JSArray> shared_info_array); |
| 85 | 83 |
| 86 static void FixupScript(Handle<Script> script, int max_function_literal_id); | 84 static void FixupScript(Handle<Script> script, int max_function_literal_id); |
| 87 | 85 |
| 88 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array, | 86 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 }; | 137 }; |
| 140 | 138 |
| 141 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 139 // Compares 2 strings line-by-line, then token-wise and returns diff in form |
| 142 // of array of triplets (pos1, pos1_end, pos2_end) describing list | 140 // of array of triplets (pos1, pos1_end, pos2_end) describing list |
| 143 // of diff chunks. | 141 // of diff chunks. |
| 144 static Handle<JSArray> CompareStrings(Handle<String> s1, | 142 static Handle<JSArray> CompareStrings(Handle<String> s1, |
| 145 Handle<String> s2); | 143 Handle<String> s2); |
| 146 | 144 |
| 147 // Architecture-specific constant. | 145 // Architecture-specific constant. |
| 148 static const bool kFrameDropperSupported; | 146 static const bool kFrameDropperSupported; |
| 149 | |
| 150 /** | |
| 151 * Defines layout of a stack frame that supports padding. This is a regular | |
| 152 * internal frame that has a flexible stack structure. LiveEdit can shift | |
| 153 * its lower part up the stack, taking up the 'padding' space when additional | |
| 154 * stack memory is required. | |
| 155 * Such frame is expected immediately above the topmost JavaScript frame. | |
| 156 * | |
| 157 * Stack Layout: | |
| 158 * --- Top | |
| 159 * LiveEdit routine frames | |
| 160 * --- | |
| 161 * C frames of debug handler | |
| 162 * --- | |
| 163 * ... | |
| 164 * --- | |
| 165 * An internal frame that has n padding words: | |
| 166 * - any number of words as needed by code -- upper part of frame | |
| 167 * - padding size: a Smi storing n -- current size of padding | |
| 168 * - padding: n words filled with kPaddingValue in form of Smi | |
| 169 * - 3 context/type words of a regular InternalFrame | |
| 170 * - fp | |
| 171 * --- | |
| 172 * Topmost JavaScript frame | |
| 173 * --- | |
| 174 * ... | |
| 175 * --- Bottom | |
| 176 */ | |
| 177 // A number of words that should be reserved on stack for the LiveEdit use. | |
| 178 // Stored on stack in form of Smi. | |
| 179 static const int kFramePaddingInitialSize = 1; | |
| 180 // A value that padding words are filled with (in form of Smi). Going | |
| 181 // bottom-top, the first word not having this value is a counter word. | |
| 182 static const int kFramePaddingValue = kFramePaddingInitialSize + 1; | |
| 183 }; | 147 }; |
| 184 | 148 |
| 185 | 149 |
| 186 // A general-purpose comparator between 2 arrays. | 150 // A general-purpose comparator between 2 arrays. |
| 187 class Comparator { | 151 class Comparator { |
| 188 public: | 152 public: |
| 189 // Holds 2 arrays of some elements allowing to compare any pair of | 153 // Holds 2 arrays of some elements allowing to compare any pair of |
| 190 // element from the first array and element from the second array. | 154 // element from the first array and element from the second array. |
| 191 class Input { | 155 class Input { |
| 192 public: | 156 public: |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 static const int kSharedInfoOffset_ = 3; | 317 static const int kSharedInfoOffset_ = 3; |
| 354 static const int kSize_ = 4; | 318 static const int kSize_ = 4; |
| 355 | 319 |
| 356 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 320 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
| 357 }; | 321 }; |
| 358 | 322 |
| 359 } // namespace internal | 323 } // namespace internal |
| 360 } // namespace v8 | 324 } // namespace v8 |
| 361 | 325 |
| 362 #endif /* V8_DEBUG_LIVEEDIT_H_ */ | 326 #endif /* V8_DEBUG_LIVEEDIT_H_ */ |
| OLD | NEW |