OLD | NEW |
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 210 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
211 data_delta = data_delta >> kBitsPerByte; | 211 data_delta = data_delta >> kBitsPerByte; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 | 215 |
216 void RelocInfoWriter::Write(const RelocInfo* rinfo) { | 216 void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
217 #ifdef DEBUG | 217 #ifdef DEBUG |
218 byte* begin_pos = pos_; | 218 byte* begin_pos = pos_; |
219 #endif | 219 #endif |
220 Counters::reloc_info_count.Increment(); | 220 COUNTERS->reloc_info_count()->Increment(); |
221 ASSERT(rinfo->pc() - last_pc_ >= 0); | 221 ASSERT(rinfo->pc() - last_pc_ >= 0); |
222 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes); | 222 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes); |
223 // Use unsigned delta-encoding for pc. | 223 // Use unsigned delta-encoding for pc. |
224 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 224 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
225 RelocInfo::Mode rmode = rinfo->rmode(); | 225 RelocInfo::Mode rmode = rinfo->rmode(); |
226 | 226 |
227 // The two most common modes are given small tags, and usually fit in a byte. | 227 // The two most common modes are given small tags, and usually fit in a byte. |
228 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 228 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
229 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); | 229 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
230 } else if (rmode == RelocInfo::CODE_TARGET) { | 230 } else if (rmode == RelocInfo::CODE_TARGET) { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 break; | 519 break; |
520 #endif | 520 #endif |
521 case CONSTRUCT_CALL: | 521 case CONSTRUCT_CALL: |
522 case CODE_TARGET_CONTEXT: | 522 case CODE_TARGET_CONTEXT: |
523 case CODE_TARGET: { | 523 case CODE_TARGET: { |
524 // convert inline target address to code object | 524 // convert inline target address to code object |
525 Address addr = target_address(); | 525 Address addr = target_address(); |
526 ASSERT(addr != NULL); | 526 ASSERT(addr != NULL); |
527 // Check that we can find the right code object. | 527 // Check that we can find the right code object. |
528 Code* code = Code::GetCodeFromTargetAddress(addr); | 528 Code* code = Code::GetCodeFromTargetAddress(addr); |
529 Object* found = Heap::FindCodeObject(addr); | 529 Object* found = HEAP->FindCodeObject(addr); |
530 ASSERT(found->IsCode()); | 530 ASSERT(found->IsCode()); |
531 ASSERT(code->address() == HeapObject::cast(found)->address()); | 531 ASSERT(code->address() == HeapObject::cast(found)->address()); |
532 break; | 532 break; |
533 } | 533 } |
534 case RUNTIME_ENTRY: | 534 case RUNTIME_ENTRY: |
535 case JS_RETURN: | 535 case JS_RETURN: |
536 case COMMENT: | 536 case COMMENT: |
537 case POSITION: | 537 case POSITION: |
538 case STATEMENT_POSITION: | 538 case STATEMENT_POSITION: |
539 case EXTERNAL_REFERENCE: | 539 case EXTERNAL_REFERENCE: |
(...skipping 15 matching lines...) Expand all Loading... |
555 ExternalReference::ExternalReference(Builtins::CFunctionId id) | 555 ExternalReference::ExternalReference(Builtins::CFunctionId id) |
556 : address_(Redirect(Builtins::c_function_address(id))) {} | 556 : address_(Redirect(Builtins::c_function_address(id))) {} |
557 | 557 |
558 | 558 |
559 ExternalReference::ExternalReference( | 559 ExternalReference::ExternalReference( |
560 ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) | 560 ApiFunction* fun, Type type = ExternalReference::BUILTIN_CALL) |
561 : address_(Redirect(fun->address(), type)) {} | 561 : address_(Redirect(fun->address(), type)) {} |
562 | 562 |
563 | 563 |
564 ExternalReference::ExternalReference(Builtins::Name name) | 564 ExternalReference::ExternalReference(Builtins::Name name) |
565 : address_(Builtins::builtin_address(name)) {} | 565 : address_(Isolate::Current()->builtins()->builtin_address(name)) {} |
566 | 566 |
567 | 567 |
568 ExternalReference::ExternalReference(Runtime::FunctionId id) | 568 ExternalReference::ExternalReference(Runtime::FunctionId id) |
569 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} | 569 : address_(Redirect(Runtime::FunctionForId(id)->entry)) {} |
570 | 570 |
571 | 571 |
572 ExternalReference::ExternalReference(Runtime::Function* f) | 572 ExternalReference::ExternalReference(const Runtime::Function* f) |
573 : address_(Redirect(f->entry)) {} | 573 : address_(Redirect(f->entry)) {} |
574 | 574 |
575 | 575 |
| 576 ExternalReference ExternalReference::isolate_address() { |
| 577 return ExternalReference(Isolate::Current()); |
| 578 } |
| 579 |
| 580 |
576 ExternalReference::ExternalReference(const IC_Utility& ic_utility) | 581 ExternalReference::ExternalReference(const IC_Utility& ic_utility) |
577 : address_(Redirect(ic_utility.address())) {} | 582 : address_(Redirect(ic_utility.address())) {} |
578 | 583 |
579 #ifdef ENABLE_DEBUGGER_SUPPORT | 584 #ifdef ENABLE_DEBUGGER_SUPPORT |
580 ExternalReference::ExternalReference(const Debug_Address& debug_address) | 585 ExternalReference::ExternalReference(const Debug_Address& debug_address) |
581 : address_(debug_address.address()) {} | 586 : address_(debug_address.address(Isolate::Current())) {} |
582 #endif | 587 #endif |
583 | 588 |
584 ExternalReference::ExternalReference(StatsCounter* counter) | 589 ExternalReference::ExternalReference(StatsCounter* counter) |
585 : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {} | 590 : address_(reinterpret_cast<Address>(counter->GetInternalPointer())) {} |
586 | 591 |
587 | 592 |
588 ExternalReference::ExternalReference(Top::AddressId id) | 593 ExternalReference::ExternalReference(Isolate::AddressId id) |
589 : address_(Top::get_address_from_id(id)) {} | 594 : address_(Isolate::Current()->get_address_from_id(id)) {} |
590 | 595 |
591 | 596 |
592 ExternalReference::ExternalReference(const SCTableReference& table_ref) | 597 ExternalReference::ExternalReference(const SCTableReference& table_ref) |
593 : address_(table_ref.address()) {} | 598 : address_(table_ref.address()) {} |
594 | 599 |
595 | 600 |
596 ExternalReference ExternalReference::perform_gc_function() { | 601 ExternalReference ExternalReference::perform_gc_function() { |
597 return ExternalReference(Redirect(FUNCTION_ADDR(Runtime::PerformGC))); | 602 return ExternalReference(Redirect(FUNCTION_ADDR(Runtime::PerformGC))); |
598 } | 603 } |
599 | 604 |
600 | 605 |
601 ExternalReference ExternalReference::fill_heap_number_with_random_function() { | 606 ExternalReference ExternalReference::fill_heap_number_with_random_function() { |
602 return | 607 return |
603 ExternalReference(Redirect(FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); | 608 ExternalReference(Redirect(FUNCTION_ADDR(V8::FillHeapNumberWithRandom))); |
604 } | 609 } |
605 | 610 |
606 | 611 |
607 ExternalReference ExternalReference::delete_handle_scope_extensions() { | 612 ExternalReference ExternalReference::delete_handle_scope_extensions() { |
608 return ExternalReference(Redirect(FUNCTION_ADDR( | 613 return ExternalReference(Redirect(FUNCTION_ADDR( |
609 HandleScope::DeleteExtensions))); | 614 HandleScope::DeleteExtensions))); |
610 } | 615 } |
611 | 616 |
612 | 617 |
613 ExternalReference ExternalReference::random_uint32_function() { | 618 ExternalReference ExternalReference::random_uint32_function() { |
614 return ExternalReference(Redirect(FUNCTION_ADDR(V8::Random))); | 619 return ExternalReference(Redirect(FUNCTION_ADDR(V8::Random))); |
615 } | 620 } |
616 | 621 |
617 | 622 |
618 ExternalReference ExternalReference::transcendental_cache_array_address() { | 623 ExternalReference ExternalReference::transcendental_cache_array_address() { |
619 return ExternalReference(TranscendentalCache::cache_array_address()); | 624 return ExternalReference(Isolate::Current()->transcendental_cache()-> |
| 625 cache_array_address()); |
620 } | 626 } |
621 | 627 |
622 | 628 |
623 ExternalReference ExternalReference::new_deoptimizer_function() { | 629 ExternalReference ExternalReference::new_deoptimizer_function() { |
624 return ExternalReference( | 630 return ExternalReference( |
625 Redirect(FUNCTION_ADDR(Deoptimizer::New))); | 631 Redirect(FUNCTION_ADDR(Deoptimizer::New))); |
626 } | 632 } |
627 | 633 |
628 | 634 |
629 ExternalReference ExternalReference::compute_output_frames_function() { | 635 ExternalReference ExternalReference::compute_output_frames_function() { |
630 return ExternalReference( | 636 return ExternalReference( |
631 Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); | 637 Redirect(FUNCTION_ADDR(Deoptimizer::ComputeOutputFrames))); |
632 } | 638 } |
633 | 639 |
634 | 640 |
635 ExternalReference ExternalReference::global_contexts_list() { | 641 ExternalReference ExternalReference::global_contexts_list() { |
636 return ExternalReference(Heap::global_contexts_list_address()); | 642 return ExternalReference(Isolate::Current()-> |
| 643 heap()->global_contexts_list_address()); |
637 } | 644 } |
638 | 645 |
639 | 646 |
640 ExternalReference ExternalReference::keyed_lookup_cache_keys() { | 647 ExternalReference ExternalReference::keyed_lookup_cache_keys() { |
641 return ExternalReference(KeyedLookupCache::keys_address()); | 648 return ExternalReference(Isolate::Current()-> |
| 649 keyed_lookup_cache()->keys_address()); |
642 } | 650 } |
643 | 651 |
644 | 652 |
645 ExternalReference ExternalReference::keyed_lookup_cache_field_offsets() { | 653 ExternalReference ExternalReference::keyed_lookup_cache_field_offsets() { |
646 return ExternalReference(KeyedLookupCache::field_offsets_address()); | 654 return ExternalReference(Isolate::Current()-> |
| 655 keyed_lookup_cache()->field_offsets_address()); |
647 } | 656 } |
648 | 657 |
649 | 658 |
650 ExternalReference ExternalReference::the_hole_value_location() { | 659 ExternalReference ExternalReference::the_hole_value_location() { |
651 return ExternalReference(Factory::the_hole_value().location()); | 660 return ExternalReference(FACTORY->the_hole_value().location()); |
652 } | 661 } |
653 | 662 |
654 | 663 |
655 ExternalReference ExternalReference::arguments_marker_location() { | 664 ExternalReference ExternalReference::arguments_marker_location() { |
656 return ExternalReference(Factory::arguments_marker().location()); | 665 return ExternalReference(FACTORY->arguments_marker().location()); |
657 } | 666 } |
658 | 667 |
659 | 668 |
660 ExternalReference ExternalReference::roots_address() { | 669 ExternalReference ExternalReference::roots_address() { |
661 return ExternalReference(Heap::roots_address()); | 670 return ExternalReference(HEAP->roots_address()); |
662 } | 671 } |
663 | 672 |
664 | 673 |
665 ExternalReference ExternalReference::address_of_stack_limit() { | 674 ExternalReference ExternalReference::address_of_stack_limit() { |
666 return ExternalReference(StackGuard::address_of_jslimit()); | 675 return ExternalReference( |
| 676 Isolate::Current()->stack_guard()->address_of_jslimit()); |
667 } | 677 } |
668 | 678 |
669 | 679 |
670 ExternalReference ExternalReference::address_of_real_stack_limit() { | 680 ExternalReference ExternalReference::address_of_real_stack_limit() { |
671 return ExternalReference(StackGuard::address_of_real_jslimit()); | 681 return ExternalReference( |
| 682 Isolate::Current()->stack_guard()->address_of_real_jslimit()); |
672 } | 683 } |
673 | 684 |
674 | 685 |
675 ExternalReference ExternalReference::address_of_regexp_stack_limit() { | 686 ExternalReference ExternalReference::address_of_regexp_stack_limit() { |
676 return ExternalReference(RegExpStack::limit_address()); | 687 return ExternalReference( |
| 688 Isolate::Current()->regexp_stack()->limit_address()); |
677 } | 689 } |
678 | 690 |
679 | 691 |
680 ExternalReference ExternalReference::new_space_start() { | 692 ExternalReference ExternalReference::new_space_start() { |
681 return ExternalReference(Heap::NewSpaceStart()); | 693 return ExternalReference(HEAP->NewSpaceStart()); |
682 } | 694 } |
683 | 695 |
684 | 696 |
685 ExternalReference ExternalReference::new_space_mask() { | 697 ExternalReference ExternalReference::new_space_mask() { |
686 return ExternalReference(reinterpret_cast<Address>(Heap::NewSpaceMask())); | 698 return ExternalReference(reinterpret_cast<Address>(HEAP->NewSpaceMask())); |
687 } | 699 } |
688 | 700 |
689 | 701 |
690 ExternalReference ExternalReference::new_space_allocation_top_address() { | 702 ExternalReference ExternalReference::new_space_allocation_top_address() { |
691 return ExternalReference(Heap::NewSpaceAllocationTopAddress()); | 703 return ExternalReference(HEAP->NewSpaceAllocationTopAddress()); |
692 } | 704 } |
693 | 705 |
694 | 706 |
695 ExternalReference ExternalReference::heap_always_allocate_scope_depth() { | 707 ExternalReference ExternalReference::heap_always_allocate_scope_depth() { |
696 return ExternalReference(Heap::always_allocate_scope_depth_address()); | 708 return ExternalReference(HEAP->always_allocate_scope_depth_address()); |
697 } | 709 } |
698 | 710 |
699 | 711 |
700 ExternalReference ExternalReference::new_space_allocation_limit_address() { | 712 ExternalReference ExternalReference::new_space_allocation_limit_address() { |
701 return ExternalReference(Heap::NewSpaceAllocationLimitAddress()); | 713 return ExternalReference(HEAP->NewSpaceAllocationLimitAddress()); |
702 } | 714 } |
703 | 715 |
704 | 716 |
705 ExternalReference ExternalReference::handle_scope_level_address() { | 717 ExternalReference ExternalReference::handle_scope_level_address() { |
706 return ExternalReference(HandleScope::current_level_address()); | 718 return ExternalReference(HandleScope::current_level_address()); |
707 } | 719 } |
708 | 720 |
709 | 721 |
710 ExternalReference ExternalReference::handle_scope_next_address() { | 722 ExternalReference ExternalReference::handle_scope_next_address() { |
711 return ExternalReference(HandleScope::current_next_address()); | 723 return ExternalReference(HandleScope::current_next_address()); |
712 } | 724 } |
713 | 725 |
714 | 726 |
715 ExternalReference ExternalReference::handle_scope_limit_address() { | 727 ExternalReference ExternalReference::handle_scope_limit_address() { |
716 return ExternalReference(HandleScope::current_limit_address()); | 728 return ExternalReference(HandleScope::current_limit_address()); |
717 } | 729 } |
718 | 730 |
719 | 731 |
720 ExternalReference ExternalReference::scheduled_exception_address() { | 732 ExternalReference ExternalReference::scheduled_exception_address() { |
721 return ExternalReference(Top::scheduled_exception_address()); | 733 return ExternalReference(Isolate::Current()->scheduled_exception_address()); |
722 } | 734 } |
723 | 735 |
724 | 736 |
725 ExternalReference ExternalReference::address_of_min_int() { | 737 ExternalReference ExternalReference::address_of_min_int() { |
726 return ExternalReference(reinterpret_cast<void*>( | 738 return ExternalReference(reinterpret_cast<void*>( |
727 const_cast<double*>(&DoubleConstant::min_int))); | 739 const_cast<double*>(&DoubleConstant::min_int))); |
728 } | 740 } |
729 | 741 |
730 | 742 |
731 ExternalReference ExternalReference::address_of_one_half() { | 743 ExternalReference ExternalReference::address_of_one_half() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 return ExternalReference(Redirect( | 789 return ExternalReference(Redirect( |
778 FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16))); | 790 FUNCTION_ADDR(NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16))); |
779 } | 791 } |
780 | 792 |
781 ExternalReference ExternalReference::re_word_character_map() { | 793 ExternalReference ExternalReference::re_word_character_map() { |
782 return ExternalReference( | 794 return ExternalReference( |
783 NativeRegExpMacroAssembler::word_character_map_address()); | 795 NativeRegExpMacroAssembler::word_character_map_address()); |
784 } | 796 } |
785 | 797 |
786 ExternalReference ExternalReference::address_of_static_offsets_vector() { | 798 ExternalReference ExternalReference::address_of_static_offsets_vector() { |
787 return ExternalReference(OffsetsVector::static_offsets_vector_address()); | 799 return ExternalReference(OffsetsVector::static_offsets_vector_address( |
| 800 Isolate::Current())); |
788 } | 801 } |
789 | 802 |
790 ExternalReference ExternalReference::address_of_regexp_stack_memory_address() { | 803 ExternalReference ExternalReference::address_of_regexp_stack_memory_address() { |
791 return ExternalReference(RegExpStack::memory_address()); | 804 return ExternalReference( |
| 805 Isolate::Current()->regexp_stack()->memory_address()); |
792 } | 806 } |
793 | 807 |
794 ExternalReference ExternalReference::address_of_regexp_stack_memory_size() { | 808 ExternalReference ExternalReference::address_of_regexp_stack_memory_size() { |
795 return ExternalReference(RegExpStack::memory_size_address()); | 809 return ExternalReference( |
| 810 Isolate::Current()->regexp_stack()->memory_size_address()); |
796 } | 811 } |
797 | 812 |
798 #endif // V8_INTERPRETED_REGEXP | 813 #endif // V8_INTERPRETED_REGEXP |
799 | 814 |
800 | 815 |
801 static double add_two_doubles(double x, double y) { | 816 static double add_two_doubles(double x, double y) { |
802 return x + y; | 817 return x + y; |
803 } | 818 } |
804 | 819 |
805 | 820 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL)); | 951 return ExternalReference(Redirect(FUNCTION_ADDR(function), FP_RETURN_CALL)); |
937 } | 952 } |
938 | 953 |
939 | 954 |
940 ExternalReference ExternalReference::compare_doubles() { | 955 ExternalReference ExternalReference::compare_doubles() { |
941 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), | 956 return ExternalReference(Redirect(FUNCTION_ADDR(native_compare_doubles), |
942 BUILTIN_CALL)); | 957 BUILTIN_CALL)); |
943 } | 958 } |
944 | 959 |
945 | 960 |
946 ExternalReference::ExternalReferenceRedirector* | |
947 ExternalReference::redirector_ = NULL; | |
948 | |
949 | |
950 #ifdef ENABLE_DEBUGGER_SUPPORT | 961 #ifdef ENABLE_DEBUGGER_SUPPORT |
951 ExternalReference ExternalReference::debug_break() { | 962 ExternalReference ExternalReference::debug_break() { |
952 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); | 963 return ExternalReference(Redirect(FUNCTION_ADDR(Debug::Break))); |
953 } | 964 } |
954 | 965 |
955 | 966 |
956 ExternalReference ExternalReference::debug_step_in_fp_address() { | 967 ExternalReference ExternalReference::debug_step_in_fp_address() { |
957 return ExternalReference(Debug::step_in_fp_addr()); | 968 return ExternalReference(Isolate::Current()->debug()->step_in_fp_addr()); |
958 } | 969 } |
959 #endif | 970 #endif |
960 | 971 |
961 | 972 |
962 void PositionsRecorder::RecordPosition(int pos) { | 973 void PositionsRecorder::RecordPosition(int pos) { |
963 ASSERT(pos != RelocInfo::kNoPosition); | 974 ASSERT(pos != RelocInfo::kNoPosition); |
964 ASSERT(pos >= 0); | 975 ASSERT(pos >= 0); |
965 state_.current_position = pos; | 976 state_.current_position = pos; |
966 #ifdef ENABLE_GDB_JIT_INTERFACE | 977 #ifdef ENABLE_GDB_JIT_INTERFACE |
967 if (gdbjit_lineinfo_ != NULL) { | 978 if (gdbjit_lineinfo_ != NULL) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1015 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
1005 state_.written_position = state_.current_position; | 1016 state_.written_position = state_.current_position; |
1006 written = true; | 1017 written = true; |
1007 } | 1018 } |
1008 | 1019 |
1009 // Return whether something was written. | 1020 // Return whether something was written. |
1010 return written; | 1021 return written; |
1011 } | 1022 } |
1012 | 1023 |
1013 } } // namespace v8::internal | 1024 } } // namespace v8::internal |
OLD | NEW |