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. |
11 // User should be able to change script on already running VM. This feature | 11 // User should be able to change script on already running VM. This feature |
12 // matches hot swap features in other frameworks. | 12 // matches hot swap features in other frameworks. |
13 // | 13 // |
14 // The basic use-case is when user spots some mistake in function body | 14 // The basic use-case is when user spots some mistake in function body |
15 // from debugger and wishes to change the algorithm without restart. | 15 // from debugger and wishes to change the algorithm without restart. |
16 // | 16 // |
17 // A single change always has a form of a simple replacement (in pseudo-code): | 17 // A single change always has a form of a simple replacement (in pseudo-code): |
18 // script.source[positions, positions+length] = new_string; | 18 // script.source[positions, positions+length] = new_string; |
19 // Implementation first determines, which function's body includes this | 19 // Implementation first determines, which function's body includes this |
20 // change area. Then both old and new versions of script are fully compiled | 20 // change area. Then both old and new versions of script are fully compiled |
21 // in order to analyze, whether the function changed its outer scope | 21 // in order to analyze, whether the function changed its outer scope |
22 // expectations (or number of parameters). If it didn't, function's code is | 22 // expectations (or number of parameters). If it didn't, function's code is |
23 // patched with a newly compiled code. If it did change, enclosing function | 23 // patched with a newly compiled code. If it did change, enclosing function |
24 // gets patched. All inner functions are left untouched, whatever happened | 24 // gets patched. All inner functions are left untouched, whatever happened |
25 // to them in a new script version. However, new version of code will | 25 // to them in a new script version. However, new version of code will |
26 // instantiate newly compiled functions. | 26 // instantiate newly compiled functions. |
27 | 27 |
28 | 28 |
29 #include "allocation.h" | 29 #include "src/allocation.h" |
30 #include "compiler.h" | 30 #include "src/compiler.h" |
31 | 31 |
32 namespace v8 { | 32 namespace v8 { |
33 namespace internal { | 33 namespace internal { |
34 | 34 |
35 // This class collects some specific information on structure of functions | 35 // This class collects some specific information on structure of functions |
36 // in a particular script. It gets called from compiler all the time, but | 36 // in a particular script. It gets called from compiler all the time, but |
37 // actually records any data only when liveedit operation is in process; | 37 // actually records any data only when liveedit operation is in process; |
38 // in any other time this class is very cheap. | 38 // in any other time this class is very cheap. |
39 // | 39 // |
40 // The primary interest of the Tracker is to record function scope structures | 40 // The primary interest of the Tracker is to record function scope structures |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 static const int kEndPositionOffset_ = 2; | 369 static const int kEndPositionOffset_ = 2; |
370 static const int kSharedInfoOffset_ = 3; | 370 static const int kSharedInfoOffset_ = 3; |
371 static const int kSize_ = 4; | 371 static const int kSize_ = 4; |
372 | 372 |
373 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 373 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
374 }; | 374 }; |
375 | 375 |
376 } } // namespace v8::internal | 376 } } // namespace v8::internal |
377 | 377 |
378 #endif /* V*_LIVEEDIT_H_ */ | 378 #endif /* V*_LIVEEDIT_H_ */ |
OLD | NEW |