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

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

Issue 8341008: Handlify upper layers of StoreIC based on 8337008. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 9 years, 2 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') | 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 Object* result; 484 Object* result;
485 { MaybeObject* maybe_result = 485 { MaybeObject* maybe_result =
486 receiver->UpdateMapCodeCache(name, Code::cast(code)); 486 receiver->UpdateMapCodeCache(name, Code::cast(code));
487 if (!maybe_result->ToObject(&result)) return maybe_result; 487 if (!maybe_result->ToObject(&result)) return maybe_result;
488 } 488 }
489 } 489 }
490 return code; 490 return code;
491 } 491 }
492 492
493 493
494 MaybeObject* StubCache::ComputeStoreField(String* name, 494 Handle<Code> StoreStubCompiler::CompileStoreField(Handle<JSObject> object,
495 JSObject* receiver, 495 int index,
496 Handle<Map> transition,
497 Handle<String> name) {
498 CALL_HEAP_FUNCTION(isolate(),
499 CompileStoreField(*object,
500 index,
501 (transition.is_null()
502 ? NULL
503 : *transition),
504 *name),
505 Code);
506 }
507
508
509 Handle<Code> StubCache::ComputeStoreField(Handle<String> name,
510 Handle<JSObject> receiver,
496 int field_index, 511 int field_index,
497 Map* transition, 512 Handle<Map> transition,
498 StrictModeFlag strict_mode) { 513 StrictModeFlag strict_mode) {
499 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; 514 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION;
500 Code::Flags flags = Code::ComputeMonomorphicFlags( 515 Code::Flags flags = Code::ComputeMonomorphicFlags(
501 Code::STORE_IC, type, strict_mode); 516 Code::STORE_IC, type, strict_mode);
502 Object* code = receiver->map()->FindInCodeCache(name, flags); 517 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
503 if (code->IsUndefined()) { 518 if (probe->IsCode()) return Handle<Code>::cast(probe);
504 HandleScope scope(isolate_); 519
505 StoreStubCompiler compiler(isolate_, strict_mode); 520 StoreStubCompiler compiler(isolate_, strict_mode);
506 { MaybeObject* maybe_code = 521 Handle<Code> code =
507 compiler.CompileStoreField(receiver, field_index, transition, name); 522 compiler.CompileStoreField(receiver, field_index, transition, name);
508 if (!maybe_code->ToObject(&code)) return maybe_code; 523 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
509 } 524 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
510 PROFILE(isolate_, 525 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
511 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
512 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
513 Object* result;
514 { MaybeObject* maybe_result =
515 receiver->UpdateMapCodeCache(name, Code::cast(code));
516 if (!maybe_result->ToObject(&result)) return maybe_result;
517 }
518 }
519 return code; 526 return code;
520 } 527 }
521 528
522 529
523 MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement( 530 MaybeObject* StubCache::ComputeKeyedLoadOrStoreElement(
524 JSObject* receiver, 531 JSObject* receiver,
525 KeyedIC::StubKind stub_kind, 532 KeyedIC::StubKind stub_kind,
526 StrictModeFlag strict_mode) { 533 StrictModeFlag strict_mode) {
527 Code::Flags flags = 534 Code::Flags flags =
528 Code::ComputeMonomorphicFlags( 535 Code::ComputeMonomorphicFlags(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 ASSERT(code->IsCode()); 586 ASSERT(code->IsCode());
580 Object* result; 587 Object* result;
581 { MaybeObject* maybe_result = 588 { MaybeObject* maybe_result =
582 receiver->UpdateMapCodeCache(name, Code::cast(code)); 589 receiver->UpdateMapCodeCache(name, Code::cast(code));
583 if (!maybe_result->ToObject(&result)) return maybe_result; 590 if (!maybe_result->ToObject(&result)) return maybe_result;
584 } 591 }
585 return code; 592 return code;
586 } 593 }
587 594
588 595
589 MaybeObject* StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { 596 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) {
590 return isolate_->builtins()->builtin((strict_mode == kStrictMode) 597 return (strict_mode == kStrictMode)
591 ? Builtins::kStoreIC_Normal_Strict 598 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict()
592 : Builtins::kStoreIC_Normal); 599 : isolate_->builtins()->Builtins::StoreIC_Normal();
593 } 600 }
594 601
595 602
596 MaybeObject* StubCache::ComputeStoreGlobal(String* name, 603 Handle<Code> StoreStubCompiler::CompileStoreGlobal(
597 GlobalObject* receiver, 604 Handle<GlobalObject> object,
598 JSGlobalPropertyCell* cell, 605 Handle<JSGlobalPropertyCell> holder,
606 Handle<String> name) {
607 CALL_HEAP_FUNCTION(isolate(),
608 CompileStoreGlobal(*object, *holder, *name),
609 Code);
610 }
611
612
613 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name,
614 Handle<GlobalObject> receiver,
615 Handle<JSGlobalPropertyCell> cell,
599 StrictModeFlag strict_mode) { 616 StrictModeFlag strict_mode) {
600 Code::Flags flags = Code::ComputeMonomorphicFlags( 617 Code::Flags flags = Code::ComputeMonomorphicFlags(
601 Code::STORE_IC, NORMAL, strict_mode); 618 Code::STORE_IC, NORMAL, strict_mode);
602 Object* code = receiver->map()->FindInCodeCache(name, flags); 619 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
603 if (code->IsUndefined()) { 620 if (probe->IsCode()) return Handle<Code>::cast(probe);
604 HandleScope scope(isolate_); 621
605 StoreStubCompiler compiler(isolate_, strict_mode); 622 StoreStubCompiler compiler(isolate_, strict_mode);
606 { MaybeObject* maybe_code = 623 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name);
607 compiler.CompileStoreGlobal(receiver, cell, name); 624 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
608 if (!maybe_code->ToObject(&code)) return maybe_code; 625 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
609 } 626 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
610 PROFILE(isolate_,
611 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
612 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
613 Object* result;
614 { MaybeObject* maybe_result =
615 receiver->UpdateMapCodeCache(name, Code::cast(code));
616 if (!maybe_result->ToObject(&result)) return maybe_result;
617 }
618 }
619 return code; 627 return code;
620 } 628 }
621 629
622 630
623 MaybeObject* StubCache::ComputeStoreCallback( 631 Handle<Code> StoreStubCompiler::CompileStoreCallback(
624 String* name, 632 Handle<JSObject> object,
625 JSObject* receiver, 633 Handle<AccessorInfo> callback,
626 AccessorInfo* callback, 634 Handle<String> name) {
627 StrictModeFlag strict_mode) { 635 CALL_HEAP_FUNCTION(isolate(),
636 CompileStoreCallback(*object, *callback, *name),
637 Code);
638 }
639
640
641 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name,
642 Handle<JSObject> receiver,
643 Handle<AccessorInfo> callback,
644 StrictModeFlag strict_mode) {
628 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); 645 ASSERT(v8::ToCData<Address>(callback->setter()) != 0);
629 Code::Flags flags = Code::ComputeMonomorphicFlags( 646 Code::Flags flags = Code::ComputeMonomorphicFlags(
630 Code::STORE_IC, CALLBACKS, strict_mode); 647 Code::STORE_IC, CALLBACKS, strict_mode);
631 Object* code = receiver->map()->FindInCodeCache(name, flags); 648 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
632 if (code->IsUndefined()) { 649 if (probe->IsCode()) return Handle<Code>::cast(probe);
633 HandleScope scope(isolate_); 650
634 StoreStubCompiler compiler(isolate_, strict_mode); 651 StoreStubCompiler compiler(isolate_, strict_mode);
635 { MaybeObject* maybe_code = 652 Handle<Code> code = compiler.CompileStoreCallback(receiver, callback, name);
636 compiler.CompileStoreCallback(receiver, callback, name); 653 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
637 if (!maybe_code->ToObject(&code)) return maybe_code; 654 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
638 } 655 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
639 PROFILE(isolate_,
640 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
641 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
642 Object* result;
643 { MaybeObject* maybe_result =
644 receiver->UpdateMapCodeCache(name, Code::cast(code));
645 if (!maybe_result->ToObject(&result)) return maybe_result;
646 }
647 }
648 return code; 656 return code;
649 } 657 }
650 658
651 659
652 MaybeObject* StubCache::ComputeStoreInterceptor( 660 Handle<Code> StoreStubCompiler::CompileStoreInterceptor(Handle<JSObject> object,
653 String* name, 661 Handle<String> name) {
654 JSObject* receiver, 662 CALL_HEAP_FUNCTION(isolate(),
655 StrictModeFlag strict_mode) { 663 CompileStoreInterceptor(*object, *name),
664 Code);
665 }
666
667
668 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name,
669 Handle<JSObject> receiver,
670 StrictModeFlag strict_mode) {
656 Code::Flags flags = Code::ComputeMonomorphicFlags( 671 Code::Flags flags = Code::ComputeMonomorphicFlags(
657 Code::STORE_IC, INTERCEPTOR, strict_mode); 672 Code::STORE_IC, INTERCEPTOR, strict_mode);
658 Object* code = receiver->map()->FindInCodeCache(name, flags); 673 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags));
659 if (code->IsUndefined()) { 674 if (probe->IsCode()) return Handle<Code>::cast(probe);
660 HandleScope scope(isolate_); 675
661 StoreStubCompiler compiler(isolate_, strict_mode); 676 StoreStubCompiler compiler(isolate_, strict_mode);
662 { MaybeObject* maybe_code = 677 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name);
663 compiler.CompileStoreInterceptor(receiver, name); 678 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name));
664 if (!maybe_code->ToObject(&code)) return maybe_code; 679 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code));
665 } 680 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code);
666 PROFILE(isolate_,
667 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name));
668 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code)));
669 Object* result;
670 { MaybeObject* maybe_result =
671 receiver->UpdateMapCodeCache(name, Code::cast(code));
672 if (!maybe_result->ToObject(&result)) return maybe_result;
673 }
674 }
675 return code; 681 return code;
676 } 682 }
677 683
678 684
679 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, 685 MaybeObject* StubCache::ComputeKeyedStoreField(String* name,
680 JSObject* receiver, 686 JSObject* receiver,
681 int field_index, 687 int field_index,
682 Map* transition, 688 Map* transition,
683 StrictModeFlag strict_mode) { 689 StrictModeFlag strict_mode) {
684 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; 690 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION;
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 expected_receiver_type_ = 1925 expected_receiver_type_ =
1920 FunctionTemplateInfo::cast(signature->receiver()); 1926 FunctionTemplateInfo::cast(signature->receiver());
1921 } 1927 }
1922 } 1928 }
1923 1929
1924 is_simple_api_call_ = true; 1930 is_simple_api_call_ = true;
1925 } 1931 }
1926 1932
1927 1933
1928 } } // namespace v8::internal 1934 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698