| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 373523b commit c900bc1
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,7 @@ | |||
| 36 | 36 | ||
| 37 | 37 | # Reset this number to 0 on major V8 upgrades. | |
| 38 | 38 | # Increment by one for each non-official patch applied to deps/v8. | |
| 39 | - 'v8_embedder_string': '-node.9', | ||
| 39 | + 'v8_embedder_string': '-node.10', | ||
| 40 | 40 | ||
| 41 | 41 | ##### V8 defaults for Node.js ##### | |
| 42 | 42 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -256,6 +256,12 @@ class V8_EXPORT ArrayBuffer : public Object { | |||
| 256 | 256 | */ | |
| 257 | 257 | std::shared_ptr<BackingStore> GetBackingStore(); | |
| 258 | 258 | ||
| 259 | + /** | ||
| 260 | + * More efficient shortcut for GetBackingStore()->Data(). The returned pointer | ||
| 261 | + * is valid as long as the ArrayBuffer is alive. | ||
| 262 | + */ | ||
| 263 | + void* Data() const; | ||
| 264 | + | ||
| 259 | 265 | V8_INLINE static ArrayBuffer* Cast(Value* value) { | |
| 260 | 266 | #ifdef V8_ENABLE_CHECKS | |
| 261 | 267 | CheckCast(value); | |
@@ -414,6 +420,12 @@ class V8_EXPORT SharedArrayBuffer : public Object { | |||
| 414 | 420 | */ | |
| 415 | 421 | std::shared_ptr<BackingStore> GetBackingStore(); | |
| 416 | 422 | ||
| 423 | + /** | ||
| 424 | + * More efficient shortcut for GetBackingStore()->Data(). The returned pointer | ||
| 425 | + * is valid as long as the ArrayBuffer is alive. | ||
| 426 | + */ | ||
| 427 | + void* Data() const; | ||
| 428 | + | ||
| 417 | 429 | V8_INLINE static SharedArrayBuffer* Cast(Value* value) { | |
| 418 | 430 | #ifdef V8_ENABLE_CHECKS | |
| 419 | 431 | CheckCast(value); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4038,6 +4038,11 @@ std::shared_ptr<v8::BackingStore> v8::ArrayBuffer::GetBackingStore() { | |||
| 4038 | 4038 | return std::static_pointer_cast<v8::BackingStore>(bs_base); | |
| 4039 | 4039 | } | |
| 4040 | 4040 | ||
| 4041 | + void* v8::ArrayBuffer::Data() const { | ||
| 4042 | + i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | ||
| 4043 | + return self->backing_store(); | ||
| 4044 | + } | ||
| 4045 | + | ||
| 4041 | 4046 | std::shared_ptr<v8::BackingStore> v8::SharedArrayBuffer::GetBackingStore() { | |
| 4042 | 4047 | i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | |
| 4043 | 4048 | std::shared_ptr<i::BackingStore> backing_store = self->GetBackingStore(); | |
@@ -4048,6 +4053,11 @@ std::shared_ptr<v8::BackingStore> v8::SharedArrayBuffer::GetBackingStore() { | |||
| 4048 | 4053 | return std::static_pointer_cast<v8::BackingStore>(bs_base); | |
| 4049 | 4054 | } | |
| 4050 | 4055 | ||
| 4056 | + void* v8::SharedArrayBuffer::Data() const { | ||
| 4057 | + i::Handle<i::JSArrayBuffer> self = Utils::OpenHandle(this); | ||
| 4058 | + return self->backing_store(); | ||
| 4059 | + } | ||
| 4060 | + | ||
| 4051 | 4061 | void v8::ArrayBuffer::CheckCast(Value* that) { | |
| 4052 | 4062 | i::Handle<i::Object> obj = Utils::OpenHandle(that); | |
| 4053 | 4063 | Utils::ApiCheck( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -366,6 +366,7 @@ THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) { | |||
| 366 | 366 | ||
| 367 | 367 | // Should not move the pointer | |
| 368 | 368 | CHECK_EQ(ab->GetBackingStore()->Data(), store_ptr); | |
| 369 | + CHECK_EQ(ab->Data(), store_ptr); | ||
| 369 | 370 | ||
| 370 | 371 | CcTest::array_buffer_allocator()->Free(buffer, 100); | |
| 371 | 372 | } | |
@@ -394,8 +395,8 @@ THREADED_TEST(SkipArrayBufferDuringScavenge) { | |||
| 394 | 395 | CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now | |
| 395 | 396 | CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now | |
| 396 | 397 | ||
| 397 | - // Use `ab` to silence compiler warning | ||
| 398 | 398 | CHECK_EQ(ab->GetBackingStore()->Data(), store_ptr); | |
| 399 | + CHECK_EQ(ab->Data(), store_ptr); | ||
| 399 | 400 | } | |
| 400 | 401 | ||
| 401 | 402 | THREADED_TEST(Regress1006600) { | |
@@ -418,6 +419,7 @@ THREADED_TEST(ArrayBuffer_NewBackingStore) { | |||
| 418 | 419 | CHECK(!backing_store->IsShared()); | |
| 419 | 420 | Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, backing_store); | |
| 420 | 421 | CHECK_EQ(backing_store.get(), ab->GetBackingStore().get()); | |
| 422 | + CHECK_EQ(backing_store->Data(), ab->Data()); | ||
| 421 | 423 | } | |
| 422 | 424 | ||
| 423 | 425 | THREADED_TEST(SharedArrayBuffer_NewBackingStore) { | |
@@ -430,6 +432,7 @@ THREADED_TEST(SharedArrayBuffer_NewBackingStore) { | |||
| 430 | 432 | Local<v8::SharedArrayBuffer> ab = | |
| 431 | 433 | v8::SharedArrayBuffer::New(isolate, backing_store); | |
| 432 | 434 | CHECK_EQ(backing_store.get(), ab->GetBackingStore().get()); | |
| 435 | + CHECK_EQ(backing_store->Data(), ab->Data()); | ||
| 433 | 436 | } | |
| 434 | 437 | ||
| 435 | 438 | static void* backing_store_custom_data = nullptr; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments