| 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/compiler-dispatcher/optimizing-compile-dispatcher.h" | 9 #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" |
| 10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 | 57 |
| 58 MUST_USE_RESULT MaybeHandle<Object> Invoke( | 58 MUST_USE_RESULT MaybeHandle<Object> Invoke( |
| 59 Isolate* isolate, bool is_construct, Handle<Object> target, | 59 Isolate* isolate, bool is_construct, Handle<Object> target, |
| 60 Handle<Object> receiver, int argc, Handle<Object> args[], | 60 Handle<Object> receiver, int argc, Handle<Object> args[], |
| 61 Handle<Object> new_target, Execution::MessageHandling message_handling) { | 61 Handle<Object> new_target, Execution::MessageHandling message_handling) { |
| 62 DCHECK(!receiver->IsJSGlobalObject()); | 62 DCHECK(!receiver->IsJSGlobalObject()); |
| 63 #if DEBUG |
| 64 // Assume that any JS call can allocate. |
| 65 if (FLAG_zap_cpp_pointers) ZapHeapPointersInCppFrames(isolate); |
| 66 #endif |
| 63 | 67 |
| 64 #ifdef USE_SIMULATOR | 68 #ifdef USE_SIMULATOR |
| 65 // Simulators use separate stacks for C++ and JS. JS stack overflow checks | 69 // Simulators use separate stacks for C++ and JS. JS stack overflow checks |
| 66 // are performed whenever a JS function is called. However, it can be the case | 70 // are performed whenever a JS function is called. However, it can be the case |
| 67 // that the C++ stack grows faster than the JS stack, resulting in an overflow | 71 // that the C++ stack grows faster than the JS stack, resulting in an overflow |
| 68 // there. Add a check here to make that less likely. | 72 // there. Add a check here to make that less likely. |
| 69 StackLimitCheck check(isolate); | 73 StackLimitCheck check(isolate); |
| 70 if (check.HasOverflowed()) { | 74 if (check.HasOverflowed()) { |
| 71 isolate->StackOverflow(); | 75 isolate->StackOverflow(); |
| 72 if (message_handling == Execution::MessageHandling::kReport) { | 76 if (message_handling == Execution::MessageHandling::kReport) { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 set_climit(kIllegalLimit); | 415 set_climit(kIllegalLimit); |
| 412 postpone_interrupts_ = NULL; | 416 postpone_interrupts_ = NULL; |
| 413 interrupt_flags_ = 0; | 417 interrupt_flags_ = 0; |
| 414 } | 418 } |
| 415 | 419 |
| 416 | 420 |
| 417 bool StackGuard::ThreadLocal::Initialize(Isolate* isolate) { | 421 bool StackGuard::ThreadLocal::Initialize(Isolate* isolate) { |
| 418 bool should_set_stack_limits = false; | 422 bool should_set_stack_limits = false; |
| 419 if (real_climit_ == kIllegalLimit) { | 423 if (real_climit_ == kIllegalLimit) { |
| 420 const uintptr_t kLimitSize = FLAG_stack_size * KB; | 424 const uintptr_t kLimitSize = FLAG_stack_size * KB; |
| 421 DCHECK(GetCurrentStackPosition() > kLimitSize); | 425 uintptr_t current_stack_position = GetCurrentStackPosition(); |
| 422 uintptr_t limit = GetCurrentStackPosition() - kLimitSize; | 426 #if DEBUG |
| 427 DCHECK(current_stack_position > kLimitSize); |
| 428 stack_base_position_ = current_stack_position; |
| 429 #endif |
| 430 uintptr_t limit = current_stack_position - kLimitSize; |
| 423 real_jslimit_ = SimulatorStack::JsLimitFromCLimit(isolate, limit); | 431 real_jslimit_ = SimulatorStack::JsLimitFromCLimit(isolate, limit); |
| 424 set_jslimit(SimulatorStack::JsLimitFromCLimit(isolate, limit)); | 432 set_jslimit(SimulatorStack::JsLimitFromCLimit(isolate, limit)); |
| 425 real_climit_ = limit; | 433 real_climit_ = limit; |
| 426 set_climit(limit); | 434 set_climit(limit); |
| 427 should_set_stack_limits = true; | 435 should_set_stack_limits = true; |
| 428 } | 436 } |
| 429 postpone_interrupts_ = NULL; | 437 postpone_interrupts_ = NULL; |
| 430 interrupt_flags_ = 0; | 438 interrupt_flags_ = 0; |
| 431 return should_set_stack_limits; | 439 return should_set_stack_limits; |
| 432 } | 440 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 | 502 |
| 495 isolate_->counters()->stack_interrupts()->Increment(); | 503 isolate_->counters()->stack_interrupts()->Increment(); |
| 496 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 504 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
| 497 isolate_->runtime_profiler()->MarkCandidatesForOptimization(); | 505 isolate_->runtime_profiler()->MarkCandidatesForOptimization(); |
| 498 | 506 |
| 499 return isolate_->heap()->undefined_value(); | 507 return isolate_->heap()->undefined_value(); |
| 500 } | 508 } |
| 501 | 509 |
| 502 } // namespace internal | 510 } // namespace internal |
| 503 } // namespace v8 | 511 } // namespace v8 |
| OLD | NEW |