| OLD | NEW |
| 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 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "api.h" | 7 #include "api.h" |
| 8 #include "arguments.h" | 8 #include "arguments.h" |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 Debug::Debug(Isolate* isolate) | 33 Debug::Debug(Isolate* isolate) |
| 34 : has_break_points_(false), | 34 : has_break_points_(false), |
| 35 script_cache_(NULL), | 35 script_cache_(NULL), |
| 36 debug_info_list_(NULL), | 36 debug_info_list_(NULL), |
| 37 disable_break_(false), | 37 disable_break_(false), |
| 38 break_on_exception_(false), | 38 break_on_exception_(false), |
| 39 break_on_uncaught_exception_(false), | 39 break_on_uncaught_exception_(false), |
| 40 promise_catch_handlers_(0), | 40 promise_catch_handlers_(0), |
| 41 promise_getters_(0), | 41 promise_getters_(0), |
| 42 isolate_(isolate) { | 42 isolate_(isolate) { |
| 43 memset(registers_, 0, sizeof(JSCallerSavedBuffer)); | |
| 44 ThreadInit(); | 43 ThreadInit(); |
| 45 } | 44 } |
| 46 | 45 |
| 47 | 46 |
| 48 static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) { | 47 static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) { |
| 49 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); | 48 Handle<Context> context = isolate->debug()->debugger_entry()->GetContext(); |
| 50 // Isolate::context() may have been NULL when "script collected" event | 49 // Isolate::context() may have been NULL when "script collected" event |
| 51 // occured. | 50 // occured. |
| 52 if (context.is_null()) return v8::Local<v8::Context>(); | 51 if (context.is_null()) return v8::Local<v8::Context>(); |
| 53 Handle<Context> native_context(context->native_context()); | 52 Handle<Context> native_context(context->native_context()); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // TODO(isolates): frames_are_dropped_? | 510 // TODO(isolates): frames_are_dropped_? |
| 512 thread_local_.debugger_entry_ = NULL; | 511 thread_local_.debugger_entry_ = NULL; |
| 513 thread_local_.has_pending_interrupt_ = false; | 512 thread_local_.has_pending_interrupt_ = false; |
| 514 thread_local_.restarter_frame_function_pointer_ = NULL; | 513 thread_local_.restarter_frame_function_pointer_ = NULL; |
| 515 } | 514 } |
| 516 | 515 |
| 517 | 516 |
| 518 char* Debug::ArchiveDebug(char* storage) { | 517 char* Debug::ArchiveDebug(char* storage) { |
| 519 char* to = storage; | 518 char* to = storage; |
| 520 OS::MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); | 519 OS::MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); |
| 521 to += sizeof(ThreadLocal); | |
| 522 OS::MemCopy(to, reinterpret_cast<char*>(®isters_), sizeof(registers_)); | |
| 523 ThreadInit(); | 520 ThreadInit(); |
| 524 ASSERT(to <= storage + ArchiveSpacePerThread()); | |
| 525 return storage + ArchiveSpacePerThread(); | 521 return storage + ArchiveSpacePerThread(); |
| 526 } | 522 } |
| 527 | 523 |
| 528 | 524 |
| 529 char* Debug::RestoreDebug(char* storage) { | 525 char* Debug::RestoreDebug(char* storage) { |
| 530 char* from = storage; | 526 char* from = storage; |
| 531 OS::MemCopy( | 527 OS::MemCopy( |
| 532 reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); | 528 reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); |
| 533 from += sizeof(ThreadLocal); | |
| 534 OS::MemCopy(reinterpret_cast<char*>(®isters_), from, sizeof(registers_)); | |
| 535 ASSERT(from <= storage + ArchiveSpacePerThread()); | |
| 536 return storage + ArchiveSpacePerThread(); | 529 return storage + ArchiveSpacePerThread(); |
| 537 } | 530 } |
| 538 | 531 |
| 539 | 532 |
| 540 int Debug::ArchiveSpacePerThread() { | 533 int Debug::ArchiveSpacePerThread() { |
| 541 return sizeof(ThreadLocal) + sizeof(JSCallerSavedBuffer); | 534 return sizeof(ThreadLocal); |
| 542 } | 535 } |
| 543 | 536 |
| 544 | 537 |
| 545 // Frame structure (conforms InternalFrame structure): | 538 // Frame structure (conforms InternalFrame structure): |
| 546 // -- code | 539 // -- code |
| 547 // -- SMI maker | 540 // -- SMI maker |
| 548 // -- function (slot is called "context") | 541 // -- function (slot is called "context") |
| 549 // -- frame base | 542 // -- frame base |
| 550 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 543 Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
| 551 Handle<Code> code) { | 544 Handle<Code> code) { |
| (...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3551 logger_->DebugEvent("Put", message.text()); | 3544 logger_->DebugEvent("Put", message.text()); |
| 3552 } | 3545 } |
| 3553 | 3546 |
| 3554 | 3547 |
| 3555 void LockingCommandMessageQueue::Clear() { | 3548 void LockingCommandMessageQueue::Clear() { |
| 3556 LockGuard<Mutex> lock_guard(&mutex_); | 3549 LockGuard<Mutex> lock_guard(&mutex_); |
| 3557 queue_.Clear(); | 3550 queue_.Clear(); |
| 3558 } | 3551 } |
| 3559 | 3552 |
| 3560 } } // namespace v8::internal | 3553 } } // namespace v8::internal |
| OLD | NEW |