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

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

Issue 1230753004: [Interpreter] Add BytecodeArray class and add to SharedFunctionInfo. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use BytecodeArray in bytecode emission path in interpreter. 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
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/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/interpreter-assembler.h" 8 #include "src/compiler/interpreter-assembler.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/interpreter/bytecode-emitter.h"
10 #include "src/interpreter/bytecodes.h" 11 #include "src/interpreter/bytecodes.h"
11 #include "src/zone.h" 12 #include "src/zone.h"
12 13
13 namespace v8 { 14 namespace v8 {
14 namespace internal { 15 namespace internal {
15 namespace interpreter { 16 namespace interpreter {
16 17
17 using compiler::Node; 18 using compiler::Node;
18 #define __ assembler-> 19 #define __ assembler->
19 20
(...skipping 19 matching lines...) Expand all
39 } 40 }
40 BYTECODE_LIST(GENERATE_CODE) 41 BYTECODE_LIST(GENERATE_CODE)
41 #undef GENERATE_CODE 42 #undef GENERATE_CODE
42 // TODO(rmcilroy): Generate code for register specializations. 43 // TODO(rmcilroy): Generate code for register specializations.
43 } 44 }
44 } 45 }
45 46
46 47
47 // static 48 // static
48 bool Interpreter::MakeBytecode(CompilationInfo* info) { 49 bool Interpreter::MakeBytecode(CompilationInfo* info) {
49 // TODO(rmcilroy): Generate bytecodes... 50 Handle<SharedFunctionInfo> shared_info =
51 Compiler::GetSharedFunctionInfo(info->function(), info->script(), info);
52 BytecodeEmitter emitter(info->isolate(), info->zone());
53 Handle<BytecodeArray> bytecodes = emitter.Emit(info->function());
54 shared_info->set_bytecode_array(*bytecodes);
50 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline()); 55 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline());
51 info->EnsureFeedbackVector(); 56 info->EnsureFeedbackVector();
52 return true; 57 return true;
53 } 58 }
54 59
55 60
56 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) { 61 void Interpreter::DoLoadLiteral0(compiler::InterpreterAssembler* assembler) {
57 // TODO(rmcilroy): Select correct register based on index in bytecode. 62 // TODO(rmcilroy): Select correct register based on index in bytecode.
58 __ StoreRegister(__ SmiConstant(0), 0); 63 __ StoreRegister(__ SmiConstant(0), 0);
59 __ Dispatch(); 64 __ Dispatch();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 114
110 115
111 void Interpreter::DoReturnRegSpecialization( 116 void Interpreter::DoReturnRegSpecialization(
112 compiler::InterpreterAssembler* assembler, int reg_index) { 117 compiler::InterpreterAssembler* assembler, int reg_index) {
113 __ Return(__ LoadRegister(reg_index)); 118 __ Return(__ LoadRegister(reg_index));
114 } 119 }
115 120
116 } // namespace interpreter 121 } // namespace interpreter
117 } // namespace internal 122 } // namespace internal
118 } // namespace v8 123 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698