| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static bool HasArrayBufferInWeakList(Heap* heap, JSArrayBuffer* ab) { | 55 static bool HasArrayBufferInWeakList(Heap* heap, JSArrayBuffer* ab) { |
| 56 for (Object* o = heap->array_buffers_list(); | 56 for (Object* o = heap->array_buffers_list(); |
| 57 !o->IsUndefined(); | 57 !o->IsUndefined(); |
| 58 o = JSArrayBuffer::cast(o)->weak_next()) { | 58 o = JSArrayBuffer::cast(o)->weak_next()) { |
| 59 if (ab == o) return true; | 59 if (ab == o) return true; |
| 60 } | 60 } |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 | 63 |
| 64 | 64 |
| 65 static int CountTypedArrays(JSArrayBuffer* array_buffer) { | 65 static int CountViews(JSArrayBuffer* array_buffer) { |
| 66 int count = 0; | 66 int count = 0; |
| 67 for (Object* o = array_buffer->weak_first_array(); | 67 for (Object* o = array_buffer->weak_first_view(); |
| 68 !o->IsUndefined(); | 68 !o->IsUndefined(); |
| 69 o = JSTypedArray::cast(o)->weak_next()) { | 69 o = JSArrayBufferView::cast(o)->weak_next()) { |
| 70 count++; | 70 count++; |
| 71 } | 71 } |
| 72 | 72 |
| 73 return count; | 73 return count; |
| 74 } | 74 } |
| 75 | 75 |
| 76 static bool HasTypedArrayInWeakList(JSArrayBuffer* array_buffer, | 76 static bool HasViewInWeakList(JSArrayBuffer* array_buffer, |
| 77 JSTypedArray* ta) { | 77 JSArrayBufferView* ta) { |
| 78 for (Object* o = array_buffer->weak_first_array(); | 78 for (Object* o = array_buffer->weak_first_view(); |
| 79 !o->IsUndefined(); | 79 !o->IsUndefined(); |
| 80 o = JSTypedArray::cast(o)->weak_next()) { | 80 o = JSArrayBufferView::cast(o)->weak_next()) { |
| 81 if (ta == o) return true; | 81 if (ta == o) return true; |
| 82 } | 82 } |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 TEST(WeakArrayBuffersFromApi) { | 87 TEST(WeakArrayBuffersFromApi) { |
| 88 i::FLAG_stress_compaction = false; | |
| 89 v8::V8::Initialize(); | 88 v8::V8::Initialize(); |
| 90 LocalContext context; | 89 LocalContext context; |
| 91 Isolate* isolate = GetIsolateFrom(&context); | 90 Isolate* isolate = GetIsolateFrom(&context); |
| 92 | 91 |
| 93 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); | 92 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); |
| 94 { | 93 { |
| 95 v8::HandleScope s1(context->GetIsolate()); | 94 v8::HandleScope s1(context->GetIsolate()); |
| 96 v8::Handle<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(256); | 95 v8::Handle<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::New(256); |
| 97 { | 96 { |
| 98 v8::HandleScope s2(context->GetIsolate()); | 97 v8::HandleScope s2(context->GetIsolate()); |
| 99 v8::Handle<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(128); | 98 v8::Handle<v8::ArrayBuffer> ab2 = v8::ArrayBuffer::New(128); |
| 100 | 99 |
| 101 Handle<JSArrayBuffer> iab1 = v8::Utils::OpenHandle(*ab1); | 100 Handle<JSArrayBuffer> iab1 = v8::Utils::OpenHandle(*ab1); |
| 102 Handle<JSArrayBuffer> iab2 = v8::Utils::OpenHandle(*ab2); | 101 Handle<JSArrayBuffer> iab2 = v8::Utils::OpenHandle(*ab2); |
| 103 CHECK_EQ(2, CountArrayBuffersInWeakList(isolate->heap())); | 102 CHECK_EQ(2, CountArrayBuffersInWeakList(isolate->heap())); |
| 104 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab1)); | 103 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab1)); |
| 105 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab2)); | 104 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab2)); |
| 106 } | 105 } |
| 107 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 106 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 108 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 109 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); | 107 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); |
| 110 { | 108 { |
| 111 HandleScope scope2(isolate); | 109 HandleScope scope2(isolate); |
| 112 Handle<JSArrayBuffer> iab1 = v8::Utils::OpenHandle(*ab1); | 110 Handle<JSArrayBuffer> iab1 = v8::Utils::OpenHandle(*ab1); |
| 113 | 111 |
| 114 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab1)); | 112 CHECK(HasArrayBufferInWeakList(isolate->heap(), *iab1)); |
| 115 } | 113 } |
| 116 } | 114 } |
| 117 | 115 |
| 118 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 116 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 119 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 120 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); | 117 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); |
| 121 } | 118 } |
| 122 | 119 |
| 123 | 120 |
| 124 TEST(WeakArrayBuffersFromScript) { | 121 TEST(WeakArrayBuffersFromScript) { |
| 125 v8::V8::Initialize(); | 122 v8::V8::Initialize(); |
| 126 LocalContext context; | 123 LocalContext context; |
| 127 Isolate* isolate = GetIsolateFrom(&context); | 124 Isolate* isolate = GetIsolateFrom(&context); |
| 128 | 125 |
| 129 for (int i = 1; i <= 3; i++) { | 126 for (int i = 1; i <= 3; i++) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 150 *v8::Utils::OpenHandle(*ab1))); | 147 *v8::Utils::OpenHandle(*ab1))); |
| 151 CHECK(HasArrayBufferInWeakList(isolate->heap(), | 148 CHECK(HasArrayBufferInWeakList(isolate->heap(), |
| 152 *v8::Utils::OpenHandle(*ab2))); | 149 *v8::Utils::OpenHandle(*ab2))); |
| 153 CHECK(HasArrayBufferInWeakList(isolate->heap(), | 150 CHECK(HasArrayBufferInWeakList(isolate->heap(), |
| 154 *v8::Utils::OpenHandle(*ab3))); | 151 *v8::Utils::OpenHandle(*ab3))); |
| 155 } | 152 } |
| 156 | 153 |
| 157 i::ScopedVector<char> source(1024); | 154 i::ScopedVector<char> source(1024); |
| 158 i::OS::SNPrintF(source, "ab%d = null;", i); | 155 i::OS::SNPrintF(source, "ab%d = null;", i); |
| 159 CompileRun(source.start()); | 156 CompileRun(source.start()); |
| 160 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 157 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 161 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 162 | 158 |
| 163 CHECK_EQ(2, CountArrayBuffersInWeakList(isolate->heap())); | 159 CHECK_EQ(2, CountArrayBuffersInWeakList(isolate->heap())); |
| 164 | 160 |
| 165 { | 161 { |
| 166 v8::HandleScope s2(context->GetIsolate()); | 162 v8::HandleScope s2(context->GetIsolate()); |
| 167 for (int j = 1; j <= 3; j++) { | 163 for (int j = 1; j <= 3; j++) { |
| 168 if (j == i) continue; | 164 if (j == i) continue; |
| 169 i::OS::SNPrintF(source, "ab%d", j); | 165 i::OS::SNPrintF(source, "ab%d", j); |
| 170 v8::Handle<v8::ArrayBuffer> ab = | 166 v8::Handle<v8::ArrayBuffer> ab = |
| 171 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun(source.start())); | 167 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun(source.start())); |
| 172 CHECK(HasArrayBufferInWeakList(isolate->heap(), | 168 CHECK(HasArrayBufferInWeakList(isolate->heap(), |
| 173 *v8::Utils::OpenHandle(*ab))); | 169 *v8::Utils::OpenHandle(*ab))); |
| 174 } | 170 } |
| 175 } | 171 } |
| 176 | 172 |
| 177 CompileRun("ab1 = null; ab2 = null; ab3 = null;"); | 173 CompileRun("ab1 = null; ab2 = null; ab3 = null;"); |
| 178 } | 174 } |
| 179 | 175 |
| 180 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 176 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 181 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 182 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); | 177 CHECK_EQ(0, CountArrayBuffersInWeakList(isolate->heap())); |
| 183 } | 178 } |
| 184 } | 179 } |
| 185 | 180 |
| 186 template <typename TypedArray> | 181 template <typename View> |
| 187 void TestTypedArrayFromApi() { | 182 void TestViewFromApi() { |
| 188 v8::V8::Initialize(); | 183 v8::V8::Initialize(); |
| 189 LocalContext context; | 184 LocalContext context; |
| 190 Isolate* isolate = GetIsolateFrom(&context); | 185 Isolate* isolate = GetIsolateFrom(&context); |
| 191 | 186 |
| 192 v8::HandleScope s1(context->GetIsolate()); | 187 v8::HandleScope s1(context->GetIsolate()); |
| 193 v8::Handle<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(2048); | 188 v8::Handle<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(2048); |
| 194 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); | 189 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); |
| 195 { | 190 { |
| 196 v8::HandleScope s2(context->GetIsolate()); | 191 v8::HandleScope s2(context->GetIsolate()); |
| 197 v8::Handle<TypedArray> ta1 = TypedArray::New(ab, 0, 256); | 192 v8::Handle<View> ta1 = View::New(ab, 0, 256); |
| 198 { | 193 { |
| 199 v8::HandleScope s3(context->GetIsolate()); | 194 v8::HandleScope s3(context->GetIsolate()); |
| 200 v8::Handle<TypedArray> ta2 = TypedArray::New(ab, 0, 128); | 195 v8::Handle<View> ta2 = View::New(ab, 0, 128); |
| 201 | 196 |
| 202 Handle<JSTypedArray> ita1 = v8::Utils::OpenHandle(*ta1); | 197 Handle<JSArrayBufferView> ita1 = v8::Utils::OpenHandle(*ta1); |
| 203 Handle<JSTypedArray> ita2 = v8::Utils::OpenHandle(*ta2); | 198 Handle<JSArrayBufferView> ita2 = v8::Utils::OpenHandle(*ta2); |
| 204 CHECK_EQ(2, CountTypedArrays(*iab)); | 199 CHECK_EQ(2, CountViews(*iab)); |
| 205 CHECK(HasTypedArrayInWeakList(*iab, *ita1)); | 200 CHECK(HasViewInWeakList(*iab, *ita1)); |
| 206 CHECK(HasTypedArrayInWeakList(*iab, *ita2)); | 201 CHECK(HasViewInWeakList(*iab, *ita2)); |
| 207 } | 202 } |
| 208 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 203 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 209 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 204 CHECK_EQ(1, CountViews(*iab)); |
| 210 CHECK_EQ(1, CountTypedArrays(*iab)); | 205 Handle<JSArrayBufferView> ita1 = v8::Utils::OpenHandle(*ta1); |
| 211 Handle<JSTypedArray> ita1 = v8::Utils::OpenHandle(*ta1); | 206 CHECK(HasViewInWeakList(*iab, *ita1)); |
| 212 CHECK(HasTypedArrayInWeakList(*iab, *ita1)); | |
| 213 } | 207 } |
| 214 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 208 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 215 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 216 | 209 |
| 217 CHECK_EQ(0, CountTypedArrays(*iab)); | 210 CHECK_EQ(0, CountViews(*iab)); |
| 218 } | 211 } |
| 219 | 212 |
| 220 | 213 |
| 221 TEST(Uint8ArrayFromApi) { | 214 TEST(Uint8ArrayFromApi) { |
| 222 TestTypedArrayFromApi<v8::Uint8Array>(); | 215 TestViewFromApi<v8::Uint8Array>(); |
| 223 } | 216 } |
| 224 | 217 |
| 225 | 218 |
| 226 TEST(Int8ArrayFromApi) { | 219 TEST(Int8ArrayFromApi) { |
| 227 TestTypedArrayFromApi<v8::Int8Array>(); | 220 TestViewFromApi<v8::Int8Array>(); |
| 228 } | 221 } |
| 229 | 222 |
| 230 | 223 |
| 231 TEST(Uint16ArrayFromApi) { | 224 TEST(Uint16ArrayFromApi) { |
| 232 TestTypedArrayFromApi<v8::Uint16Array>(); | 225 TestViewFromApi<v8::Uint16Array>(); |
| 233 } | 226 } |
| 234 | 227 |
| 235 | 228 |
| 236 TEST(Int16ArrayFromApi) { | 229 TEST(Int16ArrayFromApi) { |
| 237 TestTypedArrayFromApi<v8::Int16Array>(); | 230 TestViewFromApi<v8::Int16Array>(); |
| 238 } | 231 } |
| 239 | 232 |
| 240 | 233 |
| 241 TEST(Uint32ArrayFromApi) { | 234 TEST(Uint32ArrayFromApi) { |
| 242 TestTypedArrayFromApi<v8::Uint32Array>(); | 235 TestViewFromApi<v8::Uint32Array>(); |
| 243 } | 236 } |
| 244 | 237 |
| 245 | 238 |
| 246 TEST(Int32ArrayFromApi) { | 239 TEST(Int32ArrayFromApi) { |
| 247 TestTypedArrayFromApi<v8::Int32Array>(); | 240 TestViewFromApi<v8::Int32Array>(); |
| 248 } | 241 } |
| 249 | 242 |
| 250 | 243 |
| 251 TEST(Float32ArrayFromApi) { | 244 TEST(Float32ArrayFromApi) { |
| 252 TestTypedArrayFromApi<v8::Float32Array>(); | 245 TestViewFromApi<v8::Float32Array>(); |
| 253 } | 246 } |
| 254 | 247 |
| 255 | 248 |
| 256 TEST(Float64ArrayFromApi) { | 249 TEST(Float64ArrayFromApi) { |
| 257 TestTypedArrayFromApi<v8::Float64Array>(); | 250 TestViewFromApi<v8::Float64Array>(); |
| 258 } | 251 } |
| 259 | 252 |
| 260 | 253 |
| 261 TEST(Uint8ClampedArrayFromApi) { | 254 TEST(Uint8ClampedArrayFromApi) { |
| 262 TestTypedArrayFromApi<v8::Uint8ClampedArray>(); | 255 TestViewFromApi<v8::Uint8ClampedArray>(); |
| 256 } |
| 257 |
| 258 |
| 259 TEST(DataViewFromApi) { |
| 260 TestViewFromApi<v8::DataView>(); |
| 263 } | 261 } |
| 264 | 262 |
| 265 template <typename TypedArray> | 263 template <typename TypedArray> |
| 266 static void TestTypedArrayFromScript(const char* constructor) { | 264 static void TestTypedArrayFromScript(const char* constructor) { |
| 267 v8::V8::Initialize(); | 265 v8::V8::Initialize(); |
| 268 LocalContext context; | 266 LocalContext context; |
| 269 Isolate* isolate = GetIsolateFrom(&context); | 267 Isolate* isolate = GetIsolateFrom(&context); |
| 270 v8::HandleScope scope(context->GetIsolate()); | 268 v8::HandleScope scope(context->GetIsolate()); |
| 271 CompileRun("var ab = new ArrayBuffer(2048);"); | 269 CompileRun("var ab = new ArrayBuffer(2048);"); |
| 272 for (int i = 1; i <= 3; i++) { | 270 for (int i = 1; i <= 3; i++) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 289 v8::Handle<v8::ArrayBuffer> ab = | 287 v8::Handle<v8::ArrayBuffer> ab = |
| 290 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); | 288 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); |
| 291 v8::Handle<TypedArray> ta1 = | 289 v8::Handle<TypedArray> ta1 = |
| 292 v8::Handle<TypedArray>::Cast(CompileRun("ta1")); | 290 v8::Handle<TypedArray>::Cast(CompileRun("ta1")); |
| 293 v8::Handle<TypedArray> ta2 = | 291 v8::Handle<TypedArray> ta2 = |
| 294 v8::Handle<TypedArray>::Cast(CompileRun("ta2")); | 292 v8::Handle<TypedArray>::Cast(CompileRun("ta2")); |
| 295 v8::Handle<TypedArray> ta3 = | 293 v8::Handle<TypedArray> ta3 = |
| 296 v8::Handle<TypedArray>::Cast(CompileRun("ta3")); | 294 v8::Handle<TypedArray>::Cast(CompileRun("ta3")); |
| 297 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); | 295 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); |
| 298 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); | 296 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); |
| 299 CHECK_EQ(3, CountTypedArrays(*iab)); | 297 CHECK_EQ(3, CountViews(*iab)); |
| 300 CHECK(HasTypedArrayInWeakList(*iab, *v8::Utils::OpenHandle(*ta1))); | 298 CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta1))); |
| 301 CHECK(HasTypedArrayInWeakList(*iab, *v8::Utils::OpenHandle(*ta2))); | 299 CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta2))); |
| 302 CHECK(HasTypedArrayInWeakList(*iab, *v8::Utils::OpenHandle(*ta3))); | 300 CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta3))); |
| 303 } | 301 } |
| 304 | 302 |
| 305 i::OS::SNPrintF(source, "ta%d = null;", i); | 303 i::OS::SNPrintF(source, "ta%d = null;", i); |
| 306 CompileRun(source.start()); | 304 CompileRun(source.start()); |
| 307 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 305 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 308 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 309 | 306 |
| 310 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); | 307 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); |
| 311 | 308 |
| 312 { | 309 { |
| 313 v8::HandleScope s2(context->GetIsolate()); | 310 v8::HandleScope s2(context->GetIsolate()); |
| 314 v8::Handle<v8::ArrayBuffer> ab = | 311 v8::Handle<v8::ArrayBuffer> ab = |
| 315 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); | 312 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); |
| 316 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); | 313 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); |
| 317 CHECK_EQ(2, CountTypedArrays(*iab)); | 314 CHECK_EQ(2, CountViews(*iab)); |
| 318 for (int j = 1; j <= 3; j++) { | 315 for (int j = 1; j <= 3; j++) { |
| 319 if (j == i) continue; | 316 if (j == i) continue; |
| 320 i::OS::SNPrintF(source, "ta%d", j); | 317 i::OS::SNPrintF(source, "ta%d", j); |
| 321 v8::Handle<TypedArray> ta = | 318 v8::Handle<TypedArray> ta = |
| 322 v8::Handle<TypedArray>::Cast(CompileRun(source.start())); | 319 v8::Handle<TypedArray>::Cast(CompileRun(source.start())); |
| 323 CHECK(HasTypedArrayInWeakList(*iab, *v8::Utils::OpenHandle(*ta))); | 320 CHECK(HasViewInWeakList(*iab, *v8::Utils::OpenHandle(*ta))); |
| 324 } | 321 } |
| 325 } | 322 } |
| 326 | 323 |
| 327 CompileRun("ta1 = null; ta2 = null; ta3 = null;"); | 324 CompileRun("ta1 = null; ta2 = null; ta3 = null;"); |
| 328 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 325 isolate->heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 329 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | |
| 330 | 326 |
| 331 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); | 327 CHECK_EQ(1, CountArrayBuffersInWeakList(isolate->heap())); |
| 332 | 328 |
| 333 { | 329 { |
| 334 v8::HandleScope s3(context->GetIsolate()); | 330 v8::HandleScope s3(context->GetIsolate()); |
| 335 v8::Handle<v8::ArrayBuffer> ab = | 331 v8::Handle<v8::ArrayBuffer> ab = |
| 336 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); | 332 v8::Handle<v8::ArrayBuffer>::Cast(CompileRun("ab")); |
| 337 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); | 333 Handle<JSArrayBuffer> iab = v8::Utils::OpenHandle(*ab); |
| 338 CHECK_EQ(0, CountTypedArrays(*iab)); | 334 CHECK_EQ(0, CountViews(*iab)); |
| 339 } | 335 } |
| 340 } | 336 } |
| 341 } | 337 } |
| 342 | 338 |
| 343 | 339 |
| 344 TEST(Uint8ArrayFromScript) { | 340 TEST(Uint8ArrayFromScript) { |
| 345 TestTypedArrayFromScript<v8::Uint8Array>("Uint8Array"); | 341 TestTypedArrayFromScript<v8::Uint8Array>("Uint8Array"); |
| 346 } | 342 } |
| 347 | 343 |
| 348 | 344 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 378 | 374 |
| 379 TEST(Float64ArrayFromScript) { | 375 TEST(Float64ArrayFromScript) { |
| 380 TestTypedArrayFromScript<v8::Float64Array>("Float64Array"); | 376 TestTypedArrayFromScript<v8::Float64Array>("Float64Array"); |
| 381 } | 377 } |
| 382 | 378 |
| 383 | 379 |
| 384 TEST(Uint8ClampedArrayFromScript) { | 380 TEST(Uint8ClampedArrayFromScript) { |
| 385 TestTypedArrayFromScript<v8::Uint8ClampedArray>("Uint8ClampedArray"); | 381 TestTypedArrayFromScript<v8::Uint8ClampedArray>("Uint8ClampedArray"); |
| 386 } | 382 } |
| 387 | 383 |
| 384 |
| 385 TEST(DataViewFromScript) { |
| 386 TestTypedArrayFromScript<v8::DataView>("DataView"); |
| 387 } |
| OLD | NEW |