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

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

Issue 1702593002: More simplification and unification of frame handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix arm64 Created 4 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 | « no previous file | src/compiler/frame.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/address-map.h" 7 #include "src/address-map.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/linkage.h" 9 #include "src/compiler/linkage.h"
10 #include "src/compiler/pipeline.h" 10 #include "src/compiler/pipeline.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 // Emit the jump tables. 171 // Emit the jump tables.
172 if (jump_tables_) { 172 if (jump_tables_) {
173 masm()->Align(kPointerSize); 173 masm()->Align(kPointerSize);
174 for (JumpTable* table = jump_tables_; table; table = table->next()) { 174 for (JumpTable* table = jump_tables_; table; table = table->next()) {
175 masm()->bind(table->label()); 175 masm()->bind(table->label());
176 AssembleJumpTable(table->targets(), table->target_count()); 176 AssembleJumpTable(table->targets(), table->target_count());
177 } 177 }
178 } 178 }
179 179
180 safepoints()->Emit(masm(), frame()->GetSpillSlotCount()); 180 safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount());
181 181
182 Handle<Code> result = 182 Handle<Code> result =
183 v8::internal::CodeGenerator::MakeCodeEpilogue(masm(), info); 183 v8::internal::CodeGenerator::MakeCodeEpilogue(masm(), info);
184 result->set_is_turbofanned(true); 184 result->set_is_turbofanned(true);
185 result->set_stack_slots(frame()->GetSpillSlotCount()); 185 result->set_stack_slots(frame()->GetTotalFrameSlotCount());
186 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); 186 result->set_safepoint_table_offset(safepoints()->GetCodeOffset());
187 187
188 // Emit exception handler table. 188 // Emit exception handler table.
189 if (!handlers_.empty()) { 189 if (!handlers_.empty()) {
190 Handle<HandlerTable> table = 190 Handle<HandlerTable> table =
191 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray( 191 Handle<HandlerTable>::cast(isolate()->factory()->NewFixedArray(
192 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())), 192 HandlerTable::LengthForReturn(static_cast<int>(handlers_.size())),
193 TENURED)); 193 TENURED));
194 for (size_t i = 0; i < handlers_.size(); ++i) { 194 for (size_t i = 0; i < handlers_.size(); ++i) {
195 int position = handlers_[i].handler->pos(); 195 int position = handlers_[i].handler->pos();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 Safepoint::Kind kind, int arguments, 229 Safepoint::Kind kind, int arguments,
230 Safepoint::DeoptMode deopt_mode) { 230 Safepoint::DeoptMode deopt_mode) {
231 Safepoint safepoint = 231 Safepoint safepoint =
232 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode); 232 safepoints()->DefineSafepoint(masm(), kind, arguments, deopt_mode);
233 int stackSlotToSpillSlotDelta = 233 int stackSlotToSpillSlotDelta =
234 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount(); 234 frame()->GetTotalFrameSlotCount() - frame()->GetSpillSlotCount();
235 for (auto& operand : references->reference_operands()) { 235 for (auto& operand : references->reference_operands()) {
236 if (operand.IsStackSlot()) { 236 if (operand.IsStackSlot()) {
237 int index = LocationOperand::cast(operand).index(); 237 int index = LocationOperand::cast(operand).index();
238 DCHECK(index >= 0); 238 DCHECK(index >= 0);
239 // Safepoint table indices are 0-based from the beginning of the spill
240 // slot area, adjust appropriately.
241 index -= stackSlotToSpillSlotDelta;
242 // We might index values in the fixed part of the frame (i.e. the 239 // We might index values in the fixed part of the frame (i.e. the
243 // closure pointer or the context pointer); these are not spill slots 240 // closure pointer or the context pointer); these are not spill slots
244 // and therefore don't work with the SafepointTable currently, but 241 // and therefore don't work with the SafepointTable currently, but
245 // we also don't need to worry about them, since the GC has special 242 // we also don't need to worry about them, since the GC has special
246 // knowledge about those fields anyway. 243 // knowledge about those fields anyway.
247 if (index < 0) continue; 244 if (index < stackSlotToSpillSlotDelta) continue;
248 safepoint.DefinePointerSlot(index, zone()); 245 safepoint.DefinePointerSlot(index, zone());
249 } else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) { 246 } else if (operand.IsRegister() && (kind & Safepoint::kWithRegisters)) {
250 Register reg = LocationOperand::cast(operand).GetRegister(); 247 Register reg = LocationOperand::cast(operand).GetRegister();
251 safepoint.DefinePointerRegister(reg, zone()); 248 safepoint.DefinePointerRegister(reg, zone());
252 } 249 }
253 } 250 }
254 } 251 }
255 252
256 253
257 bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object, 254 bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { 733 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) {
737 gen->ools_ = this; 734 gen->ools_ = this;
738 } 735 }
739 736
740 737
741 OutOfLineCode::~OutOfLineCode() {} 738 OutOfLineCode::~OutOfLineCode() {}
742 739
743 } // namespace compiler 740 } // namespace compiler
744 } // namespace internal 741 } // namespace internal
745 } // namespace v8 742 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698