| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(zra): Remove when tests are ready to enable. | 5 // TODO(zra): Remove when tests are ready to enable. |
| 6 #include "platform/globals.h" | 6 #include "platform/globals.h" |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 addr = RawObject::ToAddr(new_array.raw()); | 2043 addr = RawObject::ToAddr(new_array.raw()); |
| 2044 obj = RawObject::FromAddr(addr); | 2044 obj = RawObject::FromAddr(addr); |
| 2045 EXPECT(obj.IsArray()); | 2045 EXPECT(obj.IsArray()); |
| 2046 new_array ^= obj.raw(); | 2046 new_array ^= obj.raw(); |
| 2047 EXPECT_EQ(1, new_array.Length()); | 2047 EXPECT_EQ(1, new_array.Length()); |
| 2048 addr += used_size; | 2048 addr += used_size; |
| 2049 obj = RawObject::FromAddr(addr); | 2049 obj = RawObject::FromAddr(addr); |
| 2050 EXPECT(obj.IsTypedData()); | 2050 EXPECT(obj.IsTypedData()); |
| 2051 left_over_array ^= obj.raw(); | 2051 left_over_array ^= obj.raw(); |
| 2052 EXPECT_EQ((6 * kWordSize), left_over_array.Length()); | 2052 EXPECT_EQ((6 * kWordSize), left_over_array.Length()); |
| 2053 |
| 2054 // 4. Verify that GC can handle the filler object for a large array. |
| 2055 array = GrowableObjectArray::New((1 * MB) >> kWordSizeLog2); |
| 2056 EXPECT_EQ(0, array.Length()); |
| 2057 for (intptr_t i = 0; i < 1; i++) { |
| 2058 value = Smi::New(i); |
| 2059 array.Add(value); |
| 2060 } |
| 2061 new_array = Array::MakeArray(array); |
| 2062 EXPECT_EQ(1, new_array.Length()); |
| 2063 Isolate::Current()->heap()->CollectAllGarbage(); |
| 2064 EXPECT_EQ(1, new_array.Length()); |
| 2053 } | 2065 } |
| 2054 | 2066 |
| 2055 | 2067 |
| 2056 TEST_CASE(InternalTypedData) { | 2068 TEST_CASE(InternalTypedData) { |
| 2057 uint8_t data[] = { 253, 254, 255, 0, 1, 2, 3, 4 }; | 2069 uint8_t data[] = { 253, 254, 255, 0, 1, 2, 3, 4 }; |
| 2058 intptr_t data_length = ARRAY_SIZE(data); | 2070 intptr_t data_length = ARRAY_SIZE(data); |
| 2059 | 2071 |
| 2060 const TypedData& int8_array = | 2072 const TypedData& int8_array = |
| 2061 TypedData::Handle(TypedData::New(kTypedDataInt8ArrayCid, data_length)); | 2073 TypedData::Handle(TypedData::New(kTypedDataInt8ArrayCid, data_length)); |
| 2062 EXPECT(!int8_array.IsNull()); | 2074 EXPECT(!int8_array.IsNull()); |
| (...skipping 1990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4053 const Instance& a0 = Instance::Handle(Instance::New(clazz)); | 4065 const Instance& a0 = Instance::Handle(Instance::New(clazz)); |
| 4054 const Instance& a1 = Instance::Handle(Instance::New(clazz)); | 4066 const Instance& a1 = Instance::Handle(Instance::New(clazz)); |
| 4055 EXPECT(a0.raw() != a1.raw()); | 4067 EXPECT(a0.raw() != a1.raw()); |
| 4056 EXPECT(a0.OperatorEquals(a0)); | 4068 EXPECT(a0.OperatorEquals(a0)); |
| 4057 EXPECT(a0.OperatorEquals(a1)); | 4069 EXPECT(a0.OperatorEquals(a1)); |
| 4058 EXPECT(a0.IsIdenticalTo(a0)); | 4070 EXPECT(a0.IsIdenticalTo(a0)); |
| 4059 EXPECT(!a0.IsIdenticalTo(a1)); | 4071 EXPECT(!a0.IsIdenticalTo(a1)); |
| 4060 } | 4072 } |
| 4061 | 4073 |
| 4062 } // namespace dart | 4074 } // namespace dart |
| OLD | NEW |