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