| 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 "src/ast/prettyprinter.h" | 7 #include "src/ast/prettyprinter.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/compiler/interpreter-assembler.h" | 10 #include "src/compiler/interpreter-assembler.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl | 84 << AstPrinter(info->isolate()).PrintProgram(info->literal()) << std::endl |
| 85 << std::flush; | 85 << std::flush; |
| 86 } | 86 } |
| 87 #endif // DEBUG | 87 #endif // DEBUG |
| 88 | 88 |
| 89 BytecodeGenerator generator(info->isolate(), info->zone()); | 89 BytecodeGenerator generator(info->isolate(), info->zone()); |
| 90 info->EnsureFeedbackVector(); | 90 info->EnsureFeedbackVector(); |
| 91 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info); | 91 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info); |
| 92 if (FLAG_print_bytecode) { | 92 if (FLAG_print_bytecode) { |
| 93 OFStream os(stdout); | 93 OFStream os(stdout); |
| 94 os << "Function: " << info->GetDebugName().get() << std::endl; | |
| 95 bytecodes->Print(os); | 94 bytecodes->Print(os); |
| 96 os << std::flush; | 95 os << std::flush; |
| 97 } | 96 } |
| 98 | 97 |
| 99 info->SetBytecodeArray(bytecodes); | 98 info->SetBytecodeArray(bytecodes); |
| 100 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline()); | 99 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline()); |
| 101 return true; | 100 return true; |
| 102 } | 101 } |
| 103 | 102 |
| 104 | 103 |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 compiler::InterpreterAssembler* assembler) { | 1780 compiler::InterpreterAssembler* assembler) { |
| 1782 Node* closure = __ LoadRegister(Register::function_closure()); | 1781 Node* closure = __ LoadRegister(Register::function_closure()); |
| 1783 Node* constant_pool_index = __ BytecodeOperandIdx(0); | 1782 Node* constant_pool_index = __ BytecodeOperandIdx(0); |
| 1784 Node* rest_index = __ LoadConstantPoolEntry(constant_pool_index); | 1783 Node* rest_index = __ LoadConstantPoolEntry(constant_pool_index); |
| 1785 Node* result = | 1784 Node* result = |
| 1786 __ CallRuntime(Runtime::kNewRestArguments_Generic, closure, rest_index); | 1785 __ CallRuntime(Runtime::kNewRestArguments_Generic, closure, rest_index); |
| 1787 __ SetAccumulator(result); | 1786 __ SetAccumulator(result); |
| 1788 __ Dispatch(); | 1787 __ Dispatch(); |
| 1789 } | 1788 } |
| 1790 | 1789 |
| 1790 // StackCheck |
| 1791 // |
| 1792 // Performs a stack guard check. |
| 1793 void Interpreter::DoStackCheck(compiler::InterpreterAssembler* assembler) { |
| 1794 __ StackCheck(); |
| 1795 __ Dispatch(); |
| 1796 } |
| 1797 |
| 1791 // Throw | 1798 // Throw |
| 1792 // | 1799 // |
| 1793 // Throws the exception in the accumulator. | 1800 // Throws the exception in the accumulator. |
| 1794 void Interpreter::DoThrow(compiler::InterpreterAssembler* assembler) { | 1801 void Interpreter::DoThrow(compiler::InterpreterAssembler* assembler) { |
| 1795 Node* exception = __ GetAccumulator(); | 1802 Node* exception = __ GetAccumulator(); |
| 1796 __ CallRuntime(Runtime::kThrow, exception); | 1803 __ CallRuntime(Runtime::kThrow, exception); |
| 1797 // We shouldn't ever return from a throw. | 1804 // We shouldn't ever return from a throw. |
| 1798 __ Abort(kUnexpectedReturnFromThrow); | 1805 __ Abort(kUnexpectedReturnFromThrow); |
| 1799 } | 1806 } |
| 1800 | 1807 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1903 Node* index_reg = __ BytecodeOperandReg(0); | 1910 Node* index_reg = __ BytecodeOperandReg(0); |
| 1904 Node* index = __ LoadRegister(index_reg); | 1911 Node* index = __ LoadRegister(index_reg); |
| 1905 Node* result = __ CallRuntime(Runtime::kForInStep, index); | 1912 Node* result = __ CallRuntime(Runtime::kForInStep, index); |
| 1906 __ SetAccumulator(result); | 1913 __ SetAccumulator(result); |
| 1907 __ Dispatch(); | 1914 __ Dispatch(); |
| 1908 } | 1915 } |
| 1909 | 1916 |
| 1910 } // namespace interpreter | 1917 } // namespace interpreter |
| 1911 } // namespace internal | 1918 } // namespace internal |
| 1912 } // namespace v8 | 1919 } // namespace v8 |
| OLD | NEW |