| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter.h" | 5 #include "src/interpreter/interpreter.h" |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 __ Dispatch(); | 1789 __ Dispatch(); |
| 1790 | 1790 |
| 1791 __ Bind(&stack_check_interrupt); | 1791 __ Bind(&stack_check_interrupt); |
| 1792 { | 1792 { |
| 1793 Node* context = __ GetContext(); | 1793 Node* context = __ GetContext(); |
| 1794 __ CallRuntime(Runtime::kStackGuard, context); | 1794 __ CallRuntime(Runtime::kStackGuard, context); |
| 1795 __ Dispatch(); | 1795 __ Dispatch(); |
| 1796 } | 1796 } |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 // OsrPoll <loop_depth> |
| 1800 // |
| 1801 // Performs a loop nesting check and potentially triggers OSR. |
| 1802 void Interpreter::DoOsrPoll(InterpreterAssembler* assembler) { |
| 1803 Node* loop_depth = __ BytecodeOperandImm(0); |
| 1804 Node* osr_level = __ LoadOSRNestingLevel(); |
| 1805 |
| 1806 // Check if OSR points at the given {loop_depth} are armed by comparing it to |
| 1807 // the current {osr_level} loaded from the header of the BytecodeArray. |
| 1808 Label ok(assembler), osr_armed(assembler, Label::kDeferred); |
| 1809 Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level); |
| 1810 __ Branch(condition, &ok, &osr_armed); |
| 1811 |
| 1812 __ Bind(&ok); |
| 1813 __ Dispatch(); |
| 1814 |
| 1815 __ Bind(&osr_armed); |
| 1816 { |
| 1817 Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_); |
| 1818 Node* target = __ HeapConstant(callable.code()); |
| 1819 Node* context = __ GetContext(); |
| 1820 __ CallStub(callable.descriptor(), target, context); |
| 1821 __ Dispatch(); |
| 1822 } |
| 1823 } |
| 1824 |
| 1799 // Throw | 1825 // Throw |
| 1800 // | 1826 // |
| 1801 // Throws the exception in the accumulator. | 1827 // Throws the exception in the accumulator. |
| 1802 void Interpreter::DoThrow(InterpreterAssembler* assembler) { | 1828 void Interpreter::DoThrow(InterpreterAssembler* assembler) { |
| 1803 Node* exception = __ GetAccumulator(); | 1829 Node* exception = __ GetAccumulator(); |
| 1804 Node* context = __ GetContext(); | 1830 Node* context = __ GetContext(); |
| 1805 __ CallRuntime(Runtime::kThrow, context, exception); | 1831 __ CallRuntime(Runtime::kThrow, context, exception); |
| 1806 // We shouldn't ever return from a throw. | 1832 // We shouldn't ever return from a throw. |
| 1807 __ Abort(kUnexpectedReturnFromThrow); | 1833 __ Abort(kUnexpectedReturnFromThrow); |
| 1808 } | 1834 } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2156 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
| 2131 __ SmiTag(new_state)); | 2157 __ SmiTag(new_state)); |
| 2132 __ SetAccumulator(old_state); | 2158 __ SetAccumulator(old_state); |
| 2133 | 2159 |
| 2134 __ Dispatch(); | 2160 __ Dispatch(); |
| 2135 } | 2161 } |
| 2136 | 2162 |
| 2137 } // namespace interpreter | 2163 } // namespace interpreter |
| 2138 } // namespace internal | 2164 } // namespace internal |
| 2139 } // namespace v8 | 2165 } // namespace v8 |
| OLD | NEW |