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

Side by Side Diff: src/top.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 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
« no previous file with comments | « src/top.h ('k') | src/v8.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 20 matching lines...) Expand all
31 #include "bootstrapper.h" 31 #include "bootstrapper.h"
32 #include "debug.h" 32 #include "debug.h"
33 #include "execution.h" 33 #include "execution.h"
34 #include "string-stream.h" 34 #include "string-stream.h"
35 #include "platform.h" 35 #include "platform.h"
36 36
37 namespace v8 { namespace internal { 37 namespace v8 { namespace internal {
38 38
39 ThreadLocalTop Top::thread_local_; 39 ThreadLocalTop Top::thread_local_;
40 Mutex* Top::break_access_ = OS::CreateMutex(); 40 Mutex* Top::break_access_ = OS::CreateMutex();
41 StackFrame::Id Top::break_frame_id_;
42 int Top::break_count_;
43 int Top::break_id_;
44 41
45 NoAllocationStringAllocator* preallocated_message_space = NULL; 42 NoAllocationStringAllocator* preallocated_message_space = NULL;
46 43
47 Address top_addresses[] = { 44 Address top_addresses[] = {
48 #define C(name) reinterpret_cast<Address>(Top::name()), 45 #define C(name) reinterpret_cast<Address>(Top::name()),
49 TOP_ADDRESS_LIST(C) 46 TOP_ADDRESS_LIST(C)
50 #undef C 47 #undef C
51 NULL 48 NULL
52 }; 49 };
53 50
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 char* PreallocatedMemoryThread::data_ = NULL; 212 char* PreallocatedMemoryThread::data_ = NULL;
216 unsigned PreallocatedMemoryThread::length_ = 0; 213 unsigned PreallocatedMemoryThread::length_ = 0;
217 214
218 static bool initialized = false; 215 static bool initialized = false;
219 216
220 void Top::Initialize() { 217 void Top::Initialize() {
221 CHECK(!initialized); 218 CHECK(!initialized);
222 219
223 InitializeThreadLocal(); 220 InitializeThreadLocal();
224 221
225 break_frame_id_ = StackFrame::NO_ID;
226 break_count_ = 0;
227 break_id_ = 0;
228
229 // Only preallocate on the first initialization. 222 // Only preallocate on the first initialization.
230 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) { 223 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) {
231 // Start the thread which will set aside some memory. 224 // Start the thread which will set aside some memory.
232 PreallocatedMemoryThread::StartThread(); 225 PreallocatedMemoryThread::StartThread();
233 preallocated_message_space = 226 preallocated_message_space =
234 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(), 227 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(),
235 PreallocatedMemoryThread::length()); 228 PreallocatedMemoryThread::length());
236 PreallocatedStorage::Init(PreallocatedMemoryThread::length() / 4); 229 PreallocatedStorage::Init(PreallocatedMemoryThread::length() / 4);
237 } 230 }
238 initialized = true; 231 initialized = true;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 thread_local_.try_catch_handler_ = that; 281 thread_local_.try_catch_handler_ = that;
289 } 282 }
290 283
291 284
292 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) { 285 void Top::UnregisterTryCatchHandler(v8::TryCatch* that) {
293 ASSERT(thread_local_.try_catch_handler_ == that); 286 ASSERT(thread_local_.try_catch_handler_ == that);
294 thread_local_.try_catch_handler_ = that->next_; 287 thread_local_.try_catch_handler_ = that->next_;
295 } 288 }
296 289
297 290
298 void Top::new_break(StackFrame::Id break_frame_id) {
299 ExecutionAccess access;
300 break_frame_id_ = break_frame_id;
301 break_id_ = ++break_count_;
302 }
303
304
305 void Top::set_break(StackFrame::Id break_frame_id, int break_id) {
306 ExecutionAccess access;
307 break_frame_id_ = break_frame_id;
308 break_id_ = break_id;
309 }
310
311
312 bool Top::check_break(int break_id) {
313 ExecutionAccess access;
314 return break_id == break_id_;
315 }
316
317
318 bool Top::is_break() {
319 ExecutionAccess access;
320 return break_id_ != 0;
321 }
322
323
324 StackFrame::Id Top::break_frame_id() {
325 ExecutionAccess access;
326 return break_frame_id_;
327 }
328
329
330 int Top::break_id() {
331 ExecutionAccess access;
332 return break_id_;
333 }
334
335
336 void Top::MarkCompactPrologue(bool is_compacting) { 291 void Top::MarkCompactPrologue(bool is_compacting) {
337 MarkCompactPrologue(is_compacting, &thread_local_); 292 MarkCompactPrologue(is_compacting, &thread_local_);
338 } 293 }
339 294
340 295
341 void Top::MarkCompactPrologue(bool is_compacting, char* data) { 296 void Top::MarkCompactPrologue(bool is_compacting, char* data) {
342 MarkCompactPrologue(is_compacting, reinterpret_cast<ThreadLocalTop*>(data)); 297 MarkCompactPrologue(is_compacting, reinterpret_cast<ThreadLocalTop*>(data));
343 } 298 }
344 299
345 300
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 616
662 617
663 Object* Top::PromoteScheduledException() { 618 Object* Top::PromoteScheduledException() {
664 Object* thrown = scheduled_exception(); 619 Object* thrown = scheduled_exception();
665 clear_scheduled_exception(); 620 clear_scheduled_exception();
666 // Re-throw the exception to avoid getting repeated error reporting. 621 // Re-throw the exception to avoid getting repeated error reporting.
667 return ReThrow(thrown); 622 return ReThrow(thrown);
668 } 623 }
669 624
670 625
671 // NOTE: The stack trace frame iterator is an iterator that only
672 // traverse proper JavaScript frames; that is JavaScript frames that
673 // have proper JavaScript functions. This excludes the problematic
674 // functions in runtime.js.
675 class StackTraceFrameIterator: public JavaScriptFrameIterator {
676 public:
677 StackTraceFrameIterator() {
678 if (!done() && !frame()->function()->IsJSFunction()) Advance();
679 }
680
681 void Advance() {
682 while (true) {
683 JavaScriptFrameIterator::Advance();
684 if (done()) return;
685 if (frame()->function()->IsJSFunction()) return;
686 }
687 }
688 };
689
690
691 void Top::PrintCurrentStackTrace(FILE* out) { 626 void Top::PrintCurrentStackTrace(FILE* out) {
692 StackTraceFrameIterator it; 627 StackTraceFrameIterator it;
693 while (!it.done()) { 628 while (!it.done()) {
694 HandleScope scope; 629 HandleScope scope;
695 // Find code position if recorded in relocation info. 630 // Find code position if recorded in relocation info.
696 JavaScriptFrame* frame = it.frame(); 631 JavaScriptFrame* frame = it.frame();
697 int pos = frame->code()->SourcePosition(frame->pc()); 632 int pos = frame->code()->SourcePosition(frame->pc());
698 Handle<Object> pos_obj(Smi::FromInt(pos)); 633 Handle<Object> pos_obj(Smi::FromInt(pos));
699 // Fetch function and receiver. 634 // Fetch function and receiver.
700 Handle<JSFunction> fun(JSFunction::cast(frame->function())); 635 Handle<JSFunction> fun(JSFunction::cast(frame->function()));
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 Top::break_access_->Lock(); 892 Top::break_access_->Lock();
958 } 893 }
959 894
960 895
961 ExecutionAccess::~ExecutionAccess() { 896 ExecutionAccess::~ExecutionAccess() {
962 Top::break_access_->Unlock(); 897 Top::break_access_->Unlock();
963 } 898 }
964 899
965 900
966 } } // namespace v8::internal 901 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/top.h ('k') | src/v8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698