[shared-struct] Use holder in SharedArray length getter
Bug: v8:12547, chromium:1381098 Change-Id: I4196ec8f8856caab4abf834d2b5459b81a1eec4c Fixed: chromium:1381098 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4018914 Reviewed-by: Adam Klein <adamk@chromium.org> Commit-Queue: Shu-yu Guo <syg@chromium.org> Cr-Commit-Position: refs/heads/main@{#84194}
This commit is contained in:
parent
7d2b1f5368
commit
34e3ab71d5
@ -17,6 +17,7 @@
|
||||
#include "src/objects/contexts.h"
|
||||
#include "src/objects/field-index-inl.h"
|
||||
#include "src/objects/js-array-inl.h"
|
||||
#include "src/objects/js-shared-array-inl.h"
|
||||
#include "src/objects/module-inl.h"
|
||||
#include "src/objects/property-details.h"
|
||||
#include "src/objects/prototype.h"
|
||||
@ -238,10 +239,8 @@ void Accessors::SharedArrayLengthGetter(
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
|
||||
DisallowGarbageCollection no_gc;
|
||||
HandleScope scope(isolate);
|
||||
|
||||
Object value = *Utils::OpenHandle(*v8::Local<v8::Value>(info.This()));
|
||||
|
||||
Object result = Smi::FromInt(JSObject::cast(value).elements().length());
|
||||
auto holder = JSSharedArray::cast(*Utils::OpenHandle(*info.Holder()));
|
||||
Object result = Smi::FromInt(holder.elements().length());
|
||||
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(result, isolate)));
|
||||
}
|
||||
|
||||
|
@ -107,3 +107,9 @@
|
||||
i++;
|
||||
}
|
||||
})();
|
||||
|
||||
(function TestProxyLengthGetter() {
|
||||
let a = new SharedArray(2);
|
||||
let proxy = new Proxy(a, {});
|
||||
assertEquals(2, proxy.length);
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user