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 20 matching lines...) Expand all Loading... |
31 namespace v8 { | 31 namespace v8 { |
32 namespace internal { | 32 namespace internal { |
33 | 33 |
34 // This class collects some specific information on structure of functions | 34 // This class collects some specific information on structure of functions |
35 // in a particular script. | 35 // in a particular script. |
36 // | 36 // |
37 // 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 |
38 // 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 |
39 // code successfully reading existing data from function scopes). The Tracker | 39 // code successfully reading existing data from function scopes). The Tracker |
40 // also collects compiled function codes. | 40 // also collects compiled function codes. |
41 class LiveEditFunctionTracker : public AstTraversalVisitor { | 41 class LiveEditFunctionTracker |
| 42 : public AstTraversalVisitor<LiveEditFunctionTracker> { |
42 public: | 43 public: |
43 // Traverses the entire AST, and records information about all | 44 // Traverses the entire AST, and records information about all |
44 // FunctionLiterals for further use by LiveEdit code patching. The collected | 45 // FunctionLiterals for further use by LiveEdit code patching. The collected |
45 // information is returned as a serialized array. | 46 // information is returned as a serialized array. |
46 static Handle<JSArray> Collect(FunctionLiteral* node, Handle<Script> script, | 47 static Handle<JSArray> Collect(FunctionLiteral* node, Handle<Script> script, |
47 Zone* zone, Isolate* isolate); | 48 Zone* zone, Isolate* isolate); |
48 | 49 |
49 virtual ~LiveEditFunctionTracker() {} | 50 protected: |
50 void VisitFunctionLiteral(FunctionLiteral* node) override; | 51 void VisitFunctionLiteral(FunctionLiteral* node); |
51 | 52 |
52 private: | 53 private: |
53 LiveEditFunctionTracker(Handle<Script> script, Zone* zone, Isolate* isolate); | 54 LiveEditFunctionTracker(Handle<Script> script, Zone* zone, Isolate* isolate); |
54 | 55 |
55 void FunctionStarted(FunctionLiteral* fun); | 56 void FunctionStarted(FunctionLiteral* fun); |
56 void FunctionDone(Handle<SharedFunctionInfo> shared, Scope* scope); | 57 void FunctionDone(Handle<SharedFunctionInfo> shared, Scope* scope); |
57 Handle<Object> SerializeFunctionScope(Scope* scope); | 58 Handle<Object> SerializeFunctionScope(Scope* scope); |
58 | 59 |
59 Handle<Script> script_; | 60 Handle<Script> script_; |
60 Zone* zone_; | 61 Zone* zone_; |
61 Isolate* isolate_; | 62 Isolate* isolate_; |
62 | 63 |
63 Handle<JSArray> result_; | 64 Handle<JSArray> result_; |
64 int len_; | 65 int len_; |
65 int current_parent_index_; | 66 int current_parent_index_; |
66 | 67 |
| 68 DEFINE_AST_VISITOR_DISPATCH() |
67 DISALLOW_COPY_AND_ASSIGN(LiveEditFunctionTracker); | 69 DISALLOW_COPY_AND_ASSIGN(LiveEditFunctionTracker); |
68 }; | 70 }; |
69 | 71 |
70 | 72 |
71 class LiveEdit : AllStatic { | 73 class LiveEdit : AllStatic { |
72 public: | 74 public: |
73 // Describes how exactly a frame has been dropped from stack. | 75 // Describes how exactly a frame has been dropped from stack. |
74 enum FrameDropMode { | 76 enum FrameDropMode { |
75 // No frame has been dropped. | 77 // No frame has been dropped. |
76 FRAMES_UNTOUCHED, | 78 FRAMES_UNTOUCHED, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 static const int kSharedInfoOffset_ = 3; | 372 static const int kSharedInfoOffset_ = 3; |
371 static const int kSize_ = 4; | 373 static const int kSize_ = 4; |
372 | 374 |
373 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 375 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
374 }; | 376 }; |
375 | 377 |
376 } // namespace internal | 378 } // namespace internal |
377 } // namespace v8 | 379 } // namespace v8 |
378 | 380 |
379 #endif /* V8_DEBUG_LIVEEDIT_H_ */ | 381 #endif /* V8_DEBUG_LIVEEDIT_H_ */ |
OLD | NEW |