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

Side by Side Diff: src/compiler/fast-accessor-assembler.cc

Issue 1748123003: Rework CallApi*Stubs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor fixes and make Win compiler happy. Created 4 years, 9 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/code-stubs.h ('k') | src/crankshaft/hydrogen.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/fast-accessor-assembler.h" 5 #include "src/compiler/fast-accessor-assembler.h"
6 6
7 #include "src/base/logging.h" 7 #include "src/base/logging.h"
8 #include "src/code-stubs.h" // For CallApiFunctionStub. 8 #include "src/code-stubs.h" // For CallApiCallbackStub.
9 #include "src/compiler/graph.h" 9 #include "src/compiler/graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
11 #include "src/compiler/pipeline.h" 11 #include "src/compiler/pipeline.h"
12 #include "src/compiler/raw-machine-assembler.h" 12 #include "src/compiler/raw-machine-assembler.h"
13 #include "src/compiler/schedule.h" 13 #include "src/compiler/schedule.h"
14 #include "src/compiler/verifier.h" 14 #include "src/compiler/verifier.h"
15 #include "src/handles-inl.h" 15 #include "src/handles-inl.h"
16 #include "src/objects.h" // For FAA::GetInternalField impl. 16 #include "src/objects.h" // For FAA::GetInternalField impl.
17 17
18 namespace v8 { 18 namespace v8 {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 assembler_->IntPtrEqual(FromId(value_id), assembler_->IntPtrConstant(0)), 165 assembler_->IntPtrEqual(FromId(value_id), assembler_->IntPtrConstant(0)),
166 &pass, FromId(label_id)); 166 &pass, FromId(label_id));
167 assembler_->Bind(&pass); 167 assembler_->Bind(&pass);
168 } 168 }
169 169
170 FastAccessorAssembler::ValueId FastAccessorAssembler::Call( 170 FastAccessorAssembler::ValueId FastAccessorAssembler::Call(
171 FunctionCallback callback_function, ValueId arg) { 171 FunctionCallback callback_function, ValueId arg) {
172 CHECK_EQ(kBuilding, state_); 172 CHECK_EQ(kBuilding, state_);
173 173
174 // Create API function stub. 174 // Create API function stub.
175 CallApiFunctionStub stub(assembler_->isolate(), true); 175 CallApiCallbackStub stub(assembler_->isolate(), 1, true);
176 DCHECK_EQ(1, stub.GetCallInterfaceDescriptor().GetStackParameterCount());
176 177
177 // Wrap the FunctionCallback in an ExternalReference. 178 // Wrap the FunctionCallback in an ExternalReference.
178 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); 179 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function));
179 ExternalReference callback(&callback_api_function, 180 ExternalReference callback(&callback_api_function,
180 ExternalReference::DIRECT_API_CALL, 181 ExternalReference::DIRECT_API_CALL,
181 assembler_->isolate()); 182 assembler_->isolate());
182 183
183 // The stub has 5 parameters, and kJSParam (here: 1) parameters to pass 184 // The stub has 6 parameters.
184 // through to the callback. 185 // See: ApiCallbackDescriptorBase::BuildCallInterfaceDescriptorFunctionType
185 // See: ApiFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType
186 static const int kStackParam = 1;
187 Node* args[] = { 186 Node* args[] = {
188 // Stub/register parameters: 187 // Stub/register parameters:
189 assembler_->Parameter(0), /* receiver (use accessor's) */ 188 assembler_->Parameter(0), /* receiver (use accessor's) */
190 assembler_->UndefinedConstant(), /* call_data (undefined) */ 189 assembler_->UndefinedConstant(), /* call_data (undefined) */
191 assembler_->NullConstant(), /* holder (null) */ 190 assembler_->NullConstant(), /* holder (null) */
192 assembler_->ExternalConstant(callback), /* API callback function */ 191 assembler_->ExternalConstant(callback), /* API callback function */
193 assembler_->IntPtrConstant(kStackParam), /* # JS arguments */
194 192
195 // kStackParam stack parameter(s): 193 // JS arguments, on stack:
196 FromId(arg), 194 FromId(arg),
197 195
198 // Context parameter. (See Linkage::GetStubCallDescriptor.) 196 // Context parameter. (See Linkage::GetStubCallDescriptor.)
199 assembler_->UndefinedConstant()}; 197 assembler_->UndefinedConstant()};
danno 2016/03/09 10:23:38 It might be slightly more efficient to pass Smi(0)
vogelheim 2016/03/09 11:09:35 Ack. But: The point of this CL is to enable moving
200 CHECK_EQ(5 + kStackParam + 1, arraysize(args)); 198 DCHECK_EQ(arraysize(args),
199 1 + stub.GetCallInterfaceDescriptor().GetParameterCount());
201 200
202 Node* call = assembler_->CallN( 201 Node* call = assembler_->CallN(
203 Linkage::GetStubCallDescriptor( 202 Linkage::GetStubCallDescriptor(
204 assembler_->isolate(), zone(), stub.GetCallInterfaceDescriptor(), 203 assembler_->isolate(), zone(), stub.GetCallInterfaceDescriptor(),
205 kStackParam + stub.GetStackParameterCount(), 204 stub.GetStackParameterCount(), CallDescriptor::kNoFlags),
206 CallDescriptor::kNoFlags),
207 assembler_->HeapConstant(stub.GetCode()), args); 205 assembler_->HeapConstant(stub.GetCode()), args);
208 return FromRaw(call); 206 return FromRaw(call);
209 } 207 }
210 208
211 MaybeHandle<Code> FastAccessorAssembler::Build() { 209 MaybeHandle<Code> FastAccessorAssembler::Build() {
212 CHECK_EQ(kBuilding, state_); 210 CHECK_EQ(kBuilding, state_);
213 211
214 // Cleanup: We no longer need this. 212 // Cleanup: We no longer need this.
215 nodes_.clear(); 213 nodes_.clear();
216 labels_.clear(); 214 labels_.clear();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 RawMachineLabel* FastAccessorAssembler::FromId(LabelId label) const { 251 RawMachineLabel* FastAccessorAssembler::FromId(LabelId label) const {
254 CHECK_LT(label.label_id, labels_.size()); 252 CHECK_LT(label.label_id, labels_.size());
255 CHECK_NOT_NULL(labels_.at(label.label_id)); 253 CHECK_NOT_NULL(labels_.at(label.label_id));
256 return labels_.at(label.label_id); 254 return labels_.at(label.label_id);
257 } 255 }
258 256
259 257
260 } // namespace compiler 258 } // namespace compiler
261 } // namespace internal 259 } // namespace internal
262 } // namespace v8 260 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/crankshaft/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698