OLD | NEW |
---|---|
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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/setup-interpreter.h" | 5 #include "src/interpreter/setup-interpreter.h" |
6 | 6 |
7 #include "src/handles-inl.h" | 7 #include "src/handles-inl.h" |
8 #include "src/interpreter/bytecodes.h" | 8 #include "src/interpreter/bytecodes.h" |
9 #include "src/interpreter/interpreter-generator.h" | 9 #include "src/interpreter/interpreter-generator.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
11 #include "src/objects-inl.h" | 11 #include "src/objects-inl.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 namespace interpreter { | 15 namespace interpreter { |
16 | 16 |
17 // static | 17 // static |
18 void SetupInterpreter::InstallBytecodeHandlers(Interpreter* interpreter) { | 18 void SetupInterpreter::InstallBytecodeHandlers(Interpreter* interpreter) { |
19 DCHECK(!interpreter->IsDispatchTableInitialized()); | 19 DCHECK(!interpreter->IsDispatchTableInitialized()); |
20 HandleScope scope(interpreter->isolate_); | 20 HandleScope scope(interpreter->isolate_); |
21 CanonicalHandleScope canonical(interpreter->isolate_); | |
rmcilroy
2017/05/16 09:04:05
Why is this needed? Could you add a comment please
| |
21 Address* dispatch_table = interpreter->dispatch_table_; | 22 Address* dispatch_table = interpreter->dispatch_table_; |
22 | 23 |
23 // Generate bytecode handlers for all bytecodes and scales. | 24 // Generate bytecode handlers for all bytecodes and scales. |
24 const OperandScale kOperandScales[] = { | 25 const OperandScale kOperandScales[] = { |
25 #define VALUE(Name, _) OperandScale::k##Name, | 26 #define VALUE(Name, _) OperandScale::k##Name, |
26 OPERAND_SCALE_LIST(VALUE) | 27 OPERAND_SCALE_LIST(VALUE) |
27 #undef VALUE | 28 #undef VALUE |
28 }; | 29 }; |
29 | 30 |
30 for (OperandScale operand_scale : kOperandScales) { | 31 for (OperandScale operand_scale : kOperandScales) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 if (ReuseExistingHandler(dispatch_table, bytecode, operand_scale)) return; | 83 if (ReuseExistingHandler(dispatch_table, bytecode, operand_scale)) return; |
83 | 84 |
84 size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale); | 85 size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale); |
85 Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale); | 86 Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale); |
86 dispatch_table[index] = code->entry(); | 87 dispatch_table[index] = code->entry(); |
87 } | 88 } |
88 | 89 |
89 } // namespace interpreter | 90 } // namespace interpreter |
90 } // namespace internal | 91 } // namespace internal |
91 } // namespace v8 | 92 } // namespace v8 |
OLD | NEW |