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

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

Issue 679793003: [turbofan] reduce allocations outside of pipeline (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/linkage.h ('k') | src/compiler/mips/code-generator-mips.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/linkage.h" 5 #include "src/compiler/linkage.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/compiler/pipeline.h" 10 #include "src/compiler/pipeline.h"
(...skipping 21 matching lines...) Expand all
32 32
33 33
34 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) { 34 std::ostream& operator<<(std::ostream& os, const CallDescriptor& d) {
35 // TODO(svenpanne) Output properties etc. and be less cryptic. 35 // TODO(svenpanne) Output properties etc. and be less cryptic.
36 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount() 36 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount()
37 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f" 37 << "j" << d.JSParameterCount() << "i" << d.InputCount() << "f"
38 << d.FrameStateCount(); 38 << d.FrameStateCount();
39 } 39 }
40 40
41 41
42 Linkage::Linkage(CompilationInfo* info) : info_(info) { 42 CallDescriptor* Linkage::ComputeIncoming(Zone* zone, CompilationInfo* info) {
43 if (info->function() != NULL) { 43 if (info->function() != NULL) {
44 // If we already have the function literal, use the number of parameters 44 // If we already have the function literal, use the number of parameters
45 // plus the receiver. 45 // plus the receiver.
46 incoming_ = GetJSCallDescriptor(1 + info->function()->parameter_count()); 46 return GetJSCallDescriptor(1 + info->function()->parameter_count(), zone);
47 } else if (!info->closure().is_null()) { 47 }
48 if (!info->closure().is_null()) {
48 // If we are compiling a JS function, use a JS call descriptor, 49 // If we are compiling a JS function, use a JS call descriptor,
49 // plus the receiver. 50 // plus the receiver.
50 SharedFunctionInfo* shared = info->closure()->shared(); 51 SharedFunctionInfo* shared = info->closure()->shared();
51 incoming_ = GetJSCallDescriptor(1 + shared->formal_parameter_count()); 52 return GetJSCallDescriptor(1 + shared->formal_parameter_count(), zone);
52 } else if (info->code_stub() != NULL) { 53 }
54 if (info->code_stub() != NULL) {
53 // Use the code stub interface descriptor. 55 // Use the code stub interface descriptor.
54 CallInterfaceDescriptor descriptor = 56 CallInterfaceDescriptor descriptor =
55 info->code_stub()->GetCallInterfaceDescriptor(); 57 info->code_stub()->GetCallInterfaceDescriptor();
56 incoming_ = GetStubCallDescriptor(descriptor); 58 return GetStubCallDescriptor(descriptor, 0, CallDescriptor::kNoFlags, zone);
57 } else {
58 incoming_ = NULL; // TODO(titzer): ?
59 } 59 }
60 return NULL; // TODO(titzer): ?
60 } 61 }
61 62
62 63
63 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, int extra) { 64 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame,
65 int extra) const {
64 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() || 66 if (frame->GetSpillSlotCount() > 0 || incoming_->IsJSFunctionCall() ||
65 incoming_->kind() == CallDescriptor::kCallAddress) { 67 incoming_->kind() == CallDescriptor::kCallAddress) {
66 int offset; 68 int offset;
67 int register_save_area_size = frame->GetRegisterSaveAreaSize(); 69 int register_save_area_size = frame->GetRegisterSaveAreaSize();
68 if (spill_slot >= 0) { 70 if (spill_slot >= 0) {
69 // Local or spill slot. Skip the frame pointer, function, and 71 // Local or spill slot. Skip the frame pointer, function, and
70 // context in the fixed part of the frame. 72 // context in the fixed part of the frame.
71 offset = 73 offset =
72 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra; 74 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra;
73 } else { 75 } else {
74 // Incoming parameter. Skip the return address. 76 // Incoming parameter. Skip the return address.
75 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize + 77 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize +
76 kPCOnStackSize + extra; 78 kPCOnStackSize + extra;
77 } 79 }
78 return FrameOffset::FromFramePointer(offset); 80 return FrameOffset::FromFramePointer(offset);
79 } else { 81 } else {
80 // No frame. Retrieve all parameters relative to stack pointer. 82 // No frame. Retrieve all parameters relative to stack pointer.
81 DCHECK(spill_slot < 0); // Must be a parameter. 83 DCHECK(spill_slot < 0); // Must be a parameter.
82 int register_save_area_size = frame->GetRegisterSaveAreaSize(); 84 int register_save_area_size = frame->GetRegisterSaveAreaSize();
83 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize + 85 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize +
84 kPCOnStackSize + extra; 86 kPCOnStackSize + extra;
85 return FrameOffset::FromStackPointer(offset); 87 return FrameOffset::FromStackPointer(offset);
86 } 88 }
87 } 89 }
88 90
89 91
90 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count) { 92 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count) const {
91 return GetJSCallDescriptor(parameter_count, this->info_->zone()); 93 return GetJSCallDescriptor(parameter_count, zone_);
92 } 94 }
93 95
94 96
95 CallDescriptor* Linkage::GetRuntimeCallDescriptor( 97 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
96 Runtime::FunctionId function, int parameter_count, 98 Runtime::FunctionId function, int parameter_count,
97 Operator::Properties properties) { 99 Operator::Properties properties) const {
98 return GetRuntimeCallDescriptor(function, parameter_count, properties, 100 return GetRuntimeCallDescriptor(function, parameter_count, properties, zone_);
99 this->info_->zone());
100 } 101 }
101 102
102 103
103 CallDescriptor* Linkage::GetStubCallDescriptor( 104 CallDescriptor* Linkage::GetStubCallDescriptor(
104 CallInterfaceDescriptor descriptor, int stack_parameter_count, 105 CallInterfaceDescriptor descriptor, int stack_parameter_count,
105 CallDescriptor::Flags flags) { 106 CallDescriptor::Flags flags) const {
106 return GetStubCallDescriptor(descriptor, stack_parameter_count, flags, 107 return GetStubCallDescriptor(descriptor, stack_parameter_count, flags, zone_);
107 this->info_->zone());
108 } 108 }
109 109
110 110
111 // static 111 // static
112 bool Linkage::NeedsFrameState(Runtime::FunctionId function) { 112 bool Linkage::NeedsFrameState(Runtime::FunctionId function) {
113 if (!FLAG_turbo_deoptimization) { 113 if (!FLAG_turbo_deoptimization) {
114 return false; 114 return false;
115 } 115 }
116 // TODO(jarin) At the moment, we only add frame state for 116 // TODO(jarin) At the moment, we only add frame state for
117 // few chosen runtime functions. 117 // few chosen runtime functions.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone, 242 CallDescriptor* Linkage::GetSimplifiedCDescriptor(Zone* zone,
243 MachineSignature* sig) { 243 MachineSignature* sig) {
244 UNIMPLEMENTED(); 244 UNIMPLEMENTED();
245 return NULL; 245 return NULL;
246 } 246 }
247 #endif // !V8_TURBOFAN_BACKEND 247 #endif // !V8_TURBOFAN_BACKEND
248 } 248 }
249 } 249 }
250 } // namespace v8::internal::compiler 250 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/linkage.h ('k') | src/compiler/mips/code-generator-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698