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

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 | « src/ic/call-optimization.cc ('k') | test/cctest/test-api.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/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<JSObject> property_holder(it->GetHolder<JSObject>());
300 Handle<Object> getter(Handle<AccessorPair>::cast(accessors)->getter(),
301 isolate());
302 if (!getter->IsJSFunction()) break;
303 if (!property_holder->HasFastProperties()) break;
304 auto function = Handle<JSFunction>::cast(getter);
305 CallOptimization call_optimization(function);
306 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
307 inline_followup = call_optimization.is_simple_api_call() &&
308 call_optimization.IsCompatibleReceiverType(
309 receiver_map, property_holder);
310 }
299 } 311 }
300 } 312 }
301 313
302 Label miss; 314 Label miss;
303 InterceptorVectorSlotPush(receiver()); 315 InterceptorVectorSlotPush(receiver());
304 Register reg = FrontendHeader(receiver(), it->name(), &miss); 316 Register reg = FrontendHeader(receiver(), it->name(), &miss);
305 FrontendFooter(it->name(), &miss); 317 FrontendFooter(it->name(), &miss);
306 InterceptorVectorSlotPop(reg); 318 InterceptorVectorSlotPop(reg);
307 319
308 if (inline_followup) { 320 if (inline_followup) {
(...skipping 29 matching lines...) Expand all
338 case LookupIterator::TRANSITION: 350 case LookupIterator::TRANSITION:
339 UNREACHABLE(); 351 UNREACHABLE();
340 case LookupIterator::DATA: { 352 case LookupIterator::DATA: {
341 DCHECK_EQ(DATA, it->property_details().type()); 353 DCHECK_EQ(DATA, it->property_details().type());
342 __ Move(receiver(), reg); 354 __ Move(receiver(), reg);
343 LoadFieldStub stub(isolate(), it->GetFieldIndex()); 355 LoadFieldStub stub(isolate(), it->GetFieldIndex());
344 GenerateTailCall(masm(), stub.GetCode()); 356 GenerateTailCall(masm(), stub.GetCode());
345 break; 357 break;
346 } 358 }
347 case LookupIterator::ACCESSOR: 359 case LookupIterator::ACCESSOR:
348 Handle<ExecutableAccessorInfo> info = 360 if (it->GetAccessors()->IsExecutableAccessorInfo()) {
349 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors()); 361 Handle<ExecutableAccessorInfo> info =
350 DCHECK_NOT_NULL(info->getter()); 362 Handle<ExecutableAccessorInfo>::cast(it->GetAccessors());
351 GenerateLoadCallback(reg, info); 363 DCHECK_NOT_NULL(info->getter());
364 GenerateLoadCallback(reg, info);
365 } else {
366 auto function = handle(JSFunction::cast(
367 AccessorPair::cast(*it->GetAccessors())->getter()));
368 CallOptimization call_optimization(function);
369 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate());
370 GenerateApiAccessorCall(masm(), call_optimization, receiver_map,
371 receiver(), scratch2(), false, no_reg, reg,
372 it->GetAccessorIndex());
373 }
352 } 374 }
353 } 375 }
354 376
355 377
356 Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter( 378 Handle<Code> NamedLoadHandlerCompiler::CompileLoadViaGetter(
357 Handle<Name> name, int accessor_index, int expected_arguments) { 379 Handle<Name> name, int accessor_index, int expected_arguments) {
358 Register holder = Frontend(name); 380 Register holder = Frontend(name);
359 GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index, 381 GenerateLoadViaGetter(masm(), type(), receiver(), holder, accessor_index,
360 expected_arguments, scratch2()); 382 expected_arguments, scratch2());
361 return GetCode(kind(), Code::FAST, name); 383 return GetCode(kind(), Code::FAST, name);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 DCHECK(elements_kind == DICTIONARY_ELEMENTS); 515 DCHECK(elements_kind == DICTIONARY_ELEMENTS);
494 cached_stub = LoadDictionaryElementStub(isolate()).GetCode(); 516 cached_stub = LoadDictionaryElementStub(isolate()).GetCode();
495 } 517 }
496 } 518 }
497 519
498 handlers->Add(cached_stub); 520 handlers->Add(cached_stub);
499 } 521 }
500 } 522 }
501 } 523 }
502 } // namespace v8::internal 524 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic/call-optimization.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698