OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 11644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11655 i::Handle<i::ExternalPixelArray>::cast( | 11655 i::Handle<i::ExternalPixelArray>::cast( |
11656 FACTORY->NewExternalArray(kElementCount, | 11656 FACTORY->NewExternalArray(kElementCount, |
11657 v8::kExternalPixelArray, | 11657 v8::kExternalPixelArray, |
11658 pixel_data)); | 11658 pixel_data)); |
11659 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. | 11659 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. |
11660 for (int i = 0; i < kElementCount; i++) { | 11660 for (int i = 0; i < kElementCount; i++) { |
11661 pixels->set(i, i % 256); | 11661 pixels->set(i, i % 256); |
11662 } | 11662 } |
11663 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. | 11663 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. |
11664 for (int i = 0; i < kElementCount; i++) { | 11664 for (int i = 0; i < kElementCount; i++) { |
11665 CHECK_EQ(i % 256, pixels->get(i)); | 11665 CHECK_EQ(i % 256, pixels->get_scalar(i)); |
11666 CHECK_EQ(i % 256, pixel_data[i]); | 11666 CHECK_EQ(i % 256, pixel_data[i]); |
11667 } | 11667 } |
11668 | 11668 |
11669 v8::Handle<v8::Object> obj = v8::Object::New(); | 11669 v8::Handle<v8::Object> obj = v8::Object::New(); |
11670 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 11670 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
11671 // Set the elements to be the pixels. | 11671 // Set the elements to be the pixels. |
11672 // jsobj->set_elements(*pixels); | 11672 // jsobj->set_elements(*pixels); |
11673 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); | 11673 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); |
11674 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); | 11674 CHECK_EQ(1, i::Smi::cast(jsobj->GetElement(1)->ToObjectChecked())->value()); |
11675 obj->Set(v8_str("field"), v8::Int32::New(1503)); | 11675 obj->Set(v8_str("field"), v8::Int32::New(1503)); |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12128 static_cast<ElementType*>(malloc(kElementCount * element_size)); | 12128 static_cast<ElementType*>(malloc(kElementCount * element_size)); |
12129 i::Handle<ExternalArrayClass> array = | 12129 i::Handle<ExternalArrayClass> array = |
12130 i::Handle<ExternalArrayClass>::cast( | 12130 i::Handle<ExternalArrayClass>::cast( |
12131 FACTORY->NewExternalArray(kElementCount, array_type, array_data)); | 12131 FACTORY->NewExternalArray(kElementCount, array_type, array_data)); |
12132 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. | 12132 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. |
12133 for (int i = 0; i < kElementCount; i++) { | 12133 for (int i = 0; i < kElementCount; i++) { |
12134 array->set(i, static_cast<ElementType>(i)); | 12134 array->set(i, static_cast<ElementType>(i)); |
12135 } | 12135 } |
12136 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. | 12136 HEAP->CollectAllGarbage(false); // Force GC to trigger verification. |
12137 for (int i = 0; i < kElementCount; i++) { | 12137 for (int i = 0; i < kElementCount; i++) { |
12138 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array->get(i))); | 12138 CHECK_EQ(static_cast<int64_t>(i), |
| 12139 static_cast<int64_t>(array->get_scalar(i))); |
12139 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); | 12140 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); |
12140 } | 12141 } |
12141 | 12142 |
12142 v8::Handle<v8::Object> obj = v8::Object::New(); | 12143 v8::Handle<v8::Object> obj = v8::Object::New(); |
12143 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 12144 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
12144 // Set the elements to be the external array. | 12145 // Set the elements to be the external array. |
12145 obj->SetIndexedPropertiesToExternalArrayData(array_data, | 12146 obj->SetIndexedPropertiesToExternalArrayData(array_data, |
12146 array_type, | 12147 array_type, |
12147 kElementCount); | 12148 kElementCount); |
12148 CHECK_EQ( | 12149 CHECK_EQ( |
(...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14830 } | 14831 } |
14831 | 14832 |
14832 i::Isolate::Current()->heap()->CollectAllGarbage(true); | 14833 i::Isolate::Current()->heap()->CollectAllGarbage(true); |
14833 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 14834 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |
14834 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 14835 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |
14835 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 14836 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |
14836 CHECK_GT(elements, map_cache->NumberOfElements()); | 14837 CHECK_GT(elements, map_cache->NumberOfElements()); |
14837 } | 14838 } |
14838 } | 14839 } |
14839 } | 14840 } |
OLD | NEW |