| 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_LIVEEDIT_H_ | 5 #ifndef V8_LIVEEDIT_H_ |
| 6 #define V8_LIVEEDIT_H_ | 6 #define V8_LIVEEDIT_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 // Live Edit feature implementation. | 10 // Live Edit feature implementation. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 static bool IsActive(Isolate* isolate); | 52 static bool IsActive(Isolate* isolate); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 Isolate* isolate_; | 55 Isolate* isolate_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 | 58 |
| 59 class LiveEdit : AllStatic { | 59 class LiveEdit : AllStatic { |
| 60 public: | 60 public: |
| 61 // Describes how exactly a frame has been dropped from stack. |
| 62 enum FrameDropMode { |
| 63 // No frame has been dropped. |
| 64 FRAMES_UNTOUCHED, |
| 65 // The top JS frame had been calling IC stub. IC stub mustn't be called now. |
| 66 FRAME_DROPPED_IN_IC_CALL, |
| 67 // The top JS frame had been calling debug break slot stub. Patch the |
| 68 // address this stub jumps to in the end. |
| 69 FRAME_DROPPED_IN_DEBUG_SLOT_CALL, |
| 70 // The top JS frame had been calling some C++ function. The return address |
| 71 // gets patched automatically. |
| 72 FRAME_DROPPED_IN_DIRECT_CALL, |
| 73 FRAME_DROPPED_IN_RETURN_CALL, |
| 74 CURRENTLY_SET_MODE |
| 75 }; |
| 76 |
| 77 static Address AfterBreakTarget(FrameDropMode mode, Isolate* isolate); |
| 78 |
| 61 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( | 79 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( |
| 62 Handle<Script> script, | 80 Handle<Script> script, |
| 63 Handle<String> source); | 81 Handle<String> source); |
| 64 | 82 |
| 65 static void WrapSharedFunctionInfos(Handle<JSArray> array); | 83 static void WrapSharedFunctionInfos(Handle<JSArray> array); |
| 66 | 84 |
| 67 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, | 85 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, |
| 68 Handle<JSArray> shared_info_array); | 86 Handle<JSArray> shared_info_array); |
| 69 | 87 |
| 70 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array); | 88 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5, | 133 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5, |
| 116 FUNCTION_BLOCKED_UNDER_GENERATOR = 6, | 134 FUNCTION_BLOCKED_UNDER_GENERATOR = 6, |
| 117 FUNCTION_BLOCKED_ACTIVE_GENERATOR = 7 | 135 FUNCTION_BLOCKED_ACTIVE_GENERATOR = 7 |
| 118 }; | 136 }; |
| 119 | 137 |
| 120 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 138 // Compares 2 strings line-by-line, then token-wise and returns diff in form |
| 121 // of array of triplets (pos1, pos1_end, pos2_end) describing list | 139 // of array of triplets (pos1, pos1_end, pos2_end) describing list |
| 122 // of diff chunks. | 140 // of diff chunks. |
| 123 static Handle<JSArray> CompareStrings(Handle<String> s1, | 141 static Handle<JSArray> CompareStrings(Handle<String> s1, |
| 124 Handle<String> s2); | 142 Handle<String> s2); |
| 143 |
| 144 // Architecture-specific constant. |
| 145 static const bool kFrameDropperSupported; |
| 146 |
| 147 /** |
| 148 * Defines layout of a stack frame that supports padding. This is a regular |
| 149 * internal frame that has a flexible stack structure. LiveEdit can shift |
| 150 * its lower part up the stack, taking up the 'padding' space when additional |
| 151 * stack memory is required. |
| 152 * Such frame is expected immediately above the topmost JavaScript frame. |
| 153 * |
| 154 * Stack Layout: |
| 155 * --- Top |
| 156 * LiveEdit routine frames |
| 157 * --- |
| 158 * C frames of debug handler |
| 159 * --- |
| 160 * ... |
| 161 * --- |
| 162 * An internal frame that has n padding words: |
| 163 * - any number of words as needed by code -- upper part of frame |
| 164 * - padding size: a Smi storing n -- current size of padding |
| 165 * - padding: n words filled with kPaddingValue in form of Smi |
| 166 * - 3 context/type words of a regular InternalFrame |
| 167 * - fp |
| 168 * --- |
| 169 * Topmost JavaScript frame |
| 170 * --- |
| 171 * ... |
| 172 * --- Bottom |
| 173 */ |
| 174 // A size of frame base including fp. Padding words starts right above |
| 175 // the base. |
| 176 static const int kFrameDropperFrameSize = 4; |
| 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; |
| 125 }; | 183 }; |
| 126 | 184 |
| 127 | 185 |
| 128 // A general-purpose comparator between 2 arrays. | 186 // A general-purpose comparator between 2 arrays. |
| 129 class Comparator { | 187 class Comparator { |
| 130 public: | 188 public: |
| 131 // Holds 2 arrays of some elements allowing to compare any pair of | 189 // Holds 2 arrays of some elements allowing to compare any pair of |
| 132 // element from the first array and element from the second array. | 190 // element from the first array and element from the second array. |
| 133 class Input { | 191 class Input { |
| 134 public: | 192 public: |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 static const int kEndPositionOffset_ = 2; | 369 static const int kEndPositionOffset_ = 2; |
| 312 static const int kSharedInfoOffset_ = 3; | 370 static const int kSharedInfoOffset_ = 3; |
| 313 static const int kSize_ = 4; | 371 static const int kSize_ = 4; |
| 314 | 372 |
| 315 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 373 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
| 316 }; | 374 }; |
| 317 | 375 |
| 318 } } // namespace v8::internal | 376 } } // namespace v8::internal |
| 319 | 377 |
| 320 #endif /* V*_LIVEEDIT_H_ */ | 378 #endif /* V*_LIVEEDIT_H_ */ |
| OLD | NEW |