-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassv8_1_1ArrayBuffer_1_1Allocator.html
341 lines (324 loc) · 16.5 KB
/
classv8_1_1ArrayBuffer_1_1Allocator.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>V8: v8::ArrayBuffer::Allocator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">V8
 <span id="projectnumber">v8.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.16 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1ArrayBuffer.html">ArrayBuffer</a></li><li class="navelem"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html">Allocator</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-types">Public Types</a> |
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classv8_1_1ArrayBuffer_1_1Allocator-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">v8::ArrayBuffer::Allocator Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <<a class="el" href="v8_8h_source.html">v8.h</a>></code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ab106d1fbad7be9f6fd8b0f5c550ac59e"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#ab106d1fbad7be9f6fd8b0f5c550ac59e">AllocationMode</a> { <a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#ab106d1fbad7be9f6fd8b0f5c550ac59ea07fa7a19aa722c635a15e94cb7f50416">AllocationMode::kNormal</a>,
<a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#ab106d1fbad7be9f6fd8b0f5c550ac59ea6f8f300976cbd4227d599276b3206933">AllocationMode::kReservation</a>
}</td></tr>
<tr class="separator:ab106d1fbad7be9f6fd8b0f5c550ac59e"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a387043850f644fe14a58b6aff0ba5d57"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#a387043850f644fe14a58b6aff0ba5d57">~Allocator</a> ()=default</td></tr>
<tr class="separator:a387043850f644fe14a58b6aff0ba5d57"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a106b0d80120ed04fe9b9675e96f0340b"><td class="memItemLeft" align="right" valign="top">virtual void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#a106b0d80120ed04fe9b9675e96f0340b">Allocate</a> (size_t length)=0</td></tr>
<tr class="separator:a106b0d80120ed04fe9b9675e96f0340b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a92b2d5c0a826d3c435e12f3ee178f37a"><td class="memItemLeft" align="right" valign="top">virtual void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#a92b2d5c0a826d3c435e12f3ee178f37a">AllocateUninitialized</a> (size_t length)=0</td></tr>
<tr class="separator:a92b2d5c0a826d3c435e12f3ee178f37a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a419f59d2a103a5a8863809d7977c9cd8"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#a419f59d2a103a5a8863809d7977c9cd8">Free</a> (void *data, size_t length)=0</td></tr>
<tr class="separator:a419f59d2a103a5a8863809d7977c9cd8"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a37863da17c5c7fba820d9b3a47d7e5d8"><td class="memItemLeft" align="right" valign="top">virtual void * </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#a37863da17c5c7fba820d9b3a47d7e5d8">Reallocate</a> (void *data, size_t old_length, size_t new_length)</td></tr>
<tr class="separator:a37863da17c5c7fba820d9b3a47d7e5d8"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ab274d606bbc87a2a41f114d55d6da331"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html">Allocator</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#ab274d606bbc87a2a41f114d55d6da331">NewDefaultAllocator</a> ()</td></tr>
<tr class="separator:ab274d606bbc87a2a41f114d55d6da331"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A thread-safe allocator that <a class="el" href="classv8_1_1V8.html">V8</a> uses to allocate |ArrayBuffer|'s memory. The allocator is a global <a class="el" href="classv8_1_1V8.html">V8</a> setting. It has to be set via <a class="el" href="structv8_1_1Isolate_1_1CreateParams.html">Isolate::CreateParams</a>.</p>
<p>Memory allocated through this allocator by <a class="el" href="classv8_1_1V8.html">V8</a> is accounted for as external memory by <a class="el" href="classv8_1_1V8.html">V8</a>. Note that <a class="el" href="classv8_1_1V8.html">V8</a> keeps track of the memory for all internalized |ArrayBuffer|s. Responsibility for tracking external memory (using <a class="el" href="classv8_1_1Isolate.html#aaeda5fa60961a3d9d476c46200e30711">Isolate::AdjustAmountOfExternalAllocatedMemory</a>) is handed over to the embedder upon externalization and taken over upon internalization (creating an internalized buffer from an existing buffer).</p>
<p>Note that it is unsafe to call back into <a class="el" href="classv8_1_1V8.html">V8</a> from any of the allocator functions. </p>
</div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a id="ab106d1fbad7be9f6fd8b0f5c550ac59e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab106d1fbad7be9f6fd8b0f5c550ac59e">◆ </a></span>AllocationMode</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html#ab106d1fbad7be9f6fd8b0f5c550ac59e">v8::ArrayBuffer::Allocator::AllocationMode</a></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="classv8_1_1ArrayBuffer.html">ArrayBuffer</a> allocation mode. kNormal is a malloc/free style allocation, while kReservation is for larger allocations with the ability to set access permissions. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="ab106d1fbad7be9f6fd8b0f5c550ac59ea07fa7a19aa722c635a15e94cb7f50416"></a>kNormal </td><td class="fielddoc"></td></tr>
<tr><td class="fieldname"><a id="ab106d1fbad7be9f6fd8b0f5c550ac59ea6f8f300976cbd4227d599276b3206933"></a>kReservation </td><td class="fielddoc"></td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a387043850f644fe14a58b6aff0ba5d57"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a387043850f644fe14a58b6aff0ba5d57">◆ </a></span>~Allocator()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual v8::ArrayBuffer::Allocator::~Allocator </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span><span class="mlabel">default</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a106b0d80120ed04fe9b9675e96f0340b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a106b0d80120ed04fe9b9675e96f0340b">◆ </a></span>Allocate()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void* v8::ArrayBuffer::Allocator::Allocate </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate |length| bytes. Return nullptr if allocation is not successful. Memory should be initialized to zeroes. </p>
</div>
</div>
<a id="a92b2d5c0a826d3c435e12f3ee178f37a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a92b2d5c0a826d3c435e12f3ee178f37a">◆ </a></span>AllocateUninitialized()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void* v8::ArrayBuffer::Allocator::AllocateUninitialized </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate |length| bytes. Return nullptr if allocation is not successful. Memory does not have to be initialized. </p>
</div>
</div>
<a id="a419f59d2a103a5a8863809d7977c9cd8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a419f59d2a103a5a8863809d7977c9cd8">◆ </a></span>Free()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void v8::ArrayBuffer::Allocator::Free </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Free the memory block of size |length|, pointed to by |data|. That memory is guaranteed to be previously allocated by |Allocate|. </p>
</div>
</div>
<a id="ab274d606bbc87a2a41f114d55d6da331"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab274d606bbc87a2a41f114d55d6da331">◆ </a></span>NewDefaultAllocator()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="classv8_1_1ArrayBuffer_1_1Allocator.html">Allocator</a>* v8::ArrayBuffer::Allocator::NewDefaultAllocator </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>malloc/free based convenience allocator.</p>
<p>Caller takes ownership, i.e. the returned object needs to be freed using |delete allocator| once it is no longer in use. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="process_8cc-example.html#a34">process.cc</a>, and <a class="el" href="shell_8cc-example.html#a16">shell.cc</a>.</dd>
</dl>
</div>
</div>
<a id="a37863da17c5c7fba820d9b3a47d7e5d8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a37863da17c5c7fba820d9b3a47d7e5d8">◆ </a></span>Reallocate()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void* v8::ArrayBuffer::Allocator::Reallocate </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>data</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>old_length</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>new_length</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Reallocate the memory block of size |old_length| to a memory block of size |new_length| by expanding, contracting, or copying the existing memory block. If |new_length| > |old_length|, then the new part of the memory must be initialized to zeros. Return nullptr if reallocation is not successful.</p>
<p>The caller guarantees that the memory block was previously allocated using Allocate or AllocateUninitialized.</p>
<p>The default implementation allocates a new block and copies data. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/<a class="el" href="v8_8h_source.html">v8.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>