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

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

Issue 2143983002: Fix context for fast accessors (lazy). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/crankshaft/hydrogen.cc ('k') | no next file » | 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/fast-accessor-assembler.h" 5 #include "src/fast-accessor-assembler.h"
6 6
7 #include "src/base/logging.h" 7 #include "src/base/logging.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/code-stubs.h" // For CallApiCallbackStub. 9 #include "src/code-stubs.h" // For CallApiCallbackStub.
10 #include "src/handles-inl.h" 10 #include "src/handles-inl.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 FastAccessorAssembler::ValueId FastAccessorAssembler::Call( 161 FastAccessorAssembler::ValueId FastAccessorAssembler::Call(
162 FunctionCallback callback_function, ValueId arg) { 162 FunctionCallback callback_function, ValueId arg) {
163 CHECK_EQ(kBuilding, state_); 163 CHECK_EQ(kBuilding, state_);
164 164
165 // Wrap the FunctionCallback in an ExternalReference. 165 // Wrap the FunctionCallback in an ExternalReference.
166 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function)); 166 ApiFunction callback_api_function(FUNCTION_ADDR(callback_function));
167 ExternalReference callback(&callback_api_function, 167 ExternalReference callback(&callback_api_function,
168 ExternalReference::DIRECT_API_CALL, isolate()); 168 ExternalReference::DIRECT_API_CALL, isolate());
169 169
170 // Create & call API callback via stub. 170 // Create & call API callback via stub.
171 CallApiCallbackStub stub(isolate(), 1, true); 171 CallApiCallbackStub stub(isolate(), 1, true, true);
172 DCHECK_EQ(5, stub.GetCallInterfaceDescriptor().GetParameterCount()); 172 DCHECK_EQ(5, stub.GetCallInterfaceDescriptor().GetParameterCount());
173 DCHECK_EQ(1, stub.GetCallInterfaceDescriptor().GetStackParameterCount()); 173 DCHECK_EQ(1, stub.GetCallInterfaceDescriptor().GetStackParameterCount());
174 // TODO(vogelheim): There is currently no clean way to retrieve the context 174 // TODO(vogelheim): There is currently no clean way to retrieve the context
175 // parameter for a stub and the implementation details are hidden in 175 // parameter for a stub and the implementation details are hidden in
176 // compiler/*. The context_paramter is computed as: 176 // compiler/*. The context_paramter is computed as:
177 // Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount()) 177 // Linkage::GetJSCallContextParamIndex(descriptor->JSParameterCount())
178 const int context_parameter = 2; 178 const int context_parameter = 3;
179 Node* call = assembler_->CallStub( 179 Node* call = assembler_->CallStub(
180 stub.GetCallInterfaceDescriptor(), 180 stub.GetCallInterfaceDescriptor(),
181 assembler_->HeapConstant(stub.GetCode()), 181 assembler_->HeapConstant(stub.GetCode()),
182 assembler_->Parameter(context_parameter), 182 assembler_->Parameter(context_parameter),
183 183
184 // Stub/register parameters: 184 // Stub/register parameters:
185 assembler_->Parameter(0), /* receiver (use accessor's) */ 185 assembler_->UndefinedConstant(), /* callee (there's no JSFunction) */
186 assembler_->UndefinedConstant(), /* call_data (undefined) */ 186 assembler_->UndefinedConstant(), /* call_data (undefined) */
187 assembler_->NullConstant(), /* holder (null) */ 187 assembler_->Parameter(0), /* receiver (same as holder in this case) */
188 assembler_->ExternalConstant(callback), /* API callback function */ 188 assembler_->ExternalConstant(callback), /* API callback function */
189 189
190 // JS arguments, on stack: 190 // JS arguments, on stack:
191 FromId(arg)); 191 FromId(arg));
192 192
193 return FromRaw(call); 193 return FromRaw(call);
194 } 194 }
195 195
196 MaybeHandle<Code> FastAccessorAssembler::Build() { 196 MaybeHandle<Code> FastAccessorAssembler::Build() {
197 CHECK_EQ(kBuilding, state_); 197 CHECK_EQ(kBuilding, state_);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void FastAccessorAssembler::Clear() { 229 void FastAccessorAssembler::Clear() {
230 for (auto label : labels_) { 230 for (auto label : labels_) {
231 delete label; 231 delete label;
232 } 232 }
233 nodes_.clear(); 233 nodes_.clear();
234 labels_.clear(); 234 labels_.clear();
235 } 235 }
236 236
237 } // namespace internal 237 } // namespace internal
238 } // namespace v8 238 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698