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

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

Issue 1116633002: Pass ArrayBuffer::Allocator via Isolate::CreateParams (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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 | « test/cctest/cctest.cc ('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 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 12123 matching lines...) Expand 10 before | Expand all | Expand 10 after
12134 12134
12135 env->Exit(); 12135 env->Exit();
12136 } 12136 }
12137 12137
12138 12138
12139 void SetFunctionEntryHookTest::RunTest() { 12139 void SetFunctionEntryHookTest::RunTest() {
12140 // Work in a new isolate throughout. 12140 // Work in a new isolate throughout.
12141 v8::Isolate::CreateParams create_params; 12141 v8::Isolate::CreateParams create_params;
12142 create_params.entry_hook = EntryHook; 12142 create_params.entry_hook = EntryHook;
12143 create_params.code_event_handler = JitEvent; 12143 create_params.code_event_handler = JitEvent;
12144 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
12144 v8::Isolate* isolate = v8::Isolate::New(create_params); 12145 v8::Isolate* isolate = v8::Isolate::New(create_params);
12145 12146
12146 { 12147 {
12147 v8::Isolate::Scope scope(isolate); 12148 v8::Isolate::Scope scope(isolate);
12148 12149
12149 RunLoopInNewEnv(isolate); 12150 RunLoopInNewEnv(isolate);
12150 12151
12151 // Check the exepected invocation counts. 12152 // Check the exepected invocation counts.
12152 CHECK_EQ(2, CountInvocations(NULL, "bar")); 12153 CHECK_EQ(2, CountInvocations(NULL, "bar"));
12153 CHECK_EQ(200, CountInvocations("bar", "foo")); 12154 CHECK_EQ(200, CountInvocations("bar", "foo"));
12154 CHECK_EQ(200, CountInvocations(NULL, "foo")); 12155 CHECK_EQ(200, CountInvocations(NULL, "foo"));
12155 12156
12156 // Verify that we have an entry hook on some specific stubs. 12157 // Verify that we have an entry hook on some specific stubs.
12157 CHECK_NE(0, CountInvocations(NULL, "CEntryStub")); 12158 CHECK_NE(0, CountInvocations(NULL, "CEntryStub"));
12158 CHECK_NE(0, CountInvocations(NULL, "JSEntryStub")); 12159 CHECK_NE(0, CountInvocations(NULL, "JSEntryStub"));
12159 CHECK_NE(0, CountInvocations(NULL, "JSEntryTrampoline")); 12160 CHECK_NE(0, CountInvocations(NULL, "JSEntryTrampoline"));
12160 } 12161 }
12161 isolate->Dispose(); 12162 isolate->Dispose();
12162 12163
12163 Reset(); 12164 Reset();
12164 12165
12165 // Make sure a second isolate is unaffected by the previous entry hook. 12166 // Make sure a second isolate is unaffected by the previous entry hook.
12166 isolate = v8::Isolate::New(); 12167 create_params = v8::Isolate::CreateParams();
12168 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
12169 isolate = v8::Isolate::New(create_params);
12167 { 12170 {
12168 v8::Isolate::Scope scope(isolate); 12171 v8::Isolate::Scope scope(isolate);
12169 12172
12170 // Reset the entry count to zero and set the entry hook. 12173 // Reset the entry count to zero and set the entry hook.
12171 RunLoopInNewEnv(isolate); 12174 RunLoopInNewEnv(isolate);
12172 12175
12173 // We should record no invocations in this isolate. 12176 // We should record no invocations in this isolate.
12174 CHECK_EQ(0, static_cast<int>(invocations_.size())); 12177 CHECK_EQ(0, static_cast<int>(invocations_.size()));
12175 } 12178 }
12176 12179
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
12337 " var sum = 0;" 12340 " var sum = 0;"
12338 " for (i = 0; i < 10; ++i)" 12341 " for (i = 0; i < 10; ++i)"
12339 " sum = foo(i);" 12342 " sum = foo(i);"
12340 " return sum;" 12343 " return sum;"
12341 "}" 12344 "}"
12342 "function foo(i) { return i; };" 12345 "function foo(i) { return i; };"
12343 "bar();"; 12346 "bar();";
12344 12347
12345 // Run this test in a new isolate to make sure we don't 12348 // Run this test in a new isolate to make sure we don't
12346 // have remnants of state from other code. 12349 // have remnants of state from other code.
12347 v8::Isolate* isolate = v8::Isolate::New(); 12350 v8::Isolate::CreateParams create_params;
12351 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
12352 v8::Isolate* isolate = v8::Isolate::New(create_params);
12348 isolate->Enter(); 12353 isolate->Enter();
12349 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 12354 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
12350 i::Heap* heap = i_isolate->heap(); 12355 i::Heap* heap = i_isolate->heap();
12351 12356
12352 // Start with a clean slate. 12357 // Start with a clean slate.
12353 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); 12358 heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare");
12354 12359
12355 { 12360 {
12356 v8::HandleScope scope(isolate); 12361 v8::HandleScope scope(isolate);
12357 i::HashMap code(MatchPointers); 12362 i::HashMap code(MatchPointers);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
12393 CHECK_LT(0, move_events); 12398 CHECK_LT(0, move_events);
12394 12399
12395 code_map = NULL; 12400 code_map = NULL;
12396 jitcode_line_info = NULL; 12401 jitcode_line_info = NULL;
12397 } 12402 }
12398 12403
12399 isolate->Exit(); 12404 isolate->Exit();
12400 isolate->Dispose(); 12405 isolate->Dispose();
12401 12406
12402 // Do this in a new isolate. 12407 // Do this in a new isolate.
12403 isolate = v8::Isolate::New(); 12408 isolate = v8::Isolate::New(create_params);
12404 isolate->Enter(); 12409 isolate->Enter();
12405 12410
12406 // Verify that we get callbacks for existing code objects when we 12411 // Verify that we get callbacks for existing code objects when we
12407 // request enumeration of existing code. 12412 // request enumeration of existing code.
12408 { 12413 {
12409 v8::HandleScope scope(isolate); 12414 v8::HandleScope scope(isolate);
12410 LocalContext env(isolate); 12415 LocalContext env(isolate);
12411 CompileRun(script); 12416 CompileRun(script);
12412 12417
12413 // Now get code through initial iteration. 12418 // Now get code through initial iteration.
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after
15247 CHECK(string3->IsExternal()); 15252 CHECK(string3->IsExternal());
15248 15253
15249 VisitorImpl visitor(resource); 15254 VisitorImpl visitor(resource);
15250 v8::V8::VisitExternalResources(&visitor); 15255 v8::V8::VisitExternalResources(&visitor);
15251 visitor.CheckVisitedResources(); 15256 visitor.CheckVisitedResources();
15252 } 15257 }
15253 15258
15254 15259
15255 TEST(ExternalStringCollectedAtTearDown) { 15260 TEST(ExternalStringCollectedAtTearDown) {
15256 int destroyed = 0; 15261 int destroyed = 0;
15257 v8::Isolate* isolate = v8::Isolate::New(); 15262 v8::Isolate::CreateParams create_params;
15263 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
15264 v8::Isolate* isolate = v8::Isolate::New(create_params);
15258 { v8::Isolate::Scope isolate_scope(isolate); 15265 { v8::Isolate::Scope isolate_scope(isolate);
15259 v8::HandleScope handle_scope(isolate); 15266 v8::HandleScope handle_scope(isolate);
15260 const char* s = "One string to test them all, one string to find them."; 15267 const char* s = "One string to test them all, one string to find them.";
15261 TestOneByteResource* inscription = 15268 TestOneByteResource* inscription =
15262 new TestOneByteResource(i::StrDup(s), &destroyed); 15269 new TestOneByteResource(i::StrDup(s), &destroyed);
15263 v8::Local<v8::String> ring = v8::String::NewExternal(isolate, inscription); 15270 v8::Local<v8::String> ring = v8::String::NewExternal(isolate, inscription);
15264 // Ring is still alive. Orcs are roaming freely across our lands. 15271 // Ring is still alive. Orcs are roaming freely across our lands.
15265 CHECK_EQ(0, destroyed); 15272 CHECK_EQ(0, destroyed);
15266 USE(ring); 15273 USE(ring);
15267 } 15274 }
15268 15275
15269 isolate->Dispose(); 15276 isolate->Dispose();
15270 // Ring has been destroyed. Free Peoples of Middle-earth Rejoice. 15277 // Ring has been destroyed. Free Peoples of Middle-earth Rejoice.
15271 CHECK_EQ(1, destroyed); 15278 CHECK_EQ(1, destroyed);
15272 } 15279 }
15273 15280
15274 15281
15275 TEST(ExternalInternalizedStringCollectedAtTearDown) { 15282 TEST(ExternalInternalizedStringCollectedAtTearDown) {
15276 int destroyed = 0; 15283 int destroyed = 0;
15277 v8::Isolate* isolate = v8::Isolate::New(); 15284 v8::Isolate::CreateParams create_params;
15285 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
15286 v8::Isolate* isolate = v8::Isolate::New(create_params);
15278 { v8::Isolate::Scope isolate_scope(isolate); 15287 { v8::Isolate::Scope isolate_scope(isolate);
15279 LocalContext env(isolate); 15288 LocalContext env(isolate);
15280 v8::HandleScope handle_scope(isolate); 15289 v8::HandleScope handle_scope(isolate);
15281 CompileRun("var ring = 'One string to test them all';"); 15290 CompileRun("var ring = 'One string to test them all';");
15282 const char* s = "One string to test them all"; 15291 const char* s = "One string to test them all";
15283 TestOneByteResource* inscription = 15292 TestOneByteResource* inscription =
15284 new TestOneByteResource(i::StrDup(s), &destroyed); 15293 new TestOneByteResource(i::StrDup(s), &destroyed);
15285 v8::Local<v8::String> ring = CompileRun("ring")->ToString(isolate); 15294 v8::Local<v8::String> ring = CompileRun("ring")->ToString(isolate);
15286 CHECK(v8::Utils::OpenHandle(*ring)->IsInternalizedString()); 15295 CHECK(v8::Utils::OpenHandle(*ring)->IsInternalizedString());
15287 ring->MakeExternal(inscription); 15296 ring->MakeExternal(inscription);
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
16508 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x"))); 16517 CHECK_EQ(false, global0->HasRealNamedCallbackProperty(v8_str("x")));
16509 16518
16510 // Reset the failed access check callback so it does not influence 16519 // Reset the failed access check callback so it does not influence
16511 // the other tests. 16520 // the other tests.
16512 v8::V8::SetFailedAccessCheckCallbackFunction(NULL); 16521 v8::V8::SetFailedAccessCheckCallbackFunction(NULL);
16513 } 16522 }
16514 16523
16515 16524
16516 TEST(IsolateNewDispose) { 16525 TEST(IsolateNewDispose) {
16517 v8::Isolate* current_isolate = CcTest::isolate(); 16526 v8::Isolate* current_isolate = CcTest::isolate();
16518 v8::Isolate* isolate = v8::Isolate::New(); 16527 v8::Isolate::CreateParams create_params;
16528 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16529 v8::Isolate* isolate = v8::Isolate::New(create_params);
16519 CHECK(isolate != NULL); 16530 CHECK(isolate != NULL);
16520 CHECK(current_isolate != isolate); 16531 CHECK(current_isolate != isolate);
16521 CHECK(current_isolate == CcTest::isolate()); 16532 CHECK(current_isolate == CcTest::isolate());
16522 16533
16523 v8::V8::SetFatalErrorHandler(StoringErrorCallback); 16534 v8::V8::SetFatalErrorHandler(StoringErrorCallback);
16524 last_location = last_message = NULL; 16535 last_location = last_message = NULL;
16525 isolate->Dispose(); 16536 isolate->Dispose();
16526 CHECK(!last_location); 16537 CHECK(!last_location);
16527 CHECK(!last_message); 16538 CHECK(!last_message);
16528 } 16539 }
16529 16540
16530 16541
16531 UNINITIALIZED_TEST(DisposeIsolateWhenInUse) { 16542 UNINITIALIZED_TEST(DisposeIsolateWhenInUse) {
16532 v8::Isolate* isolate = v8::Isolate::New(); 16543 v8::Isolate::CreateParams create_params;
16544 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16545 v8::Isolate* isolate = v8::Isolate::New(create_params);
16533 { 16546 {
16534 v8::Isolate::Scope i_scope(isolate); 16547 v8::Isolate::Scope i_scope(isolate);
16535 v8::HandleScope scope(isolate); 16548 v8::HandleScope scope(isolate);
16536 LocalContext context(isolate); 16549 LocalContext context(isolate);
16537 // Run something in this isolate. 16550 // Run something in this isolate.
16538 ExpectTrue("true"); 16551 ExpectTrue("true");
16539 v8::V8::SetFatalErrorHandler(StoringErrorCallback); 16552 v8::V8::SetFatalErrorHandler(StoringErrorCallback);
16540 last_location = last_message = NULL; 16553 last_location = last_message = NULL;
16541 // Still entered, should fail. 16554 // Still entered, should fail.
16542 isolate->Dispose(); 16555 isolate->Dispose();
16543 CHECK(last_location); 16556 CHECK(last_location);
16544 CHECK(last_message); 16557 CHECK(last_message);
16545 } 16558 }
16546 isolate->Dispose(); 16559 isolate->Dispose();
16547 } 16560 }
16548 16561
16549 16562
16550 static void BreakArrayGuarantees(const char* script) { 16563 static void BreakArrayGuarantees(const char* script) {
16551 v8::Isolate* isolate1 = v8::Isolate::New(); 16564 v8::Isolate::CreateParams create_params;
16565 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16566 v8::Isolate* isolate1 = v8::Isolate::New(create_params);
16552 isolate1->Enter(); 16567 isolate1->Enter();
16553 v8::Persistent<v8::Context> context1; 16568 v8::Persistent<v8::Context> context1;
16554 { 16569 {
16555 v8::HandleScope scope(isolate1); 16570 v8::HandleScope scope(isolate1);
16556 context1.Reset(isolate1, Context::New(isolate1)); 16571 context1.Reset(isolate1, Context::New(isolate1));
16557 } 16572 }
16558 16573
16559 { 16574 {
16560 v8::HandleScope scope(isolate1); 16575 v8::HandleScope scope(isolate1);
16561 v8::Local<v8::Context> context = 16576 v8::Local<v8::Context> context =
(...skipping 28 matching lines...) Expand all
16590 "Object.defineProperty(Array.prototype, 0, {" 16605 "Object.defineProperty(Array.prototype, 0, {"
16591 " get: function() { return 3; }});"); 16606 " get: function() { return 3; }});");
16592 BreakArrayGuarantees( 16607 BreakArrayGuarantees(
16593 "Object.defineProperty(Object.prototype, 0, {" 16608 "Object.defineProperty(Object.prototype, 0, {"
16594 " get: function() { return 3; }});"); 16609 " get: function() { return 3; }});");
16595 } 16610 }
16596 16611
16597 16612
16598 TEST(RunTwoIsolatesOnSingleThread) { 16613 TEST(RunTwoIsolatesOnSingleThread) {
16599 // Run isolate 1. 16614 // Run isolate 1.
16600 v8::Isolate* isolate1 = v8::Isolate::New(); 16615 v8::Isolate::CreateParams create_params;
16616 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16617 v8::Isolate* isolate1 = v8::Isolate::New(create_params);
16601 isolate1->Enter(); 16618 isolate1->Enter();
16602 v8::Persistent<v8::Context> context1; 16619 v8::Persistent<v8::Context> context1;
16603 { 16620 {
16604 v8::HandleScope scope(isolate1); 16621 v8::HandleScope scope(isolate1);
16605 context1.Reset(isolate1, Context::New(isolate1)); 16622 context1.Reset(isolate1, Context::New(isolate1));
16606 } 16623 }
16607 16624
16608 { 16625 {
16609 v8::HandleScope scope(isolate1); 16626 v8::HandleScope scope(isolate1);
16610 v8::Local<v8::Context> context = 16627 v8::Local<v8::Context> context =
16611 v8::Local<v8::Context>::New(isolate1, context1); 16628 v8::Local<v8::Context>::New(isolate1, context1);
16612 v8::Context::Scope context_scope(context); 16629 v8::Context::Scope context_scope(context);
16613 // Run something in new isolate. 16630 // Run something in new isolate.
16614 CompileRun("var foo = 'isolate 1';"); 16631 CompileRun("var foo = 'isolate 1';");
16615 ExpectString("function f() { return foo; }; f()", "isolate 1"); 16632 ExpectString("function f() { return foo; }; f()", "isolate 1");
16616 } 16633 }
16617 16634
16618 // Run isolate 2. 16635 // Run isolate 2.
16619 v8::Isolate* isolate2 = v8::Isolate::New(); 16636 v8::Isolate* isolate2 = v8::Isolate::New(create_params);
16620 v8::Persistent<v8::Context> context2; 16637 v8::Persistent<v8::Context> context2;
16621 16638
16622 { 16639 {
16623 v8::Isolate::Scope iscope(isolate2); 16640 v8::Isolate::Scope iscope(isolate2);
16624 v8::HandleScope scope(isolate2); 16641 v8::HandleScope scope(isolate2);
16625 context2.Reset(isolate2, Context::New(isolate2)); 16642 context2.Reset(isolate2, Context::New(isolate2));
16626 v8::Local<v8::Context> context = 16643 v8::Local<v8::Context> context =
16627 v8::Local<v8::Context>::New(isolate2, context2); 16644 v8::Local<v8::Context>::New(isolate2, context2);
16628 v8::Context::Scope context_scope(context); 16645 v8::Context::Scope context_scope(context);
16629 16646
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
16734 CHECK(value->IsNumber()); 16751 CHECK(value->IsNumber());
16735 return static_cast<int>(value->NumberValue()); 16752 return static_cast<int>(value->NumberValue());
16736 } 16753 }
16737 16754
16738 class IsolateThread : public v8::base::Thread { 16755 class IsolateThread : public v8::base::Thread {
16739 public: 16756 public:
16740 explicit IsolateThread(int fib_limit) 16757 explicit IsolateThread(int fib_limit)
16741 : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {} 16758 : Thread(Options("IsolateThread")), fib_limit_(fib_limit), result_(0) {}
16742 16759
16743 void Run() { 16760 void Run() {
16744 v8::Isolate* isolate = v8::Isolate::New(); 16761 v8::Isolate::CreateParams create_params;
16762 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16763 v8::Isolate* isolate = v8::Isolate::New(create_params);
16745 result_ = CalcFibonacci(isolate, fib_limit_); 16764 result_ = CalcFibonacci(isolate, fib_limit_);
16746 isolate->Dispose(); 16765 isolate->Dispose();
16747 } 16766 }
16748 16767
16749 int result() { return result_; } 16768 int result() { return result_; }
16750 16769
16751 private: 16770 private:
16752 int fib_limit_; 16771 int fib_limit_;
16753 int result_; 16772 int result_;
16754 }; 16773 };
(...skipping 16 matching lines...) Expand all
16771 // Compare results. The actual fibonacci numbers for 12 and 21 are taken 16790 // Compare results. The actual fibonacci numbers for 12 and 21 are taken
16772 // (I'm lazy!) from http://en.wikipedia.org/wiki/Fibonacci_number 16791 // (I'm lazy!) from http://en.wikipedia.org/wiki/Fibonacci_number
16773 CHECK_EQ(result1, 10946); 16792 CHECK_EQ(result1, 10946);
16774 CHECK_EQ(result2, 144); 16793 CHECK_EQ(result2, 144);
16775 CHECK_EQ(result1, thread1.result()); 16794 CHECK_EQ(result1, thread1.result());
16776 CHECK_EQ(result2, thread2.result()); 16795 CHECK_EQ(result2, thread2.result());
16777 } 16796 }
16778 16797
16779 16798
16780 TEST(IsolateDifferentContexts) { 16799 TEST(IsolateDifferentContexts) {
16781 v8::Isolate* isolate = v8::Isolate::New(); 16800 v8::Isolate::CreateParams create_params;
16801 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16802 v8::Isolate* isolate = v8::Isolate::New(create_params);
16782 Local<v8::Context> context; 16803 Local<v8::Context> context;
16783 { 16804 {
16784 v8::Isolate::Scope isolate_scope(isolate); 16805 v8::Isolate::Scope isolate_scope(isolate);
16785 v8::HandleScope handle_scope(isolate); 16806 v8::HandleScope handle_scope(isolate);
16786 context = v8::Context::New(isolate); 16807 context = v8::Context::New(isolate);
16787 v8::Context::Scope context_scope(context); 16808 v8::Context::Scope context_scope(context);
16788 Local<Value> v = CompileRun("2"); 16809 Local<Value> v = CompileRun("2");
16789 CHECK(v->IsNumber()); 16810 CHECK(v->IsNumber());
16790 CHECK_EQ(2, static_cast<int>(v->NumberValue())); 16811 CHECK_EQ(2, static_cast<int>(v->NumberValue()));
16791 } 16812 }
(...skipping 19 matching lines...) Expand all
16811 SetAddHistogramSampleFunction 16832 SetAddHistogramSampleFunction
16812 }; 16833 };
16813 16834
16814 explicit InitDefaultIsolateThread(TestCase testCase) 16835 explicit InitDefaultIsolateThread(TestCase testCase)
16815 : Thread(Options("InitDefaultIsolateThread")), 16836 : Thread(Options("InitDefaultIsolateThread")),
16816 testCase_(testCase), 16837 testCase_(testCase),
16817 result_(false) {} 16838 result_(false) {}
16818 16839
16819 void Run() { 16840 void Run() {
16820 v8::Isolate::CreateParams create_params; 16841 v8::Isolate::CreateParams create_params;
16842 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
16821 switch (testCase_) { 16843 switch (testCase_) {
16822 case SetResourceConstraints: { 16844 case SetResourceConstraints: {
16823 create_params.constraints.set_max_semi_space_size(1); 16845 create_params.constraints.set_max_semi_space_size(1);
16824 create_params.constraints.set_max_old_space_size(4); 16846 create_params.constraints.set_max_old_space_size(4);
16825 break; 16847 break;
16826 } 16848 }
16827 default: 16849 default:
16828 break; 16850 break;
16829 } 16851 }
16830 v8::Isolate* isolate = v8::Isolate::New(create_params); 16852 v8::Isolate* isolate = v8::Isolate::New(create_params);
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
18257 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); 18279 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value);
18258 i::Handle<i::Object> true_value = factory->true_value(); 18280 i::Handle<i::Object> true_value = factory->true_value();
18259 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); 18281 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value);
18260 i::Handle<i::Object> false_value = factory->false_value(); 18282 i::Handle<i::Object> false_value = factory->false_value();
18261 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); 18283 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value);
18262 } 18284 }
18263 18285
18264 18286
18265 UNINITIALIZED_TEST(IsolateEmbedderData) { 18287 UNINITIALIZED_TEST(IsolateEmbedderData) {
18266 CcTest::DisableAutomaticDispose(); 18288 CcTest::DisableAutomaticDispose();
18267 v8::Isolate* isolate = v8::Isolate::New(); 18289 v8::Isolate::CreateParams create_params;
18290 create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
18291 v8::Isolate* isolate = v8::Isolate::New(create_params);
18268 isolate->Enter(); 18292 isolate->Enter();
18269 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 18293 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
18270 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { 18294 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
18271 CHECK(!isolate->GetData(slot)); 18295 CHECK(!isolate->GetData(slot));
18272 CHECK(!i_isolate->GetData(slot)); 18296 CHECK(!i_isolate->GetData(slot));
18273 } 18297 }
18274 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) { 18298 for (uint32_t slot = 0; slot < v8::Isolate::GetNumberOfDataSlots(); ++slot) {
18275 void* data = reinterpret_cast<void*>(0xacce55ed + slot); 18299 void* data = reinterpret_cast<void*>(0xacce55ed + slot);
18276 isolate->SetData(slot, data); 18300 isolate->SetData(slot, data);
18277 } 18301 }
(...skipping 2694 matching lines...) Expand 10 before | Expand all | Expand 10 after
20972 20996
20973 { 20997 {
20974 v8::HandleScope handle_scope(isolate); 20998 v8::HandleScope handle_scope(isolate);
20975 20999
20976 // Should work 21000 // Should work
20977 v8::Local<v8::Object> obj = v8::Object::New(isolate); 21001 v8::Local<v8::Object> obj = v8::Object::New(isolate);
20978 21002
20979 USE(obj); 21003 USE(obj);
20980 } 21004 }
20981 } 21005 }
OLDNEW
« no previous file with comments | « test/cctest/cctest.cc ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698