Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(658)

Side by Side Diff: src/snapshot/serialize.cc

Issue 1189743003: [destructuring] Implement parameter pattern matching. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix magic number issue Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2621 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 2632
2633 // Copy serialized data. 2633 // Copy serialized data.
2634 CopyBytes(data_ + padded_payload_offset, payload.begin(), 2634 CopyBytes(data_ + padded_payload_offset, payload.begin(),
2635 static_cast<size_t>(payload.length())); 2635 static_cast<size_t>(payload.length()));
2636 } 2636 }
2637 2637
2638 2638
2639 SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck( 2639 SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
2640 Isolate* isolate, String* source) const { 2640 Isolate* isolate, String* source) const {
2641 uint32_t magic_number = GetMagicNumber(); 2641 uint32_t magic_number = GetMagicNumber();
2642 if (magic_number != ComputeMagicNumber(isolate)) return MAGIC_NUMBER_MISMATCH;
2642 uint32_t version_hash = GetHeaderValue(kVersionHashOffset); 2643 uint32_t version_hash = GetHeaderValue(kVersionHashOffset);
2643 uint32_t source_hash = GetHeaderValue(kSourceHashOffset); 2644 uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
2644 uint32_t cpu_features = GetHeaderValue(kCpuFeaturesOffset); 2645 uint32_t cpu_features = GetHeaderValue(kCpuFeaturesOffset);
2645 uint32_t flags_hash = GetHeaderValue(kFlagHashOffset); 2646 uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
2646 uint32_t c1 = GetHeaderValue(kChecksum1Offset); 2647 uint32_t c1 = GetHeaderValue(kChecksum1Offset);
2647 uint32_t c2 = GetHeaderValue(kChecksum2Offset); 2648 uint32_t c2 = GetHeaderValue(kChecksum2Offset);
2648 if (magic_number != ComputeMagicNumber(isolate)) return MAGIC_NUMBER_MISMATCH;
2649 if (version_hash != Version::Hash()) return VERSION_MISMATCH; 2649 if (version_hash != Version::Hash()) return VERSION_MISMATCH;
2650 if (source_hash != SourceHash(source)) return SOURCE_MISMATCH; 2650 if (source_hash != SourceHash(source)) return SOURCE_MISMATCH;
2651 if (cpu_features != static_cast<uint32_t>(CpuFeatures::SupportedFeatures())) { 2651 if (cpu_features != static_cast<uint32_t>(CpuFeatures::SupportedFeatures())) {
2652 return CPU_FEATURES_MISMATCH; 2652 return CPU_FEATURES_MISMATCH;
2653 } 2653 }
2654 if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH; 2654 if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH;
2655 if (!Checksum(Payload()).Check(c1, c2)) return CHECKSUM_MISMATCH; 2655 if (!Checksum(Payload()).Check(c1, c2)) return CHECKSUM_MISMATCH;
2656 return CHECK_SUCCESS; 2656 return CHECK_SUCCESS;
2657 } 2657 }
2658 2658
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2712 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2713 SanityCheckResult r = scd->SanityCheck(isolate, source); 2713 SanityCheckResult r = scd->SanityCheck(isolate, source);
2714 if (r == CHECK_SUCCESS) return scd; 2714 if (r == CHECK_SUCCESS) return scd;
2715 cached_data->Reject(); 2715 cached_data->Reject();
2716 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2716 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2717 delete scd; 2717 delete scd;
2718 return NULL; 2718 return NULL;
2719 } 2719 }
2720 } // namespace internal 2720 } // namespace internal
2721 } // namespace v8 2721 } // namespace v8
OLDNEW
« no previous file with comments | « src/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698