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 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 | 836 |
837 | 837 |
838 void Deserializer::ReadData(Object** current, Object** limit, int source_space, | 838 void Deserializer::ReadData(Object** current, Object** limit, int source_space, |
839 Address current_object_address) { | 839 Address current_object_address) { |
840 Isolate* const isolate = isolate_; | 840 Isolate* const isolate = isolate_; |
841 // 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 |
842 // 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, |
843 // but that may change. | 843 // but that may change. |
844 bool write_barrier_needed = | 844 bool write_barrier_needed = |
845 (current_object_address != NULL && source_space != NEW_SPACE && | 845 (current_object_address != NULL && source_space != NEW_SPACE && |
846 source_space != CELL_SPACE && source_space != CODE_SPACE); | 846 source_space != CODE_SPACE); |
847 while (current < limit) { | 847 while (current < limit) { |
848 byte data = source_.Get(); | 848 byte data = source_.Get(); |
849 switch (data) { | 849 switch (data) { |
850 #define CASE_STATEMENT(where, how, within, space_number) \ | 850 #define CASE_STATEMENT(where, how, within, space_number) \ |
851 case where + how + within + space_number: \ | 851 case where + how + within + space_number: \ |
852 STATIC_ASSERT((where & ~kWhereMask) == 0); \ | 852 STATIC_ASSERT((where & ~kWhereMask) == 0); \ |
853 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ | 853 STATIC_ASSERT((how & ~kHowToCodeMask) == 0); \ |
854 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ | 854 STATIC_ASSERT((within & ~kWhereToPointMask) == 0); \ |
855 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); | 855 STATIC_ASSERT((space_number & ~kSpaceMask) == 0); |
856 | 856 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 | 945 |
946 // 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 |
947 // 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 |
948 // and one body. | 948 // and one body. |
949 #define ALL_SPACES(where, how, within) \ | 949 #define ALL_SPACES(where, how, within) \ |
950 CASE_STATEMENT(where, how, within, NEW_SPACE) \ | 950 CASE_STATEMENT(where, how, within, NEW_SPACE) \ |
951 CASE_BODY(where, how, within, NEW_SPACE) \ | 951 CASE_BODY(where, how, within, NEW_SPACE) \ |
952 CASE_STATEMENT(where, how, within, OLD_SPACE) \ | 952 CASE_STATEMENT(where, how, within, OLD_SPACE) \ |
953 CASE_STATEMENT(where, how, within, CODE_SPACE) \ | 953 CASE_STATEMENT(where, how, within, CODE_SPACE) \ |
954 CASE_STATEMENT(where, how, within, MAP_SPACE) \ | 954 CASE_STATEMENT(where, how, within, MAP_SPACE) \ |
955 CASE_STATEMENT(where, how, within, CELL_SPACE) \ | |
956 CASE_STATEMENT(where, how, within, LO_SPACE) \ | 955 CASE_STATEMENT(where, how, within, LO_SPACE) \ |
957 CASE_BODY(where, how, within, kAnyOldSpace) | 956 CASE_BODY(where, how, within, kAnyOldSpace) |
958 | 957 |
959 #define FOUR_CASES(byte_code) \ | 958 #define FOUR_CASES(byte_code) \ |
960 case byte_code: \ | 959 case byte_code: \ |
961 case byte_code + 1: \ | 960 case byte_code + 1: \ |
962 case byte_code + 2: \ | 961 case byte_code + 2: \ |
963 case byte_code + 3: | 962 case byte_code + 3: |
964 | 963 |
965 #define SIXTEEN_CASES(byte_code) \ | 964 #define SIXTEEN_CASES(byte_code) \ |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2523 DisallowHeapAllocation no_gc; | 2522 DisallowHeapAllocation no_gc; |
2524 SerializedCodeData* scd = new SerializedCodeData(cached_data); | 2523 SerializedCodeData* scd = new SerializedCodeData(cached_data); |
2525 SanityCheckResult r = scd->SanityCheck(isolate, source); | 2524 SanityCheckResult r = scd->SanityCheck(isolate, source); |
2526 if (r == CHECK_SUCCESS) return scd; | 2525 if (r == CHECK_SUCCESS) return scd; |
2527 cached_data->Reject(); | 2526 cached_data->Reject(); |
2528 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); | 2527 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); |
2529 delete scd; | 2528 delete scd; |
2530 return NULL; | 2529 return NULL; |
2531 } | 2530 } |
2532 } } // namespace v8::internal | 2531 } } // namespace v8::internal |
OLD | NEW |