| 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 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 | 836 |
| 845 | 837 |
| 846 void Deserializer::ReadData(Object** current, Object** limit, int source_space, | 838 void Deserializer::ReadData(Object** current, Object** limit, int source_space, |
| 847 Address current_object_address) { | 839 Address current_object_address) { |
| 848 Isolate* const isolate = isolate_; | 840 Isolate* const isolate = isolate_; |
| 849 // Write barrier support costs around 1% in startup time. In fact there | 841 // Write barrier support costs around 1% in startup time. In fact there |
| 850 // are no new space objects in current boot snapshots, so it's not needed, | 842 // are no new space objects in current boot snapshots, so it's not needed, |
| 851 // but that may change. | 843 // but that may change. |
| 852 bool write_barrier_needed = | 844 bool write_barrier_needed = |
| 853 (current_object_address != NULL && source_space != NEW_SPACE && | 845 (current_object_address != NULL && source_space != NEW_SPACE && |
| 854 source_space != CELL_SPACE && source_space != CODE_SPACE && | 846 source_space != CELL_SPACE && source_space != CODE_SPACE); |
| 855 source_space != OLD_DATA_SPACE); | |
| 856 while (current < limit) { | 847 while (current < limit) { |
| 857 byte data = source_.Get(); | 848 byte data = source_.Get(); |
| 858 switch (data) { | 849 switch (data) { |
| 859 #define CASE_STATEMENT(where, how, within, space_number) \ | 850 #define CASE_STATEMENT(where, how, within, space_number) \ |
| 860 case where + how + within + space_number: \ | 851 case where + how + within + space_number: \ |
| 861 STATIC_ASSERT((where & ~kWhereMask) == 0); \ | 852 STATIC_ASSERT((where & ~kWhereMask) == 0); \ |
| 862 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ | 853 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ |
| 863 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ | 854 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ |
| 864 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); | 855 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); |
| 865 | 856 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 } \ | 939 } \ |
| 949 if (!current_was_incremented) { \ | 940 if (!current_was_incremented) { \ |
| 950 current++; \ | 941 current++; \ |
| 951 } \ | 942 } \ |
| 952 break; \ | 943 break; \ |
| 953 } | 944 } |
| 954 | 945 |
| 955 // 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 |
| 956 // 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 |
| 957 // and one body. | 948 // and one body. |
| 958 #define ALL_SPACES(where, how, within) \ | 949 #define ALL_SPACES(where, how, within) \ |
| 959 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 950 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
| 960 CASE_BODY(where, how, within, NEW_SPACE) \ | 951 CASE_BODY(where, how, within, NEW_SPACE) \ |
| 961 CASE_STATEMENT(where, how, within, OLD_DATA_SPACE) \ | 952 CASE_STATEMENT(where, how, within, OLD_SPACE) \ |
| 962 CASE_STATEMENT(where, how, within, OLD_POINTER_SPACE) \ | 953 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
| 963 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 954 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
| 964 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 955 CASE_STATEMENT(where, how, within, CELL_SPACE) \ |
| 965 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | 956 CASE_STATEMENT(where, how, within, LO_SPACE) \ |
| 966 CASE_STATEMENT(where, how, within, LO_SPACE) \ | |
| 967 CASE_BODY(where, how, within, kAnyOldSpace) | 957 CASE_BODY(where, how, within, kAnyOldSpace) |
| 968 | 958 |
| 969 #define FOUR_CASES(byte_code) \ | 959 #define FOUR_CASES(byte_code) \ |
| 970 case byte_code: \ | 960 case byte_code: \ |
| 971 case byte_code + 1: \ | 961 case byte_code + 1: \ |
| 972 case byte_code + 2: \ | 962 case byte_code + 2: \ |
| 973 case byte_code + 3: | 963 case byte_code + 3: |
| 974 | 964 |
| 975 #define SIXTEEN_CASES(byte_code) \ | 965 #define SIXTEEN_CASES(byte_code) \ |
| 976 FOUR_CASES(byte_code) \ | 966 FOUR_CASES(byte_code) \ |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 map = internalized ? isolate->heap()->internalized_string_map() | 1664 map = internalized ? isolate->heap()->internalized_string_map() |
| 1675 : isolate->heap()->string_map(); | 1665 : isolate->heap()->string_map(); |
| 1676 allocation_size = SeqTwoByteString::SizeFor(length); | 1666 allocation_size = SeqTwoByteString::SizeFor(length); |
| 1677 content_size = length * kShortSize; | 1667 content_size = length * kShortSize; |
| 1678 resource = reinterpret_cast<const byte*>( | 1668 resource = reinterpret_cast<const byte*>( |
| 1679 ExternalTwoByteString::cast(string)->resource()->data()); | 1669 ExternalTwoByteString::cast(string)->resource()->data()); |
| 1680 } | 1670 } |
| 1681 | 1671 |
| 1682 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) | 1672 AllocationSpace space = (allocation_size > Page::kMaxRegularHeapObjectSize) |
| 1683 ? LO_SPACE | 1673 ? LO_SPACE |
| 1684 : OLD_DATA_SPACE; | 1674 : OLD_SPACE; |
| 1685 SerializePrologue(space, allocation_size, map); | 1675 SerializePrologue(space, allocation_size, map); |
| 1686 | 1676 |
| 1687 // Output the rest of the imaginary string. | 1677 // Output the rest of the imaginary string. |
| 1688 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; | 1678 int bytes_to_output = allocation_size - HeapObject::kHeaderSize; |
| 1689 | 1679 |
| 1690 // Output raw data header. Do not bother with common raw length cases here. | 1680 // Output raw data header. Do not bother with common raw length cases here. |
| 1691 sink_->Put(kVariableRawData, "RawDataForString"); | 1681 sink_->Put(kVariableRawData, "RawDataForString"); |
| 1692 sink_->PutInt(bytes_to_output, "length"); | 1682 sink_->PutInt(bytes_to_output, "length"); |
| 1693 | 1683 |
| 1694 // Serialize string header (except for map). | 1684 // Serialize string header (except for map). |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2533 DisallowHeapAllocation no_gc; | 2523 DisallowHeapAllocation no_gc; |
| 2534 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2524 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
| 2535 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2525 SanityCheckResult r = scd->SanityCheck(isolate, source); |
| 2536 if (r == CHECK_SUCCESS) return scd; | 2526 if (r == CHECK_SUCCESS) return scd; |
| 2537 cached_data->Reject(); | 2527 cached_data->Reject(); |
| 2538 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2528 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
| 2539 delete scd; | 2529 delete scd; |
| 2540 return NULL; | 2530 return NULL; |
| 2541 } | 2531 } |
| 2542 } } // namespace v8::internal | 2532 } } // namespace v8::internal |
| OLD | NEW |