| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 3be068009e275e53bb60903d812af6f841ab6069..ce45ebe5a00803b1af772b00b994bf6d89aa4c3d 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -25,6 +25,9 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| +// We want to test our deprecated API entries, too.
|
| +#define V8_DISABLE_DEPRECATIONS 1
|
| +
|
| #include <limits.h>
|
|
|
| #ifndef WIN32
|
| @@ -2055,6 +2058,38 @@ THREADED_TEST(InternalFieldsNativePointersAndExternal) {
|
| delete[] data;
|
| }
|
|
|
| +static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj,
|
| + void* value) {
|
| + CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
|
| + obj->SetPointerInInternalField(0, value);
|
| + HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
| + CHECK_EQ(value, obj->GetPointerFromInternalField(0));
|
| +}
|
| +
|
| +
|
| +THREADED_TEST(InternalFieldsAlignedPointers) {
|
| + v8::HandleScope scope;
|
| + LocalContext env;
|
| +
|
| + Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
|
| + Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
|
| + instance_templ->SetInternalFieldCount(1);
|
| + Local<v8::Object> obj = templ->GetFunction()->NewInstance();
|
| + CHECK_EQ(1, obj->InternalFieldCount());
|
| +
|
| + CheckAlignedPointerInInternalField(obj, NULL);
|
| +
|
| + int* heap_allocated = new int[100];
|
| + CheckAlignedPointerInInternalField(obj, heap_allocated);
|
| + delete[] heap_allocated;
|
| +
|
| + int stack_allocated[100];
|
| + CheckAlignedPointerInInternalField(obj, stack_allocated);
|
| +
|
| + void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
|
| + CheckAlignedPointerInInternalField(obj, huge);
|
| +}
|
| +
|
|
|
| THREADED_TEST(IdentityHash) {
|
| v8::HandleScope scope;
|
|
|