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

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

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GN for realz Created 5 years, 5 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/isolate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/interpreter/interpreter.h"
6
7 #include "src/compiler.h"
8 #include "src/compiler/interpreter-assembler.h"
9 #include "src/factory.h"
10 #include "src/interpreter/bytecodes.h"
11 #include "src/zone.h"
12
13 namespace v8 {
14 namespace internal {
15 namespace interpreter {
16
17 using compiler::Node;
18 #define __ assembler->
19
20
21 Interpreter::Interpreter(Isolate* isolate) : isolate_(isolate) {}
22
23
24 void Interpreter::Initialize(bool create_heap_objects) {
25 DCHECK(FLAG_ignition);
26 if (create_heap_objects) {
27 Zone zone;
28 HandleScope scope(isolate_);
29 Handle<FixedArray> handler_table = isolate_->factory()->NewFixedArray(
30 static_cast<int>(Bytecode::kLast) + 1, TENURED);
31 isolate_->heap()->public_set_interpreter_table(*handler_table);
32
33 #define GENERATE_CODE(Name, _) \
34 { \
35 compiler::InterpreterAssembler assembler(isolate_, &zone, \
36 Bytecode::k##Name); \
37 Do##Name(&assembler); \
38 handler_table->set(static_cast<int>(Bytecode::k##Name), \
39 *assembler.GenerateCode()); \
40 }
41 BYTECODE_LIST(GENERATE_CODE)
42 #undef GENERATE_CODE
43 }
44 }
45
46
47 // Load literal '0' into the register index specified by the bytecode's
48 // argument.
49 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) {
50 Node* register_index = __ BytecodeArg(0);
51 __ StoreRegister(__ NumberConstant(0), register_index);
52 __ Dispatch();
53 }
54
55
56 // Return the value in register 0.
57 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) {
58 // TODO(rmcilroy) Jump to exit trampoline.
59 }
60
61
62 } // namespace interpreter
63 } // namespace internal
64 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698