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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 uintptr_t stored_limit = per_thread->stack_limit(); | 513 uintptr_t stored_limit = per_thread->stack_limit(); |
514 // You should hold the ExecutionAccess lock when you call this. | 514 // You should hold the ExecutionAccess lock when you call this. |
515 if (stored_limit != 0) { | 515 if (stored_limit != 0) { |
516 SetStackLimit(stored_limit); | 516 SetStackLimit(stored_limit); |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 | 520 |
521 // --- C a l l s t o n a t i v e s --- | 521 // --- C a l l s t o n a t i v e s --- |
522 | 522 |
523 #define RETURN_NATIVE_CALL(name, args) \ | 523 #define RETURN_NATIVE_CALL(name, args) \ |
524 do { \ | 524 do { \ |
525 Handle<Object> argv[] = args; \ | 525 Handle<Object> argv[] = args; \ |
526 return Call(isolate, \ | 526 return Call(isolate, isolate->name##_fun(), \ |
527 isolate->name##_fun(), \ | 527 isolate->factory()->undefined_value(), arraysize(argv), argv); \ |
528 isolate->js_builtins_object(), \ | |
529 arraysize(argv), argv); \ | |
530 } while (false) | 528 } while (false) |
531 | 529 |
532 | 530 |
533 MaybeHandle<Object> Execution::ToNumber( | 531 MaybeHandle<Object> Execution::ToNumber( |
534 Isolate* isolate, Handle<Object> obj) { | 532 Isolate* isolate, Handle<Object> obj) { |
535 RETURN_NATIVE_CALL(to_number, { obj }); | 533 RETURN_NATIVE_CALL(to_number, { obj }); |
536 } | 534 } |
537 | 535 |
538 | 536 |
539 MaybeHandle<Object> Execution::ToString( | 537 MaybeHandle<Object> Execution::ToString( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
608 | 606 |
609 | 607 |
610 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, | 608 Handle<String> Execution::GetStackTraceLine(Handle<Object> recv, |
611 Handle<JSFunction> fun, | 609 Handle<JSFunction> fun, |
612 Handle<Object> pos, | 610 Handle<Object> pos, |
613 Handle<Object> is_global) { | 611 Handle<Object> is_global) { |
614 Isolate* isolate = fun->GetIsolate(); | 612 Isolate* isolate = fun->GetIsolate(); |
615 Handle<Object> args[] = { recv, fun, pos, is_global }; | 613 Handle<Object> args[] = { recv, fun, pos, is_global }; |
616 MaybeHandle<Object> maybe_result = | 614 MaybeHandle<Object> maybe_result = |
617 TryCall(isolate->get_stack_trace_line_fun(), | 615 TryCall(isolate->get_stack_trace_line_fun(), |
618 isolate->js_builtins_object(), | 616 isolate->factory()->undefined_value(), arraysize(args), args); |
619 arraysize(args), | |
620 args); | |
621 Handle<Object> result; | 617 Handle<Object> result; |
622 if (!maybe_result.ToHandle(&result) || !result->IsString()) { | 618 if (!maybe_result.ToHandle(&result) || !result->IsString()) { |
623 return isolate->factory()->empty_string(); | 619 return isolate->factory()->empty_string(); |
624 } | 620 } |
625 | 621 |
626 return Handle<String>::cast(result); | 622 return Handle<String>::cast(result); |
627 } | 623 } |
628 | 624 |
629 | 625 |
630 void StackGuard::CheckAndHandleGCInterrupt() { | 626 void StackGuard::CheckAndHandleGCInterrupt() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 659 |
664 isolate_->counters()->stack_interrupts()->Increment(); | 660 isolate_->counters()->stack_interrupts()->Increment(); |
665 isolate_->counters()->runtime_profiler_ticks()->Increment(); | 661 isolate_->counters()->runtime_profiler_ticks()->Increment(); |
666 isolate_->runtime_profiler()->OptimizeNow(); | 662 isolate_->runtime_profiler()->OptimizeNow(); |
667 | 663 |
668 return isolate_->heap()->undefined_value(); | 664 return isolate_->heap()->undefined_value(); |
669 } | 665 } |
670 | 666 |
671 } // namespace internal | 667 } // namespace internal |
672 } // namespace v8 | 668 } // namespace v8 |
OLD | NEW |