Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 CHECK_EQ(type, map->instance_type()); | 52 CHECK_EQ(type, map->instance_type()); |
| 53 CHECK_EQ(instance_size, map->instance_size()); | 53 CHECK_EQ(instance_size, map->instance_size()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 | 56 |
| 57 TEST(HeapMaps) { | 57 TEST(HeapMaps) { |
| 58 CcTest::InitializeVM(); | 58 CcTest::InitializeVM(); |
| 59 Heap* heap = CcTest::heap(); | 59 Heap* heap = CcTest::heap(); |
| 60 CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize); | 60 CheckMap(heap->meta_map(), MAP_TYPE, Map::kSize); |
| 61 CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); | 61 CheckMap(heap->heap_number_map(), HEAP_NUMBER_TYPE, HeapNumber::kSize); |
| 62 CheckMap(heap->float32x4_map(), FLOAT32X4_TYPE, Float32x4::kSize); | |
| 62 CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel); | 63 CheckMap(heap->fixed_array_map(), FIXED_ARRAY_TYPE, kVariableSizeSentinel); |
| 63 CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel); | 64 CheckMap(heap->string_map(), STRING_TYPE, kVariableSizeSentinel); |
| 64 } | 65 } |
| 65 | 66 |
| 66 | 67 |
| 67 static void CheckOddball(Isolate* isolate, Object* obj, const char* string) { | 68 static void CheckOddball(Isolate* isolate, Object* obj, const char* string) { |
| 68 CHECK(obj->IsOddball()); | 69 CHECK(obj->IsOddball()); |
| 69 Handle<Object> handle(obj, isolate); | 70 Handle<Object> handle(obj, isolate); |
| 70 Object* print_string = | 71 Object* print_string = |
| 71 *Execution::ToString(isolate, handle).ToHandleChecked(); | 72 *Execution::ToString(isolate, handle).ToHandleChecked(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 CHECK(value->IsNumber()); | 177 CHECK(value->IsNumber()); |
| 177 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(Smi::kMaxValue) + 1), | 178 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(Smi::kMaxValue) + 1), |
| 178 value->Number()); | 179 value->Number()); |
| 179 | 180 |
| 180 value = factory->NewNumberFromUint(static_cast<uint32_t>(1) << 31); | 181 value = factory->NewNumberFromUint(static_cast<uint32_t>(1) << 31); |
| 181 CHECK(value->IsHeapNumber()); | 182 CHECK(value->IsHeapNumber()); |
| 182 CHECK(value->IsNumber()); | 183 CHECK(value->IsNumber()); |
| 183 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(1) << 31), | 184 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(1) << 31), |
| 184 value->Number()); | 185 value->Number()); |
| 185 | 186 |
| 187 value = factory->NewFloat32x4(1, 2, 3, 4); | |
|
titzer
2015/06/03 13:27:15
Can we try some more floating point values, and al
bbudge
2015/06/03 20:31:48
Done.
| |
| 188 CHECK(value->IsFloat32x4()); | |
| 189 CHECK(value->BooleanValue()); // SIMD values map to true. | |
| 190 Float32x4* float32x4 = *Handle<Float32x4>::cast(value); | |
| 191 CHECK_EQ(1, float32x4->get_lane(0)); | |
| 192 CHECK_EQ(2, float32x4->get_lane(1)); | |
| 193 CHECK_EQ(3, float32x4->get_lane(2)); | |
| 194 CHECK_EQ(4, float32x4->get_lane(3)); | |
| 195 float32x4->set_lane(3, 5); | |
| 196 CHECK_EQ(5, float32x4->get_lane(3)); | |
| 197 | |
| 186 // nan oddball checks | 198 // nan oddball checks |
| 187 CHECK(factory->nan_value()->IsNumber()); | 199 CHECK(factory->nan_value()->IsNumber()); |
| 188 CHECK(std::isnan(factory->nan_value()->Number())); | 200 CHECK(std::isnan(factory->nan_value()->Number())); |
| 189 | 201 |
| 190 Handle<String> s = factory->NewStringFromStaticChars("fisk hest "); | 202 Handle<String> s = factory->NewStringFromStaticChars("fisk hest "); |
| 191 CHECK(s->IsString()); | 203 CHECK(s->IsString()); |
| 192 CHECK_EQ(10, s->length()); | 204 CHECK_EQ(10, s->length()); |
| 193 | 205 |
| 194 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); | 206 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); |
| 195 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); | 207 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); |
| (...skipping 5702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5898 size_t counter2 = 2000; | 5910 size_t counter2 = 2000; |
| 5899 tracer->SampleAllocation(time2, counter2, counter2); | 5911 tracer->SampleAllocation(time2, counter2, counter2); |
| 5900 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5912 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5901 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5913 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
| 5902 int time3 = 1000; | 5914 int time3 = 1000; |
| 5903 size_t counter3 = 30000; | 5915 size_t counter3 = 30000; |
| 5904 tracer->SampleAllocation(time3, counter3, counter3); | 5916 tracer->SampleAllocation(time3, counter3, counter3); |
| 5905 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5917 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5906 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5918 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
| 5907 } | 5919 } |
| OLD | NEW |