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

Side by Side Diff: src/interpreter/setup-interpreter-full.cc

Issue 2760233005: [snapshot] Move builtins generation into mksnapshot (Closed)
Patch Set: Created 3 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/interpreter/interpreter.h"
6
7 #include "src/handles-inl.h"
8 #include "src/interpreter/bytecodes.h"
9 #include "src/interpreter/interpreter-generator.h"
10 #include "src/objects-inl.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace interpreter {
15
16 void Interpreter::Initialize() {
17 DCHECK(!IsDispatchTableInitialized());
18 HandleScope scope(isolate_);
19
20 if (FLAG_trace_ignition_dispatches) {
21 static const int kBytecodeCount = static_cast<int>(Bytecode::kLast) + 1;
22 bytecode_dispatch_counters_table_.reset(
23 new uintptr_t[kBytecodeCount * kBytecodeCount]);
24 memset(bytecode_dispatch_counters_table_.get(), 0,
25 sizeof(uintptr_t) * kBytecodeCount * kBytecodeCount);
26 }
rmcilroy 2017/03/21 16:55:56 This code needs to be done for snapshot builds as
Jakob Kummerow 2017/03/28 10:35:16 Done. As it turns out, cctests/test-serialize requ
27
28 // Generate bytecode handlers for all bytecodes and scales.
29 const OperandScale kOperandScales[] = {
30 #define VALUE(Name, _) OperandScale::k##Name,
31 OPERAND_SCALE_LIST(VALUE)
32 #undef VALUE
33 };
34
35 for (OperandScale operand_scale : kOperandScales) {
36 #define GENERATE_CODE(Name, ...) \
37 InstallBytecodeHandler(isolate_, Bytecode::k##Name, operand_scale);
38 BYTECODE_LIST(GENERATE_CODE)
39 #undef GENERATE_CODE
40 }
41
42 // Fill unused entries will the illegal bytecode handler.
43 size_t illegal_index =
44 GetDispatchTableIndex(Bytecode::kIllegal, OperandScale::kSingle);
45 for (size_t index = 0; index < arraysize(dispatch_table_); ++index) {
46 if (dispatch_table_[index] == nullptr) {
47 dispatch_table_[index] = dispatch_table_[illegal_index];
48 }
49 }
50
51 // Initialization should have been successful.
52 DCHECK(IsDispatchTableInitialized());
53 }
54
55 void Interpreter::InstallBytecodeHandler(Isolate* isolate, Bytecode bytecode,
56 OperandScale operand_scale) {
57 if (!Bytecodes::BytecodeHasHandler(bytecode, operand_scale)) return;
58 if (ReuseExistingHandler(bytecode, operand_scale)) return;
59
60 size_t index = GetDispatchTableIndex(bytecode, operand_scale);
61 Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale);
62 dispatch_table_[index] = code->entry();
63 }
64
65 } // namespace interpreter
66 } // namespace internal
67 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698