Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: src/debug/liveedit.h

Issue 1971683002: [debugger] Refactor LiveEdit function info collection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Keep infos as MaybeHandle Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler.cc ('k') | src/debug/liveedit.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
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/compiler.h" 29 #include "src/compiler.h"
30 30
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. It gets called from compiler all the time, but 35 // in a particular script.
36 // actually records any data only when liveedit operation is in process;
37 // in any other time this class is very cheap.
38 // 36 //
39 // 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
40 // in order to analyze whether function code maybe safely patched (with new 38 // in order to analyze whether function code may be safely patched (with new
41 // code successfully reading existing data from function scopes). The Tracker 39 // code successfully reading existing data from function scopes). The Tracker
42 // also collects compiled function codes. 40 // also collects compiled function codes.
43 class LiveEditFunctionTracker { 41 class LiveEditFunctionTracker : public AstTraversalVisitor {
44 public: 42 public:
45 explicit LiveEditFunctionTracker(Isolate* isolate, FunctionLiteral* fun); 43 // Traverses the entire AST, and records information about all
46 ~LiveEditFunctionTracker(); 44 // FunctionLiterals for further use by LiveEdit code patching. The collected
47 void RecordFunctionInfo(Handle<SharedFunctionInfo> info, 45 // information is returned as a serialized array.
48 FunctionLiteral* lit, Zone* zone); 46 static Handle<JSArray> Collect(FunctionLiteral* node, Handle<Script> script,
47 Zone* zone, Isolate* isolate);
49 48
50 static bool IsActive(Isolate* isolate); 49 virtual ~LiveEditFunctionTracker() {}
50 void VisitFunctionLiteral(FunctionLiteral* node) override;
51 51
52 private: 52 private:
53 LiveEditFunctionTracker(Handle<Script> script, Zone* zone, Isolate* isolate);
54
55 void FunctionStarted(FunctionLiteral* fun);
56 void FunctionDone(Handle<SharedFunctionInfo> shared, Scope* scope);
57 Handle<Object> SerializeFunctionScope(Scope* scope);
58
59 Handle<Script> script_;
60 Zone* zone_;
53 Isolate* isolate_; 61 Isolate* isolate_;
62
63 Handle<JSArray> result_;
64 int len_;
65 int current_parent_index_;
66
67 DISALLOW_COPY_AND_ASSIGN(LiveEditFunctionTracker);
54 }; 68 };
55 69
56 70
57 class LiveEdit : AllStatic { 71 class LiveEdit : AllStatic {
58 public: 72 public:
59 // Describes how exactly a frame has been dropped from stack. 73 // Describes how exactly a frame has been dropped from stack.
60 enum FrameDropMode { 74 enum FrameDropMode {
61 // No frame has been dropped. 75 // No frame has been dropped.
62 FRAMES_UNTOUCHED, 76 FRAMES_UNTOUCHED,
63 // The top JS frame had been calling debug break slot stub. Patch the 77 // The top JS frame had been calling debug break slot stub. Patch the
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 static const int kSharedInfoOffset_ = 3; 370 static const int kSharedInfoOffset_ = 3;
357 static const int kSize_ = 4; 371 static const int kSize_ = 4;
358 372
359 friend class JSArrayBasedStruct<SharedInfoWrapper>; 373 friend class JSArrayBasedStruct<SharedInfoWrapper>;
360 }; 374 };
361 375
362 } // namespace internal 376 } // namespace internal
363 } // namespace v8 377 } // namespace v8
364 378
365 #endif /* V8_DEBUG_LIVEEDIT_H_ */ 379 #endif /* V8_DEBUG_LIVEEDIT_H_ */
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/debug/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698