Commit 339b52f 1 parent 34ba230 commit 339b52f Copy full SHA for 339b52f
File tree 2 files changed +17
-13
lines changed
2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -510,6 +510,22 @@ SlicedArguments::SlicedArguments(
510
510
(*this )[i] = args[i + start];
511
511
}
512
512
513
+ template <typename T, size_t kStackStorageSize >
514
+ void MaybeStackBuffer<T, kStackStorageSize >::AllocateSufficientStorage(
515
+ size_t storage) {
516
+ CHECK (!IsInvalidated ());
517
+ if (storage > capacity ()) {
518
+ bool was_allocated = IsAllocated ();
519
+ T* allocated_ptr = was_allocated ? buf_ : nullptr ;
520
+ buf_ = Realloc (allocated_ptr, storage);
521
+ capacity_ = storage;
522
+ if (!was_allocated && length_ > 0 )
523
+ memcpy (buf_, buf_st_, length_ * sizeof (buf_[0 ]));
524
+ }
525
+
526
+ length_ = storage;
527
+ }
528
+
513
529
template <typename T, size_t S>
514
530
ArrayBufferViewContents<T, S>::ArrayBufferViewContents(
515
531
v8::Local<v8::Value> value) {
Original file line number Diff line number Diff line change @@ -411,19 +411,7 @@ class MaybeStackBuffer {
411
411
// This method can be called multiple times throughout the lifetime of the
412
412
// buffer, but once this has been called Invalidate() cannot be used.
413
413
// Content of the buffer in the range [0, length()) is preserved.
414
- void AllocateSufficientStorage (size_t storage) {
415
- CHECK (!IsInvalidated ());
416
- if (storage > capacity ()) {
417
- bool was_allocated = IsAllocated ();
418
- T* allocated_ptr = was_allocated ? buf_ : nullptr ;
419
- buf_ = Realloc (allocated_ptr, storage);
420
- capacity_ = storage;
421
- if (!was_allocated && length_ > 0 )
422
- memcpy (buf_, buf_st_, length_ * sizeof (buf_[0 ]));
423
- }
424
-
425
- length_ = storage;
426
- }
414
+ void AllocateSufficientStorage (size_t storage);
427
415
428
416
void SetLength (size_t length) {
429
417
// capacity() returns how much memory is actually available.
You can’t perform that action at this time.
0 commit comments