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

Side by Side Diff: vm/stack_frame.cc

Issue 10223015: Add a stub_code_space in the heap alongside code_space so that stub code generation happens here an… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/stack_frame.h" 5 #include "vm/stack_frame.h"
6 6
7 #include "vm/isolate.h" 7 #include "vm/isolate.h"
8 #include "vm/object.h" 8 #include "vm/object.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
11 #include "vm/raw_object.h" 11 #include "vm/raw_object.h"
12 #include "vm/stub_code.h" 12 #include "vm/stub_code.h"
13 #include "vm/visitor.h" 13 #include "vm/visitor.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 bool StackFrame::FindRawCodeVisitor::FindObject(RawObject* obj) { 17 bool StackFrame::FindRawCodeVisitor::FindObject(RawObject* obj) {
18 return RawInstructions::ContainsPC(obj, pc_); 18 return RawInstructions::ContainsPC(obj, pc_);
19 } 19 }
20 20
21 21
22 bool StackFrame::IsStubFrame() const { 22 bool StackFrame::IsStubFrame() const {
23 if (Dart::vm_isolate()->heap()->CodeContains(pc())) { 23 if (Dart::vm_isolate()->heap()->StubCodeContains(pc())) {
24 return true; // Common stub code is generated in the VM heap. 24 return true; // Common stub code is generated in the VM heap.
25 } 25 }
26 // We add a no gc scope to ensure that the code below does not trigger 26 if (Isolate::Current()->heap()->StubCodeContains(pc())) {
27 // a GC as we are handling raw object references here. It is possible 27 return true; // Common stub code is generated in the VM heap.
28 // that the code is called while a GC is in progress, that is ok. 28 }
29 NoGCScope no_gc; 29 return false;
30 Isolate* isolate = Isolate::Current();
31 RawCode* code = StackFrame::LookupCode(isolate, pc());
32 return ((code != Code::null()) &&
33 (code->ptr()->function_ == Function::null()));
34 } 30 }
35 31
36 32
37 void StackFrame::Print() const { 33 void StackFrame::Print() const {
38 OS::Print("[%-8s : sp(%p) ]\n", GetName(), sp()); 34 OS::Print("[%-8s : sp(%p) ]\n", GetName(), sp());
39 } 35 }
40 36
41 37
42 RawCode* StackFrame::LookupCode(Isolate* isolate, uword pc) { 38 RawCode* StackFrame::LookupCode(Isolate* isolate, uword pc) {
43 // TODO(asiva): Need to add a data structure for storing a (pc, code 39 // TODO(asiva): Need to add a data structure for storing a (pc, code
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 *handler_pc = handlers.HandlerPC(j); 158 *handler_pc = handlers.HandlerPC(j);
163 return true; 159 return true;
164 } 160 }
165 } 161 }
166 } 162 }
167 return false; 163 return false;
168 } 164 }
169 165
170 166
171 bool StackFrame::IsValid() const { 167 bool StackFrame::IsValid() const {
172 if (IsEntryFrame() || IsExitFrame()) { 168 if (IsEntryFrame() || IsExitFrame() || IsStubFrame()) {
173 return true; 169 return true;
174 } 170 }
175 if (Dart::vm_isolate()->heap()->CodeContains(pc())) {
176 return true; // Common stub code is generated in the VM heap.
177 }
178 return (StackFrame::LookupCode(Isolate::Current(), pc()) != Code::null()); 171 return (StackFrame::LookupCode(Isolate::Current(), pc()) != Code::null());
179 } 172 }
180 173
181 174
182 StackFrameIterator::StackFrameIterator(bool validate) 175 StackFrameIterator::StackFrameIterator(bool validate)
183 : validate_(validate), entry_(), exit_(), current_frame_(NULL) { 176 : validate_(validate), entry_(), exit_(), current_frame_(NULL) {
184 SetupLastExitFrameData(); // Setup data for last exit frame. 177 SetupLastExitFrameData(); // Setup data for last exit frame.
185 } 178 }
186 179
187 180
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 EntryFrame* StackFrameIterator::NextEntryFrame() { 245 EntryFrame* StackFrameIterator::NextEntryFrame() {
253 ASSERT(!frames_.HasNext()); 246 ASSERT(!frames_.HasNext());
254 entry_.sp_ = frames_.sp_; 247 entry_.sp_ = frames_.sp_;
255 entry_.fp_ = frames_.fp_; 248 entry_.fp_ = frames_.fp_;
256 SetupNextExitFrameData(); // Setup data for next exit frame in chain. 249 SetupNextExitFrameData(); // Setup data for next exit frame in chain.
257 ASSERT(entry_.IsValid()); 250 ASSERT(entry_.IsValid());
258 return &entry_; 251 return &entry_;
259 } 252 }
260 253
261 } // namespace dart 254 } // namespace dart
OLDNEW
« vm/heap.cc ('K') | « vm/stack_frame.h ('k') | vm/stub_code.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698