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

Side by Side Diff: src/top.cc

Issue 18581: Enable preemption in d8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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/runtime.cc ('k') | src/v8threads.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 19 matching lines...) Expand all
30 #include "api.h" 30 #include "api.h"
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_; 40 Mutex* Top::break_access_ = OS::CreateMutex();
41 StackFrame::Id Top::break_frame_id_; 41 StackFrame::Id Top::break_frame_id_;
42 int Top::break_count_; 42 int Top::break_count_;
43 int Top::break_id_; 43 int Top::break_id_;
44 44
45 NoAllocationStringAllocator* preallocated_message_space = NULL; 45 NoAllocationStringAllocator* preallocated_message_space = NULL;
46 46
47 Address top_addresses[] = { 47 Address top_addresses[] = {
48 #define C(name) reinterpret_cast<Address>(Top::name()), 48 #define C(name) reinterpret_cast<Address>(Top::name()),
49 TOP_ADDRESS_LIST(C) 49 TOP_ADDRESS_LIST(C)
50 #undef C 50 #undef C
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 char* PreallocatedMemoryThread::data_ = NULL; 218 char* PreallocatedMemoryThread::data_ = NULL;
219 unsigned PreallocatedMemoryThread::length_ = 0; 219 unsigned PreallocatedMemoryThread::length_ = 0;
220 220
221 static bool initialized = false; 221 static bool initialized = false;
222 222
223 void Top::Initialize() { 223 void Top::Initialize() {
224 CHECK(!initialized); 224 CHECK(!initialized);
225 225
226 InitializeThreadLocal(); 226 InitializeThreadLocal();
227 227
228 break_access_ = OS::CreateMutex();
229 break_frame_id_ = StackFrame::NO_ID; 228 break_frame_id_ = StackFrame::NO_ID;
230 break_count_ = 0; 229 break_count_ = 0;
231 break_id_ = 0; 230 break_id_ = 0;
232 231
233 // Only preallocate on the first initialization. 232 // Only preallocate on the first initialization.
234 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) { 233 if (FLAG_preallocate_message_memory && (preallocated_message_space == NULL)) {
235 // Start the thread which will set aside some memory. 234 // Start the thread which will set aside some memory.
236 PreallocatedMemoryThread::StartThread(); 235 PreallocatedMemoryThread::StartThread();
237 preallocated_message_space = 236 preallocated_message_space =
238 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(), 237 new NoAllocationStringAllocator(PreallocatedMemoryThread::data(),
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 Top::break_access_->Lock(); 956 Top::break_access_->Lock();
958 } 957 }
959 958
960 959
961 ExecutionAccess::~ExecutionAccess() { 960 ExecutionAccess::~ExecutionAccess() {
962 Top::break_access_->Unlock(); 961 Top::break_access_->Unlock();
963 } 962 }
964 963
965 964
966 } } // namespace v8::internal 965 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | src/v8threads.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698