OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/execution.h" | 5 #include "src/execution.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 } | 334 } |
335 | 335 |
336 // If the Object doesn't have an instance-call handler we should | 336 // If the Object doesn't have an instance-call handler we should |
337 // throw a non-callable exception. | 337 // throw a non-callable exception. |
338 THROW_NEW_ERROR(isolate, | 338 THROW_NEW_ERROR(isolate, |
339 NewTypeError(MessageTemplate::kCalledNonCallable, object), | 339 NewTypeError(MessageTemplate::kCalledNonCallable, object), |
340 Object); | 340 Object); |
341 } | 341 } |
342 | 342 |
343 | 343 |
344 void StackGuard::EnableInterrupts() { | |
345 ExecutionAccess access(isolate_); | |
346 if (has_pending_interrupts(access)) { | |
347 set_interrupt_limits(access); | |
348 } | |
349 } | |
350 | |
351 | |
352 void StackGuard::SetStackLimit(uintptr_t limit) { | 344 void StackGuard::SetStackLimit(uintptr_t limit) { |
353 ExecutionAccess access(isolate_); | 345 ExecutionAccess access(isolate_); |
354 // If the current limits are special (e.g. due to a pending interrupt) then | 346 // If the current limits are special (e.g. due to a pending interrupt) then |
355 // leave them alone. | 347 // leave them alone. |
356 uintptr_t jslimit = SimulatorStack::JsLimitFromCLimit(isolate_, limit); | 348 uintptr_t jslimit = SimulatorStack::JsLimitFromCLimit(isolate_, limit); |
357 if (thread_local_.jslimit() == thread_local_.real_jslimit_) { | 349 if (thread_local_.jslimit() == thread_local_.real_jslimit_) { |
358 thread_local_.set_jslimit(jslimit); | 350 thread_local_.set_jslimit(jslimit); |
359 } | 351 } |
360 if (thread_local_.climit() == thread_local_.real_climit_) { | 352 if (thread_local_.climit() == thread_local_.real_climit_) { |
361 thread_local_.set_climit(limit); | 353 thread_local_.set_climit(limit); |
362 } | 354 } |
363 thread_local_.real_climit_ = limit; | 355 thread_local_.real_climit_ = limit; |
364 thread_local_.real_jslimit_ = jslimit; | 356 thread_local_.real_jslimit_ = jslimit; |
365 } | 357 } |
366 | 358 |
367 | 359 |
| 360 void StackGuard::AdjustStackLimitForSimulator() { |
| 361 ExecutionAccess access(isolate_); |
| 362 uintptr_t climit = thread_local_.real_climit_; |
| 363 // If the current limits are special (e.g. due to a pending interrupt) then |
| 364 // leave them alone. |
| 365 uintptr_t jslimit = SimulatorStack::JsLimitFromCLimit(isolate_, climit); |
| 366 if (thread_local_.jslimit() == thread_local_.real_jslimit_) { |
| 367 thread_local_.set_jslimit(jslimit); |
| 368 isolate_->heap()->SetStackLimits(); |
| 369 } |
| 370 } |
| 371 |
| 372 |
| 373 void StackGuard::EnableInterrupts() { |
| 374 ExecutionAccess access(isolate_); |
| 375 if (has_pending_interrupts(access)) { |
| 376 set_interrupt_limits(access); |
| 377 } |
| 378 } |
| 379 |
| 380 |
368 void StackGuard::DisableInterrupts() { | 381 void StackGuard::DisableInterrupts() { |
369 ExecutionAccess access(isolate_); | 382 ExecutionAccess access(isolate_); |
370 reset_limits(access); | 383 reset_limits(access); |
371 } | 384 } |
372 | 385 |
373 | 386 |
374 void StackGuard::PushPostponeInterruptsScope(PostponeInterruptsScope* scope) { | 387 void StackGuard::PushPostponeInterruptsScope(PostponeInterruptsScope* scope) { |
375 ExecutionAccess access(isolate_); | 388 ExecutionAccess access(isolate_); |
376 // Intercept already requested interrupts. | 389 // Intercept already requested interrupts. |
377 int intercepted = thread_local_.interrupt_flags_ & scope->intercept_mask_; | 390 int intercepted = thread_local_.interrupt_flags_ & scope->intercept_mask_; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 | 675 |
663 isolate_->counters()->stack_interrupts()->Increment(); | 676 isolate_->counters()->stack_interrupts()->Increment(); |
664 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 677 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
665 isolate_->runtime_profiler()->OptimizeNow(); | 678 isolate_->runtime_profiler()->OptimizeNow(); |
666 | 679 |
667 return isolate_->heap()->undefined_value(); | 680 return isolate_->heap()->undefined_value(); |
668 } | 681 } |
669 | 682 |
670 } // namespace internal | 683 } // namespace internal |
671 } // namespace v8 | 684 } // namespace v8 |
OLD | NEW |