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 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1786 __ Dispatch(); | 1786 __ Dispatch(); |
1787 | 1787 |
1788 __ Bind(&stack_check_interrupt); | 1788 __ Bind(&stack_check_interrupt); |
1789 { | 1789 { |
1790 Node* context = __ GetContext(); | 1790 Node* context = __ GetContext(); |
1791 __ CallRuntime(Runtime::kStackGuard, context); | 1791 __ CallRuntime(Runtime::kStackGuard, context); |
1792 __ Dispatch(); | 1792 __ Dispatch(); |
1793 } | 1793 } |
1794 } | 1794 } |
1795 | 1795 |
1796 // OsrPoll <loop_depth> | |
1797 // | |
1798 // Performs a loop nesting check and potentially triggers OSR. | |
1799 void Interpreter::DoOsrPoll(InterpreterAssembler* assembler) { | |
1800 Node* loop_depth = __ BytecodeOperandFlag(0); | |
1801 Node* osr_level = __ LoadOSRNestingLevel(); | |
1802 | |
1803 // Check if OSR points at the given {loop_depth} are armed by comparing it to | |
1804 // the current {osr_level} loaded from the header of the BytecodeArray. | |
1805 Label ok(assembler), osr_armed(assembler, Label::kDeferred); | |
1806 Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level); | |
rmcilroy
2016/07/25 12:40:24
It looks like OSR nesting level initialized to 0 i
Michael Starzinger
2016/07/25 13:40:48
The {OsrPoll} handler will fall-through (i.e. the
rmcilroy
2016/07/26 09:26:44
You are right, sorry I got the labels on the branc
| |
1807 __ Branch(condition, &ok, &osr_armed); | |
1808 | |
1809 __ Bind(&ok); | |
1810 __ Dispatch(); | |
1811 | |
1812 __ Bind(&osr_armed); | |
1813 { | |
1814 Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_); | |
1815 Node* target = __ HeapConstant(callable.code()); | |
1816 Node* context = __ GetContext(); | |
1817 // TODO(4764): We don't have a CallStub method with zero arguments, add one! | |
rmcilroy
2016/07/25 12:40:24
Could you do that with this CL please?
Michael Starzinger
2016/07/25 13:40:48
Done.
| |
1818 __ CallStub(callable.descriptor(), target, context, context); | |
1819 __ Dispatch(); | |
1820 } | |
1821 } | |
1822 | |
1796 // Throw | 1823 // Throw |
1797 // | 1824 // |
1798 // Throws the exception in the accumulator. | 1825 // Throws the exception in the accumulator. |
1799 void Interpreter::DoThrow(InterpreterAssembler* assembler) { | 1826 void Interpreter::DoThrow(InterpreterAssembler* assembler) { |
1800 Node* exception = __ GetAccumulator(); | 1827 Node* exception = __ GetAccumulator(); |
1801 Node* context = __ GetContext(); | 1828 Node* context = __ GetContext(); |
1802 __ CallRuntime(Runtime::kThrow, context, exception); | 1829 __ CallRuntime(Runtime::kThrow, context, exception); |
1803 // We shouldn't ever return from a throw. | 1830 // We shouldn't ever return from a throw. |
1804 __ Abort(kUnexpectedReturnFromThrow); | 1831 __ Abort(kUnexpectedReturnFromThrow); |
1805 } | 1832 } |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2127 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, | 2154 __ StoreObjectField(generator, JSGeneratorObject::kContinuationOffset, |
2128 __ SmiTag(new_state)); | 2155 __ SmiTag(new_state)); |
2129 __ SetAccumulator(old_state); | 2156 __ SetAccumulator(old_state); |
2130 | 2157 |
2131 __ Dispatch(); | 2158 __ Dispatch(); |
2132 } | 2159 } |
2133 | 2160 |
2134 } // namespace interpreter | 2161 } // namespace interpreter |
2135 } // namespace internal | 2162 } // namespace internal |
2136 } // namespace v8 | 2163 } // namespace v8 |
OLD | NEW |