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

Side by Side Diff: src/frames.h

Issue 4070003: [Isolates] Convert more static data either to read-only or to per-isolate. (Closed)
Patch Set: Created 10 years, 2 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/debug-agent.cc ('k') | src/frames.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 25 matching lines...) Expand all
36 // Get the number of registers in a given register list. 36 // Get the number of registers in a given register list.
37 int NumRegs(RegList list); 37 int NumRegs(RegList list);
38 38
39 // Return the code of the n-th saved register available to JavaScript. 39 // Return the code of the n-th saved register available to JavaScript.
40 int JSCallerSavedCode(int n); 40 int JSCallerSavedCode(int n);
41 41
42 42
43 // Forward declarations. 43 // Forward declarations.
44 class StackFrameIterator; 44 class StackFrameIterator;
45 class ThreadLocalTop; 45 class ThreadLocalTop;
46 class Isolate;
46 47
47 48 class PcToCodeCache {
48 class PcToCodeCache : AllStatic {
49 public: 49 public:
50 struct PcToCodeCacheEntry { 50 struct PcToCodeCacheEntry {
51 Address pc; 51 Address pc;
52 Code* code; 52 Code* code;
53 }; 53 };
54 54
55 static PcToCodeCacheEntry* cache(int index) { 55 explicit PcToCodeCache(Isolate* isolate) : isolate_(isolate) {}
56 return &cache_[index];
57 }
58 56
59 static Code* GcSafeFindCodeForPc(Address pc); 57 Code* GcSafeFindCodeForPc(Address pc);
60 static Code* GcSafeCastToCode(HeapObject* object, Address pc); 58 Code* GcSafeCastToCode(HeapObject* object, Address pc);
61 59
62 static void FlushPcToCodeCache() { 60 void Flush() {
63 memset(&cache_[0], 0, sizeof(cache_)); 61 memset(&cache_[0], 0, sizeof(cache_));
64 } 62 }
65 63
66 static PcToCodeCacheEntry* GetCacheEntry(Address pc); 64 PcToCodeCacheEntry* GetCacheEntry(Address pc);
67 65
68 private: 66 private:
67 PcToCodeCacheEntry* cache(int index) { return &cache_[index]; }
68
69 Isolate* isolate_;
70
69 static const int kPcToCodeCacheSize = 1024; 71 static const int kPcToCodeCacheSize = 1024;
70 static PcToCodeCacheEntry cache_[kPcToCodeCacheSize]; 72 PcToCodeCacheEntry cache_[kPcToCodeCacheSize];
73
74 DISALLOW_COPY_AND_ASSIGN(PcToCodeCache);
71 }; 75 };
72 76
73 77
74 class StackHandler BASE_EMBEDDED { 78 class StackHandler BASE_EMBEDDED {
75 public: 79 public:
76 enum State { 80 enum State {
77 ENTRY, 81 ENTRY,
78 TRY_CATCH, 82 TRY_CATCH,
79 TRY_FINALLY 83 TRY_FINALLY
80 }; 84 };
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 bool HasHandler() const; 186 bool HasHandler() const;
183 187
184 // Get the type of this frame. 188 // Get the type of this frame.
185 virtual Type type() const = 0; 189 virtual Type type() const = 0;
186 190
187 // Get the code associated with this frame. 191 // Get the code associated with this frame.
188 // This method could be called during marking phase of GC. 192 // This method could be called during marking phase of GC.
189 virtual Code* unchecked_code() const = 0; 193 virtual Code* unchecked_code() const = 0;
190 194
191 // Get the code associated with this frame. 195 // Get the code associated with this frame.
192 Code* code() const { return GetContainingCode(pc()); } 196 Code* LookupCode(Isolate* isolate) const {
Dmitry Titov 2010/10/26 01:16:07 "Lookup" made me think there is some hash table or
197 return GetContainingCode(isolate, pc());
198 }
193 199
194 // Get the code object that contains the given pc. 200 // Get the code object that contains the given pc.
195 Code* GetContainingCode(Address pc) const { 201 static inline Code* GetContainingCode(Isolate* isolate, Address pc);
196 return PcToCodeCache::GetCacheEntry(pc)->code;
197 }
198 202
199 virtual void Iterate(ObjectVisitor* v) const = 0; 203 virtual void Iterate(ObjectVisitor* v) const = 0;
200 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder); 204 static void IteratePc(ObjectVisitor* v, Address* pc_address, Code* holder);
201 205
202 206
203 // Printing support. 207 // Printing support.
204 enum PrintMode { OVERVIEW, DETAILS }; 208 enum PrintMode { OVERVIEW, DETAILS };
205 virtual void Print(StringStream* accumulator, 209 virtual void Print(StringStream* accumulator,
206 PrintMode mode, 210 PrintMode mode,
207 int index) const { } 211 int index) const { }
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 }; 739 };
736 740
737 741
738 // Reads all frames on the current stack and copies them into the current 742 // Reads all frames on the current stack and copies them into the current
739 // zone memory. 743 // zone memory.
740 Vector<StackFrame*> CreateStackMap(); 744 Vector<StackFrame*> CreateStackMap();
741 745
742 } } // namespace v8::internal 746 } } // namespace v8::internal
743 747
744 #endif // V8_FRAMES_H_ 748 #endif // V8_FRAMES_H_
OLDNEW
« no previous file with comments | « src/debug-agent.cc ('k') | src/frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698