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

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

Issue 10914257: Fix API check for length of external arrays. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | no next file » | 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 14021 matching lines...) Expand 10 before | Expand all | Expand 10 after
14032 ExternalArrayInfoTestHelper(v8::kExternalShortArray); 14032 ExternalArrayInfoTestHelper(v8::kExternalShortArray);
14033 ExternalArrayInfoTestHelper(v8::kExternalUnsignedShortArray); 14033 ExternalArrayInfoTestHelper(v8::kExternalUnsignedShortArray);
14034 ExternalArrayInfoTestHelper(v8::kExternalIntArray); 14034 ExternalArrayInfoTestHelper(v8::kExternalIntArray);
14035 ExternalArrayInfoTestHelper(v8::kExternalUnsignedIntArray); 14035 ExternalArrayInfoTestHelper(v8::kExternalUnsignedIntArray);
14036 ExternalArrayInfoTestHelper(v8::kExternalFloatArray); 14036 ExternalArrayInfoTestHelper(v8::kExternalFloatArray);
14037 ExternalArrayInfoTestHelper(v8::kExternalDoubleArray); 14037 ExternalArrayInfoTestHelper(v8::kExternalDoubleArray);
14038 ExternalArrayInfoTestHelper(v8::kExternalPixelArray); 14038 ExternalArrayInfoTestHelper(v8::kExternalPixelArray);
14039 } 14039 }
14040 14040
14041 14041
14042 void ExternalArrayLimitTestHelper(v8::ExternalArrayType array_type, int size) {
14043 v8::Handle<v8::Object> obj = v8::Object::New();
14044 v8::V8::SetFatalErrorHandler(StoringErrorCallback);
14045 last_location = last_message = NULL;
14046 obj->SetIndexedPropertiesToExternalArrayData(NULL, array_type, size);
14047 CHECK(!obj->HasIndexedPropertiesInExternalArrayData());
14048 CHECK_NE(NULL, last_location);
14049 CHECK_NE(NULL, last_message);
14050 }
14051
14052
14053 TEST(ExternalArrayLimits) {
14054 v8::HandleScope scope;
14055 LocalContext context;
14056 ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0x40000000);
14057 ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0xffffffff);
14058 ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0x40000000);
14059 ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0xffffffff);
14060 ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0x40000000);
14061 ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0xffffffff);
14062 ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0x40000000);
14063 ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0xffffffff);
14064 ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0x40000000);
14065 ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0xffffffff);
14066 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0x40000000);
14067 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0xffffffff);
14068 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0x40000000);
14069 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0xffffffff);
14070 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0x40000000);
14071 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0xffffffff);
14072 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000);
14073 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff);
14074 }
14075
14076
14042 THREADED_TEST(ScriptContextDependence) { 14077 THREADED_TEST(ScriptContextDependence) {
14043 v8::HandleScope scope; 14078 v8::HandleScope scope;
14044 LocalContext c1; 14079 LocalContext c1;
14045 const char *source = "foo"; 14080 const char *source = "foo";
14046 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); 14081 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
14047 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); 14082 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
14048 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); 14083 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
14049 CHECK_EQ(dep->Run()->Int32Value(), 100); 14084 CHECK_EQ(dep->Run()->Int32Value(), 100);
14050 CHECK_EQ(indep->Run()->Int32Value(), 100); 14085 CHECK_EQ(indep->Run()->Int32Value(), 100);
14051 LocalContext c2; 14086 LocalContext c2;
(...skipping 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after
17472 17507
17473 i::Semaphore* sem_; 17508 i::Semaphore* sem_;
17474 volatile int sem_value_; 17509 volatile int sem_value_;
17475 }; 17510 };
17476 17511
17477 17512
17478 THREADED_TEST(SemaphoreInterruption) { 17513 THREADED_TEST(SemaphoreInterruption) {
17479 ThreadInterruptTest().RunTest(); 17514 ThreadInterruptTest().RunTest();
17480 } 17515 }
17481 #endif // WIN32 17516 #endif // WIN32
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698