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

Side by Side Diff: src/execution.cc

Issue 18581: Enable preemption in d8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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/execution.h ('k') | src/runtime.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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 return Factory::undefined_value(); 185 return Factory::undefined_value();
186 } 186 }
187 187
188 188
189 // Static state for stack guards. 189 // Static state for stack guards.
190 StackGuard::ThreadLocal StackGuard::thread_local_; 190 StackGuard::ThreadLocal StackGuard::thread_local_;
191 191
192 192
193 StackGuard::StackGuard() { 193 StackGuard::StackGuard() {
194 // NOTE: Overall the StackGuard code assumes that the stack grows towards
195 // lower addresses.
194 ExecutionAccess access; 196 ExecutionAccess access;
195 if (thread_local_.nesting_++ == 0 && 197 if (thread_local_.nesting_++ == 0) {
196 thread_local_.jslimit_ != kInterruptLimit) { 198 // Initial StackGuard is being set. We will set the stack limits based on
197 // NOTE: We assume that the stack grows towards lower addresses. 199 // the current stack pointer allowing the stack to grow kLimitSize from
198 ASSERT(thread_local_.jslimit_ == kIllegalLimit); 200 // here.
199 ASSERT(thread_local_.climit_ == kIllegalLimit); 201
202 // Ensure that either the stack limits are unset (kIllegalLimit) or that
203 // they indicate a pending interruption. The interrupt limit will be
204 // temporarily reset through the code below and reestablished if the
205 // interrupt flags indicate that an interrupt is pending.
206 ASSERT(thread_local_.jslimit_ == kIllegalLimit ||
207 (thread_local_.jslimit_ == kInterruptLimit &&
208 thread_local_.interrupt_flags_ != 0));
209 ASSERT(thread_local_.climit_ == kIllegalLimit ||
210 (thread_local_.climit_ == kInterruptLimit &&
211 thread_local_.interrupt_flags_ != 0));
200 212
201 thread_local_.initial_jslimit_ = thread_local_.jslimit_ = 213 thread_local_.initial_jslimit_ = thread_local_.jslimit_ =
202 GENERATED_CODE_STACK_LIMIT(kLimitSize); 214 GENERATED_CODE_STACK_LIMIT(kLimitSize);
203 // NOTE: The check for overflow is not safe as there is no guarantee that 215 // NOTE: The check for overflow is not safe as there is no guarantee that
204 // the running thread has its stack in all memory up to address 0x00000000. 216 // the running thread has its stack in all memory up to address 0x00000000.
205 thread_local_.initial_climit_ = thread_local_.climit_ = 217 thread_local_.initial_climit_ = thread_local_.climit_ =
206 reinterpret_cast<uintptr_t>(this) >= kLimitSize ? 218 reinterpret_cast<uintptr_t>(this) >= kLimitSize ?
207 reinterpret_cast<uintptr_t>(this) - kLimitSize : 0; 219 reinterpret_cast<uintptr_t>(this) - kLimitSize : 0;
208 220
209 if (thread_local_.interrupt_flags_ != 0) { 221 if (thread_local_.interrupt_flags_ != 0) {
210 set_limits(kInterruptLimit, access); 222 set_limits(kInterruptLimit, access);
211 } 223 }
212 } 224 }
213 // make sure we have proper limits setup 225 // Ensure that proper limits have been set.
214 ASSERT(thread_local_.jslimit_ != kIllegalLimit && 226 ASSERT(thread_local_.jslimit_ != kIllegalLimit &&
215 thread_local_.climit_ != kIllegalLimit); 227 thread_local_.climit_ != kIllegalLimit);
228 ASSERT(thread_local_.initial_jslimit_ != kIllegalLimit &&
229 thread_local_.initial_climit_ != kIllegalLimit);
216 } 230 }
217 231
218 232
219 StackGuard::~StackGuard() { 233 StackGuard::~StackGuard() {
220 ExecutionAccess access; 234 ExecutionAccess access;
221 if (--thread_local_.nesting_ == 0) { 235 if (--thread_local_.nesting_ == 0) {
222 set_limits(kIllegalLimit, access); 236 set_limits(kIllegalLimit, access);
223 } 237 }
224 } 238 }
225 239
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // All allocation spaces other than NEW_SPACE have the same effect. 595 // All allocation spaces other than NEW_SPACE have the same effect.
582 Heap::CollectGarbage(0, OLD_DATA_SPACE); 596 Heap::CollectGarbage(0, OLD_DATA_SPACE);
583 return v8::Undefined(); 597 return v8::Undefined();
584 } 598 }
585 599
586 600
587 static GCExtension kGCExtension; 601 static GCExtension kGCExtension;
588 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension); 602 v8::DeclareExtension kGCExtensionDeclaration(&kGCExtension);
589 603
590 } } // namespace v8::internal 604 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698