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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5, | 115 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5, |
116 FUNCTION_BLOCKED_UNDER_GENERATOR = 6, | 116 FUNCTION_BLOCKED_UNDER_GENERATOR = 6, |
117 FUNCTION_BLOCKED_ACTIVE_GENERATOR = 7 | 117 FUNCTION_BLOCKED_ACTIVE_GENERATOR = 7 |
118 }; | 118 }; |
119 | 119 |
120 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 120 // 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 | 121 // of array of triplets (pos1, pos1_end, pos2_end) describing list |
122 // of diff chunks. | 122 // of diff chunks. |
123 static Handle<JSArray> CompareStrings(Handle<String> s1, | 123 static Handle<JSArray> CompareStrings(Handle<String> s1, |
124 Handle<String> s2); | 124 Handle<String> s2); |
| 125 |
| 126 // Architecture-specific constant. |
| 127 static const bool kFrameDropperSupported; |
| 128 |
| 129 /** |
| 130 * Defines layout of a stack frame that supports padding. This is a regular |
| 131 * internal frame that has a flexible stack structure. LiveEdit can shift |
| 132 * its lower part up the stack, taking up the 'padding' space when additional |
| 133 * stack memory is required. |
| 134 * Such frame is expected immediately above the topmost JavaScript frame. |
| 135 * |
| 136 * Stack Layout: |
| 137 * --- Top |
| 138 * LiveEdit routine frames |
| 139 * --- |
| 140 * C frames of debug handler |
| 141 * --- |
| 142 * ... |
| 143 * --- |
| 144 * An internal frame that has n padding words: |
| 145 * - any number of words as needed by code -- upper part of frame |
| 146 * - padding size: a Smi storing n -- current size of padding |
| 147 * - padding: n words filled with kPaddingValue in form of Smi |
| 148 * - 3 context/type words of a regular InternalFrame |
| 149 * - fp |
| 150 * --- |
| 151 * Topmost JavaScript frame |
| 152 * --- |
| 153 * ... |
| 154 * --- Bottom |
| 155 */ |
| 156 // A size of frame base including fp. Padding words starts right above |
| 157 // the base. |
| 158 static const int kFrameDropperFrameSize = 4; |
| 159 // A number of words that should be reserved on stack for the LiveEdit use. |
| 160 // Stored on stack in form of Smi. |
| 161 static const int kFramePaddingInitialSize = 1; |
| 162 // A value that padding words are filled with (in form of Smi). Going |
| 163 // bottom-top, the first word not having this value is a counter word. |
| 164 static const int kFramePaddingValue = kFramePaddingInitialSize + 1; |
| 165 |
| 166 |
| 167 // Describes how exactly a frame has been dropped from stack. |
| 168 enum FrameDropMode { |
| 169 // No frame has been dropped. |
| 170 FRAMES_UNTOUCHED, |
| 171 // The top JS frame had been calling IC stub. IC stub mustn't be called now. |
| 172 FRAME_DROPPED_IN_IC_CALL, |
| 173 // The top JS frame had been calling debug break slot stub. Patch the |
| 174 // address this stub jumps to in the end. |
| 175 FRAME_DROPPED_IN_DEBUG_SLOT_CALL, |
| 176 // The top JS frame had been calling some C++ function. The return address |
| 177 // gets patched automatically. |
| 178 FRAME_DROPPED_IN_DIRECT_CALL, |
| 179 FRAME_DROPPED_IN_RETURN_CALL, |
| 180 CURRENTLY_SET_MODE |
| 181 }; |
125 }; | 182 }; |
126 | 183 |
127 | 184 |
128 // A general-purpose comparator between 2 arrays. | 185 // A general-purpose comparator between 2 arrays. |
129 class Comparator { | 186 class Comparator { |
130 public: | 187 public: |
131 // Holds 2 arrays of some elements allowing to compare any pair of | 188 // Holds 2 arrays of some elements allowing to compare any pair of |
132 // element from the first array and element from the second array. | 189 // element from the first array and element from the second array. |
133 class Input { | 190 class Input { |
134 public: | 191 public: |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 static const int kEndPositionOffset_ = 2; | 368 static const int kEndPositionOffset_ = 2; |
312 static const int kSharedInfoOffset_ = 3; | 369 static const int kSharedInfoOffset_ = 3; |
313 static const int kSize_ = 4; | 370 static const int kSize_ = 4; |
314 | 371 |
315 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 372 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
316 }; | 373 }; |
317 | 374 |
318 } } // namespace v8::internal | 375 } } // namespace v8::internal |
319 | 376 |
320 #endif /* V*_LIVEEDIT_H_ */ | 377 #endif /* V*_LIVEEDIT_H_ */ |
OLD | NEW |