Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1019)

Side by Side Diff: test/cctest/test-api.cc

Issue 1061753008: Revert of Remove the weak list of views from array buffers (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/snapshot/serialize.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13801 matching lines...) Expand 10 before | Expand all | Expand 10 after
13812 template <class FixedTypedArrayClass, i::ElementsKind elements_kind, 13812 template <class FixedTypedArrayClass, i::ElementsKind elements_kind,
13813 class ElementType> 13813 class ElementType>
13814 static void FixedTypedArrayTestHelper(i::ExternalArrayType array_type, 13814 static void FixedTypedArrayTestHelper(i::ExternalArrayType array_type,
13815 ElementType low, ElementType high) { 13815 ElementType low, ElementType high) {
13816 i::FLAG_allow_natives_syntax = true; 13816 i::FLAG_allow_natives_syntax = true;
13817 LocalContext context; 13817 LocalContext context;
13818 i::Isolate* isolate = CcTest::i_isolate(); 13818 i::Isolate* isolate = CcTest::i_isolate();
13819 i::Factory* factory = isolate->factory(); 13819 i::Factory* factory = isolate->factory();
13820 v8::HandleScope scope(context->GetIsolate()); 13820 v8::HandleScope scope(context->GetIsolate());
13821 const int kElementCount = 260; 13821 const int kElementCount = 260;
13822 i::Handle<i::JSTypedArray> jsobj = 13822 i::Handle<FixedTypedArrayClass> fixed_array =
13823 factory->NewJSTypedArray(elements_kind, kElementCount); 13823 i::Handle<FixedTypedArrayClass>::cast(
13824 i::Handle<FixedTypedArrayClass> fixed_array( 13824 factory->NewFixedTypedArray(kElementCount, array_type));
13825 FixedTypedArrayClass::cast(jsobj->elements()));
13826 CHECK_EQ(FixedTypedArrayClass::kInstanceType, 13825 CHECK_EQ(FixedTypedArrayClass::kInstanceType,
13827 fixed_array->map()->instance_type()); 13826 fixed_array->map()->instance_type());
13828 CHECK_EQ(kElementCount, fixed_array->length()); 13827 CHECK_EQ(kElementCount, fixed_array->length());
13829 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 13828 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
13830 for (int i = 0; i < kElementCount; i++) { 13829 for (int i = 0; i < kElementCount; i++) {
13831 fixed_array->set(i, static_cast<ElementType>(i)); 13830 fixed_array->set(i, static_cast<ElementType>(i));
13832 } 13831 }
13833 // Force GC to trigger verification. 13832 // Force GC to trigger verification.
13834 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); 13833 CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
13835 for (int i = 0; i < kElementCount; i++) { 13834 for (int i = 0; i < kElementCount; i++) {
13836 CHECK_EQ(static_cast<int64_t>(static_cast<ElementType>(i)), 13835 CHECK_EQ(static_cast<int64_t>(static_cast<ElementType>(i)),
13837 static_cast<int64_t>(fixed_array->get_scalar(i))); 13836 static_cast<int64_t>(fixed_array->get_scalar(i)));
13838 } 13837 }
13839 v8::Handle<v8::Object> obj = v8::Utils::ToLocal(jsobj); 13838 v8::Handle<v8::Object> obj = v8::Object::New(CcTest::isolate());
13839 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj);
13840 i::Handle<i::Map> fixed_array_map =
13841 i::JSObject::GetElementsTransitionMap(jsobj, elements_kind);
13842 jsobj->set_map(*fixed_array_map);
13843 jsobj->set_elements(*fixed_array);
13840 13844
13841 ObjectWithExternalArrayTestHelper<FixedTypedArrayClass, ElementType>( 13845 ObjectWithExternalArrayTestHelper<FixedTypedArrayClass, ElementType>(
13842 context.local(), obj, kElementCount, array_type, 13846 context.local(), obj, kElementCount, array_type,
13843 static_cast<int64_t>(low), 13847 static_cast<int64_t>(low),
13844 static_cast<int64_t>(high)); 13848 static_cast<int64_t>(high));
13845 } 13849 }
13846 13850
13847 13851
13848 THREADED_TEST(FixedUint8Array) { 13852 THREADED_TEST(FixedUint8Array) {
13849 FixedTypedArrayTestHelper<i::FixedUint8Array, i::UINT8_ELEMENTS, uint8_t>( 13853 FixedTypedArrayTestHelper<i::FixedUint8Array, i::UINT8_ELEMENTS, uint8_t>(
(...skipping 7165 matching lines...) Expand 10 before | Expand all | Expand 10 after
21015 21019
21016 { 21020 {
21017 v8::HandleScope handle_scope(isolate); 21021 v8::HandleScope handle_scope(isolate);
21018 21022
21019 // Should work 21023 // Should work
21020 v8::Local<v8::Object> obj = v8::Object::New(isolate); 21024 v8::Local<v8::Object> obj = v8::Object::New(isolate);
21021 21025
21022 USE(obj); 21026 USE(obj);
21023 } 21027 }
21024 } 21028 }
OLDNEW
« no previous file with comments | « src/snapshot/serialize.cc ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698