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_space_allocation_top_address(isolate).address(), | 108 Add(ExternalReference::old_pointer_space_allocation_top_address(isolate) |
109 "Heap::OldSpaceAllocationTopAddress"); | 109 .address(), |
110 Add(ExternalReference::old_space_allocation_limit_address(isolate).address(), | 110 "Heap::OldPointerSpaceAllocationTopAddress"); |
111 "Heap::OldSpaceAllocationLimitAddress"); | 111 Add(ExternalReference::old_pointer_space_allocation_limit_address(isolate) |
| 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"); |
112 Add(ExternalReference::allocation_sites_list_address(isolate).address(), | 120 Add(ExternalReference::allocation_sites_list_address(isolate).address(), |
113 "Heap::allocation_sites_list_address()"); | 121 "Heap::allocation_sites_list_address()"); |
114 Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias"); | 122 Add(ExternalReference::address_of_uint32_bias().address(), "uint32_bias"); |
115 Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(), | 123 Add(ExternalReference::get_mark_code_as_executed_function(isolate).address(), |
116 "Code::MarkCodeAsExecuted"); | 124 "Code::MarkCodeAsExecuted"); |
117 Add(ExternalReference::is_profiling_address(isolate).address(), | 125 Add(ExternalReference::is_profiling_address(isolate).address(), |
118 "CpuProfiler::is_profiling"); | 126 "CpuProfiler::is_profiling"); |
119 Add(ExternalReference::scheduled_exception_address(isolate).address(), | 127 Add(ExternalReference::scheduled_exception_address(isolate).address(), |
120 "Isolate::scheduled_exception"); | 128 "Isolate::scheduled_exception"); |
121 Add(ExternalReference::invoke_function_callback(isolate).address(), | 129 Add(ExternalReference::invoke_function_callback(isolate).address(), |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 835 |
828 | 836 |
829 void Deserializer::ReadData(Object** current, Object** limit, int source_space, | 837 void Deserializer::ReadData(Object** current, Object** limit, int source_space, |
830 Address current_object_address) { | 838 Address current_object_address) { |
831 Isolate* const isolate = isolate_; | 839 Isolate* const isolate = isolate_; |
832 // Write barrier support costs around 1% in startup time. In fact there | 840 // Write barrier support costs around 1% in startup time. In fact there |
833 // are no new space objects in current boot snapshots, so it's not needed, | 841 // are no new space objects in current boot snapshots, so it's not needed, |
834 // but that may change. | 842 // but that may change. |
835 bool write_barrier_needed = | 843 bool write_barrier_needed = |
836 (current_object_address != NULL && source_space != NEW_SPACE && | 844 (current_object_address != NULL && source_space != NEW_SPACE && |
837 source_space != CELL_SPACE && source_space != CODE_SPACE); | 845 source_space != CELL_SPACE && source_space != CODE_SPACE && |
| 846 source_space != OLD_DATA_SPACE); |
838 while (current < limit) { | 847 while (current < limit) { |
839 byte data = source_.Get(); | 848 byte data = source_.Get(); |
840 switch (data) { | 849 switch (data) { |
841 #define CASE_STATEMENT(where, how, within, space_number) \ | 850 #define CASE_STATEMENT(where, how, within, space_number) \ |
842 case where + how + within + space_number: \ | 851 case where + how + within + space_number: \ |
843 STATIC_ASSERT((where & ~kWhereMask) == 0); \ | 852 STATIC_ASSERT((where & ~kWhereMask) == 0); \ |
844 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ | 853 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ |
845 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ | 854 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ |
846 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); | 855 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); |
847 | 856 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 } \ | 939 } \ |
931 if (!current_was_incremented) { \ | 940 if (!current_was_incremented) { \ |
932 current++; \ | 941 current++; \ |
933 } \ | 942 } \ |
934 break; \ | 943 break; \ |
935 } | 944 } |
936 | 945 |
937 // This generates a case and a body for the new space (which has to do extra | 946 // This generates a case and a body for the new space (which has to do extra |
938 // write barrier handling) and handles the other spaces with fall-through cases | 947 // write barrier handling) and handles the other spaces with fall-through cases |
939 // and one body. | 948 // and one body. |
940 #define ALL_SPACES(where, how, within) \ | 949 #define ALL_SPACES(where, how, within) \ |
941 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 950 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
942 CASE_BODY(where, how, within, NEW_SPACE) \ | 951 CASE_BODY(where, how, within, NEW_SPACE) \ |
943 CASE_STATEMENT(where, how, within, OLD_SPACE) \ | 952 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ |
944 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 953 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \ |
945 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 954 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
946 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | 955 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
947 CASE_STATEMENT(where, how, within, LO_SPACE) \ | 956 CASE_STATEMENT(where, how, within, CELL_SPACE) \ |
| 957 CASE_STATEMENT(where, how, within, LO_SPACE) \ |
948 CASE_BODY(where, how, within, kAnyOldSpace) | 958 CASE_BODY(where, how, within, kAnyOldSpace) |
949 | 959 |
950 #define FOUR_CASES(byte_code) \ | 960 #define FOUR_CASES(byte_code) \ |
951 case byte_code: \ | 961 case byte_code: \ |
952 case byte_code + 1: \ | 962 case byte_code + 1: \ |
953 case byte_code + 2: \ | 963 case byte_code + 2: \ |
954 case byte_code + 3: | 964 case byte_code + 3: |
955 | 965 |
956 #define SIXTEEN_CASES(byte_code) \ | 966 #define SIXTEEN_CASES(byte_code) \ |
957 FOUR_CASES(byte_code) \ | 967 FOUR_CASES(byte_code) \ |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 map = internalized ? isolate->heap()->internalized_string_map() | 1662 map = internalized ? isolate->heap()->internalized_string_map() |
1653 : isolate->heap()->string_map(); | 1663 : isolate->heap()->string_map(); |
1654 allocation_size = SeqTwoByteString::SizeFor(length); | 1664 allocation_size = SeqTwoByteString::SizeFor(length); |
1655 content_size = length * kShortSize; | 1665 content_size = length * kShortSize; |
1656 resource = reinterpret_cast<const byte*>( | 1666 resource = reinterpret_cast<const byte*>( |
1657 ExternalTwoByteString::cast(string)->resource()->data()); | 1667 ExternalTwoByteString::cast(string)->resource()->data()); |
1658 } | 1668 } |
1659 | 1669 |
1660 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) | 1670 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) |
1661 ? LO_SPACE | 1671 ? LO_SPACE |
1662 : OLD_SPACE; | 1672 : OLD_DATA_SPACE; |
1663 SerializePrologue(space, allocation_size, map); | 1673 SerializePrologue(space, allocation_size, map); |
1664 | 1674 |
1665 // Output the rest of the imaginary string. | 1675 // Output the rest of the imaginary string. |
1666 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; | 1676 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; |
1667 | 1677 |
1668 // Output raw data header. Do not bother with common raw length cases here. | 1678 // Output raw data header. Do not bother with common raw length cases here. |
1669 sink_->Put(kVariableRawData, "RawDataForString"); | 1679 sink_->Put(kVariableRawData, "RawDataForString"); |
1670 sink_->PutInt(bytes_to_output, "length"); | 1680 sink_->PutInt(bytes_to_output, "length"); |
1671 | 1681 |
1672 // Serialize string header (except for map). | 1682 // Serialize string header (except for map). |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2508 DisallowHeapAllocation no_gc; | 2518 DisallowHeapAllocation no_gc; |
2509 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2519 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2510 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2520 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2511 if (r == CHECK_SUCCESS) return scd; | 2521 if (r == CHECK_SUCCESS) return scd; |
2512 cached_data->Reject(); | 2522 cached_data->Reject(); |
2513 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2523 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2514 delete scd; | 2524 delete scd; |
2515 return NULL; | 2525 return NULL; |
2516 } | 2526 } |
2517 } } // namespace v8::internal | 2527 } } // namespace v8::internal |
OLD | NEW |