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

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

Issue 208263002: Remove Failure::OutOfMemory propagation and V8::IgnoreOutOfMemoryException. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/x64/code-stubs-x64.cc ('k') | test/cctest/test-strings.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 19314 matching lines...) Expand 10 before | Expand all | Expand 10 after
19325 Local<Value> v = CompileRun("22"); 19325 Local<Value> v = CompileRun("22");
19326 CHECK(v->IsNumber()); 19326 CHECK(v->IsNumber());
19327 CHECK_EQ(22, static_cast<int>(v->NumberValue())); 19327 CHECK_EQ(22, static_cast<int>(v->NumberValue()));
19328 } 19328 }
19329 isolate->Dispose(); 19329 isolate->Dispose();
19330 } 19330 }
19331 19331
19332 class InitDefaultIsolateThread : public v8::internal::Thread { 19332 class InitDefaultIsolateThread : public v8::internal::Thread {
19333 public: 19333 public:
19334 enum TestCase { 19334 enum TestCase {
19335 IgnoreOOM,
19336 SetResourceConstraints, 19335 SetResourceConstraints,
19337 SetFatalHandler, 19336 SetFatalHandler,
19338 SetCounterFunction, 19337 SetCounterFunction,
19339 SetCreateHistogramFunction, 19338 SetCreateHistogramFunction,
19340 SetAddHistogramSampleFunction 19339 SetAddHistogramSampleFunction
19341 }; 19340 };
19342 19341
19343 explicit InitDefaultIsolateThread(TestCase testCase) 19342 explicit InitDefaultIsolateThread(TestCase testCase)
19344 : Thread("InitDefaultIsolateThread"), 19343 : Thread("InitDefaultIsolateThread"),
19345 testCase_(testCase), 19344 testCase_(testCase),
19346 result_(false) { } 19345 result_(false) { }
19347 19346
19348 void Run() { 19347 void Run() {
19349 v8::Isolate* isolate = v8::Isolate::New(); 19348 v8::Isolate* isolate = v8::Isolate::New();
19350 isolate->Enter(); 19349 isolate->Enter();
19351 switch (testCase_) { 19350 switch (testCase_) {
19352 case IgnoreOOM: 19351 case SetResourceConstraints: {
19353 v8::V8::IgnoreOutOfMemoryException(); 19352 static const int K = 1024;
19354 break; 19353 v8::ResourceConstraints constraints;
19354 constraints.set_max_young_space_size(256 * K);
19355 constraints.set_max_old_space_size(4 * K * K);
19356 v8::SetResourceConstraints(CcTest::isolate(), &constraints);
19357 break;
19358 }
19355 19359
19356 case SetResourceConstraints: { 19360 case SetFatalHandler:
19357 static const int K = 1024; 19361 v8::V8::SetFatalErrorHandler(NULL);
19358 v8::ResourceConstraints constraints; 19362 break;
19359 constraints.set_max_young_space_size(256 * K);
19360 constraints.set_max_old_space_size(4 * K * K);
19361 v8::SetResourceConstraints(CcTest::isolate(), &constraints);
19362 break;
19363 }
19364 19363
19365 case SetFatalHandler: 19364 case SetCounterFunction:
19366 v8::V8::SetFatalErrorHandler(NULL); 19365 v8::V8::SetCounterFunction(NULL);
19367 break; 19366 break;
19368 19367
19369 case SetCounterFunction: 19368 case SetCreateHistogramFunction:
19370 v8::V8::SetCounterFunction(NULL); 19369 v8::V8::SetCreateHistogramFunction(NULL);
19371 break; 19370 break;
19372 19371
19373 case SetCreateHistogramFunction: 19372 case SetAddHistogramSampleFunction:
19374 v8::V8::SetCreateHistogramFunction(NULL); 19373 v8::V8::SetAddHistogramSampleFunction(NULL);
19375 break; 19374 break;
19376
19377 case SetAddHistogramSampleFunction:
19378 v8::V8::SetAddHistogramSampleFunction(NULL);
19379 break;
19380 } 19375 }
19381 isolate->Exit(); 19376 isolate->Exit();
19382 isolate->Dispose(); 19377 isolate->Dispose();
19383 result_ = true; 19378 result_ = true;
19384 } 19379 }
19385 19380
19386 bool result() { return result_; } 19381 bool result() { return result_; }
19387 19382
19388 private: 19383 private:
19389 TestCase testCase_; 19384 TestCase testCase_;
19390 bool result_; 19385 bool result_;
19391 }; 19386 };
19392 19387
19393 19388
19394 static void InitializeTestHelper(InitDefaultIsolateThread::TestCase testCase) { 19389 static void InitializeTestHelper(InitDefaultIsolateThread::TestCase testCase) {
19395 InitDefaultIsolateThread thread(testCase); 19390 InitDefaultIsolateThread thread(testCase);
19396 thread.Start(); 19391 thread.Start();
19397 thread.Join(); 19392 thread.Join();
19398 CHECK_EQ(thread.result(), true); 19393 CHECK_EQ(thread.result(), true);
19399 } 19394 }
19400 19395
19401 19396
19402 TEST(InitializeDefaultIsolateOnSecondaryThread1) { 19397 TEST(InitializeDefaultIsolateOnSecondaryThread1) {
19403 InitializeTestHelper(InitDefaultIsolateThread::IgnoreOOM); 19398 InitializeTestHelper(InitDefaultIsolateThread::SetResourceConstraints);
19404 } 19399 }
19405 19400
19406 19401
19407 TEST(InitializeDefaultIsolateOnSecondaryThread2) { 19402 TEST(InitializeDefaultIsolateOnSecondaryThread2) {
19408 InitializeTestHelper(InitDefaultIsolateThread::SetResourceConstraints); 19403 InitializeTestHelper(InitDefaultIsolateThread::SetFatalHandler);
19409 } 19404 }
19410 19405
19411 19406
19412 TEST(InitializeDefaultIsolateOnSecondaryThread3) { 19407 TEST(InitializeDefaultIsolateOnSecondaryThread3) {
19413 InitializeTestHelper(InitDefaultIsolateThread::SetFatalHandler); 19408 InitializeTestHelper(InitDefaultIsolateThread::SetCounterFunction);
19414 } 19409 }
19415 19410
19416 19411
19417 TEST(InitializeDefaultIsolateOnSecondaryThread4) { 19412 TEST(InitializeDefaultIsolateOnSecondaryThread4) {
19418 InitializeTestHelper(InitDefaultIsolateThread::SetCounterFunction); 19413 InitializeTestHelper(InitDefaultIsolateThread::SetCreateHistogramFunction);
19419 } 19414 }
19420 19415
19421 19416
19422 TEST(InitializeDefaultIsolateOnSecondaryThread5) { 19417 TEST(InitializeDefaultIsolateOnSecondaryThread5) {
19423 InitializeTestHelper(InitDefaultIsolateThread::SetCreateHistogramFunction);
19424 }
19425
19426
19427 TEST(InitializeDefaultIsolateOnSecondaryThread6) {
19428 InitializeTestHelper(InitDefaultIsolateThread::SetAddHistogramSampleFunction); 19418 InitializeTestHelper(InitDefaultIsolateThread::SetAddHistogramSampleFunction);
19429 } 19419 }
19430 19420
19431 19421
19432 TEST(StringCheckMultipleContexts) { 19422 TEST(StringCheckMultipleContexts) {
19433 const char* code = 19423 const char* code =
19434 "(function() { return \"a\".charAt(0); })()"; 19424 "(function() { return \"a\".charAt(0); })()";
19435 19425
19436 { 19426 {
19437 // Run the code twice in the first context to initialize the call IC. 19427 // Run the code twice in the first context to initialize the call IC.
(...skipping 2898 matching lines...) Expand 10 before | Expand all | Expand 10 after
22336 "f.call(friend);"); 22326 "f.call(friend);");
22337 CHECK_EQ(2, named_access_count); 22327 CHECK_EQ(2, named_access_count);
22338 22328
22339 // Test access using Object.setPrototypeOf reflective method. 22329 // Test access using Object.setPrototypeOf reflective method.
22340 named_access_count = 0; 22330 named_access_count = 0;
22341 CompileRun("Object.setPrototypeOf(friend, {});"); 22331 CompileRun("Object.setPrototypeOf(friend, {});");
22342 CHECK_EQ(1, named_access_count); 22332 CHECK_EQ(1, named_access_count);
22343 CompileRun("Object.getPrototypeOf(friend);"); 22333 CompileRun("Object.getPrototypeOf(friend);");
22344 CHECK_EQ(2, named_access_count); 22334 CHECK_EQ(2, named_access_count);
22345 } 22335 }
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698