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

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

Issue 763963002: [turbofan] Add checked load/store operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reapply fix. Created 6 years 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/code-generator-impl.h » ('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/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, 15 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
16 InstructionSequence* code, CompilationInfo* info) 16 InstructionSequence* code, CompilationInfo* info)
17 : frame_(frame), 17 : frame_(frame),
18 linkage_(linkage), 18 linkage_(linkage),
19 code_(code), 19 code_(code),
20 info_(info), 20 info_(info),
21 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), 21 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
22 current_block_(BasicBlock::RpoNumber::Invalid()), 22 current_block_(BasicBlock::RpoNumber::Invalid()),
23 current_source_position_(SourcePosition::Invalid()), 23 current_source_position_(SourcePosition::Invalid()),
24 masm_(code->zone()->isolate(), NULL, 0), 24 masm_(code->zone()->isolate(), NULL, 0),
25 resolver_(this), 25 resolver_(this),
26 safepoints_(code->zone()), 26 safepoints_(code->zone()),
27 deoptimization_states_(code->zone()), 27 deoptimization_states_(code->zone()),
28 deoptimization_literals_(code->zone()), 28 deoptimization_literals_(code->zone()),
29 translations_(code->zone()), 29 translations_(code->zone()),
30 last_lazy_deopt_pc_(0) { 30 last_lazy_deopt_pc_(0),
31 ools_(nullptr) {
31 for (int i = 0; i < code->InstructionBlockCount(); ++i) { 32 for (int i = 0; i < code->InstructionBlockCount(); ++i) {
32 new (&labels_[i]) Label; 33 new (&labels_[i]) Label;
33 } 34 }
34 } 35 }
35 36
36 37
37 Handle<Code> CodeGenerator::GenerateCode() { 38 Handle<Code> CodeGenerator::GenerateCode() {
38 CompilationInfo* info = this->info(); 39 CompilationInfo* info = this->info();
39 40
40 // Emit a code line info recording start event. 41 // Emit a code line info recording start event.
(...skipping 23 matching lines...) Expand all
64 SNPrintF(buffer, "-- B%d start --", block->id().ToInt()); 65 SNPrintF(buffer, "-- B%d start --", block->id().ToInt());
65 masm()->RecordComment(buffer.start()); 66 masm()->RecordComment(buffer.start());
66 } 67 }
67 masm()->bind(GetLabel(current_block_)); 68 masm()->bind(GetLabel(current_block_));
68 for (int i = block->code_start(); i < block->code_end(); ++i) { 69 for (int i = block->code_start(); i < block->code_end(); ++i) {
69 AssembleInstruction(code()->InstructionAt(i)); 70 AssembleInstruction(code()->InstructionAt(i));
70 } 71 }
71 } 72 }
72 } 73 }
73 74
75 // Assemble all out-of-line code.
76 if (ools_) {
77 masm()->RecordComment("-- Out of line code --");
78 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) {
79 masm()->bind(ool->entry());
80 ool->Generate();
81 masm()->jmp(ool->exit());
82 }
83 }
84
74 FinishCode(masm()); 85 FinishCode(masm());
75 86
76 // Ensure there is space for lazy deopt. 87 // Ensure there is space for lazy deopt.
77 if (!info->IsStub()) { 88 if (!info->IsStub()) {
78 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); 89 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size();
79 while (masm()->pc_offset() < target_offset) { 90 while (masm()->pc_offset() < target_offset) {
80 masm()->nop(); 91 masm()->nop();
81 } 92 }
82 } 93 }
83 94
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 void CodeGenerator::AssembleSwap(InstructionOperand* source, 559 void CodeGenerator::AssembleSwap(InstructionOperand* source,
549 InstructionOperand* destination) { 560 InstructionOperand* destination) {
550 UNIMPLEMENTED(); 561 UNIMPLEMENTED();
551 } 562 }
552 563
553 564
554 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } 565 void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); }
555 566
556 #endif // !V8_TURBOFAN_BACKEND 567 #endif // !V8_TURBOFAN_BACKEND
557 568
569
570 OutOfLineCode::OutOfLineCode(CodeGenerator* gen)
571 : masm_(gen->masm()), next_(gen->ools_) {
572 gen->ools_ = this;
573 }
574
575
576 OutOfLineCode::~OutOfLineCode() {}
577
558 } // namespace compiler 578 } // namespace compiler
559 } // namespace internal 579 } // namespace internal
560 } // namespace v8 580 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/code-generator-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698