| 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/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-generator.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 Do##Name(&assembler); \ | 53 Do##Name(&assembler); \ |
| 53 Handle<Code> code = assembler.GenerateCode(); \ | 54 Handle<Code> code = assembler.GenerateCode(); \ |
| 54 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ | 55 handler_table->set(static_cast<int>(Bytecode::k##Name), *code); \ |
| 55 } | 56 } |
| 56 BYTECODE_LIST(GENERATE_CODE) | 57 BYTECODE_LIST(GENERATE_CODE) |
| 57 #undef GENERATE_CODE | 58 #undef GENERATE_CODE |
| 58 } | 59 } |
| 59 } | 60 } |
| 60 | 61 |
| 61 | 62 |
| 63 bool Interpreter::MakeBytecode(CompilationInfo* info) { |
| 64 Handle<SharedFunctionInfo> shared_info = |
| 65 Compiler::GetSharedFunctionInfo(info->function(), info->script(), info); |
| 66 BytecodeGenerator generator(info->isolate(), info->zone()); |
| 67 Handle<BytecodeArray> bytecodes = generator.MakeBytecode(info); |
| 68 if (FLAG_print_ignition_bytecode) { |
| 69 bytecodes->Print(); |
| 70 } |
| 71 |
| 72 CHECK(shared_info->function_data()->IsUndefined()); |
| 73 shared_info->set_function_data(*bytecodes); |
| 74 info->SetCode(info->isolate()->builtins()->InterpreterEntryTrampoline()); |
| 75 info->EnsureFeedbackVector(); |
| 76 return true; |
| 77 } |
| 78 |
| 79 |
| 62 bool Interpreter::IsInterpreterTableInitialized( | 80 bool Interpreter::IsInterpreterTableInitialized( |
| 63 Handle<FixedArray> handler_table) { | 81 Handle<FixedArray> handler_table) { |
| 64 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1); | 82 DCHECK(handler_table->length() == static_cast<int>(Bytecode::kLast) + 1); |
| 65 return handler_table->get(0) == | 83 return handler_table->get(0) == |
| 66 isolate_->builtins()->builtin(Builtins::kIllegal); | 84 isolate_->builtins()->builtin(Builtins::kIllegal); |
| 67 } | 85 } |
| 68 | 86 |
| 69 | 87 |
| 70 // LdaZero | 88 // LdaZero |
| 71 // | 89 // |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // | 206 // |
| 189 // Return the value in register 0. | 207 // Return the value in register 0. |
| 190 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { | 208 void Interpreter::DoReturn(compiler::InterpreterAssembler* assembler) { |
| 191 __ Return(); | 209 __ Return(); |
| 192 } | 210 } |
| 193 | 211 |
| 194 | 212 |
| 195 } // namespace interpreter | 213 } // namespace interpreter |
| 196 } // namespace internal | 214 } // namespace internal |
| 197 } // namespace v8 | 215 } // namespace v8 |
| OLD | NEW |