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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 | 839 |
840 | 840 |
841 void Deserializer::ReadData(Object** current, Object** limit, int source_space, | 841 void Deserializer::ReadData(Object** current, Object** limit, int source_space, |
842 Address current_object_address) { | 842 Address current_object_address) { |
843 Isolate* const isolate = isolate_; | 843 Isolate* const isolate = isolate_; |
844 // Write barrier support costs around 1% in startup time. In fact there | 844 // Write barrier support costs around 1% in startup time. In fact there |
845 // are no new space objects in current boot snapshots, so it's not needed, | 845 // are no new space objects in current boot snapshots, so it's not needed, |
846 // but that may change. | 846 // but that may change. |
847 bool write_barrier_needed = | 847 bool write_barrier_needed = |
848 (current_object_address != NULL && source_space != NEW_SPACE && | 848 (current_object_address != NULL && source_space != NEW_SPACE && |
849 source_space != CELL_SPACE && source_space != PROPERTY_CELL_SPACE && | 849 source_space != CELL_SPACE && source_space != CODE_SPACE); |
850 source_space != CODE_SPACE); | |
851 while (current < limit) { | 850 while (current < limit) { |
852 byte data = source_.Get(); | 851 byte data = source_.Get(); |
853 switch (data) { | 852 switch (data) { |
854 #define CASE_STATEMENT(where, how, within, space_number) \ | 853 #define CASE_STATEMENT(where, how, within, space_number) \ |
855 case where + how + within + space_number: \ | 854 case where + how + within + space_number: \ |
856 STATIC_ASSERT((where & ~kPointedToMask) == 0); \ | 855 STATIC_ASSERT((where & ~kPointedToMask) == 0); \ |
857 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ | 856 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ |
858 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ | 857 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ |
859 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); | 858 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); |
860 | 859 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 current_object_address, \ | 940 current_object_address, \ |
942 static_cast<int>(current_address - current_object_address)); \ | 941 static_cast<int>(current_address - current_object_address)); \ |
943 } \ | 942 } \ |
944 if (!current_was_incremented) { \ | 943 if (!current_was_incremented) { \ |
945 current++; \ | 944 current++; \ |
946 } \ | 945 } \ |
947 break; \ | 946 break; \ |
948 } | 947 } |
949 | 948 |
950 // This generates a case and a body for the new space (which has to do extra | 949 // This generates a case and a body for the new space (which has to do extra |
951 // write barrier handling) and handles the other spaces with 8 fall-through | 950 // write barrier handling) and handles the other spaces with fall-through cases |
952 // cases and one body. | 951 // and one body. |
953 #define ALL_SPACES(where, how, within) \ | 952 #define ALL_SPACES(where, how, within) \ |
954 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 953 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
955 CASE_BODY(where, how, within, NEW_SPACE) \ | 954 CASE_BODY(where, how, within, NEW_SPACE) \ |
956 CASE_STATEMENT(where, how, within, OLD_SPACE) \ | 955 CASE_STATEMENT(where, how, within, OLD_SPACE) \ |
957 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 956 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
958 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 957 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
959 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | 958 CASE_STATEMENT(where, how, within, CELL_SPACE) \ |
960 CASE_STATEMENT(where, how, within, PROPERTY_CELL_SPACE) \ | |
961 CASE_STATEMENT(where, how, within, LO_SPACE) \ | 959 CASE_STATEMENT(where, how, within, LO_SPACE) \ |
962 CASE_BODY(where, how, within, kAnyOldSpace) | 960 CASE_BODY(where, how, within, kAnyOldSpace) |
963 | 961 |
964 #define FOUR_CASES(byte_code) \ | 962 #define FOUR_CASES(byte_code) \ |
965 case byte_code: \ | 963 case byte_code: \ |
966 case byte_code + 1: \ | 964 case byte_code + 1: \ |
967 case byte_code + 2: \ | 965 case byte_code + 2: \ |
968 case byte_code + 3: | 966 case byte_code + 3: |
969 | 967 |
970 #define SIXTEEN_CASES(byte_code) \ | 968 #define SIXTEEN_CASES(byte_code) \ |
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 DisallowHeapAllocation no_gc; | 2547 DisallowHeapAllocation no_gc; |
2550 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2548 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2551 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2549 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2552 if (r == CHECK_SUCCESS) return scd; | 2550 if (r == CHECK_SUCCESS) return scd; |
2553 cached_data->Reject(); | 2551 cached_data->Reject(); |
2554 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2552 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2555 delete scd; | 2553 delete scd; |
2556 return NULL; | 2554 return NULL; |
2557 } | 2555 } |
2558 } } // namespace v8::internal | 2556 } } // namespace v8::internal |
OLD | NEW |