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

Side by Side Diff: src/serialize.cc

Issue 510013002: Fix rare access violation during JS heap serialization. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 int root_index = serializer_->RootIndex(current_contents, kPlain); 1532 int root_index = serializer_->RootIndex(current_contents, kPlain);
1533 // Repeats are not subject to the write barrier so there are only some 1533 // Repeats are not subject to the write barrier so there are only some
1534 // objects that can be used in a repeat encoding. These are the early 1534 // objects that can be used in a repeat encoding. These are the early
1535 // ones in the root array that are never in new space. 1535 // ones in the root array that are never in new space.
1536 if (current != start && 1536 if (current != start &&
1537 root_index != kInvalidRootIndex && 1537 root_index != kInvalidRootIndex &&
1538 root_index < kRootArrayNumberOfConstantEncodings && 1538 root_index < kRootArrayNumberOfConstantEncodings &&
1539 current_contents == current[-1]) { 1539 current_contents == current[-1]) {
1540 DCHECK(!serializer_->isolate()->heap()->InNewSpace(current_contents)); 1540 DCHECK(!serializer_->isolate()->heap()->InNewSpace(current_contents));
1541 int repeat_count = 1; 1541 int repeat_count = 1;
1542 while (current < end - 1 && current[repeat_count] == current_contents) { 1542 while (&current[repeat_count] < end - 1 &&
1543 current[repeat_count] == current_contents) {
1543 repeat_count++; 1544 repeat_count++;
1544 } 1545 }
Slava Chigrin 2014/08/27 17:06:01 Before that sometimes current[repeat_count] can go
1545 current += repeat_count; 1546 current += repeat_count;
1546 bytes_processed_so_far_ += repeat_count * kPointerSize; 1547 bytes_processed_so_far_ += repeat_count * kPointerSize;
1547 if (repeat_count > kMaxRepeats) { 1548 if (repeat_count > kMaxRepeats) {
1548 sink_->Put(kRepeat, "SerializeRepeats"); 1549 sink_->Put(kRepeat, "SerializeRepeats");
1549 sink_->PutInt(repeat_count, "SerializeRepeats"); 1550 sink_->PutInt(repeat_count, "SerializeRepeats");
1550 } else { 1551 } else {
1551 sink_->Put(CodeForRepeats(repeat_count), "SerializeRepeats"); 1552 sink_->Put(CodeForRepeats(repeat_count), "SerializeRepeats");
1552 } 1553 }
1553 } else { 1554 } else {
1554 serializer_->SerializeObject( 1555 serializer_->SerializeObject(
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 1957
1957 int SerializedCodeData::CheckSum(String* string) { 1958 int SerializedCodeData::CheckSum(String* string) {
1958 int checksum = Version::Hash(); 1959 int checksum = Version::Hash();
1959 #ifdef DEBUG 1960 #ifdef DEBUG
1960 uint32_t seed = static_cast<uint32_t>(checksum); 1961 uint32_t seed = static_cast<uint32_t>(checksum);
1961 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed)); 1962 checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
1962 #endif // DEBUG 1963 #endif // DEBUG
1963 return checksum; 1964 return checksum;
1964 } 1965 }
1965 } } // namespace v8::internal 1966 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698