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

Side by Side Diff: src/compiler/code-generator.cc

Issue 2651833003: [wasm] Move protected instruction info to RelocInfo (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/v8/v8 into trap-relocinfo Created 3 years, 10 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
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/address-map.h" 7 #include "src/address-map.h"
8 #include "src/base/adapters.h" 8 #include "src/base/adapters.h"
9 #include "src/compilation-info.h" 9 #include "src/compilation-info.h"
10 #include "src/compiler/code-generator-impl.h" 10 #include "src/compiler/code-generator-impl.h"
(...skipping 15 matching lines...) Expand all
26 Label** targets() const { return targets_; } 26 Label** targets() const { return targets_; }
27 size_t target_count() const { return target_count_; } 27 size_t target_count() const { return target_count_; }
28 28
29 private: 29 private:
30 Label label_; 30 Label label_;
31 JumpTable* const next_; 31 JumpTable* const next_;
32 Label** const targets_; 32 Label** const targets_;
33 size_t const target_count_; 33 size_t const target_count_;
34 }; 34 };
35 35
36 CodeGenerator::CodeGenerator( 36 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
37 Frame* frame, Linkage* linkage, InstructionSequence* code, 37 InstructionSequence* code, CompilationInfo* info)
38 CompilationInfo* info,
39 ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions)
40 : frame_access_state_(nullptr), 38 : frame_access_state_(nullptr),
41 linkage_(linkage), 39 linkage_(linkage),
42 code_(code), 40 code_(code),
43 unwinding_info_writer_(zone()), 41 unwinding_info_writer_(zone()),
44 info_(info), 42 info_(info),
45 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), 43 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
46 current_block_(RpoNumber::Invalid()), 44 current_block_(RpoNumber::Invalid()),
47 current_source_position_(SourcePosition::Unknown()), 45 current_source_position_(SourcePosition::Unknown()),
48 masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo), 46 masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
49 resolver_(this), 47 resolver_(this),
50 safepoints_(code->zone()), 48 safepoints_(code->zone()),
51 handlers_(code->zone()), 49 handlers_(code->zone()),
52 deoptimization_exits_(code->zone()), 50 deoptimization_exits_(code->zone()),
53 deoptimization_states_(code->zone()), 51 deoptimization_states_(code->zone()),
54 deoptimization_literals_(code->zone()), 52 deoptimization_literals_(code->zone()),
55 inlined_function_count_(0), 53 inlined_function_count_(0),
56 translations_(code->zone()), 54 translations_(code->zone()),
57 last_lazy_deopt_pc_(0), 55 last_lazy_deopt_pc_(0),
58 jump_tables_(nullptr), 56 jump_tables_(nullptr),
59 ools_(nullptr), 57 ools_(nullptr),
60 osr_pc_offset_(-1), 58 osr_pc_offset_(-1),
61 optimized_out_literal_id_(-1), 59 optimized_out_literal_id_(-1),
62 source_position_table_builder_(code->zone(), 60 source_position_table_builder_(code->zone(),
63 info->SourcePositionRecordingMode()), 61 info->SourcePositionRecordingMode()) {
64 protected_instructions_(protected_instructions) {
65 for (int i = 0; i < code->InstructionBlockCount(); ++i) { 62 for (int i = 0; i < code->InstructionBlockCount(); ++i) {
66 new (&labels_[i]) Label; 63 new (&labels_[i]) Label;
67 } 64 }
68 CreateFrameAccessState(frame); 65 CreateFrameAccessState(frame);
69 } 66 }
70 67
71 Isolate* CodeGenerator::isolate() const { return info_->isolate(); } 68 Isolate* CodeGenerator::isolate() const { return info_->isolate(); }
72 69
73 void CodeGenerator::CreateFrameAccessState(Frame* frame) { 70 void CodeGenerator::CreateFrameAccessState(Frame* frame) {
74 FinishFrame(frame); 71 FinishFrame(frame);
75 frame_access_state_ = new (code()->zone()) FrameAccessState(frame); 72 frame_access_state_ = new (code()->zone()) FrameAccessState(frame);
76 } 73 }
77 74
78 void CodeGenerator::AddProtectedInstruction(int instr_offset,
79 int landing_offset) {
80 if (protected_instructions_ != nullptr) {
81 trap_handler::ProtectedInstructionData data = {instr_offset,
82 landing_offset};
83 protected_instructions_->emplace_back(data);
84 }
85 }
86 75
87 Handle<Code> CodeGenerator::GenerateCode() { 76 Handle<Code> CodeGenerator::GenerateCode() {
88 CompilationInfo* info = this->info(); 77 CompilationInfo* info = this->info();
89 78
90 // Open a frame scope to indicate that there is a frame on the stack. The 79 // Open a frame scope to indicate that there is a frame on the stack. The
91 // MANUAL indicates that the scope shouldn't actually generate code to set up 80 // MANUAL indicates that the scope shouldn't actually generate code to set up
92 // the frame (that is done in AssemblePrologue). 81 // the frame (that is done in AssemblePrologue).
93 FrameScope frame_scope(masm(), StackFrame::MANUAL); 82 FrameScope frame_scope(masm(), StackFrame::MANUAL);
94 83
95 if (info->is_source_positions_enabled()) { 84 if (info->is_source_positions_enabled()) {
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { 985 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) {
997 gen->ools_ = this; 986 gen->ools_ = this;
998 } 987 }
999 988
1000 989
1001 OutOfLineCode::~OutOfLineCode() {} 990 OutOfLineCode::~OutOfLineCode() {}
1002 991
1003 } // namespace compiler 992 } // namespace compiler
1004 } // namespace internal 993 } // namespace internal
1005 } // namespace v8 994 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698