OLD | NEW |
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // track of various declaration related counters to make it easier to | 46 // track of various declaration related counters to make it easier to |
47 // track if global declarations in the presence of interceptors behave | 47 // track if global declarations in the presence of interceptors behave |
48 // the right way. | 48 // the right way. |
49 class DeclarationContext { | 49 class DeclarationContext { |
50 public: | 50 public: |
51 DeclarationContext(); | 51 DeclarationContext(); |
52 | 52 |
53 virtual ~DeclarationContext() { | 53 virtual ~DeclarationContext() { |
54 if (is_initialized_) { | 54 if (is_initialized_) { |
55 context_->Exit(); | 55 context_->Exit(); |
56 context_.Dispose(); | 56 context_.Dispose(context_->GetIsolate()); |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 void Check(const char* source, | 60 void Check(const char* source, |
61 int get, int set, int has, | 61 int get, int set, int has, |
62 Expectations expectations, | 62 Expectations expectations, |
63 v8::Handle<Value> value = Local<Value>()); | 63 v8::Handle<Value> value = Local<Value>()); |
64 | 64 |
65 int get_count() const { return get_count_; } | 65 int get_count() const { return get_count_; } |
66 int set_count() const { return set_count_; } | 66 int set_count() const { return set_count_; } |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 694 |
695 class SimpleContext { | 695 class SimpleContext { |
696 public: | 696 public: |
697 SimpleContext() { | 697 SimpleContext() { |
698 context_ = Context::New(0); | 698 context_ = Context::New(0); |
699 context_->Enter(); | 699 context_->Enter(); |
700 } | 700 } |
701 | 701 |
702 virtual ~SimpleContext() { | 702 virtual ~SimpleContext() { |
703 context_->Exit(); | 703 context_->Exit(); |
704 context_.Dispose(); | 704 context_.Dispose(context_->GetIsolate()); |
705 } | 705 } |
706 | 706 |
707 void Check(const char* source, | 707 void Check(const char* source, |
708 Expectations expectations, | 708 Expectations expectations, |
709 v8::Handle<Value> value = Local<Value>()) { | 709 v8::Handle<Value> value = Local<Value>()) { |
710 HandleScope scope; | 710 HandleScope scope; |
711 TryCatch catcher; | 711 TryCatch catcher; |
712 catcher.SetVerbose(true); | 712 catcher.SetVerbose(true); |
713 Local<Script> script = Script::Compile(String::New(source)); | 713 Local<Script> script = Script::Compile(String::New(source)); |
714 if (expectations == EXPECT_ERROR) { | 714 if (expectations == EXPECT_ERROR) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 SimpleContext context; | 834 SimpleContext context; |
835 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); | 835 context.Check(firsts[i], EXPECT_RESULT, Number::New(1)); |
836 // TODO(rossberg): All tests should actually be errors in Harmony, | 836 // TODO(rossberg): All tests should actually be errors in Harmony, |
837 // but we currently do not detect the cases where the first declaration | 837 // but we currently do not detect the cases where the first declaration |
838 // is not lexical. | 838 // is not lexical. |
839 context.Check(seconds[j], | 839 context.Check(seconds[j], |
840 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); | 840 i < 2 ? EXPECT_RESULT : EXPECT_ERROR, Number::New(2)); |
841 } | 841 } |
842 } | 842 } |
843 } | 843 } |
OLD | NEW |