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

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

Issue 434117: Remove usage of JSArray in Script object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/objects-inl.h ('k') | test/cctest/test-debug.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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 8509 matching lines...) Expand 10 before | Expand all | Expand 10 after
8520 v8::Persistent<Context> context; 8520 v8::Persistent<Context> context;
8521 int gc_count; 8521 int gc_count;
8522 8522
8523 // Context-dependent context data creates reference from the compilation 8523 // Context-dependent context data creates reference from the compilation
8524 // cache to the global object. 8524 // cache to the global object.
8525 context = Context::New(); 8525 context = Context::New();
8526 { 8526 {
8527 v8::HandleScope scope; 8527 v8::HandleScope scope;
8528 8528
8529 context->Enter(); 8529 context->Enter();
8530 Local<v8::Object> obj = v8::Object::New(); 8530 Local<v8::String> obj = v8::String::New("");
8531 context->SetData(obj); 8531 context->SetData(obj);
8532 CompileRun("1"); 8532 CompileRun("1");
8533 context->Exit(); 8533 context->Exit();
8534 } 8534 }
8535 context.Dispose(); 8535 context.Dispose();
8536 for (gc_count = 1; gc_count < 10; gc_count++) { 8536 for (gc_count = 1; gc_count < 10; gc_count++) {
8537 v8::internal::Heap::CollectAllGarbage(false); 8537 v8::internal::Heap::CollectAllGarbage(false);
8538 if (GetGlobalObjectsCount() == 0) break; 8538 if (GetGlobalObjectsCount() == 0) break;
8539 } 8539 }
8540 CHECK_EQ(0, GetGlobalObjectsCount()); 8540 CHECK_EQ(0, GetGlobalObjectsCount());
8541 8541 CHECK_EQ(2, gc_count);
8542 // Compilation cache size is different for Android.
8543 #if defined(ANDROID)
8544 CHECK_EQ(1, gc_count);
8545 #else
8546 CHECK_EQ(5, gc_count);
8547 #endif
8548 8542
8549 // Eval in a function creates reference from the compilation cache to the 8543 // Eval in a function creates reference from the compilation cache to the
8550 // global object. 8544 // global object.
8551 context = Context::New(); 8545 context = Context::New();
8552 { 8546 {
8553 v8::HandleScope scope; 8547 v8::HandleScope scope;
8554 8548
8555 context->Enter(); 8549 context->Enter();
8556 CompileRun("function f(){eval('1')}; f()"); 8550 CompileRun("function f(){eval('1')}; f()");
8557 context->Exit(); 8551 context->Exit();
8558 } 8552 }
8559 context.Dispose(); 8553 context.Dispose();
8560 for (gc_count = 1; gc_count < 10; gc_count++) { 8554 for (gc_count = 1; gc_count < 10; gc_count++) {
8561 v8::internal::Heap::CollectAllGarbage(false); 8555 v8::internal::Heap::CollectAllGarbage(false);
8562 if (GetGlobalObjectsCount() == 0) break; 8556 if (GetGlobalObjectsCount() == 0) break;
8563 } 8557 }
8564 CHECK_EQ(0, GetGlobalObjectsCount()); 8558 CHECK_EQ(0, GetGlobalObjectsCount());
8565
8566 // Compilation cache size is different for Android.
8567 #if defined(ANDROID)
8568 CHECK_EQ(1, gc_count);
8569 #else
8570 CHECK_EQ(2, gc_count); 8559 CHECK_EQ(2, gc_count);
8571 #endif
8572 8560
8573 // Looking up the line number for an exception creates reference from the 8561 // Looking up the line number for an exception creates reference from the
8574 // compilation cache to the global object. 8562 // compilation cache to the global object.
8575 context = Context::New(); 8563 context = Context::New();
8576 { 8564 {
8577 v8::HandleScope scope; 8565 v8::HandleScope scope;
8578 8566
8579 context->Enter(); 8567 context->Enter();
8580 v8::TryCatch try_catch; 8568 v8::TryCatch try_catch;
8581 CompileRun("function f(){throw 1;}; f()"); 8569 CompileRun("function f(){throw 1;}; f()");
8582 CHECK(try_catch.HasCaught()); 8570 CHECK(try_catch.HasCaught());
8583 v8::Handle<v8::Message> message = try_catch.Message(); 8571 v8::Handle<v8::Message> message = try_catch.Message();
8584 CHECK(!message.IsEmpty()); 8572 CHECK(!message.IsEmpty());
8585 CHECK_EQ(1, message->GetLineNumber()); 8573 CHECK_EQ(1, message->GetLineNumber());
8586 context->Exit(); 8574 context->Exit();
8587 } 8575 }
8588 context.Dispose(); 8576 context.Dispose();
8589 for (gc_count = 1; gc_count < 10; gc_count++) { 8577 for (gc_count = 1; gc_count < 10; gc_count++) {
8590 v8::internal::Heap::CollectAllGarbage(false); 8578 v8::internal::Heap::CollectAllGarbage(false);
8591 if (GetGlobalObjectsCount() == 0) break; 8579 if (GetGlobalObjectsCount() == 0) break;
8592 } 8580 }
8593 CHECK_EQ(0, GetGlobalObjectsCount()); 8581 CHECK_EQ(0, GetGlobalObjectsCount());
8594
8595 // Compilation cache size is different for Android.
8596 #if defined(ANDROID)
8597 CHECK_EQ(2, gc_count); 8582 CHECK_EQ(2, gc_count);
8598 #else
8599 CHECK_EQ(5, gc_count);
8600 #endif
8601 } 8583 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698