Skip to content

Commit 0fc6220

Browse files
author
Martijn Otto
committed
Remove custom memory allocation routines: We'll stick with the 4.4.9.1 of the v8 engine where this is not necessary since it appears to be much faster
1 parent 1de0e4d commit 0fc6220

File tree

1 file changed

+2
-47
lines changed

1 file changed

+2
-47
lines changed

isolate.cpp

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace JS {
3030
/**
3131
* Private class
3232
*/
33-
class Isolate final : private v8::ArrayBuffer::Allocator
33+
class Isolate final
3434
{
3535
private:
3636
/**
@@ -39,53 +39,11 @@ class Isolate final : private v8::ArrayBuffer::Allocator
3939
*/
4040
Platform _platform;
4141

42-
/**
43-
* The isolate creation parameters
44-
* @var v8::Isolate::CreateParams
45-
*/
46-
v8::Isolate::CreateParams _params;
47-
4842
/**
4943
* The underlying isolate
5044
* @var v8::Isolate*
5145
*/
5246
v8::Isolate *_isolate;
53-
54-
/**
55-
* Allocate a range of memory, zero-initialized.
56-
*
57-
* @param size The number of bytes to allocate
58-
* @return Pointer to the allocated memory, or a nullptr
59-
*/
60-
void *Allocate(size_t size) override
61-
{
62-
// request some cleared memory
63-
return std::calloc(size, 1);
64-
}
65-
66-
/**
67-
* Allocate a range of memory, uninitialized.
68-
*
69-
* @param size The number of bytes to allocate
70-
* @return Pointer to the allocated memory, or a nullptr
71-
*/
72-
void *AllocateUninitialized(size_t size) override
73-
{
74-
// request some uninitialized memory
75-
return std::malloc(size);
76-
}
77-
78-
/**
79-
* Free some allocated memory
80-
*
81-
* @param data Pointer to memory to free
82-
* @param size Number of bytes to free
83-
*/
84-
void Free(void *data, size_t size) override
85-
{
86-
// free the allocated memory
87-
std::free(data);
88-
}
8947
public:
9048
/**
9149
* Constructor
@@ -97,11 +55,8 @@ class Isolate final : private v8::ArrayBuffer::Allocator
9755
v8::V8::InitializePlatform(&_platform);
9856
v8::V8::Initialize();
9957

100-
// initialize the parameters
101-
_params.array_buffer_allocator = this;
102-
10358
// create the actual isolate
104-
_isolate = v8::Isolate::New(_params);
59+
_isolate = v8::Isolate::New();
10560

10661
// and enter it
10762
_isolate->Enter();

0 commit comments

Comments
 (0)