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

Side by Side Diff: src/serialize.cc

Issue 1008923003: Serializer: micro-optimizations for the deserializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add assertion Created 5 years, 9 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 | « no previous file | src/snapshot-source-sink.h » ('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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 NameMap address_to_name_map_; 501 NameMap address_to_name_map_;
502 Isolate* isolate_; 502 Isolate* isolate_;
503 }; 503 };
504 504
505 505
506 void Deserializer::DecodeReservation( 506 void Deserializer::DecodeReservation(
507 Vector<const SerializedData::Reservation> res) { 507 Vector<const SerializedData::Reservation> res) {
508 DCHECK_EQ(0, reservations_[NEW_SPACE].length()); 508 DCHECK_EQ(0, reservations_[NEW_SPACE].length());
509 STATIC_ASSERT(NEW_SPACE == 0); 509 STATIC_ASSERT(NEW_SPACE == 0);
510 int current_space = NEW_SPACE; 510 int current_space = NEW_SPACE;
511 for (int i = 0; i < res.length(); i++) { 511 for (auto& r : res) {
512 SerializedData::Reservation r(0);
513 memcpy(&r, res.start() + i, sizeof(r));
514 reservations_[current_space].Add({r.chunk_size(), NULL, NULL}); 512 reservations_[current_space].Add({r.chunk_size(), NULL, NULL});
515 if (r.is_last()) current_space++; 513 if (r.is_last()) current_space++;
516 } 514 }
517 DCHECK_EQ(kNumberOfSpaces, current_space); 515 DCHECK_EQ(kNumberOfSpaces, current_space);
518 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) current_chunk_[i] = 0; 516 for (int i = 0; i < kNumberOfPreallocatedSpaces; i++) current_chunk_[i] = 0;
519 } 517 }
520 518
521 519
522 void Deserializer::FlushICacheForNewCodeObjects() { 520 void Deserializer::FlushICacheForNewCodeObjects() {
523 PageIterator it(isolate_->heap()->code_space()); 521 PageIterator it(isolate_->heap()->code_space());
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 DisallowHeapAllocation no_gc; 2560 DisallowHeapAllocation no_gc;
2563 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2561 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2564 SanityCheckResult r = scd->SanityCheck(isolate, source); 2562 SanityCheckResult r = scd->SanityCheck(isolate, source);
2565 if (r == CHECK_SUCCESS) return scd; 2563 if (r == CHECK_SUCCESS) return scd;
2566 cached_data->Reject(); 2564 cached_data->Reject();
2567 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2565 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2568 delete scd; 2566 delete scd;
2569 return NULL; 2567 return NULL;
2570 } 2568 }
2571 } } // namespace v8::internal 2569 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/snapshot-source-sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698