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

Side by Side Diff: src/compiler/bytecode-analysis.cc

Issue 2894293003: Save/restore only live registers in the generator suspend/resume. (Closed)
Patch Set: Tweak Created 3 years, 6 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/bytecode-analysis.h ('k') | src/compiler/bytecode-graph-builder.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/bytecode-analysis.h" 5 #include "src/compiler/bytecode-analysis.h"
6 6
7 #include "src/interpreter/bytecode-array-iterator.h" 7 #include "src/interpreter/bytecode-array-iterator.h"
8 #include "src/interpreter/bytecode-array-random-iterator.h" 8 #include "src/interpreter/bytecode-array-random-iterator.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
(...skipping 10 matching lines...) Expand all
21 BitVector(parameter_count + register_count, zone)) {} 21 BitVector(parameter_count + register_count, zone)) {}
22 22
23 void BytecodeLoopAssignments::Add(interpreter::Register r) { 23 void BytecodeLoopAssignments::Add(interpreter::Register r) {
24 if (r.is_parameter()) { 24 if (r.is_parameter()) {
25 bit_vector_->Add(r.ToParameterIndex(parameter_count_)); 25 bit_vector_->Add(r.ToParameterIndex(parameter_count_));
26 } else { 26 } else {
27 bit_vector_->Add(parameter_count_ + r.index()); 27 bit_vector_->Add(parameter_count_ + r.index());
28 } 28 }
29 } 29 }
30 30
31 void BytecodeLoopAssignments::AddPair(interpreter::Register r) { 31 void BytecodeLoopAssignments::AddList(interpreter::Register r, uint32_t count) {
32 if (r.is_parameter()) { 32 if (r.is_parameter()) {
33 DCHECK(interpreter::Register(r.index() + 1).is_parameter()); 33 for (uint32_t i = 0; i < count; i++) {
34 bit_vector_->Add(r.ToParameterIndex(parameter_count_)); 34 DCHECK(interpreter::Register(r.index() + i).is_parameter());
35 bit_vector_->Add(r.ToParameterIndex(parameter_count_) + 1); 35 bit_vector_->Add(r.ToParameterIndex(parameter_count_) + i);
36 }
36 } else { 37 } else {
37 DCHECK(!interpreter::Register(r.index() + 1).is_parameter()); 38 for (uint32_t i = 0; i < count; i++) {
38 bit_vector_->Add(parameter_count_ + r.index()); 39 DCHECK(!interpreter::Register(r.index() + i).is_parameter());
39 bit_vector_->Add(parameter_count_ + r.index() + 1); 40 bit_vector_->Add(parameter_count_ + r.index() + i);
41 }
40 } 42 }
41 } 43 }
42 44
43 void BytecodeLoopAssignments::AddTriple(interpreter::Register r) {
44 if (r.is_parameter()) {
45 DCHECK(interpreter::Register(r.index() + 1).is_parameter());
46 DCHECK(interpreter::Register(r.index() + 2).is_parameter());
47 bit_vector_->Add(r.ToParameterIndex(parameter_count_));
48 bit_vector_->Add(r.ToParameterIndex(parameter_count_) + 1);
49 bit_vector_->Add(r.ToParameterIndex(parameter_count_) + 2);
50 } else {
51 DCHECK(!interpreter::Register(r.index() + 1).is_parameter());
52 DCHECK(!interpreter::Register(r.index() + 2).is_parameter());
53 bit_vector_->Add(parameter_count_ + r.index());
54 bit_vector_->Add(parameter_count_ + r.index() + 1);
55 bit_vector_->Add(parameter_count_ + r.index() + 2);
56 }
57 }
58
59 void BytecodeLoopAssignments::AddAll() { bit_vector_->AddAll(); } 45 void BytecodeLoopAssignments::AddAll() { bit_vector_->AddAll(); }
60 46
61 void BytecodeLoopAssignments::Union(const BytecodeLoopAssignments& other) { 47 void BytecodeLoopAssignments::Union(const BytecodeLoopAssignments& other) {
62 bit_vector_->Union(*other.bit_vector_); 48 bit_vector_->Union(*other.bit_vector_);
63 } 49 }
64 50
65 bool BytecodeLoopAssignments::ContainsParameter(int index) const { 51 bool BytecodeLoopAssignments::ContainsParameter(int index) const {
66 DCHECK_GE(index, 0); 52 DCHECK_GE(index, 0);
67 DCHECK_LT(index, parameter_count()); 53 DCHECK_LT(index, parameter_count());
68 return bit_vector_->Contains(index); 54 return bit_vector_->Contains(index);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 91 }
106 for (int i = 0; i < num_operands; ++i) { 92 for (int i = 0; i < num_operands; ++i) {
107 switch (operand_types[i]) { 93 switch (operand_types[i]) {
108 case OperandType::kRegOut: { 94 case OperandType::kRegOut: {
109 interpreter::Register r = accessor.GetRegisterOperand(i); 95 interpreter::Register r = accessor.GetRegisterOperand(i);
110 if (!r.is_parameter()) { 96 if (!r.is_parameter()) {
111 in_liveness.MarkRegisterDead(r.index()); 97 in_liveness.MarkRegisterDead(r.index());
112 } 98 }
113 break; 99 break;
114 } 100 }
101 case OperandType::kRegOutList: {
102 interpreter::Register r = accessor.GetRegisterOperand(i++);
103 uint32_t reg_count = accessor.GetRegisterCountOperand(i);
104 if (!r.is_parameter()) {
105 for (uint32_t j = 0; j < reg_count; ++j) {
106 DCHECK(!interpreter::Register(r.index() + j).is_parameter());
107 in_liveness.MarkRegisterDead(r.index() + j);
108 }
109 }
110 break;
111 }
115 case OperandType::kRegOutPair: { 112 case OperandType::kRegOutPair: {
116 interpreter::Register r = accessor.GetRegisterOperand(i); 113 interpreter::Register r = accessor.GetRegisterOperand(i);
117 if (!r.is_parameter()) { 114 if (!r.is_parameter()) {
118 DCHECK(!interpreter::Register(r.index() + 1).is_parameter()); 115 DCHECK(!interpreter::Register(r.index() + 1).is_parameter());
119 in_liveness.MarkRegisterDead(r.index()); 116 in_liveness.MarkRegisterDead(r.index());
120 in_liveness.MarkRegisterDead(r.index() + 1); 117 in_liveness.MarkRegisterDead(r.index() + 1);
121 } 118 }
122 break; 119 break;
123 } 120 }
124 case OperandType::kRegOutTriple: { 121 case OperandType::kRegOutTriple: {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const BytecodeArrayAccessor& accessor) { 217 const BytecodeArrayAccessor& accessor) {
221 int num_operands = Bytecodes::NumberOfOperands(bytecode); 218 int num_operands = Bytecodes::NumberOfOperands(bytecode);
222 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); 219 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode);
223 220
224 for (int i = 0; i < num_operands; ++i) { 221 for (int i = 0; i < num_operands; ++i) {
225 switch (operand_types[i]) { 222 switch (operand_types[i]) {
226 case OperandType::kRegOut: { 223 case OperandType::kRegOut: {
227 assignments.Add(accessor.GetRegisterOperand(i)); 224 assignments.Add(accessor.GetRegisterOperand(i));
228 break; 225 break;
229 } 226 }
227 case OperandType::kRegOutList: {
228 interpreter::Register r = accessor.GetRegisterOperand(i++);
229 uint32_t reg_count = accessor.GetRegisterCountOperand(i);
230 assignments.AddList(r, reg_count);
231 break;
232 }
230 case OperandType::kRegOutPair: { 233 case OperandType::kRegOutPair: {
231 assignments.AddPair(accessor.GetRegisterOperand(i)); 234 assignments.AddList(accessor.GetRegisterOperand(i), 2);
232 break; 235 break;
233 } 236 }
234 case OperandType::kRegOutTriple: { 237 case OperandType::kRegOutTriple: {
235 assignments.AddTriple(accessor.GetRegisterOperand(i)); 238 assignments.AddList(accessor.GetRegisterOperand(i), 3);
236 break; 239 break;
237 } 240 }
238 default: 241 default:
239 DCHECK(!Bytecodes::IsRegisterOutputOperandType(operand_types[i])); 242 DCHECK(!Bytecodes::IsRegisterOutputOperandType(operand_types[i]));
240 break; 243 break;
241 } 244 }
242 } 245 }
243 } 246 }
244 247
245 } // namespace 248 } // namespace
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 622 }
620 } 623 }
621 624
622 return invalid_offset == -1; 625 return invalid_offset == -1;
623 } 626 }
624 #endif 627 #endif
625 628
626 } // namespace compiler 629 } // namespace compiler
627 } // namespace internal 630 } // namespace internal
628 } // namespace v8 631 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/bytecode-analysis.h ('k') | src/compiler/bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698