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

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

Issue 24508006: remove uses of static oddball accessors using GetCurrent in advance of removal from api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits Created 7 years, 2 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 | « test/cctest/test-debug.cc ('k') | test/cctest/test-object-observe.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-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Test global declaration of a property the interceptor doesn't know 227 // Test global declaration of a property the interceptor doesn't know
228 // about and doesn't handle. 228 // about and doesn't handle.
229 TEST(Unknown) { 229 TEST(Unknown) {
230 HandleScope scope(CcTest::isolate()); 230 HandleScope scope(CcTest::isolate());
231 231
232 { DeclarationContext context; 232 { DeclarationContext context;
233 context.Check("var x; x", 233 context.Check("var x; x",
234 1, // access 234 1, // access
235 1, // declaration 235 1, // declaration
236 2, // declaration + initialization 236 2, // declaration + initialization
237 EXPECT_RESULT, Undefined()); 237 EXPECT_RESULT, Undefined(CcTest::isolate()));
238 } 238 }
239 239
240 { DeclarationContext context; 240 { DeclarationContext context;
241 context.Check("var x = 0; x", 241 context.Check("var x = 0; x",
242 1, // access 242 1, // access
243 2, // declaration + initialization 243 2, // declaration + initialization
244 2, // declaration + initialization 244 2, // declaration + initialization
245 EXPECT_RESULT, Number::New(0)); 245 EXPECT_RESULT, Number::New(0));
246 } 246 }
247 247
248 { DeclarationContext context; 248 { DeclarationContext context;
249 context.Check("function x() { }; x", 249 context.Check("function x() { }; x",
250 1, // access 250 1, // access
251 0, 251 0,
252 0, 252 0,
253 EXPECT_RESULT); 253 EXPECT_RESULT);
254 } 254 }
255 255
256 { DeclarationContext context; 256 { DeclarationContext context;
257 context.Check("const x; x", 257 context.Check("const x; x",
258 1, // access 258 1, // access
259 2, // declaration + initialization 259 2, // declaration + initialization
260 1, // declaration 260 1, // declaration
261 EXPECT_RESULT, Undefined()); 261 EXPECT_RESULT, Undefined(CcTest::isolate()));
262 } 262 }
263 263
264 { DeclarationContext context; 264 { DeclarationContext context;
265 // SB 0 - BUG 1213579
265 context.Check("const x = 0; x", 266 context.Check("const x = 0; x",
266 1, // access 267 1, // access
267 2, // declaration + initialization 268 2, // declaration + initialization
268 1, // declaration 269 1, // declaration
269 EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579 270 EXPECT_RESULT, Undefined(CcTest::isolate()));
270 } 271 }
271 } 272 }
272 273
273 274
274 275
275 class PresentPropertyContext: public DeclarationContext { 276 class PresentPropertyContext: public DeclarationContext {
276 protected: 277 protected:
277 virtual v8::Handle<Integer> Query(Local<String> key) { 278 virtual v8::Handle<Integer> Query(Local<String> key) {
278 return Integer::New(v8::None); 279 return Integer::New(v8::None);
279 } 280 }
(...skipping 26 matching lines...) Expand all
306 0, 307 0,
307 0, 308 0,
308 EXPECT_RESULT); 309 EXPECT_RESULT);
309 } 310 }
310 311
311 { PresentPropertyContext context; 312 { PresentPropertyContext context;
312 context.Check("const x; x", 313 context.Check("const x; x",
313 1, // access 314 1, // access
314 1, // initialization 315 1, // initialization
315 1, // (re-)declaration 316 1, // (re-)declaration
316 EXPECT_RESULT, Undefined()); 317 EXPECT_RESULT, Undefined(CcTest::isolate()));
317 } 318 }
318 319
319 { PresentPropertyContext context; 320 { PresentPropertyContext context;
320 context.Check("const x = 0; x", 321 context.Check("const x = 0; x",
321 1, // access 322 1, // access
322 1, // initialization 323 1, // initialization
323 1, // (re-)declaration 324 1, // (re-)declaration
324 EXPECT_RESULT, Number::New(0)); 325 EXPECT_RESULT, Number::New(0));
325 } 326 }
326 } 327 }
327 328
328 329
329 330
330 class AbsentPropertyContext: public DeclarationContext { 331 class AbsentPropertyContext: public DeclarationContext {
331 protected: 332 protected:
332 virtual v8::Handle<Integer> Query(Local<String> key) { 333 virtual v8::Handle<Integer> Query(Local<String> key) {
333 return v8::Handle<Integer>(); 334 return v8::Handle<Integer>();
334 } 335 }
335 }; 336 };
336 337
337 338
338 TEST(Absent) { 339 TEST(Absent) {
339 HandleScope scope(CcTest::isolate()); 340 v8::Isolate* isolate = CcTest::isolate();
341 HandleScope scope(isolate);
340 342
341 { AbsentPropertyContext context; 343 { AbsentPropertyContext context;
342 context.Check("var x; x", 344 context.Check("var x; x",
343 1, // access 345 1, // access
344 1, // declaration 346 1, // declaration
345 2, // declaration + initialization 347 2, // declaration + initialization
346 EXPECT_RESULT, Undefined()); 348 EXPECT_RESULT, Undefined(isolate));
347 } 349 }
348 350
349 { AbsentPropertyContext context; 351 { AbsentPropertyContext context;
350 context.Check("var x = 0; x", 352 context.Check("var x = 0; x",
351 1, // access 353 1, // access
352 2, // declaration + initialization 354 2, // declaration + initialization
353 2, // declaration + initialization 355 2, // declaration + initialization
354 EXPECT_RESULT, Number::New(0)); 356 EXPECT_RESULT, Number::New(0));
355 } 357 }
356 358
357 { AbsentPropertyContext context; 359 { AbsentPropertyContext context;
358 context.Check("function x() { }; x", 360 context.Check("function x() { }; x",
359 1, // access 361 1, // access
360 0, 362 0,
361 0, 363 0,
362 EXPECT_RESULT); 364 EXPECT_RESULT);
363 } 365 }
364 366
365 { AbsentPropertyContext context; 367 { AbsentPropertyContext context;
366 context.Check("const x; x", 368 context.Check("const x; x",
367 1, // access 369 1, // access
368 2, // declaration + initialization 370 2, // declaration + initialization
369 1, // declaration 371 1, // declaration
370 EXPECT_RESULT, Undefined()); 372 EXPECT_RESULT, Undefined(isolate));
371 } 373 }
372 374
373 { AbsentPropertyContext context; 375 { AbsentPropertyContext context;
374 context.Check("const x = 0; x", 376 context.Check("const x = 0; x",
375 1, // access 377 1, // access
376 2, // declaration + initialization 378 2, // declaration + initialization
377 1, // declaration 379 1, // declaration
378 EXPECT_RESULT, Undefined()); // SB 0 - BUG 1213579 380 EXPECT_RESULT, Undefined(isolate)); // SB 0 - BUG 1213579
379 } 381 }
380 382
381 { AbsentPropertyContext context; 383 { AbsentPropertyContext context;
382 context.Check("if (false) { var x = 0 }; x", 384 context.Check("if (false) { var x = 0 }; x",
383 1, // access 385 1, // access
384 1, // declaration 386 1, // declaration
385 1, // declaration + initialization 387 1, // declaration + initialization
386 EXPECT_RESULT, Undefined()); 388 EXPECT_RESULT, Undefined(isolate));
387 } 389 }
388 } 390 }
389 391
390 392
391 393
392 class AppearingPropertyContext: public DeclarationContext { 394 class AppearingPropertyContext: public DeclarationContext {
393 public: 395 public:
394 enum State { 396 enum State {
395 DECLARE, 397 DECLARE,
396 INITIALIZE_IF_ASSIGN, 398 INITIALIZE_IF_ASSIGN,
(...skipping 29 matching lines...) Expand all
426 428
427 429
428 TEST(Appearing) { 430 TEST(Appearing) {
429 HandleScope scope(CcTest::isolate()); 431 HandleScope scope(CcTest::isolate());
430 432
431 { AppearingPropertyContext context; 433 { AppearingPropertyContext context;
432 context.Check("var x; x", 434 context.Check("var x; x",
433 1, // access 435 1, // access
434 1, // declaration 436 1, // declaration
435 2, // declaration + initialization 437 2, // declaration + initialization
436 EXPECT_RESULT, Undefined()); 438 EXPECT_RESULT, Undefined(CcTest::isolate()));
437 } 439 }
438 440
439 { AppearingPropertyContext context; 441 { AppearingPropertyContext context;
440 context.Check("var x = 0; x", 442 context.Check("var x = 0; x",
441 1, // access 443 1, // access
442 2, // declaration + initialization 444 2, // declaration + initialization
443 2, // declaration + initialization 445 2, // declaration + initialization
444 EXPECT_RESULT, Number::New(0)); 446 EXPECT_RESULT, Number::New(0));
445 } 447 }
446 448
447 { AppearingPropertyContext context; 449 { AppearingPropertyContext context;
448 context.Check("function x() { }; x", 450 context.Check("function x() { }; x",
449 1, // access 451 1, // access
450 0, 452 0,
451 0, 453 0,
452 EXPECT_RESULT); 454 EXPECT_RESULT);
453 } 455 }
454 456
455 { AppearingPropertyContext context; 457 { AppearingPropertyContext context;
456 context.Check("const x; x", 458 context.Check("const x; x",
457 1, // access 459 1, // access
458 2, // declaration + initialization 460 2, // declaration + initialization
459 1, // declaration 461 1, // declaration
460 EXPECT_RESULT, Undefined()); 462 EXPECT_RESULT, Undefined(CcTest::isolate()));
461 } 463 }
462 464
463 { AppearingPropertyContext context; 465 { AppearingPropertyContext context;
464 context.Check("const x = 0; x", 466 context.Check("const x = 0; x",
465 1, // access 467 1, // access
466 2, // declaration + initialization 468 2, // declaration + initialization
467 1, // declaration 469 1, // declaration
468 EXPECT_RESULT, Undefined()); 470 EXPECT_RESULT, Undefined(CcTest::isolate()));
469 // Result is undefined because declaration succeeded but 471 // Result is undefined because declaration succeeded but
470 // initialization to 0 failed (due to context behavior). 472 // initialization to 0 failed (due to context behavior).
471 } 473 }
472 } 474 }
473 475
474 476
475 477
476 class ReappearingPropertyContext: public DeclarationContext { 478 class ReappearingPropertyContext: public DeclarationContext {
477 public: 479 public:
478 enum State { 480 enum State {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 520
519 521
520 TEST(Reappearing) { 522 TEST(Reappearing) {
521 HandleScope scope(CcTest::isolate()); 523 HandleScope scope(CcTest::isolate());
522 524
523 { ReappearingPropertyContext context; 525 { ReappearingPropertyContext context;
524 context.Check("const x; var x = 0", 526 context.Check("const x; var x = 0",
525 0, 527 0,
526 3, // const declaration+initialization, var initialization 528 3, // const declaration+initialization, var initialization
527 3, // 2 x declaration + var initialization 529 3, // 2 x declaration + var initialization
528 EXPECT_RESULT, Undefined()); 530 EXPECT_RESULT, Undefined(CcTest::isolate()));
529 } 531 }
530 } 532 }
531 533
532 534
533 535
534 class ExistsInPrototypeContext: public DeclarationContext { 536 class ExistsInPrototypeContext: public DeclarationContext {
535 protected: 537 protected:
536 virtual v8::Handle<Integer> Query(Local<String> key) { 538 virtual v8::Handle<Integer> Query(Local<String> key) {
537 // Let it seem that the property exists in the prototype object. 539 // Let it seem that the property exists in the prototype object.
538 return Integer::New(v8::None); 540 return Integer::New(v8::None);
(...skipping 18 matching lines...) Expand all
557 0, 559 0,
558 0, 560 0,
559 EXPECT_RESULT, Number::New(87)); 561 EXPECT_RESULT, Number::New(87));
560 } 562 }
561 563
562 { ExistsInPrototypeContext context; 564 { ExistsInPrototypeContext context;
563 context.Check("var x; x", 565 context.Check("var x; x",
564 0, 566 0,
565 0, 567 0,
566 0, 568 0,
567 EXPECT_RESULT, Undefined()); 569 EXPECT_RESULT, Undefined(CcTest::isolate()));
568 } 570 }
569 571
570 { ExistsInPrototypeContext context; 572 { ExistsInPrototypeContext context;
571 context.Check("var x = 0; x", 573 context.Check("var x = 0; x",
572 0, 574 0,
573 0, 575 0,
574 0, 576 0,
575 EXPECT_RESULT, Number::New(0)); 577 EXPECT_RESULT, Number::New(0));
576 } 578 }
577 579
578 { ExistsInPrototypeContext context; 580 { ExistsInPrototypeContext context;
579 context.Check("const x; x", 581 context.Check("const x; x",
580 0, 582 0,
581 0, 583 0,
582 0, 584 0,
583 EXPECT_RESULT, Undefined()); 585 EXPECT_RESULT, Undefined(CcTest::isolate()));
584 } 586 }
585 587
586 { ExistsInPrototypeContext context; 588 { ExistsInPrototypeContext context;
587 context.Check("const x = 0; x", 589 context.Check("const x = 0; x",
588 0, 590 0,
589 0, 591 0,
590 0, 592 0,
591 EXPECT_RESULT, Number::New(0)); 593 EXPECT_RESULT, Number::New(0));
592 } 594 }
593 } 595 }
(...skipping 16 matching lines...) Expand all
610 612
611 TEST(AbsentInPrototype) { 613 TEST(AbsentInPrototype) {
612 i::FLAG_es52_globals = true; 614 i::FLAG_es52_globals = true;
613 HandleScope scope(CcTest::isolate()); 615 HandleScope scope(CcTest::isolate());
614 616
615 { AbsentInPrototypeContext context; 617 { AbsentInPrototypeContext context;
616 context.Check("if (false) { var x = 0; }; x", 618 context.Check("if (false) { var x = 0; }; x",
617 0, 619 0,
618 0, 620 0,
619 0, 621 0,
620 EXPECT_RESULT, Undefined()); 622 EXPECT_RESULT, Undefined(CcTest::isolate()));
621 } 623 }
622 } 624 }
623 625
624 626
625 627
626 class ExistsInHiddenPrototypeContext: public DeclarationContext { 628 class ExistsInHiddenPrototypeContext: public DeclarationContext {
627 public: 629 public:
628 ExistsInHiddenPrototypeContext() { 630 ExistsInHiddenPrototypeContext() {
629 hidden_proto_ = FunctionTemplate::New(); 631 hidden_proto_ = FunctionTemplate::New();
630 hidden_proto_->SetHiddenPrototype(true); 632 hidden_proto_->SetHiddenPrototype(true);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 0, 684 0,
683 EXPECT_RESULT); 685 EXPECT_RESULT);
684 } 686 }
685 687
686 // TODO(mstarzinger): The semantics of global const is vague. 688 // TODO(mstarzinger): The semantics of global const is vague.
687 { ExistsInHiddenPrototypeContext context; 689 { ExistsInHiddenPrototypeContext context;
688 context.Check("const x; x", 690 context.Check("const x; x",
689 0, 691 0,
690 0, 692 0,
691 1, // (re-)declaration 693 1, // (re-)declaration
692 EXPECT_RESULT, Undefined()); 694 EXPECT_RESULT, Undefined(CcTest::isolate()));
693 } 695 }
694 696
695 // TODO(mstarzinger): The semantics of global const is vague. 697 // TODO(mstarzinger): The semantics of global const is vague.
696 { ExistsInHiddenPrototypeContext context; 698 { ExistsInHiddenPrototypeContext context;
697 context.Check("const x = 0; x", 699 context.Check("const x = 0; x",
698 0, 700 0,
699 0, 701 0,
700 1, // (re-)declaration 702 1, // (re-)declaration
701 EXPECT_RESULT, Number::New(0)); 703 EXPECT_RESULT, Number::New(0));
702 } 704 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 SimpleContext context; 849 SimpleContext context;
848 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); 850 context.Check(firsts[i], EXPECT_RESULT, Number::New(1));
849 // TODO(rossberg): All tests should actually be errors in Harmony, 851 // TODO(rossberg): All tests should actually be errors in Harmony,
850 // but we currently do not detect the cases where the first declaration 852 // but we currently do not detect the cases where the first declaration
851 // is not lexical. 853 // is not lexical.
852 context.Check(seconds[j], 854 context.Check(seconds[j],
853 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); 855 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2));
854 } 856 }
855 } 857 }
856 } 858 }
OLDNEW
« no previous file with comments | « test/cctest/test-debug.cc ('k') | test/cctest/test-object-observe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698