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

Side by Side Diff: src/api.cc

Issue 2051043003: [snapshot] pass arguments as pointers, not references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@snapshotcreator
Patch Set: Created 4 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 | « no previous file | src/snapshot/code-serializer.h » ('j') | src/snapshot/code-serializer.h » ('J')
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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 data->contexts_.Clear(); 459 data->contexts_.Clear();
460 460
461 i::SnapshotByteSink snapshot_sink; 461 i::SnapshotByteSink snapshot_sink;
462 i::StartupSerializer startup_serializer(isolate, &snapshot_sink, 462 i::StartupSerializer startup_serializer(isolate, &snapshot_sink,
463 function_code_handling); 463 function_code_handling);
464 startup_serializer.SerializeStrongReferences(); 464 startup_serializer.SerializeStrongReferences();
465 465
466 i::SnapshotByteSink context_sink; 466 i::SnapshotByteSink context_sink;
467 i::PartialSerializer context_serializer(isolate, &startup_serializer, 467 i::PartialSerializer context_serializer(isolate, &startup_serializer,
468 &context_sink); 468 &context_sink);
469 // TODO(yangguo): support multiple contexts in the snapshot.
470 DCHECK_EQ(1, contexts.length());
471 context_serializer.Serialize(&contexts[0]); 469 context_serializer.Serialize(&contexts[0]);
472 startup_serializer.SerializeWeakReferencesAndDeferred(); 470 startup_serializer.SerializeWeakReferencesAndDeferred();
473 471
474 data->created_ = true; 472 data->created_ = true;
475 return i::Snapshot::CreateSnapshotBlob(startup_serializer, 473 return i::Snapshot::CreateSnapshotBlob(&startup_serializer,
476 context_serializer); 474 &context_serializer);
477 } 475 }
478 476
479 StartupData V8::CreateSnapshotDataBlob(const char* embedded_source) { 477 StartupData V8::CreateSnapshotDataBlob(const char* embedded_source) {
480 // Create a new isolate and a new context from scratch, optionally run 478 // Create a new isolate and a new context from scratch, optionally run
481 // a script to embed, and serialize to create a snapshot blob. 479 // a script to embed, and serialize to create a snapshot blob.
482 StartupData result = {nullptr, 0}; 480 StartupData result = {nullptr, 0};
483 base::ElapsedTimer timer; 481 base::ElapsedTimer timer;
484 timer.Start(); 482 timer.Start();
485 { 483 {
486 SnapshotCreator snapshot_creator; 484 SnapshotCreator snapshot_creator;
(...skipping 8313 matching lines...) Expand 10 before | Expand all | Expand 10 after
8800 Address callback_address = 8798 Address callback_address =
8801 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8799 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8802 VMState<EXTERNAL> state(isolate); 8800 VMState<EXTERNAL> state(isolate);
8803 ExternalCallbackScope call_scope(isolate, callback_address); 8801 ExternalCallbackScope call_scope(isolate, callback_address);
8804 callback(info); 8802 callback(info);
8805 } 8803 }
8806 8804
8807 8805
8808 } // namespace internal 8806 } // namespace internal
8809 } // namespace v8 8807 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/snapshot/code-serializer.h » ('j') | src/snapshot/code-serializer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698