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

Side by Side Diff: src/ic/handler-compiler.cc

Issue 885763004: follow up named interceptor miss with api callback getter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | 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 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/ic/call-optimization.h" 7 #include "src/ic/call-optimization.h"
8 #include "src/ic/handler-compiler.h" 8 #include "src/ic/handler-compiler.h"
9 #include "src/ic/ic.h" 9 #include "src/ic/ic.h"
10 #include "src/ic/ic-inl.h" 10 #include "src/ic/ic-inl.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 case LookupIterator::INTERCEPTOR: 282 case LookupIterator::INTERCEPTOR:
283 case LookupIterator::JSPROXY: 283 case LookupIterator::JSPROXY:
284 case LookupIterator::NOT_FOUND: 284 case LookupIterator::NOT_FOUND:
285 break; 285 break;
286 case LookupIterator::DATA: 286 case LookupIterator::DATA:
287 inline_followup = 287 inline_followup =
288 it->property_details().type() == DATA && !it->is_dictionary_holder(); 288 it->property_details().type() == DATA && !it->is_dictionary_holder();
289 break; 289 break;
290 case LookupIterator::ACCESSOR: { 290 case LookupIterator::ACCESSOR: {
291 Handle<Object> accessors = it->GetAccessors(); 291 Handle<Object> accessors = it->GetAccessors();
292 inline_followup = accessors->IsExecutableAccessorInfo(); 292 if (accessors->IsExecutableAccessorInfo()) {
293 if (!inline_followup) break; 293 Handle<ExecutableAccessorInfo> info =
294 Handle<ExecutableAccessorInfo> info = 294 Handle<ExecutableAccessorInfo>::cast(accessors);
295 Handle<ExecutableAccessorInfo>::cast(accessors); 295 inline_followup = info->getter() != NULL &&
296 inline_followup = info->getter() != NULL && 296 ExecutableAccessorInfo::IsCompatibleReceiverType(
297 ExecutableAccessorInfo::IsCompatibleReceiverType( 297 isolate(), info, type());
298 isolate(), info, type()); 298 } else if (accessors->IsAccessorPair()) {
299 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
300 isolate());
301 if (!getter->IsJSFunction()) break;
302 if (!holder()->HasFastProperties()) break;
Toon Verwaest 2015/02/02 12:40:55 it->GetHolder<JSObject>
303 auto function = Handle<JSFunction>::cast(getter);
304 CallOptimization call_optimization(function);
305 inline_followup =
306 call_optimization.is_simple_api_call() &&
307 call_optimization.IsCompatibleReceiver(type(), holder());
Toon Verwaest 2015/02/02 12:40:55 Same here.
308 }
299 } 309 }
300 } 310 }
301 311
302 Label miss; 312 Label miss;
303 InterceptorVectorSlotPush(receiver()); 313 InterceptorVectorSlotPush(receiver());
304 Register reg = FrontendHeader(receiver(), it->name(), &miss); 314 Register reg = FrontendHeader(receiver(), it->name(), &miss);
305 FrontendFooter(it->name(), &miss); 315 FrontendFooter(it->name(), &miss);
306 InterceptorVectorSlotPop(reg); 316 InterceptorVectorSlotPop(reg);
307 317
308 if (inline_followup) { 318 if (inline_followup) {
(...skipping 29 matching lines...) Expand all
338 case LookupIterator::TRANSITION: 348 case LookupIterator::TRANSITION:
339 UNREACHABLE(); 349 UNREACHABLE();
340 case LookupIterator::DATA: { 350 case LookupIterator::DATA: {
341 DCHECK_EQ(DATA, it->property_details().type()); 351 DCHECK_EQ(DATA, it->property_details().type());
342 __ Move(receiver(), reg); 352 __ Move(receiver(), reg);
343 LoadFieldStub stub(isolate(), it->GetFieldIndex()); 353 LoadFieldStub stub(isolate(), it->GetFieldIndex());
344 GenerateTailCall(masm(), stub.GetCode()); 354 GenerateTailCall(masm(), stub.GetCode());
345 break; 355 break;
346 } 356 }
347 case LookupIterator::ACCESSOR: 357 case LookupIterator::ACCESSOR:
348 Handle<ExecutableAccessorInfo> info = 358 if (it->GetAccessors()->IsExecutableAccessorInfo()) {
349 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors()); 359 Handle<ExecutableAccessorInfo> info =
350 DCHECK_NOT_NULL(info->getter()); 360 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors());
351 GenerateLoadCallback(reg, info); 361 DCHECK_NOT_NULL(info->getter());
362 GenerateLoadCallback(reg, info);
363 } else {
364 auto function = handle(JSFunction::cast(
365 AccessorPair::cast(*it->GetAccessors())->getter()));
366 CallOptimization call_optimization(function);
367 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
368 GenerateApiAccessorCall(masm(), call_optimization, receiver_map,
369 receiver(), scratch2(), false, no_reg, reg,
370 it->GetAccessorIndex());
371 }
352 } 372 }
353 } 373 }
354 374
355 375
356 Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter( 376 Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter(
357 Handle<Name> name, int accessor_index, int expected_arguments) { 377 Handle<Name> name, int accessor_index, int expected_arguments) {
358 Register holder = Frontend(name); 378 Register holder = Frontend(name);
359 GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index, 379 GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index,
360 expected_arguments, scratch2()); 380 expected_arguments, scratch2());
361 return GetCode(kind(), Code::FAST, name); 381 return GetCode(kind(), Code::FAST, name);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 DCHECK(elements_kind == DICTIONARY_ELEMENTS); 513 DCHECK(elements_kind == DICTIONARY_ELEMENTS);
494 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); 514 cached_stub = LoadDictionaryElementStub(isolate()).GetCode();
495 } 515 }
496 } 516 }
497 517
498 handlers->Add(cached_stub); 518 handlers->Add(cached_stub);
499 } 519 }
500 } 520 }
501 } 521 }
502 } // namespace v8::internal 522 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698