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

Side by Side Diff: src/frames.cc

Issue 43693002: Correctly setup exit frame when calling into allocation tracker (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added AllowStubCallsScope Created 7 years, 1 month 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
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('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 // 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const Address limit_; 72 const Address limit_;
73 StackHandler* handler_; 73 StackHandler* handler_;
74 }; 74 };
75 75
76 76
77 // ------------------------------------------------------------------------- 77 // -------------------------------------------------------------------------
78 78
79 79
80 #define INITIALIZE_SINGLETON(type, field) field##_(this), 80 #define INITIALIZE_SINGLETON(type, field) field##_(this),
81 StackFrameIteratorBase::StackFrameIteratorBase(Isolate* isolate, 81 StackFrameIteratorBase::StackFrameIteratorBase(Isolate* isolate,
82 bool can_access_heap_objects) 82 bool can_access_heap_objects,
83 bool allow_builtins_on_stack)
83 : isolate_(isolate), 84 : isolate_(isolate),
84 STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON) 85 STACK_FRAME_TYPE_LIST(INITIALIZE_SINGLETON)
85 frame_(NULL), handler_(NULL), 86 frame_(NULL), handler_(NULL),
86 can_access_heap_objects_(can_access_heap_objects) { 87 can_access_heap_objects_(can_access_heap_objects),
88 allow_builtins_on_stack_(allow_builtins_on_stack) {
87 } 89 }
88 #undef INITIALIZE_SINGLETON 90 #undef INITIALIZE_SINGLETON
89 91
90 92
91 StackFrameIterator::StackFrameIterator(Isolate* isolate) 93 StackFrameIterator::StackFrameIterator(Isolate* isolate,
92 : StackFrameIteratorBase(isolate, true) { 94 bool allow_builtins_on_stack)
95 : StackFrameIteratorBase(isolate, true, allow_builtins_on_stack) {
93 Reset(isolate->thread_local_top()); 96 Reset(isolate->thread_local_top());
94 } 97 }
95 98
96 99
97 StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t) 100 StackFrameIterator::StackFrameIterator(Isolate* isolate, ThreadLocalTop* t)
98 : StackFrameIteratorBase(isolate, true) { 101 : StackFrameIteratorBase(isolate, true, false) {
99 Reset(t); 102 Reset(t);
100 } 103 }
101 104
102 105
103 void StackFrameIterator::Advance() { 106 void StackFrameIterator::Advance() {
104 ASSERT(!done()); 107 ASSERT(!done());
105 // Compute the state of the calling frame before restoring 108 // Compute the state of the calling frame before restoring
106 // callee-saved registers and unwinding handlers. This allows the 109 // callee-saved registers and unwinding handlers. This allows the
107 // frame code that computes the caller state to access the top 110 // frame code that computes the caller state to access the top
108 // handler and the value of any callee-saved register if needed. 111 // handler and the value of any callee-saved register if needed.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 void JavaScriptFrameIterator::AdvanceToArgumentsFrame() { 185 void JavaScriptFrameIterator::AdvanceToArgumentsFrame() {
183 if (!frame()->has_adapted_arguments()) return; 186 if (!frame()->has_adapted_arguments()) return;
184 iterator_.Advance(); 187 iterator_.Advance();
185 ASSERT(iterator_.frame()->is_arguments_adaptor()); 188 ASSERT(iterator_.frame()->is_arguments_adaptor());
186 } 189 }
187 190
188 191
189 // ------------------------------------------------------------------------- 192 // -------------------------------------------------------------------------
190 193
191 194
192 StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate) 195 StackTraceFrameIterator::StackTraceFrameIterator(Isolate* isolate,
193 : JavaScriptFrameIterator(isolate) { 196 bool allow_builtins_on_stack)
197 : JavaScriptFrameIterator(isolate, allow_builtins_on_stack) {
194 if (!done() && !IsValidFrame()) Advance(); 198 if (!done() && !IsValidFrame()) Advance();
195 } 199 }
196 200
197 201
198 void StackTraceFrameIterator::Advance() { 202 void StackTraceFrameIterator::Advance() {
199 while (true) { 203 while (true) {
200 JavaScriptFrameIterator::Advance(); 204 JavaScriptFrameIterator::Advance();
201 if (done()) return; 205 if (done()) return;
202 if (IsValidFrame()) return; 206 if (IsValidFrame()) return;
203 } 207 }
204 } 208 }
205 209
206 210
207 bool StackTraceFrameIterator::IsValidFrame() { 211 bool StackTraceFrameIterator::IsValidFrame() {
208 if (!frame()->function()->IsJSFunction()) return false; 212 if (!frame()->function()->IsJSFunction()) return false;
209 Object* script = frame()->function()->shared()->script(); 213 Object* script = frame()->function()->shared()->script();
210 // Don't show functions from native scripts to user. 214 // Don't show functions from native scripts to user.
211 return (script->IsScript() && 215 return (script->IsScript() &&
212 Script::TYPE_NATIVE != Script::cast(script)->type()->value()); 216 Script::TYPE_NATIVE != Script::cast(script)->type()->value());
213 } 217 }
214 218
215 219
216 // ------------------------------------------------------------------------- 220 // -------------------------------------------------------------------------
217 221
218 222
219 SafeStackFrameIterator::SafeStackFrameIterator( 223 SafeStackFrameIterator::SafeStackFrameIterator(
220 Isolate* isolate, 224 Isolate* isolate,
221 Address fp, Address sp, Address js_entry_sp) 225 Address fp, Address sp, Address js_entry_sp)
222 : StackFrameIteratorBase(isolate, false), 226 : StackFrameIteratorBase(isolate, false, true),
223 low_bound_(sp), 227 low_bound_(sp),
224 high_bound_(js_entry_sp), 228 high_bound_(js_entry_sp),
225 top_frame_type_(StackFrame::NONE), 229 top_frame_type_(StackFrame::NONE),
226 external_callback_scope_(isolate->external_callback_scope()) { 230 external_callback_scope_(isolate->external_callback_scope()) {
227 StackFrame::State state; 231 StackFrame::State state;
228 StackFrame::Type type; 232 StackFrame::Type type;
229 ThreadLocalTop* top = isolate->thread_local_top(); 233 ThreadLocalTop* top = isolate->thread_local_top();
230 if (IsValidTop(top)) { 234 if (IsValidTop(top)) {
231 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state); 235 type = ExitFrame::GetStateForFramePointer(Isolate::c_entry_fp(top), &state);
232 top_frame_type_ = type; 236 top_frame_type_ = type;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 const int offset = StandardFrameConstants::kMarkerOffset; 451 const int offset = StandardFrameConstants::kMarkerOffset;
448 Object* marker = Memory::Object_at(state->fp + offset); 452 Object* marker = Memory::Object_at(state->fp + offset);
449 if (!marker->IsSmi()) { 453 if (!marker->IsSmi()) {
450 // If we're using a "safe" stack iterator, we treat optimized 454 // If we're using a "safe" stack iterator, we treat optimized
451 // frames as normal JavaScript frames to avoid having to look 455 // frames as normal JavaScript frames to avoid having to look
452 // into the heap to determine the state. This is safe as long 456 // into the heap to determine the state. This is safe as long
453 // as nobody tries to GC... 457 // as nobody tries to GC...
454 if (!iterator->can_access_heap_objects_) return JAVA_SCRIPT; 458 if (!iterator->can_access_heap_objects_) return JAVA_SCRIPT;
455 Code::Kind kind = GetContainingCode(iterator->isolate(), 459 Code::Kind kind = GetContainingCode(iterator->isolate(),
456 *(state->pc_address))->kind(); 460 *(state->pc_address))->kind();
457 ASSERT(kind == Code::FUNCTION || kind == Code::OPTIMIZED_FUNCTION); 461 ASSERT(kind == Code::FUNCTION || kind == Code::OPTIMIZED_FUNCTION ||
462 iterator->allow_builtins_on_stack_);
458 return (kind == Code::OPTIMIZED_FUNCTION) ? OPTIMIZED : JAVA_SCRIPT; 463 return (kind == Code::OPTIMIZED_FUNCTION) ? OPTIMIZED : JAVA_SCRIPT;
459 } 464 }
460 return static_cast<StackFrame::Type>(Smi::cast(marker)->value()); 465 return static_cast<StackFrame::Type>(Smi::cast(marker)->value());
461 } 466 }
462 467
463 468
464 #ifdef DEBUG 469 #ifdef DEBUG
465 bool StackFrame::can_access_heap_objects() const { 470 bool StackFrame::can_access_heap_objects() const {
466 return iterator_->can_access_heap_objects_; 471 return iterator_->can_access_heap_objects_;
467 } 472 }
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 ZoneList<StackFrame*> list(10, zone); 1632 ZoneList<StackFrame*> list(10, zone);
1628 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1633 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1629 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1634 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1630 list.Add(frame, zone); 1635 list.Add(frame, zone);
1631 } 1636 }
1632 return list.ToVector(); 1637 return list.ToVector();
1633 } 1638 }
1634 1639
1635 1640
1636 } } // namespace v8::internal 1641 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/frames-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698