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

Side by Side Diff: src/compiler/frame.cc

Issue 1775323002: [turbofan] Frame elision for code stubs (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/frame.h ('k') | src/compiler/frame-elider.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/frame.h" 5 #include "src/compiler/frame.h"
6 6
7 #include "src/compiler/linkage.h" 7 #include "src/compiler/linkage.h"
8 #include "src/compiler/register-allocator.h" 8 #include "src/compiler/register-allocator.h"
9 #include "src/macro-assembler.h" 9 #include "src/macro-assembler.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 Frame::Frame(int fixed_frame_size_in_slots, const CallDescriptor* descriptor) 15 Frame::Frame(int fixed_frame_size_in_slots, const CallDescriptor* descriptor)
16 : needs_frame_((descriptor != nullptr) && 16 : frame_slot_count_(fixed_frame_size_in_slots),
17 descriptor->RequiresFrameAsIncoming()),
18 frame_slot_count_(fixed_frame_size_in_slots),
19 callee_saved_slot_count_(0), 17 callee_saved_slot_count_(0),
20 spill_slot_count_(0), 18 spill_slot_count_(0),
21 allocated_registers_(nullptr), 19 allocated_registers_(nullptr),
22 allocated_double_registers_(nullptr) {} 20 allocated_double_registers_(nullptr) {}
23 21
24 int Frame::AlignFrame(int alignment) { 22 int Frame::AlignFrame(int alignment) {
25 DCHECK_EQ(0, callee_saved_slot_count_); 23 DCHECK_EQ(0, callee_saved_slot_count_);
26 int alignment_slots = alignment / kPointerSize; 24 int alignment_slots = alignment / kPointerSize;
27 int delta = alignment_slots - (frame_slot_count_ & (alignment_slots - 1)); 25 int delta = alignment_slots - (frame_slot_count_ & (alignment_slots - 1));
28 if (delta != alignment_slots) { 26 if (delta != alignment_slots) {
29 frame_slot_count_ += delta; 27 frame_slot_count_ += delta;
30 if (spill_slot_count_ != 0) { 28 if (spill_slot_count_ != 0) {
31 spill_slot_count_ += delta; 29 spill_slot_count_ += delta;
32 } 30 }
33 } 31 }
34 return delta; 32 return delta;
35 } 33 }
36 34
35 void FrameAccessState::MarkHasFrame(bool state) {
36 has_frame_ = state;
37 SetFrameAccessToDefault();
38 }
39
37 void FrameAccessState::SetFrameAccessToDefault() { 40 void FrameAccessState::SetFrameAccessToDefault() {
38 if (frame()->needs_frame() && !FLAG_turbo_sp_frame_access) { 41 if (has_frame() && !FLAG_turbo_sp_frame_access) {
39 SetFrameAccessToFP(); 42 SetFrameAccessToFP();
40 } else { 43 } else {
41 SetFrameAccessToSP(); 44 SetFrameAccessToSP();
42 } 45 }
43 } 46 }
44 47
45 48
46 FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const { 49 FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const {
47 const int frame_offset = FrameSlotToFPOffset(spill_slot); 50 const int frame_offset = FrameSlotToFPOffset(spill_slot);
48 if (access_frame_with_fp()) { 51 if (access_frame_with_fp()) {
49 DCHECK(frame()->needs_frame());
50 return FrameOffset::FromFramePointer(frame_offset); 52 return FrameOffset::FromFramePointer(frame_offset);
51 } else { 53 } else {
52 // No frame. Retrieve all parameters relative to stack pointer. 54 // No frame. Retrieve all parameters relative to stack pointer.
53 int sp_offset = frame_offset + GetSPToFPOffset(); 55 int sp_offset = frame_offset + GetSPToFPOffset();
54 return FrameOffset::FromStackPointer(sp_offset); 56 return FrameOffset::FromStackPointer(sp_offset);
55 } 57 }
56 } 58 }
57 59
58 60
59 } // namespace compiler 61 } // namespace compiler
60 } // namespace internal 62 } // namespace internal
61 } // namespace v8 63 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/frame.h ('k') | src/compiler/frame-elider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698