Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/interpreter/interpreter.cc

Issue 1703453002: [interpreter, debugger] support debug breaks via bytecode array copy (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/factory.h" 10 #include "src/factory.h"
(...skipping 19 matching lines...) Expand all
30 if (IsDispatchTableInitialized()) return; 30 if (IsDispatchTableInitialized()) return;
31 Zone zone; 31 Zone zone;
32 HandleScope scope(isolate_); 32 HandleScope scope(isolate_);
33 33
34 #define GENERATE_CODE(Name, ...) \ 34 #define GENERATE_CODE(Name, ...) \
35 { \ 35 { \
36 InterpreterAssembler assembler(isolate_, &zone, Bytecode::k##Name); \ 36 InterpreterAssembler assembler(isolate_, &zone, Bytecode::k##Name); \
37 Do##Name(&assembler); \ 37 Do##Name(&assembler); \
38 Handle<Code> code = assembler.GenerateCode(); \ 38 Handle<Code> code = assembler.GenerateCode(); \
39 TraceCodegen(code, #Name); \ 39 TraceCodegen(code, #Name); \
40 int index = static_cast<int>(Bytecode::k##Name); \ 40 dispatch_table_[Bytecodes::ToByte(Bytecode::k##Name)] = *code; \
41 dispatch_table_[index] = *code; \
42 } 41 }
43 BYTECODE_LIST(GENERATE_CODE) 42 BYTECODE_LIST(GENERATE_CODE)
44 #undef GENERATE_CODE 43 #undef GENERATE_CODE
45 } 44 }
46 45
46 Code* Interpreter::GetBytecodeHandler(Bytecode bytecode) {
47 DCHECK(IsDispatchTableInitialized());
48 return dispatch_table_[Bytecodes::ToByte(bytecode)];
49 }
50
47 void Interpreter::IterateDispatchTable(ObjectVisitor* v) { 51 void Interpreter::IterateDispatchTable(ObjectVisitor* v) {
48 v->VisitPointers(&dispatch_table_[0], 52 v->VisitPointers(
49 &dispatch_table_[0] + kDispatchTableSize); 53 reinterpret_cast<Object**>(&dispatch_table_[0]),
54 reinterpret_cast<Object**>(&dispatch_table_[0] + kDispatchTableSize));
50 } 55 }
51 56
52 // static 57 // static
53 int Interpreter::InterruptBudget() { 58 int Interpreter::InterruptBudget() {
54 // TODO(ignition): Tune code size multiplier. 59 // TODO(ignition): Tune code size multiplier.
55 const int kCodeSizeMultiplier = 32; 60 const int kCodeSizeMultiplier = 32;
56 return FLAG_interrupt_budget * kCodeSizeMultiplier; 61 return FLAG_interrupt_budget * kCodeSizeMultiplier;
57 } 62 }
58 63
59 bool Interpreter::MakeBytecode(CompilationInfo* info) { 64 bool Interpreter::MakeBytecode(CompilationInfo* info) {
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 1727
1723 // Debugger 1728 // Debugger
1724 // 1729 //
1725 // Call runtime to handle debugger statement. 1730 // Call runtime to handle debugger statement.
1726 void Interpreter::DoDebugger(InterpreterAssembler* assembler) { 1731 void Interpreter::DoDebugger(InterpreterAssembler* assembler) {
1727 Node* context = __ GetContext(); 1732 Node* context = __ GetContext();
1728 __ CallRuntime(Runtime::kHandleDebuggerStatement, context); 1733 __ CallRuntime(Runtime::kHandleDebuggerStatement, context);
1729 __ Dispatch(); 1734 __ Dispatch();
1730 } 1735 }
1731 1736
1737 // DebugBreak
1738 //
1739 // Call runtime to handle a debug break.
1740 #define DEBUG_BREAK(Name, ...) \
1741 void Interpreter::Do##Name(InterpreterAssembler* assembler) { \
1742 Node* context = __ GetContext(); \
1743 Node* original_handler = __ CallRuntime(Runtime::kDebugBreak, context); \
1744 __ DispatchToBytecodeHandler(original_handler); \
1745 }
1746 DEBUG_BREAK_BYTECODE_LIST(DEBUG_BREAK);
1747 #undef DEBUG_BREAK
1748
1732 // ForInPrepare <cache_info_triple> 1749 // ForInPrepare <cache_info_triple>
1733 // 1750 //
1734 // Returns state for for..in loop execution based on the object in the 1751 // Returns state for for..in loop execution based on the object in the
1735 // accumulator. The result is output in registers |cache_info_triple| to 1752 // accumulator. The result is output in registers |cache_info_triple| to
1736 // |cache_info_triple + 2|, with the registers holding cache_type, cache_array, 1753 // |cache_info_triple + 2|, with the registers holding cache_type, cache_array,
1737 // and cache_length respectively. 1754 // and cache_length respectively.
1738 void Interpreter::DoForInPrepare(InterpreterAssembler* assembler) { 1755 void Interpreter::DoForInPrepare(InterpreterAssembler* assembler) {
1739 Node* object = __ GetAccumulator(); 1756 Node* object = __ GetAccumulator();
1740 Node* context = __ GetContext(); 1757 Node* context = __ GetContext();
1741 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, context, object); 1758 Node* result_triple = __ CallRuntime(Runtime::kForInPrepare, context, object);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1818 Node* index = __ LoadRegister(index_reg); 1835 Node* index = __ LoadRegister(index_reg);
1819 Node* context = __ GetContext(); 1836 Node* context = __ GetContext();
1820 Node* result = __ CallRuntime(Runtime::kForInStep, context, index); 1837 Node* result = __ CallRuntime(Runtime::kForInStep, context, index);
1821 __ SetAccumulator(result); 1838 __ SetAccumulator(result);
1822 __ Dispatch(); 1839 __ Dispatch();
1823 } 1840 }
1824 1841
1825 } // namespace interpreter 1842 } // namespace interpreter
1826 } // namespace internal 1843 } // namespace internal
1827 } // namespace v8 1844 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/interpreter/interpreter-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698