Revision f230a1cf deps/v8/test/cctest/test-decls.cc
deps/v8/test/cctest/test-decls.cc | ||
---|---|---|
52 | 52 |
|
53 | 53 |
virtual ~DeclarationContext() { |
54 | 54 |
if (is_initialized_) { |
55 |
Isolate* isolate = Isolate::GetCurrent();
|
|
55 |
Isolate* isolate = CcTest::isolate();
|
|
56 | 56 |
HandleScope scope(isolate); |
57 | 57 |
Local<Context> context = Local<Context>::New(isolate, context_); |
58 | 58 |
context->Exit(); |
... | ... | |
116 | 116 |
|
117 | 117 |
void DeclarationContext::InitializeIfNeeded() { |
118 | 118 |
if (is_initialized_) return; |
119 |
Isolate* isolate = Isolate::GetCurrent();
|
|
119 |
Isolate* isolate = CcTest::isolate();
|
|
120 | 120 |
HandleScope scope(isolate); |
121 | 121 |
Local<FunctionTemplate> function = FunctionTemplate::New(); |
122 | 122 |
Local<Value> data = External::New(this); |
... | ... | |
143 | 143 |
InitializeIfNeeded(); |
144 | 144 |
// A retry after a GC may pollute the counts, so perform gc now |
145 | 145 |
// to avoid that. |
146 |
HEAP->CollectGarbage(v8::internal::NEW_SPACE);
|
|
147 |
HandleScope scope(Isolate::GetCurrent());
|
|
146 |
CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE);
|
|
147 |
HandleScope scope(CcTest::isolate());
|
|
148 | 148 |
TryCatch catcher; |
149 | 149 |
catcher.SetVerbose(true); |
150 | 150 |
Local<Script> script = Script::Compile(String::New(source)); |
... | ... | |
169 | 169 |
CHECK_EQ(value, catcher.Exception()); |
170 | 170 |
} |
171 | 171 |
} |
172 |
HEAP->CollectAllAvailableGarbage(); // Clean slate for the next test. |
|
172 |
// Clean slate for the next test. |
|
173 |
CcTest::heap()->CollectAllAvailableGarbage(); |
|
173 | 174 |
} |
174 | 175 |
|
175 | 176 |
|
... | ... | |
226 | 227 |
// Test global declaration of a property the interceptor doesn't know |
227 | 228 |
// about and doesn't handle. |
228 | 229 |
TEST(Unknown) { |
229 |
HandleScope scope(Isolate::GetCurrent()); |
|
230 |
HandleScope scope(CcTest::isolate()); |
|
231 |
v8::V8::Initialize(); |
|
230 | 232 |
|
231 | 233 |
{ DeclarationContext context; |
232 | 234 |
context.Check("var x; x", |
233 | 235 |
1, // access |
234 | 236 |
1, // declaration |
235 | 237 |
2, // declaration + initialization |
236 |
EXPECT_RESULT, Undefined()); |
|
238 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
237 | 239 |
} |
238 | 240 |
|
239 | 241 |
{ DeclarationContext context; |
... | ... | |
257 | 259 |
1, // access |
258 | 260 |
2, // declaration + initialization |
259 | 261 |
1, // declaration |
260 |
EXPECT_RESULT, Undefined()); |
|
262 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
261 | 263 |
} |
262 | 264 |
|
263 | 265 |
{ DeclarationContext context; |
266 |
// SB 0 - BUG 1213579 |
|
264 | 267 |
context.Check("const x = 0; x", |
265 | 268 |
1, // access |
266 | 269 |
2, // declaration + initialization |
267 | 270 |
1, // declaration |
268 |
EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579
|
|
271 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
269 | 272 |
} |
270 | 273 |
} |
271 | 274 |
|
... | ... | |
281 | 284 |
|
282 | 285 |
|
283 | 286 |
TEST(Present) { |
284 |
HandleScope scope(Isolate::GetCurrent());
|
|
287 |
HandleScope scope(CcTest::isolate());
|
|
285 | 288 |
|
286 | 289 |
{ PresentPropertyContext context; |
287 | 290 |
context.Check("var x; x", |
... | ... | |
312 | 315 |
1, // access |
313 | 316 |
1, // initialization |
314 | 317 |
1, // (re-)declaration |
315 |
EXPECT_RESULT, Undefined()); |
|
318 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
316 | 319 |
} |
317 | 320 |
|
318 | 321 |
{ PresentPropertyContext context; |
... | ... | |
335 | 338 |
|
336 | 339 |
|
337 | 340 |
TEST(Absent) { |
338 |
HandleScope scope(Isolate::GetCurrent()); |
|
341 |
v8::Isolate* isolate = CcTest::isolate(); |
|
342 |
v8::V8::Initialize(); |
|
343 |
HandleScope scope(isolate); |
|
339 | 344 |
|
340 | 345 |
{ AbsentPropertyContext context; |
341 | 346 |
context.Check("var x; x", |
342 | 347 |
1, // access |
343 | 348 |
1, // declaration |
344 | 349 |
2, // declaration + initialization |
345 |
EXPECT_RESULT, Undefined()); |
|
350 |
EXPECT_RESULT, Undefined(isolate));
|
|
346 | 351 |
} |
347 | 352 |
|
348 | 353 |
{ AbsentPropertyContext context; |
... | ... | |
366 | 371 |
1, // access |
367 | 372 |
2, // declaration + initialization |
368 | 373 |
1, // declaration |
369 |
EXPECT_RESULT, Undefined()); |
|
374 |
EXPECT_RESULT, Undefined(isolate));
|
|
370 | 375 |
} |
371 | 376 |
|
372 | 377 |
{ AbsentPropertyContext context; |
... | ... | |
374 | 379 |
1, // access |
375 | 380 |
2, // declaration + initialization |
376 | 381 |
1, // declaration |
377 |
EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579 |
|
382 |
EXPECT_RESULT, Undefined(isolate)); // SB 0 - BUG 1213579
|
|
378 | 383 |
} |
379 | 384 |
|
380 | 385 |
{ AbsentPropertyContext context; |
... | ... | |
382 | 387 |
1, // access |
383 | 388 |
1, // declaration |
384 | 389 |
1, // declaration + initialization |
385 |
EXPECT_RESULT, Undefined()); |
|
390 |
EXPECT_RESULT, Undefined(isolate));
|
|
386 | 391 |
} |
387 | 392 |
} |
388 | 393 |
|
... | ... | |
425 | 430 |
|
426 | 431 |
|
427 | 432 |
TEST(Appearing) { |
428 |
HandleScope scope(Isolate::GetCurrent()); |
|
433 |
v8::V8::Initialize(); |
|
434 |
HandleScope scope(CcTest::isolate()); |
|
429 | 435 |
|
430 | 436 |
{ AppearingPropertyContext context; |
431 | 437 |
context.Check("var x; x", |
432 | 438 |
1, // access |
433 | 439 |
1, // declaration |
434 | 440 |
2, // declaration + initialization |
435 |
EXPECT_RESULT, Undefined()); |
|
441 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
436 | 442 |
} |
437 | 443 |
|
438 | 444 |
{ AppearingPropertyContext context; |
... | ... | |
456 | 462 |
1, // access |
457 | 463 |
2, // declaration + initialization |
458 | 464 |
1, // declaration |
459 |
EXPECT_RESULT, Undefined()); |
|
465 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
460 | 466 |
} |
461 | 467 |
|
462 | 468 |
{ AppearingPropertyContext context; |
... | ... | |
464 | 470 |
1, // access |
465 | 471 |
2, // declaration + initialization |
466 | 472 |
1, // declaration |
467 |
EXPECT_RESULT, Undefined()); |
|
473 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
468 | 474 |
// Result is undefined because declaration succeeded but |
469 | 475 |
// initialization to 0 failed (due to context behavior). |
470 | 476 |
} |
... | ... | |
517 | 523 |
|
518 | 524 |
|
519 | 525 |
TEST(Reappearing) { |
520 |
HandleScope scope(Isolate::GetCurrent()); |
|
526 |
v8::V8::Initialize(); |
|
527 |
HandleScope scope(CcTest::isolate()); |
|
521 | 528 |
|
522 | 529 |
{ ReappearingPropertyContext context; |
523 | 530 |
context.Check("const x; var x = 0", |
524 | 531 |
0, |
525 | 532 |
3, // const declaration+initialization, var initialization |
526 | 533 |
3, // 2 x declaration + var initialization |
527 |
EXPECT_RESULT, Undefined()); |
|
534 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
528 | 535 |
} |
529 | 536 |
} |
530 | 537 |
|
... | ... | |
546 | 553 |
|
547 | 554 |
TEST(ExistsInPrototype) { |
548 | 555 |
i::FLAG_es52_globals = true; |
549 |
HandleScope scope(Isolate::GetCurrent());
|
|
556 |
HandleScope scope(CcTest::isolate());
|
|
550 | 557 |
|
551 | 558 |
// Sanity check to make sure that the holder of the interceptor |
552 | 559 |
// really is the prototype object. |
... | ... | |
563 | 570 |
0, |
564 | 571 |
0, |
565 | 572 |
0, |
566 |
EXPECT_RESULT, Undefined()); |
|
573 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
567 | 574 |
} |
568 | 575 |
|
569 | 576 |
{ ExistsInPrototypeContext context; |
... | ... | |
579 | 586 |
0, |
580 | 587 |
0, |
581 | 588 |
0, |
582 |
EXPECT_RESULT, Undefined()); |
|
589 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
583 | 590 |
} |
584 | 591 |
|
585 | 592 |
{ ExistsInPrototypeContext context; |
... | ... | |
609 | 616 |
|
610 | 617 |
TEST(AbsentInPrototype) { |
611 | 618 |
i::FLAG_es52_globals = true; |
612 |
HandleScope scope(Isolate::GetCurrent()); |
|
619 |
v8::V8::Initialize(); |
|
620 |
HandleScope scope(CcTest::isolate()); |
|
613 | 621 |
|
614 | 622 |
{ AbsentInPrototypeContext context; |
615 | 623 |
context.Check("if (false) { var x = 0; }; x", |
616 | 624 |
0, |
617 | 625 |
0, |
618 | 626 |
0, |
619 |
EXPECT_RESULT, Undefined()); |
|
627 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
620 | 628 |
} |
621 | 629 |
} |
622 | 630 |
|
... | ... | |
656 | 664 |
|
657 | 665 |
TEST(ExistsInHiddenPrototype) { |
658 | 666 |
i::FLAG_es52_globals = true; |
659 |
HandleScope scope(Isolate::GetCurrent());
|
|
667 |
HandleScope scope(CcTest::isolate());
|
|
660 | 668 |
|
661 | 669 |
{ ExistsInHiddenPrototypeContext context; |
662 | 670 |
context.Check("var x; x", |
... | ... | |
688 | 696 |
0, |
689 | 697 |
0, |
690 | 698 |
1, // (re-)declaration |
691 |
EXPECT_RESULT, Undefined()); |
|
699 |
EXPECT_RESULT, Undefined(CcTest::isolate()));
|
|
692 | 700 |
} |
693 | 701 |
|
694 | 702 |
// TODO(mstarzinger): The semantics of global const is vague. |
... | ... | |
706 | 714 |
class SimpleContext { |
707 | 715 |
public: |
708 | 716 |
SimpleContext() |
709 |
: handle_scope_(Isolate::GetCurrent()),
|
|
710 |
context_(Context::New(Isolate::GetCurrent())) {
|
|
717 |
: handle_scope_(CcTest::isolate()),
|
|
718 |
context_(Context::New(CcTest::isolate())) {
|
|
711 | 719 |
context_->Enter(); |
712 | 720 |
} |
713 | 721 |
|
... | ... | |
749 | 757 |
|
750 | 758 |
|
751 | 759 |
TEST(CrossScriptReferences) { |
752 |
HandleScope scope(Isolate::GetCurrent());
|
|
760 |
HandleScope scope(CcTest::isolate());
|
|
753 | 761 |
|
754 | 762 |
{ SimpleContext context; |
755 | 763 |
context.Check("var x = 1; x", |
... | ... | |
794 | 802 |
i::FLAG_harmony_scoping = true; |
795 | 803 |
i::FLAG_harmony_modules = true; |
796 | 804 |
|
797 |
HandleScope scope(Isolate::GetCurrent());
|
|
805 |
HandleScope scope(CcTest::isolate());
|
|
798 | 806 |
|
799 | 807 |
const char* decs[] = { |
800 | 808 |
"var x = 1; x", "x", "this.x", |
... | ... | |
822 | 830 |
i::FLAG_harmony_scoping = true; |
823 | 831 |
i::FLAG_harmony_modules = true; |
824 | 832 |
|
825 |
HandleScope scope(Isolate::GetCurrent());
|
|
833 |
HandleScope scope(CcTest::isolate());
|
|
826 | 834 |
|
827 | 835 |
const char* firsts[] = { |
828 | 836 |
"var x = 1; x", |
Also available in: Unified diff