OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 "c[4] = 2;" | 65 "c[4] = 2;" |
66 "c[5] = 3;" | 66 "c[5] = 3;" |
67 "var a = new DataView(b, 2);"); | 67 "var a = new DataView(b, 2);"); |
68 TestArrayBufferViewContents(env, true); | 68 TestArrayBufferViewContents(env, true); |
69 } | 69 } |
70 | 70 |
71 | 71 |
72 TEST(AllocateNotExternal) { | 72 TEST(AllocateNotExternal) { |
73 LocalContext env; | 73 LocalContext env; |
74 v8::HandleScope scope(env->GetIsolate()); | 74 v8::HandleScope scope(env->GetIsolate()); |
75 void* memory = V8::ArrayBufferAllocator()->Allocate(1024); | 75 void* memory = reinterpret_cast<Isolate*>(env->GetIsolate()) |
| 76 ->array_buffer_allocator() |
| 77 ->Allocate(1024); |
76 v8::Local<v8::ArrayBuffer> buffer = | 78 v8::Local<v8::ArrayBuffer> buffer = |
77 v8::ArrayBuffer::New(env->GetIsolate(), memory, 1024, | 79 v8::ArrayBuffer::New(env->GetIsolate(), memory, 1024, |
78 v8::ArrayBufferCreationMode::kInternalized); | 80 v8::ArrayBufferCreationMode::kInternalized); |
79 CHECK(!buffer->IsExternal()); | 81 CHECK(!buffer->IsExternal()); |
80 CHECK_EQ(memory, buffer->GetContents().Data()); | 82 CHECK_EQ(memory, buffer->GetContents().Data()); |
81 } | 83 } |
OLD | NEW |