Flutter Engine
The Flutter Engine
third_party
dart-lang
sdk
runtime
vm
snapshot.cc
Go to the documentation of this file.
1
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2
// for details. All rights reserved. Use of this source code is governed by a
3
// BSD-style license that can be found in the LICENSE file.
4
5
#include "
vm/snapshot.h
"
6
7
#include "
platform/assert.h
"
8
#include "
vm/dart.h
"
9
10
namespace
dart
{
11
12
const
char
*
Snapshot::KindToCString
(
Kind
kind) {
13
switch
(
kind
) {
14
case
kFull
:
15
return
"full"
;
16
case
kFullCore
:
17
return
"full-core"
;
18
case
kFullJIT
:
19
return
"full-jit"
;
20
case
kFullAOT
:
21
return
"full-aot"
;
22
case
kNone
:
23
return
"none"
;
24
case
kInvalid
:
25
default
:
26
return
"invalid"
;
27
}
28
}
29
30
const
Snapshot
*
Snapshot::SetupFromBuffer
(
const
void
* raw_memory) {
31
ASSERT
(raw_memory !=
nullptr
);
32
const
Snapshot
* snapshot =
reinterpret_cast<
const
Snapshot
*
>
(raw_memory);
33
if
(!snapshot->
check_magic
()) {
34
return
nullptr
;
35
}
36
// If the raw length is negative or greater than what the local machine can
37
// handle, then signal an error.
38
int64_t
length
= snapshot->
large_length
();
39
if
((
length
< 0) || (
length
>
kIntptrMax
)) {
40
return
nullptr
;
41
}
42
return
snapshot;
43
}
44
45
}
// namespace dart
assert.h
dart::Snapshot
Definition:
snapshot.h:22
dart::Snapshot::kind
Kind kind() const
Definition:
snapshot.h:60
dart::Snapshot::check_magic
bool check_magic() const
Definition:
snapshot.h:46
dart::Snapshot::SetupFromBuffer
static const Snapshot * SetupFromBuffer(const void *raw_memory)
Definition:
snapshot.cc:30
dart::Snapshot::KindToCString
static const char * KindToCString(Kind kind)
Definition:
snapshot.cc:12
dart::Snapshot::length
intptr_t length() const
Definition:
snapshot.h:56
dart::Snapshot::Kind
Kind
Definition:
snapshot.h:24
dart::Snapshot::kFull
@ kFull
Definition:
snapshot.h:25
dart::Snapshot::kFullJIT
@ kFullJIT
Definition:
snapshot.h:27
dart::Snapshot::kInvalid
@ kInvalid
Definition:
snapshot.h:30
dart::Snapshot::kFullAOT
@ kFullAOT
Definition:
snapshot.h:28
dart::Snapshot::kNone
@ kNone
Definition:
snapshot.h:29
dart::Snapshot::kFullCore
@ kFullCore
Definition:
snapshot.h:26
dart::Snapshot::large_length
int64_t large_length() const
Definition:
snapshot.h:53
dart.h
ASSERT
#define ASSERT(E)
Definition:
entrypoints_verification_test.cc:25
dart
Definition:
dart_vm.cc:33
dart::kIntptrMax
constexpr intptr_t kIntptrMax
Definition:
globals.h:557
snapshot.h
Generated on Sun Jun 23 2024 21:55:04 for Flutter Engine by
1.9.4