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

Side by Side Diff: src/stub-cache.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/stub-cache.h ('k') | src/symbol.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // prototype cannot hold multiple handlers, one for each of the string maps, 140 // prototype cannot hold multiple handlers, one for each of the string maps,
141 // for a single name. Hence, turn off caching of the IC. 141 // for a single name. Hence, turn off caching of the IC.
142 bool can_be_cached = !type->Is(Type::String()); 142 bool can_be_cached = !type->Is(Type::String());
143 if (can_be_cached) { 143 if (can_be_cached) {
144 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); 144 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate());
145 ic = FindIC(name, stub_holder, kind, extra_ic_state, flag); 145 ic = FindIC(name, stub_holder, kind, extra_ic_state, flag);
146 if (!ic.is_null()) return ic; 146 if (!ic.is_null()) return ic;
147 } 147 }
148 148
149 if (kind == Code::LOAD_IC) { 149 if (kind == Code::LOAD_IC) {
150 LoadStubCompiler ic_compiler(isolate(), flag); 150 LoadStubCompiler ic_compiler(isolate(), extra_ic_state, flag);
151 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 151 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
152 } else if (kind == Code::KEYED_LOAD_IC) { 152 } else if (kind == Code::KEYED_LOAD_IC) {
153 KeyedLoadStubCompiler ic_compiler(isolate(), flag); 153 KeyedLoadStubCompiler ic_compiler(isolate(), extra_ic_state, flag);
154 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 154 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
155 } else if (kind == Code::STORE_IC) { 155 } else if (kind == Code::STORE_IC) {
156 StoreStubCompiler ic_compiler(isolate(), extra_ic_state); 156 StoreStubCompiler ic_compiler(isolate(), extra_ic_state);
157 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 157 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
158 } else { 158 } else {
159 ASSERT(kind == Code::KEYED_STORE_IC); 159 ASSERT(kind == Code::KEYED_STORE_IC);
160 ASSERT(STANDARD_STORE == 160 ASSERT(STANDARD_STORE ==
161 KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state)); 161 KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state));
162 KeyedStoreStubCompiler ic_compiler(isolate(), extra_ic_state); 162 KeyedStoreStubCompiler ic_compiler(isolate(), extra_ic_state);
163 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); 163 ic = ic_compiler.CompileMonomorphicIC(type, handler, name);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 static void FillCache(Isolate* isolate, Handle<Code> code) { 412 static void FillCache(Isolate* isolate, Handle<Code> code) {
413 Handle<UnseededNumberDictionary> dictionary = 413 Handle<UnseededNumberDictionary> dictionary =
414 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), 414 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(),
415 code->flags(), 415 code->flags(),
416 code); 416 code);
417 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); 417 isolate->heap()->public_set_non_monomorphic_cache(*dictionary);
418 } 418 }
419 419
420 420
421 Code* StubCache::FindCallInitialize(int argc, 421 Code* StubCache::FindCallInitialize(int argc,
422 RelocInfo::Mode mode, 422 ContextualMode mode,
423 Code::Kind kind) { 423 Code::Kind kind) {
424 ExtraICState extra_state = 424 ExtraICState extra_state =
425 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | 425 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) |
426 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT 426 CallICBase::Contextual::encode(mode);
427 ? CONTEXTUAL : NOT_CONTEXTUAL);
428 Code::Flags flags = 427 Code::Flags flags =
429 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); 428 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
430 UnseededNumberDictionary* dictionary = 429 UnseededNumberDictionary* dictionary =
431 isolate()->heap()->non_monomorphic_cache(); 430 isolate()->heap()->non_monomorphic_cache();
432 int entry = dictionary->FindEntry(isolate(), flags); 431 int entry = dictionary->FindEntry(isolate(), flags);
433 ASSERT(entry != -1); 432 ASSERT(entry != -1);
434 Object* code = dictionary->ValueAt(entry); 433 Object* code = dictionary->ValueAt(entry);
435 // This might be called during the marking phase of the collector 434 // This might be called during the marking phase of the collector
436 // hence the unchecked cast. 435 // hence the unchecked cast.
437 return reinterpret_cast<Code*>(code); 436 return reinterpret_cast<Code*>(code);
438 } 437 }
439 438
440 439
440 Code* StubCache::FindPreMonomorphicIC(Code::Kind kind, ExtraICState state) {
441 Code::Flags flags = Code::ComputeFlags(kind, PREMONOMORPHIC, state);
442 UnseededNumberDictionary* dictionary =
443 isolate()->heap()->non_monomorphic_cache();
444 int entry = dictionary->FindEntry(isolate(), flags);
445 ASSERT(entry != -1);
446 Object* code = dictionary->ValueAt(entry);
447 // This might be called during the marking phase of the collector
448 // hence the unchecked cast.
449 return reinterpret_cast<Code*>(code);
450 }
451
452
441 Handle<Code> StubCache::ComputeCallInitialize(int argc, 453 Handle<Code> StubCache::ComputeCallInitialize(int argc,
442 RelocInfo::Mode mode, 454 ContextualMode mode,
443 Code::Kind kind) { 455 Code::Kind kind) {
444 ExtraICState extra_state = 456 ExtraICState extra_state =
445 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | 457 CallICBase::ComputeExtraICState(mode, DEFAULT_STRING_STUB);
446 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT
447 ? CONTEXTUAL : NOT_CONTEXTUAL);
448 Code::Flags flags = 458 Code::Flags flags =
449 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); 459 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc);
450 Handle<UnseededNumberDictionary> cache = 460 Handle<UnseededNumberDictionary> cache =
451 isolate_->factory()->non_monomorphic_cache(); 461 isolate_->factory()->non_monomorphic_cache();
452 int entry = cache->FindEntry(isolate_, flags); 462 int entry = cache->FindEntry(isolate_, flags);
453 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); 463 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
454 464
455 StubCompiler compiler(isolate_); 465 StubCompiler compiler(isolate_);
456 Handle<Code> code = compiler.CompileCallInitialize(flags); 466 Handle<Code> code = compiler.CompileCallInitialize(flags);
457 FillCache(isolate_, code); 467 FillCache(isolate_, code);
458 return code; 468 return code;
459 } 469 }
460 470
461 471
462 Handle<Code> StubCache::ComputeCallInitialize(int argc, RelocInfo::Mode mode) { 472 Handle<Code> StubCache::ComputeCallInitialize(int argc, ContextualMode mode) {
463 return ComputeCallInitialize(argc, mode, Code::CALL_IC); 473 return ComputeCallInitialize(argc, mode, Code::CALL_IC);
464 } 474 }
465 475
466 476
467 Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) { 477 Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) {
468 return ComputeCallInitialize(argc, RelocInfo::CODE_TARGET, 478 return ComputeCallInitialize(argc, NOT_CONTEXTUAL, Code::KEYED_CALL_IC);
469 Code::KEYED_CALL_IC);
470 } 479 }
471 480
472 481
473 Handle<Code> StubCache::ComputeCallPreMonomorphic( 482 Handle<Code> StubCache::ComputeCallPreMonomorphic(
474 int argc, 483 int argc,
475 Code::Kind kind, 484 Code::Kind kind,
476 ExtraICState extra_state) { 485 ExtraICState extra_state) {
477 Code::Flags flags = 486 Code::Flags flags =
478 Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, Code::NORMAL, argc); 487 Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, Code::NORMAL, argc);
479 Handle<UnseededNumberDictionary> cache = 488 Handle<UnseededNumberDictionary> cache =
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 int entry = cache->FindEntry(isolate_, flags); 542 int entry = cache->FindEntry(isolate_, flags);
534 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); 543 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
535 544
536 StubCompiler compiler(isolate_); 545 StubCompiler compiler(isolate_);
537 Handle<Code> code = compiler.CompileCallMegamorphic(flags); 546 Handle<Code> code = compiler.CompileCallMegamorphic(flags);
538 FillCache(isolate_, code); 547 FillCache(isolate_, code);
539 return code; 548 return code;
540 } 549 }
541 550
542 551
552 Handle<Code> StubCache::ComputeLoad(InlineCacheState ic_state,
553 ExtraICState extra_state) {
554 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, ic_state, extra_state);
555 Handle<UnseededNumberDictionary> cache =
556 isolate_->factory()->non_monomorphic_cache();
557 int entry = cache->FindEntry(isolate_, flags);
558 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
559
560 StubCompiler compiler(isolate_);
561 Handle<Code> code;
562 if (ic_state == UNINITIALIZED) {
563 code = compiler.CompileLoadInitialize(flags);
564 } else if (ic_state == PREMONOMORPHIC) {
565 code = compiler.CompileLoadPreMonomorphic(flags);
566 } else if (ic_state == MEGAMORPHIC) {
567 code = compiler.CompileLoadMegamorphic(flags);
568 } else {
569 UNREACHABLE();
570 }
571 FillCache(isolate_, code);
572 return code;
573 }
574
575
576 Handle<Code> StubCache::ComputeStore(InlineCacheState ic_state,
577 ExtraICState extra_state) {
578 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, ic_state, extra_state);
579 Handle<UnseededNumberDictionary> cache =
580 isolate_->factory()->non_monomorphic_cache();
581 int entry = cache->FindEntry(isolate_, flags);
582 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry)));
583
584 StubCompiler compiler(isolate_);
585 Handle<Code> code;
586 if (ic_state == UNINITIALIZED) {
587 code = compiler.CompileStoreInitialize(flags);
588 } else if (ic_state == PREMONOMORPHIC) {
589 code = compiler.CompileStorePreMonomorphic(flags);
590 } else if (ic_state == GENERIC) {
591 code = compiler.CompileStoreGeneric(flags);
592 } else if (ic_state == MEGAMORPHIC) {
593 code = compiler.CompileStoreMegamorphic(flags);
594 } else {
595 UNREACHABLE();
596 }
597
598 FillCache(isolate_, code);
599 return code;
600 }
601
602
543 Handle<Code> StubCache::ComputeCallMiss(int argc, 603 Handle<Code> StubCache::ComputeCallMiss(int argc,
544 Code::Kind kind, 604 Code::Kind kind,
545 ExtraICState extra_state) { 605 ExtraICState extra_state) {
546 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs 606 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs
547 // and monomorphic stubs are not mixed up together in the stub cache. 607 // and monomorphic stubs are not mixed up together in the stub cache.
548 Code::Flags flags = 608 Code::Flags flags =
549 Code::ComputeFlags(kind, MONOMORPHIC_PROTOTYPE_FAILURE, extra_state, 609 Code::ComputeFlags(kind, MONOMORPHIC_PROTOTYPE_FAILURE, extra_state,
550 Code::NORMAL, argc, OWN_MAP); 610 Code::NORMAL, argc, OWN_MAP);
551 Handle<UnseededNumberDictionary> cache = 611 Handle<UnseededNumberDictionary> cache =
552 isolate_->factory()->non_monomorphic_cache(); 612 isolate_->factory()->non_monomorphic_cache();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 Handle<Code> StubCache::ComputeLoadElementPolymorphic( 644 Handle<Code> StubCache::ComputeLoadElementPolymorphic(
585 MapHandleList* receiver_maps) { 645 MapHandleList* receiver_maps) {
586 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC); 646 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
587 Handle<PolymorphicCodeCache> cache = 647 Handle<PolymorphicCodeCache> cache =
588 isolate_->factory()->polymorphic_code_cache(); 648 isolate_->factory()->polymorphic_code_cache();
589 Handle<Object> probe = cache->Lookup(receiver_maps, flags); 649 Handle<Object> probe = cache->Lookup(receiver_maps, flags);
590 if (probe->IsCode()) return Handle<Code>::cast(probe); 650 if (probe->IsCode()) return Handle<Code>::cast(probe);
591 651
592 TypeHandleList types(receiver_maps->length()); 652 TypeHandleList types(receiver_maps->length());
593 for (int i = 0; i < receiver_maps->length(); i++) { 653 for (int i = 0; i < receiver_maps->length(); i++) {
594 types.Add(handle(Type::Class(receiver_maps->at(i)), isolate())); 654 types.Add(Type::Class(receiver_maps->at(i), isolate()));
595 } 655 }
596 CodeHandleList handlers(receiver_maps->length()); 656 CodeHandleList handlers(receiver_maps->length());
597 KeyedLoadStubCompiler compiler(isolate_); 657 KeyedLoadStubCompiler compiler(isolate_);
598 compiler.CompileElementHandlers(receiver_maps, &handlers); 658 compiler.CompileElementHandlers(receiver_maps, &handlers);
599 Handle<Code> code = compiler.CompilePolymorphicIC( 659 Handle<Code> code = compiler.CompilePolymorphicIC(
600 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT); 660 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT);
601 661
602 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); 662 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment();
603 663
604 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); 664 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
605 return code; 665 return code;
606 } 666 }
607 667
608 668
609 Handle<Code> StubCache::ComputePolymorphicIC( 669 Handle<Code> StubCache::ComputePolymorphicIC(
610 TypeHandleList* types, 670 TypeHandleList* types,
611 CodeHandleList* handlers, 671 CodeHandleList* handlers,
612 int number_of_valid_types, 672 int number_of_valid_types,
613 Handle<Name> name, 673 Handle<Name> name,
614 ExtraICState extra_ic_state) { 674 ExtraICState extra_ic_state) {
615 675
616 Handle<Code> handler = handlers->at(0); 676 Handle<Code> handler = handlers->at(0);
617 Code::Kind kind = handler->handler_kind(); 677 Code::Kind kind = handler->handler_kind();
618 Code::StubType type = number_of_valid_types == 1 ? handler->type() 678 Code::StubType type = number_of_valid_types == 1 ? handler->type()
619 : Code::NORMAL; 679 : Code::NORMAL;
620 if (kind == Code::LOAD_IC) { 680 if (kind == Code::LOAD_IC) {
621 LoadStubCompiler ic_compiler(isolate_); 681 LoadStubCompiler ic_compiler(isolate_, extra_ic_state);
622 return ic_compiler.CompilePolymorphicIC( 682 return ic_compiler.CompilePolymorphicIC(
623 types, handlers, name, type, PROPERTY); 683 types, handlers, name, type, PROPERTY);
624 } else { 684 } else {
625 ASSERT(kind == Code::STORE_IC); 685 ASSERT(kind == Code::STORE_IC);
626 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); 686 StoreStubCompiler ic_compiler(isolate_, extra_ic_state);
627 StoreStubCompiler ic_compiler(isolate_, strict_mode);
628 return ic_compiler.CompilePolymorphicIC( 687 return ic_compiler.CompilePolymorphicIC(
629 types, handlers, name, type, PROPERTY); 688 types, handlers, name, type, PROPERTY);
630 } 689 }
631 } 690 }
632 691
633 692
634 Handle<Code> StubCache::ComputeStoreElementPolymorphic( 693 Handle<Code> StubCache::ComputeStoreElementPolymorphic(
635 MapHandleList* receiver_maps, 694 MapHandleList* receiver_maps,
636 KeyedAccessStoreMode store_mode, 695 KeyedAccessStoreMode store_mode,
637 StrictModeFlag strict_mode) { 696 StrictModeFlag strict_mode) {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 886 }
828 887
829 888
830 static MaybeObject* ThrowReferenceError(Isolate* isolate, Name* name) { 889 static MaybeObject* ThrowReferenceError(Isolate* isolate, Name* name) {
831 // If the load is non-contextual, just return the undefined result. 890 // If the load is non-contextual, just return the undefined result.
832 // Note that both keyed and non-keyed loads may end up here, so we 891 // Note that both keyed and non-keyed loads may end up here, so we
833 // can't use either LoadIC or KeyedLoadIC constructors. 892 // can't use either LoadIC or KeyedLoadIC constructors.
834 HandleScope scope(isolate); 893 HandleScope scope(isolate);
835 IC ic(IC::NO_EXTRA_FRAME, isolate); 894 IC ic(IC::NO_EXTRA_FRAME, isolate);
836 ASSERT(ic.IsLoadStub()); 895 ASSERT(ic.IsLoadStub());
837 if (!ic.SlowIsUndeclaredGlobal()) return isolate->heap()->undefined_value(); 896 if (!ic.IsContextual()) {
897 return isolate->heap()->undefined_value();
898 }
838 899
839 // Throw a reference error. 900 // Throw a reference error.
840 Handle<Name> name_handle(name); 901 Handle<Name> name_handle(name);
841 Handle<Object> error = 902 Handle<Object> error =
842 isolate->factory()->NewReferenceError("not_defined", 903 isolate->factory()->NewReferenceError("not_defined",
843 HandleVector(&name_handle, 1)); 904 HandleVector(&name_handle, 1));
844 return isolate->Throw(*error); 905 return isolate->Throw(*error);
845 } 906 }
846 907
847 908
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic"); 1081 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic");
1021 isolate()->counters()->call_megamorphic_stubs()->Increment(); 1082 isolate()->counters()->call_megamorphic_stubs()->Increment();
1022 PROFILE(isolate(), 1083 PROFILE(isolate(),
1023 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), 1084 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG),
1024 *code, code->arguments_count())); 1085 *code, code->arguments_count()));
1025 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); 1086 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code));
1026 return code; 1087 return code;
1027 } 1088 }
1028 1089
1029 1090
1091 Handle<Code> StubCompiler::CompileLoadInitialize(Code::Flags flags) {
1092 LoadIC::GenerateInitialize(masm());
1093 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadInitialize");
1094 PROFILE(isolate(),
1095 CodeCreateEvent(Logger::LOAD_INITIALIZE_TAG, *code, 0));
1096 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
1097 return code;
1098 }
1099
1100
1101 Handle<Code> StubCompiler::CompileLoadPreMonomorphic(Code::Flags flags) {
1102 LoadIC::GeneratePreMonomorphic(masm());
1103 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadPreMonomorphic");
1104 PROFILE(isolate(),
1105 CodeCreateEvent(Logger::LOAD_PREMONOMORPHIC_TAG, *code, 0));
1106 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
1107 return code;
1108 }
1109
1110
1111 Handle<Code> StubCompiler::CompileLoadMegamorphic(Code::Flags flags) {
1112 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1113 ContextualMode mode = IC::GetContextualMode(extra_state);
1114 LoadIC::GenerateMegamorphic(masm(), mode);
1115 Handle<Code> code = GetCodeWithFlags(flags, "CompileLoadMegamorphic");
1116 PROFILE(isolate(),
1117 CodeCreateEvent(Logger::LOAD_MEGAMORPHIC_TAG, *code, 0));
1118 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *code));
1119 return code;
1120 }
1121
1122
1123 Handle<Code> StubCompiler::CompileStoreInitialize(Code::Flags flags) {
1124 StoreIC::GenerateInitialize(masm());
1125 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreInitialize");
1126 PROFILE(isolate(),
1127 CodeCreateEvent(Logger::STORE_INITIALIZE_TAG, *code, 0));
1128 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
1129 return code;
1130 }
1131
1132
1133 Handle<Code> StubCompiler::CompileStorePreMonomorphic(Code::Flags flags) {
1134 StoreIC::GeneratePreMonomorphic(masm());
1135 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic");
1136 PROFILE(isolate(),
1137 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0));
1138 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
1139 return code;
1140 }
1141
1142
1143 Handle<Code> StubCompiler::CompileStoreGeneric(Code::Flags flags) {
1144 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1145 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_state);
1146 StoreIC::GenerateRuntimeSetProperty(masm(), strict_mode);
1147 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric");
1148 PROFILE(isolate(),
1149 CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0));
1150 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
1151 return code;
1152 }
1153
1154
1155 Handle<Code> StubCompiler::CompileStoreMegamorphic(Code::Flags flags) {
1156 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags);
1157 StoreIC::GenerateMegamorphic(masm(), extra_state);
1158 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic");
1159 PROFILE(isolate(),
1160 CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0));
1161 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *code));
1162 return code;
1163 }
1164
1165
1030 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) { 1166 Handle<Code> StubCompiler::CompileCallArguments(Code::Flags flags) {
1031 int argc = Code::ExtractArgumentsCountFromFlags(flags); 1167 int argc = Code::ExtractArgumentsCountFromFlags(flags);
1032 KeyedCallIC::GenerateNonStrictArguments(masm(), argc); 1168 KeyedCallIC::GenerateNonStrictArguments(masm(), argc);
1033 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallArguments"); 1169 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallArguments");
1034 PROFILE(isolate(), 1170 PROFILE(isolate(),
1035 CodeCreateEvent(CALL_LOGGER_TAG(Code::ExtractKindFromFlags(flags), 1171 CodeCreateEvent(CALL_LOGGER_TAG(Code::ExtractKindFromFlags(flags),
1036 CALL_MEGAMORPHIC_TAG), 1172 CALL_MEGAMORPHIC_TAG),
1037 *code, code->arguments_count())); 1173 *code, code->arguments_count()));
1038 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); 1174 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code));
1039 return code; 1175 return code;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 void CallStubCompiler::GenerateJumpFunctionIgnoreReceiver( 1284 void CallStubCompiler::GenerateJumpFunctionIgnoreReceiver(
1149 Handle<JSFunction> function) { 1285 Handle<JSFunction> function) {
1150 ParameterCount expected(function); 1286 ParameterCount expected(function);
1151 __ InvokeFunction(function, expected, arguments(), 1287 __ InvokeFunction(function, expected, arguments(),
1152 JUMP_FUNCTION, NullCallWrapper(), call_kind()); 1288 JUMP_FUNCTION, NullCallWrapper(), call_kind());
1153 } 1289 }
1154 1290
1155 1291
1156 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, 1292 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
1157 Handle<JSFunction> function) { 1293 Handle<JSFunction> function) {
1158 PatchGlobalProxy(object); 1294 PatchImplicitReceiver(object);
1159 GenerateJumpFunctionIgnoreReceiver(function); 1295 GenerateJumpFunctionIgnoreReceiver(function);
1160 } 1296 }
1161 1297
1162 1298
1163 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, 1299 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
1164 Register actual_closure, 1300 Register actual_closure,
1165 Handle<JSFunction> function) { 1301 Handle<JSFunction> function) {
1166 PatchGlobalProxy(object); 1302 PatchImplicitReceiver(object);
1167 ParameterCount expected(function); 1303 ParameterCount expected(function);
1168 __ InvokeFunction(actual_closure, expected, arguments(), 1304 __ InvokeFunction(actual_closure, expected, arguments(),
1169 JUMP_FUNCTION, NullCallWrapper(), call_kind()); 1305 JUMP_FUNCTION, NullCallWrapper(), call_kind());
1170 } 1306 }
1171 1307
1172 1308
1173 Handle<Code> CallStubCompiler::CompileCallConstant( 1309 Handle<Code> CallStubCompiler::CompileCallConstant(
1174 Handle<Object> object, 1310 Handle<Object> object,
1175 Handle<JSObject> holder, 1311 Handle<JSObject> holder,
1176 Handle<Name> name, 1312 Handle<Name> name,
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 1797
1662 1798
1663 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps, 1799 void KeyedLoadStubCompiler::CompileElementHandlers(MapHandleList* receiver_maps,
1664 CodeHandleList* handlers) { 1800 CodeHandleList* handlers) {
1665 for (int i = 0; i < receiver_maps->length(); ++i) { 1801 for (int i = 0; i < receiver_maps->length(); ++i) {
1666 Handle<Map> receiver_map = receiver_maps->at(i); 1802 Handle<Map> receiver_map = receiver_maps->at(i);
1667 Handle<Code> cached_stub; 1803 Handle<Code> cached_stub;
1668 1804
1669 if ((receiver_map->instance_type() & kNotStringTag) == 0) { 1805 if ((receiver_map->instance_type() & kNotStringTag) == 0) {
1670 cached_stub = isolate()->builtins()->KeyedLoadIC_String(); 1806 cached_stub = isolate()->builtins()->KeyedLoadIC_String();
1807 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1808 cached_stub = isolate()->builtins()->KeyedLoadIC_Slow();
1671 } else { 1809 } else {
1672 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1810 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1673 ElementsKind elements_kind = receiver_map->elements_kind(); 1811 ElementsKind elements_kind = receiver_map->elements_kind();
1674 1812
1675 if (IsFastElementsKind(elements_kind) || 1813 if (IsFastElementsKind(elements_kind) ||
1676 IsExternalArrayElementsKind(elements_kind)) { 1814 IsExternalArrayElementsKind(elements_kind)) {
1677 cached_stub = 1815 cached_stub =
1678 KeyedLoadFastElementStub(is_js_array, 1816 KeyedLoadFastElementStub(is_js_array,
1679 elements_kind).GetCode(isolate()); 1817 elements_kind).GetCode(isolate());
1680 } else { 1818 } else {
(...skipping 24 matching lines...) Expand all
1705 // to be. Not all the elements are in place yet, pessimistic elements 1843 // to be. Not all the elements are in place yet, pessimistic elements
1706 // transitions are still important for performance. 1844 // transitions are still important for performance.
1707 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 1845 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
1708 ElementsKind elements_kind = receiver_map->elements_kind(); 1846 ElementsKind elements_kind = receiver_map->elements_kind();
1709 if (!transitioned_map.is_null()) { 1847 if (!transitioned_map.is_null()) {
1710 cached_stub = ElementsTransitionAndStoreStub( 1848 cached_stub = ElementsTransitionAndStoreStub(
1711 elements_kind, 1849 elements_kind,
1712 transitioned_map->elements_kind(), 1850 transitioned_map->elements_kind(),
1713 is_js_array, 1851 is_js_array,
1714 store_mode()).GetCode(isolate()); 1852 store_mode()).GetCode(isolate());
1853 } else if (receiver_map->instance_type() < FIRST_JS_RECEIVER_TYPE) {
1854 cached_stub = isolate()->builtins()->KeyedStoreIC_Slow();
1715 } else { 1855 } else {
1716 if (receiver_map->has_fast_elements() || 1856 if (receiver_map->has_fast_elements() ||
1717 receiver_map->has_external_array_elements()) { 1857 receiver_map->has_external_array_elements()) {
1718 cached_stub = KeyedStoreFastElementStub( 1858 cached_stub = KeyedStoreFastElementStub(
1719 is_js_array, 1859 is_js_array,
1720 elements_kind, 1860 elements_kind,
1721 store_mode()).GetCode(isolate()); 1861 store_mode()).GetCode(isolate());
1722 } else { 1862 } else {
1723 cached_stub = KeyedStoreElementStub( 1863 cached_stub = KeyedStoreElementStub(
1724 is_js_array, 1864 is_js_array,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 Handle<FunctionTemplateInfo>( 2041 Handle<FunctionTemplateInfo>(
1902 FunctionTemplateInfo::cast(signature->receiver())); 2042 FunctionTemplateInfo::cast(signature->receiver()));
1903 } 2043 }
1904 } 2044 }
1905 2045
1906 is_simple_api_call_ = true; 2046 is_simple_api_call_ = true;
1907 } 2047 }
1908 2048
1909 2049
1910 } } // namespace v8::internal 2050 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698