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 // Canonicalize handles, so that we can share constant pool entries pointing | |
22 // to code targets without dereferencing their handles. | |
23 CanonicalHandleScope canonical(interpreter->isolate_); | |
24 Address* dispatch_table = interpreter->dispatch_table_; | 21 Address* dispatch_table = interpreter->dispatch_table_; |
25 | 22 |
26 // Generate bytecode handlers for all bytecodes and scales. | 23 // Generate bytecode handlers for all bytecodes and scales. |
27 const OperandScale kOperandScales[] = { | 24 const OperandScale kOperandScales[] = { |
28 #define VALUE(Name, _) OperandScale::k##Name, | 25 #define VALUE(Name, _) OperandScale::k##Name, |
29 OPERAND_SCALE_LIST(VALUE) | 26 OPERAND_SCALE_LIST(VALUE) |
30 #undef VALUE | 27 #undef VALUE |
31 }; | 28 }; |
32 | 29 |
33 for (OperandScale operand_scale : kOperandScales) { | 30 for (OperandScale operand_scale : kOperandScales) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (ReuseExistingHandler(dispatch_table, bytecode, operand_scale)) return; | 82 if (ReuseExistingHandler(dispatch_table, bytecode, operand_scale)) return; |
86 | 83 |
87 size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale); | 84 size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale); |
88 Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale); | 85 Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale); |
89 dispatch_table[index] = code->entry(); | 86 dispatch_table[index] = code->entry(); |
90 } | 87 } |
91 | 88 |
92 } // namespace interpreter | 89 } // namespace interpreter |
93 } // namespace internal | 90 } // namespace internal |
94 } // namespace v8 | 91 } // namespace v8 |
OLD | NEW |