OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 | 445 |
446 char* StackGuard::RestoreStackGuard(char* from) { | 446 char* StackGuard::RestoreStackGuard(char* from) { |
447 ExecutionAccess access(isolate_); | 447 ExecutionAccess access(isolate_); |
448 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); | 448 memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal)); |
449 isolate_->heap()->SetStackLimits(); | 449 isolate_->heap()->SetStackLimits(); |
450 return from + sizeof(ThreadLocal); | 450 return from + sizeof(ThreadLocal); |
451 } | 451 } |
452 | 452 |
453 | 453 |
454 void StackGuard::FreeThreadResources() { | 454 void StackGuard::FreeThreadResources() { |
455 Isolate::CurrentPerIsolateThreadData()->set_stack_limit( | 455 Isolate::PerIsolateThreadData* per_thread = |
456 thread_local_.real_climit_); | 456 isolate_->FindOrAllocatePerThreadDataForThisThread(); |
| 457 per_thread->set_stack_limit(thread_local_.real_climit_); |
457 } | 458 } |
458 | 459 |
459 | 460 |
460 void StackGuard::ThreadLocal::Clear() { | 461 void StackGuard::ThreadLocal::Clear() { |
461 real_jslimit_ = kIllegalLimit; | 462 real_jslimit_ = kIllegalLimit; |
462 jslimit_ = kIllegalLimit; | 463 jslimit_ = kIllegalLimit; |
463 real_climit_ = kIllegalLimit; | 464 real_climit_ = kIllegalLimit; |
464 climit_ = kIllegalLimit; | 465 climit_ = kIllegalLimit; |
465 nesting_ = 0; | 466 nesting_ = 0; |
466 postpone_interrupts_nesting_ = 0; | 467 postpone_interrupts_nesting_ = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
495 } | 496 } |
496 | 497 |
497 | 498 |
498 void StackGuard::InitThread(const ExecutionAccess& lock) { | 499 void StackGuard::InitThread(const ExecutionAccess& lock) { |
499 if (thread_local_.Initialize(isolate_)) isolate_->heap()->SetStackLimits(); | 500 if (thread_local_.Initialize(isolate_)) isolate_->heap()->SetStackLimits(); |
500 Isolate::PerIsolateThreadData* per_thread = | 501 Isolate::PerIsolateThreadData* per_thread = |
501 isolate_->FindOrAllocatePerThreadDataForThisThread(); | 502 isolate_->FindOrAllocatePerThreadDataForThisThread(); |
502 uintptr_t stored_limit = per_thread->stack_limit(); | 503 uintptr_t stored_limit = per_thread->stack_limit(); |
503 // You should hold the ExecutionAccess lock when you call this. | 504 // You should hold the ExecutionAccess lock when you call this. |
504 if (stored_limit != 0) { | 505 if (stored_limit != 0) { |
505 StackGuard::SetStackLimit(stored_limit); | 506 SetStackLimit(stored_limit); |
506 } | 507 } |
507 } | 508 } |
508 | 509 |
509 | 510 |
510 // --- C a l l s t o n a t i v e s --- | 511 // --- C a l l s t o n a t i v e s --- |
511 | 512 |
512 #define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \ | 513 #define RETURN_NATIVE_CALL(name, argc, argv, has_pending_exception) \ |
513 do { \ | 514 do { \ |
514 Isolate* isolate = Isolate::Current(); \ | 515 Isolate* isolate = Isolate::Current(); \ |
515 Object** args[argc] = argv; \ | 516 Object** args[argc] = argv; \ |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 return isolate->TerminateExecution(); | 824 return isolate->TerminateExecution(); |
824 } | 825 } |
825 if (stack_guard->IsInterrupted()) { | 826 if (stack_guard->IsInterrupted()) { |
826 stack_guard->Continue(INTERRUPT); | 827 stack_guard->Continue(INTERRUPT); |
827 return isolate->StackOverflow(); | 828 return isolate->StackOverflow(); |
828 } | 829 } |
829 return isolate->heap()->undefined_value(); | 830 return isolate->heap()->undefined_value(); |
830 } | 831 } |
831 | 832 |
832 } } // namespace v8::internal | 833 } } // namespace v8::internal |
OLD | NEW |