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

Side by Side Diff: src/assembler.cc

Issue 6880010: Merge (7265, 7271] from bleeding_edge to experimental/gc branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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/assembler.h ('k') | src/ast.h » ('j') | src/heap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Signed right shift is arithmetic shift. Tested in test-utils.cc. 212 // Signed right shift is arithmetic shift. Tested in test-utils.cc.
213 data_delta = data_delta >> kBitsPerByte; 213 data_delta = data_delta >> kBitsPerByte;
214 } 214 }
215 } 215 }
216 216
217 217
218 void RelocInfoWriter::Write(const RelocInfo* rinfo) { 218 void RelocInfoWriter::Write(const RelocInfo* rinfo) {
219 #ifdef DEBUG 219 #ifdef DEBUG
220 byte* begin_pos = pos_; 220 byte* begin_pos = pos_;
221 #endif 221 #endif
222 Counters::reloc_info_count.Increment(); 222 COUNTERS->reloc_info_count()->Increment();
223 ASSERT(rinfo->pc() - last_pc_ >= 0); 223 ASSERT(rinfo->pc() - last_pc_ >= 0);
224 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes); 224 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes);
225 // Use unsigned delta-encoding for pc. 225 // Use unsigned delta-encoding for pc.
226 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); 226 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
227 RelocInfo::Mode rmode = rinfo->rmode(); 227 RelocInfo::Mode rmode = rinfo->rmode();
228 228
229 // The two most common modes are given small tags, and usually fit in a byte. 229 // The two most common modes are given small tags, and usually fit in a byte.
230 if (rmode == RelocInfo::EMBEDDED_OBJECT) { 230 if (rmode == RelocInfo::EMBEDDED_OBJECT) {
231 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); 231 WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
232 } else if (rmode == RelocInfo::CODE_TARGET) { 232 } else if (rmode == RelocInfo::CODE_TARGET) {
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 break; 521 break;
522 #endif 522 #endif
523 case CONSTRUCT_CALL: 523 case CONSTRUCT_CALL:
524 case CODE_TARGET_CONTEXT: 524 case CODE_TARGET_CONTEXT:
525 case CODE_TARGET: { 525 case CODE_TARGET: {
526 // convert inline target address to code object 526 // convert inline target address to code object
527 Address addr = target_address(); 527 Address addr = target_address();
528 ASSERT(addr != NULL); 528 ASSERT(addr != NULL);
529 // Check that we can find the right code object. 529 // Check that we can find the right code object.
530 Code* code = Code::GetCodeFromTargetAddress(addr); 530 Code* code = Code::GetCodeFromTargetAddress(addr);
531 Object* found = Heap::FindCodeObject(addr); 531 Object* found = HEAP->FindCodeObject(addr);
532 ASSERT(found->IsCode()); 532 ASSERT(found->IsCode());
533 ASSERT(code->address() == HeapObject::cast(found)->address()); 533 ASSERT(code->address() == HeapObject::cast(found)->address());
534 break; 534 break;
535 } 535 }
536 case RUNTIME_ENTRY: 536 case RUNTIME_ENTRY:
537 case JS_RETURN: 537 case JS_RETURN:
538 case COMMENT: 538 case COMMENT:
539 case POSITION: 539 case POSITION:
540 case STATEMENT_POSITION: 540 case STATEMENT_POSITION:
541 case EXTERNAL_REFERENCE: 541 case EXTERNAL_REFERENCE:
(...skipping 15 matching lines...) Expand all
557 ExternalReference::ExternalReference(Builtins::CFunctionId id) 557 ExternalReference::ExternalReference(Builtins::CFunctionId id)
558 : address_(Redirect(Builtins::c_function_address(id))) {} 558 : address_(Redirect(Builtins::c_function_address(id))) {}
559 559
560 560
561 ExternalReference::ExternalReference( 561 ExternalReference::ExternalReference(
562 ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) 562 ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL)
563 : address_(Redirect(fun->address(), type)) {} 563 : address_(Redirect(fun->address(), type)) {}
564 564
565 565
566 ExternalReference::ExternalReference(Builtins::Name name) 566 ExternalReference::ExternalReference(Builtins::Name name)
567 : address_(Builtins::builtin_address(name)) {} 567 : address_(Isolate::Current()->builtins()->builtin_address(name)) {}
568 568
569 569
570 ExternalReference::ExternalReference(Runtime::FunctionId id) 570 ExternalReference::ExternalReference(Runtime::FunctionId id)
571 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} 571 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {}
572 572
573 573
574 ExternalReference::ExternalReference(Runtime::Function* f) 574 ExternalReference::ExternalReference(const Runtime::Function* f)
575 : address_(Redirect(f->entry)) {} 575 : address_(Redirect(f->entry)) {}
576 576
577 577
578 ExternalReference ExternalReference::isolate_address() {
579 return ExternalReference(Isolate::Current());
580 }
581
582
578 ExternalReference::ExternalReference(const IC_Utility& ic_utility) 583 ExternalReference::ExternalReference(const IC_Utility& ic_utility)
579 : address_(Redirect(ic_utility.address())) {} 584 : address_(Redirect(ic_utility.address())) {}
580 585
581 #ifdef ENABLE_DEBUGGER_SUPPORT 586 #ifdef ENABLE_DEBUGGER_SUPPORT
582 ExternalReference::ExternalReference(const Debug_Address& debug_address) 587 ExternalReference::ExternalReference(const Debug_Address& debug_address)
583 : address_(debug_address.address()) {} 588 : address_(debug_address.address(Isolate::Current())) {}
584 #endif 589 #endif
585 590
586 ExternalReference::ExternalReference(StatsCounter* counter) 591 ExternalReference::ExternalReference(StatsCounter* counter)
587 : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {} 592 : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {}
588 593
589 594
590 ExternalReference::ExternalReference(Top::AddressId id) 595 ExternalReference::ExternalReference(Isolate::AddressId id)
591 : address_(Top::get_address_from_id(id)) {} 596 : address_(Isolate::Current()->get_address_from_id(id)) {}
592 597
593 598
594 ExternalReference::ExternalReference(const SCTableReference& table_ref) 599 ExternalReference::ExternalReference(const SCTableReference& table_ref)
595 : address_(table_ref.address()) {} 600 : address_(table_ref.address()) {}
596 601
597 602
598 ExternalReference ExternalReference:: 603 ExternalReference ExternalReference::
599 incremental_marking_record_write_function() { 604 incremental_marking_record_write_function() {
600 return ExternalReference(Redirect( 605 return ExternalReference(Redirect(
601 FUNCTION_ADDR(IncrementalMarking::RecordWrite))); 606 FUNCTION_ADDR(IncrementalMarking::RecordWriteFromCode)));
607 }
608
609
610 ExternalReference ExternalReference::
611 store_buffer_overflow_function() {
612 return ExternalReference(Redirect(
613 FUNCTION_ADDR(StoreBuffer::StoreBufferOverflow)));
602 } 614 }
603 615
604 616
605 ExternalReference ExternalReference::perform_gc_function() { 617 ExternalReference ExternalReference::perform_gc_function() {
606 return ExternalReference(Redirect(FUNCTION_ADDR(Runtime::PerformGC))); 618 return ExternalReference(Redirect(FUNCTION_ADDR(Runtime::PerformGC)));
607 } 619 }
608 620
609 621
610 ExternalReference ExternalReference::fill_heap_number_with_random_function() { 622 ExternalReference ExternalReference::fill_heap_number_with_random_function() {
611 return 623 return
612 ExternalReference(Redirect(FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); 624 ExternalReference(Redirect(FUNCTION_ADDR(V8::FillHeapNumberWithRandom)));
613 } 625 }
614 626
615 627
616 ExternalReference ExternalReference::delete_handle_scope_extensions() { 628 ExternalReference ExternalReference::delete_handle_scope_extensions() {
617 return ExternalReference(Redirect(FUNCTION_ADDR( 629 return ExternalReference(Redirect(FUNCTION_ADDR(
618 HandleScope::DeleteExtensions))); 630 HandleScope::DeleteExtensions)));
619 } 631 }
620 632
621 633
622 ExternalReference ExternalReference::random_uint32_function() { 634 ExternalReference ExternalReference::random_uint32_function() {
623 return ExternalReference(Redirect(FUNCTION_ADDR(V8::Random))); 635 return ExternalReference(Redirect(FUNCTION_ADDR(V8::Random)));
624 } 636 }
625 637
626 638
627 ExternalReference ExternalReference::transcendental_cache_array_address() { 639 ExternalReference ExternalReference::transcendental_cache_array_address() {
628 return ExternalReference(TranscendentalCache::cache_array_address()); 640 return ExternalReference(Isolate::Current()->transcendental_cache()->
641 cache_array_address());
629 } 642 }
630 643
631 644
632 ExternalReference ExternalReference::new_deoptimizer_function() { 645 ExternalReference ExternalReference::new_deoptimizer_function() {
633 return ExternalReference( 646 return ExternalReference(
634 Redirect(FUNCTION_ADDR(Deoptimizer::New))); 647 Redirect(FUNCTION_ADDR(Deoptimizer::New)));
635 } 648 }
636 649
637 650
638 ExternalReference ExternalReference::compute_output_frames_function() { 651 ExternalReference ExternalReference::compute_output_frames_function() {
639 return ExternalReference( 652 return ExternalReference(
640 Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); 653 Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames)));
641 } 654 }
642 655
643 656
644 ExternalReference ExternalReference::global_contexts_list() { 657 ExternalReference ExternalReference::global_contexts_list() {
645 return ExternalReference(Heap::global_contexts_list_address()); 658 return ExternalReference(Isolate::Current()->
659 heap()->global_contexts_list_address());
646 } 660 }
647 661
648 662
649 ExternalReference ExternalReference::keyed_lookup_cache_keys() { 663 ExternalReference ExternalReference::keyed_lookup_cache_keys() {
650 return ExternalReference(KeyedLookupCache::keys_address()); 664 return ExternalReference(Isolate::Current()->
665 keyed_lookup_cache()->keys_address());
651 } 666 }
652 667
653 668
654 ExternalReference ExternalReference::keyed_lookup_cache_field_offsets() { 669 ExternalReference ExternalReference::keyed_lookup_cache_field_offsets() {
655 return ExternalReference(KeyedLookupCache::field_offsets_address()); 670 return ExternalReference(Isolate::Current()->
671 keyed_lookup_cache()->field_offsets_address());
656 } 672 }
657 673
658 674
659 ExternalReference ExternalReference::the_hole_value_location() { 675 ExternalReference ExternalReference::the_hole_value_location() {
660 return ExternalReference(Factory::the_hole_value().location()); 676 return ExternalReference(FACTORY->the_hole_value().location());
661 } 677 }
662 678
663 679
664 ExternalReference ExternalReference::arguments_marker_location() { 680 ExternalReference ExternalReference::arguments_marker_location() {
665 return ExternalReference(Factory::arguments_marker().location()); 681 return ExternalReference(FACTORY->arguments_marker().location());
666 } 682 }
667 683
668 684
669 ExternalReference ExternalReference::roots_address() { 685 ExternalReference ExternalReference::roots_address() {
670 return ExternalReference(Heap::roots_address()); 686 return ExternalReference(HEAP->roots_address());
671 } 687 }
672 688
673 689
674 ExternalReference ExternalReference::address_of_stack_limit() { 690 ExternalReference ExternalReference::address_of_stack_limit() {
675 return ExternalReference(StackGuard::address_of_jslimit()); 691 return ExternalReference(
692 Isolate::Current()->stack_guard()->address_of_jslimit());
676 } 693 }
677 694
678 695
679 ExternalReference ExternalReference::address_of_real_stack_limit() { 696 ExternalReference ExternalReference::address_of_real_stack_limit() {
680 return ExternalReference(StackGuard::address_of_real_jslimit()); 697 return ExternalReference(
698 Isolate::Current()->stack_guard()->address_of_real_jslimit());
681 } 699 }
682 700
683 701
684 ExternalReference ExternalReference::address_of_regexp_stack_limit() { 702 ExternalReference ExternalReference::address_of_regexp_stack_limit() {
685 return ExternalReference(RegExpStack::limit_address()); 703 return ExternalReference(
704 Isolate::Current()->regexp_stack()->limit_address());
686 } 705 }
687 706
688 707
689 ExternalReference ExternalReference::new_space_start() { 708 ExternalReference ExternalReference::new_space_start() {
690 return ExternalReference(Heap::NewSpaceStart()); 709 return ExternalReference(HEAP->NewSpaceStart());
691 } 710 }
692 711
693 712
694 ExternalReference ExternalReference::store_buffer_top() { 713 ExternalReference ExternalReference::store_buffer_top() {
695 return ExternalReference(StoreBuffer::TopAddress()); 714 return ExternalReference(HEAP->store_buffer()->TopAddress());
696 } 715 }
697 716
698 717
699 ExternalReference ExternalReference::new_space_mask() { 718 ExternalReference ExternalReference::new_space_mask() {
700 return ExternalReference(reinterpret_cast<Address>(Heap::NewSpaceMask())); 719 return ExternalReference(reinterpret_cast<Address>(HEAP->NewSpaceMask()));
701 } 720 }
702 721
703 722
704 ExternalReference ExternalReference::new_space_allocation_top_address() { 723 ExternalReference ExternalReference::new_space_allocation_top_address() {
705 return ExternalReference(Heap::NewSpaceAllocationTopAddress()); 724 return ExternalReference(HEAP->NewSpaceAllocationTopAddress());
706 } 725 }
707 726
708 727
709 ExternalReference ExternalReference::heap_always_allocate_scope_depth() { 728 ExternalReference ExternalReference::heap_always_allocate_scope_depth() {
710 return ExternalReference(Heap::always_allocate_scope_depth_address()); 729 return ExternalReference(HEAP->always_allocate_scope_depth_address());
711 } 730 }
712 731
713 732
714 ExternalReference ExternalReference::new_space_allocation_limit_address() { 733 ExternalReference ExternalReference::new_space_allocation_limit_address() {
715 return ExternalReference(Heap::NewSpaceAllocationLimitAddress()); 734 return ExternalReference(HEAP->NewSpaceAllocationLimitAddress());
716 } 735 }
717 736
718 737
719 ExternalReference ExternalReference::handle_scope_level_address() { 738 ExternalReference ExternalReference::handle_scope_level_address() {
720 return ExternalReference(HandleScope::current_level_address()); 739 return ExternalReference(HandleScope::current_level_address());
721 } 740 }
722 741
723 742
724 ExternalReference ExternalReference::handle_scope_next_address() { 743 ExternalReference ExternalReference::handle_scope_next_address() {
725 return ExternalReference(HandleScope::current_next_address()); 744 return ExternalReference(HandleScope::current_next_address());
726 } 745 }
727 746
728 747
729 ExternalReference ExternalReference::handle_scope_limit_address() { 748 ExternalReference ExternalReference::handle_scope_limit_address() {
730 return ExternalReference(HandleScope::current_limit_address()); 749 return ExternalReference(HandleScope::current_limit_address());
731 } 750 }
732 751
733 752
734 ExternalReference ExternalReference::scheduled_exception_address() { 753 ExternalReference ExternalReference::scheduled_exception_address() {
735 return ExternalReference(Top::scheduled_exception_address()); 754 return ExternalReference(Isolate::Current()->scheduled_exception_address());
736 } 755 }
737 756
738 757
739 ExternalReference ExternalReference::address_of_min_int() { 758 ExternalReference ExternalReference::address_of_min_int() {
740 return ExternalReference(reinterpret_cast<void*>( 759 return ExternalReference(reinterpret_cast<void*>(
741 const_cast<double*>(&DoubleConstant::min_int))); 760 const_cast<double*>(&DoubleConstant::min_int)));
742 } 761 }
743 762
744 763
745 ExternalReference ExternalReference::address_of_one_half() { 764 ExternalReference ExternalReference::address_of_one_half() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 return ExternalReference(Redirect( 810 return ExternalReference(Redirect(
792 FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16))); 811 FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16)));
793 } 812 }
794 813
795 ExternalReference ExternalReference::re_word_character_map() { 814 ExternalReference ExternalReference::re_word_character_map() {
796 return ExternalReference( 815 return ExternalReference(
797 NativeRegExpMacroAssembler::word_character_map_address()); 816 NativeRegExpMacroAssembler::word_character_map_address());
798 } 817 }
799 818
800 ExternalReference ExternalReference::address_of_static_offsets_vector() { 819 ExternalReference ExternalReference::address_of_static_offsets_vector() {
801 return ExternalReference(OffsetsVector::static_offsets_vector_address()); 820 return ExternalReference(OffsetsVector::static_offsets_vector_address(
821 Isolate::Current()));
802 } 822 }
803 823
804 ExternalReference ExternalReference::address_of_regexp_stack_memory_address() { 824 ExternalReference ExternalReference::address_of_regexp_stack_memory_address() {
805 return ExternalReference(RegExpStack::memory_address()); 825 return ExternalReference(
826 Isolate::Current()->regexp_stack()->memory_address());
806 } 827 }
807 828
808 ExternalReference ExternalReference::address_of_regexp_stack_memory_size() { 829 ExternalReference ExternalReference::address_of_regexp_stack_memory_size() {
809 return ExternalReference(RegExpStack::memory_size_address()); 830 return ExternalReference(
831 Isolate::Current()->regexp_stack()->memory_size_address());
810 } 832 }
811 833
812 #endif // V8_INTERPRETED_REGEXP 834 #endif // V8_INTERPRETED_REGEXP
813 835
814 836
815 static double add_two_doubles(double x, double y) { 837 static double add_two_doubles(double x, double y) {
816 return x + y; 838 return x + y;
817 } 839 }
818 840
819 841
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL)); 972 return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL));
951 } 973 }
952 974
953 975
954 ExternalReference ExternalReference::compare_doubles() { 976 ExternalReference ExternalReference::compare_doubles() {
955 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), 977 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles),
956 BUILTIN_CALL)); 978 BUILTIN_CALL));
957 } 979 }
958 980
959 981
960 ExternalReference::ExternalReferenceRedirector*
961 ExternalReference::redirector_ = NULL;
962
963
964 #ifdef ENABLE_DEBUGGER_SUPPORT 982 #ifdef ENABLE_DEBUGGER_SUPPORT
965 ExternalReference ExternalReference::debug_break() { 983 ExternalReference ExternalReference::debug_break() {
966 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); 984 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break)));
967 } 985 }
968 986
969 987
970 ExternalReference ExternalReference::debug_step_in_fp_address() { 988 ExternalReference ExternalReference::debug_step_in_fp_address() {
971 return ExternalReference(Debug::step_in_fp_addr()); 989 return ExternalReference(Isolate::Current()->debug()->step_in_fp_addr());
972 } 990 }
973 #endif 991 #endif
974 992
975 993
976 void PositionsRecorder::RecordPosition(int pos) { 994 void PositionsRecorder::RecordPosition(int pos) {
977 ASSERT(pos != RelocInfo::kNoPosition); 995 ASSERT(pos != RelocInfo::kNoPosition);
978 ASSERT(pos >= 0); 996 ASSERT(pos >= 0);
979 state_.current_position = pos; 997 state_.current_position = pos;
980 #ifdef ENABLE_GDB_JIT_INTERFACE 998 #ifdef ENABLE_GDB_JIT_INTERFACE
981 if (gdbjit_lineinfo_ != NULL) { 999 if (gdbjit_lineinfo_ != NULL) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1036 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1019 state_.written_position = state_.current_position; 1037 state_.written_position = state_.current_position;
1020 written = true; 1038 written = true;
1021 } 1039 }
1022 1040
1023 // Return whether something was written. 1041 // Return whether something was written.
1024 return written; 1042 return written;
1025 } 1043 }
1026 1044
1027 } } // namespace v8::internal 1045 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ast.h » ('j') | src/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698