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

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

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/compiler/linkage.h"
6
7 #include "src/code-stubs.h"
8 #include "src/compiler.h"
9 #include "src/compiler/node.h"
10 #include "src/compiler/pipeline.h"
11 #include "src/scopes.h"
12
13 namespace v8 {
14 namespace internal {
15 namespace compiler {
16
17
18 OStream& operator<<(OStream& os, const CallDescriptor::Kind& k) {
19 switch (k) {
20 case CallDescriptor::kCallCodeObject:
21 os << "Code";
22 break;
23 case CallDescriptor::kCallJSFunction:
24 os << "JS";
25 break;
26 case CallDescriptor::kCallAddress:
27 os << "Addr";
28 break;
29 }
30 return os;
31 }
32
33
34 OStream& operator<<(OStream& os, const CallDescriptor& d) {
35 // TODO(svenpanne) Output properties etc. and be less cryptic.
36 return os << d.kind() << ":" << d.debug_name() << ":r" << d.ReturnCount()
37 << "p" << d.ParameterCount() << "i" << d.InputCount()
38 << (d.CanLazilyDeoptimize() ? "deopt" : "");
39 }
40
41
42 Linkage::Linkage(CompilationInfo* info) : info_(info) {
43 if (info->function() != NULL) {
44 // If we already have the function literal, use the number of parameters
45 // plus the receiver.
46 incoming_ = GetJSCallDescriptor(1 + info->function()->parameter_count());
47 } else if (!info->closure().is_null()) {
48 // If we are compiling a JS function, use a JS call descriptor,
49 // plus the receiver.
50 SharedFunctionInfo* shared = info->closure()->shared();
51 incoming_ = GetJSCallDescriptor(1 + shared->formal_parameter_count());
52 } else if (info->code_stub() != NULL) {
53 // Use the code stub interface descriptor.
54 HydrogenCodeStub* stub = info->code_stub();
55 CodeStubInterfaceDescriptor* descriptor =
56 info_->isolate()->code_stub_interface_descriptor(stub->MajorKey());
57 incoming_ = GetStubCallDescriptor(descriptor);
58 } else {
59 incoming_ = NULL; // TODO(titzer): ?
60 }
61 }
62
63
64 FrameOffset Linkage::GetFrameOffset(int spill_slot, Frame* frame, int extra) {
65 if (frame->GetSpillSlotCount() > 0 ||
66 incoming_->IsJSFunctionCall() ||
67 incoming_->kind() == CallDescriptor::kCallAddress) {
68 int offset;
69 int register_save_area_size = frame->GetRegisterSaveAreaSize();
70 if (spill_slot >= 0) {
71 // Local or spill slot. Skip the frame pointer, function, and
72 // context in the fixed part of the frame.
73 offset =
74 -(spill_slot + 1) * kPointerSize - register_save_area_size + extra;
75 } else {
76 // Incoming parameter. Skip the return address.
77 offset = -(spill_slot + 1) * kPointerSize + kFPOnStackSize +
78 kPCOnStackSize + extra;
79 }
80 return FrameOffset::FromFramePointer(offset);
81 } else {
82 // No frame. Retrieve all parameters relative to stack pointer.
83 ASSERT(spill_slot < 0); // Must be a parameter.
84 int register_save_area_size = frame->GetRegisterSaveAreaSize();
85 int offset = register_save_area_size - (spill_slot + 1) * kPointerSize +
86 kPCOnStackSize + extra;
87 return FrameOffset::FromStackPointer(offset);
88 }
89 }
90
91
92 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count) {
93 return GetJSCallDescriptor(parameter_count, this->info_->zone());
94 }
95
96
97 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
98 Runtime::FunctionId function, int parameter_count,
99 Operator::Property properties,
100 CallDescriptor::DeoptimizationSupport can_deoptimize) {
101 return GetRuntimeCallDescriptor(function, parameter_count, properties,
102 can_deoptimize, this->info_->zone());
103 }
104
105
106 //==============================================================================
107 // Provide unimplemented methods on unsupported architectures, to at least link.
108 //==============================================================================
109 #if !V8_TURBOFAN_TARGET
110 CallDescriptor* Linkage::GetJSCallDescriptor(int parameter_count, Zone* zone) {
111 UNIMPLEMENTED();
112 return NULL;
113 }
114
115
116 CallDescriptor* Linkage::GetRuntimeCallDescriptor(
117 Runtime::FunctionId function, int parameter_count,
118 Operator::Property properties,
119 CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
120 UNIMPLEMENTED();
121 return NULL;
122 }
123
124
125 CallDescriptor* Linkage::GetStubCallDescriptor(
126 CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count) {
127 UNIMPLEMENTED();
128 return NULL;
129 }
130
131
132 CallDescriptor* Linkage::GetSimplifiedCDescriptor(
133 Zone* zone,
134 int num_params,
135 MachineRepresentation return_type,
136 MachineRepresentation* param_types) {
137 UNIMPLEMENTED();
138 return NULL;
139 }
140 #endif // !V8_TURBOFAN_TARGET
141
142 } } } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/linkage.h ('k') | src/compiler/linkage-impl.h » ('j') | src/lithium-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698