| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/api.h" | 8 #include "src/api.h" |
| 9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 Add(ExternalReference::address_of_the_hole_nan().address(), "the_hole_nan"); | 98 Add(ExternalReference::address_of_the_hole_nan().address(), "the_hole_nan"); |
| 99 Add(ExternalReference::get_date_field_function(isolate).address(), | 99 Add(ExternalReference::get_date_field_function(isolate).address(), |
| 100 "JSDate::GetField"); | 100 "JSDate::GetField"); |
| 101 Add(ExternalReference::date_cache_stamp(isolate).address(), | 101 Add(ExternalReference::date_cache_stamp(isolate).address(), |
| 102 "date_cache_stamp"); | 102 "date_cache_stamp"); |
| 103 Add(ExternalReference::address_of_pending_message_obj(isolate).address(), | 103 Add(ExternalReference::address_of_pending_message_obj(isolate).address(), |
| 104 "address_of_pending_message_obj"); | 104 "address_of_pending_message_obj"); |
| 105 Add(ExternalReference::get_make_code_young_function(isolate).address(), | 105 Add(ExternalReference::get_make_code_young_function(isolate).address(), |
| 106 "Code::MakeCodeYoung"); | 106 "Code::MakeCodeYoung"); |
| 107 Add(ExternalReference::cpu_features().address(), "cpu_features"); | 107 Add(ExternalReference::cpu_features().address(), "cpu_features"); |
| 108 Add(ExternalReference::old_pointer_space_allocation_top_address(isolate) | 108 Add(ExternalReference::old_space_allocation_top_address(isolate).address(), |
| 109 .address(), | 109 "Heap::OldSpaceAllocationTopAddress"); |
| 110 "Heap::OldPointerSpaceAllocationTopAddress"); | 110 Add(ExternalReference::old_space_allocation_limit_address(isolate).address(), |
| 111 Add(ExternalReference::old_pointer_space_allocation_limit_address(isolate) | 111 "Heap::OldSpaceAllocationLimitAddress"); |
| 112 .address(), | |
| 113 "Heap::OldPointerSpaceAllocationLimitAddress"); | |
| 114 Add(ExternalReference::old_data_space_allocation_top_address(isolate) | |
| 115 .address(), | |
| 116 "Heap::OldDataSpaceAllocationTopAddress"); | |
| 117 Add(ExternalReference::old_data_space_allocation_limit_address(isolate) | |
| 118 .address(), | |
| 119 "Heap::OldDataSpaceAllocationLimitAddress"); | |
| 120 Add(ExternalReference::allocation_sites_list_address(isolate).address(), | 112 Add(ExternalReference::allocation_sites_list_address(isolate).address(), |
| 121 "Heap::allocation_sites_list_address()"); | 113 "Heap::allocation_sites_list_address()"); |
| 122 Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias"); | 114 Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias"); |
| 123 Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(), | 115 Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(), |
| 124 "Code::MarkCodeAsExecuted"); | 116 "Code::MarkCodeAsExecuted"); |
| 125 Add(ExternalReference::is_profiling_address(isolate).address(), | 117 Add(ExternalReference::is_profiling_address(isolate).address(), |
| 126 "CpuProfiler::is_profiling"); | 118 "CpuProfiler::is_profiling"); |
| 127 Add(ExternalReference::scheduled_exception_address(isolate).address(), | 119 Add(ExternalReference::scheduled_exception_address(isolate).address(), |
| 128 "Isolate::scheduled_exception"); | 120 "Isolate::scheduled_exception"); |
| 129 Add(ExternalReference::invoke_function_callback(isolate).address(), | 121 Add(ExternalReference::invoke_function_callback(isolate).address(), |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 } | 839 } |
| 848 } | 840 } |
| 849 | 841 |
| 850 | 842 |
| 851 void Deserializer::ReadData(Object** current, Object** limit, int source_space, | 843 void Deserializer::ReadData(Object** current, Object** limit, int source_space, |
| 852 Address current_object_address) { | 844 Address current_object_address) { |
| 853 Isolate* const isolate = isolate_; | 845 Isolate* const isolate = isolate_; |
| 854 // Write barrier support costs around 1% in startup time. In fact there | 846 // Write barrier support costs around 1% in startup time. In fact there |
| 855 // are no new space objects in current boot snapshots, so it's not needed, | 847 // are no new space objects in current boot snapshots, so it's not needed, |
| 856 // but that may change. | 848 // but that may change. |
| 857 bool write_barrier_needed = (current_object_address != NULL && | 849 bool write_barrier_needed = |
| 858 source_space != NEW_SPACE && | 850 (current_object_address != NULL && source_space != NEW_SPACE && |
| 859 source_space != CELL_SPACE && | 851 source_space != CELL_SPACE && source_space != PROPERTY_CELL_SPACE && |
| 860 source_space != PROPERTY_CELL_SPACE && | 852 source_space != CODE_SPACE); |
| 861 source_space != CODE_SPACE && | |
| 862 source_space != OLD_DATA_SPACE); | |
| 863 while (current < limit) { | 853 while (current < limit) { |
| 864 byte data = source_.Get(); | 854 byte data = source_.Get(); |
| 865 switch (data) { | 855 switch (data) { |
| 866 #define CASE_STATEMENT(where, how, within, space_number) \ | 856 #define CASE_STATEMENT(where, how, within, space_number) \ |
| 867 case where + how + within + space_number: \ | 857 case where + how + within + space_number: \ |
| 868 STATIC_ASSERT((where & ~kPointedToMask) == 0); \ | 858 STATIC_ASSERT((where & ~kPointedToMask) == 0); \ |
| 869 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ | 859 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ |
| 870 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ | 860 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ |
| 871 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); | 861 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); |
| 872 | 862 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 } \ | 948 } \ |
| 959 break; \ | 949 break; \ |
| 960 } | 950 } |
| 961 | 951 |
| 962 // This generates a case and a body for the new space (which has to do extra | 952 // This generates a case and a body for the new space (which has to do extra |
| 963 // write barrier handling) and handles the other spaces with 8 fall-through | 953 // write barrier handling) and handles the other spaces with 8 fall-through |
| 964 // cases and one body. | 954 // cases and one body. |
| 965 #define ALL_SPACES(where, how, within) \ | 955 #define ALL_SPACES(where, how, within) \ |
| 966 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 956 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
| 967 CASE_BODY(where, how, within, NEW_SPACE) \ | 957 CASE_BODY(where, how, within, NEW_SPACE) \ |
| 968 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ | 958 CASE_STATEMENT(where, how, within, OLD_SPACE) \ |
| 969 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \ | |
| 970 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 959 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
| 971 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 960 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
| 972 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | 961 CASE_STATEMENT(where, how, within, CELL_SPACE) \ |
| 973 CASE_STATEMENT(where, how, within, PROPERTY_CELL_SPACE) \ | 962 CASE_STATEMENT(where, how, within, PROPERTY_CELL_SPACE) \ |
| 974 CASE_STATEMENT(where, how, within, LO_SPACE) \ | 963 CASE_STATEMENT(where, how, within, LO_SPACE) \ |
| 975 CASE_BODY(where, how, within, kAnyOldSpace) | 964 CASE_BODY(where, how, within, kAnyOldSpace) |
| 976 | 965 |
| 977 #define FOUR_CASES(byte_code) \ | 966 #define FOUR_CASES(byte_code) \ |
| 978 case byte_code: \ | 967 case byte_code: \ |
| 979 case byte_code + 1: \ | 968 case byte_code + 1: \ |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 map = internalized ? isolate->heap()->internalized_string_map() | 1704 map = internalized ? isolate->heap()->internalized_string_map() |
| 1716 : isolate->heap()->string_map(); | 1705 : isolate->heap()->string_map(); |
| 1717 allocation_size = SeqTwoByteString::SizeFor(length); | 1706 allocation_size = SeqTwoByteString::SizeFor(length); |
| 1718 content_size = length * kShortSize; | 1707 content_size = length * kShortSize; |
| 1719 resource = reinterpret_cast<const byte*>( | 1708 resource = reinterpret_cast<const byte*>( |
| 1720 ExternalTwoByteString::cast(string)->resource()->data()); | 1709 ExternalTwoByteString::cast(string)->resource()->data()); |
| 1721 } | 1710 } |
| 1722 | 1711 |
| 1723 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) | 1712 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) |
| 1724 ? LO_SPACE | 1713 ? LO_SPACE |
| 1725 : OLD_DATA_SPACE; | 1714 : OLD_SPACE; |
| 1726 SerializePrologue(space, allocation_size, map); | 1715 SerializePrologue(space, allocation_size, map); |
| 1727 | 1716 |
| 1728 // Output the rest of the imaginary string. | 1717 // Output the rest of the imaginary string. |
| 1729 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; | 1718 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; |
| 1730 | 1719 |
| 1731 // Output raw data header. Do not bother with common raw length cases here. | 1720 // Output raw data header. Do not bother with common raw length cases here. |
| 1732 sink_->Put(kRawData, "RawDataForString"); | 1721 sink_->Put(kRawData, "RawDataForString"); |
| 1733 sink_->PutInt(bytes_to_output, "length"); | 1722 sink_->PutInt(bytes_to_output, "length"); |
| 1734 | 1723 |
| 1735 // Serialize string header (except for map). | 1724 // Serialize string header (except for map). |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2562 DisallowHeapAllocation no_gc; | 2551 DisallowHeapAllocation no_gc; |
| 2563 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2552 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2564 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2553 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2565 if (r == CHECK_SUCCESS) return scd; | 2554 if (r == CHECK_SUCCESS) return scd; |
| 2566 cached_data->Reject(); | 2555 cached_data->Reject(); |
| 2567 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2556 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2568 delete scd; | 2557 delete scd; |
| 2569 return NULL; | 2558 return NULL; |
| 2570 } | 2559 } |
| 2571 } } // namespace v8::internal | 2560 } } // namespace v8::internal |
| OLD | NEW |