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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 | 125 |
126 void DeclarationContext::Check(const char* source, | 126 void DeclarationContext::Check(const char* source, |
127 int get, int set, int query, | 127 int get, int set, int query, |
128 Expectations expectations, | 128 Expectations expectations, |
129 v8::Handle<Value> value) { | 129 v8::Handle<Value> value) { |
130 InitializeIfNeeded(); | 130 InitializeIfNeeded(); |
131 // A retry after a GC may pollute the counts, so perform gc now | 131 // A retry after a GC may pollute the counts, so perform gc now |
132 // to avoid that. | 132 // to avoid that. |
133 v8::internal::Heap::CollectGarbage(v8::internal::NEW_SPACE); | 133 HEAP->CollectGarbage(v8::internal::NEW_SPACE); |
134 HandleScope scope; | 134 HandleScope scope; |
135 TryCatch catcher; | 135 TryCatch catcher; |
136 catcher.SetVerbose(true); | 136 catcher.SetVerbose(true); |
137 Local<Value> result = Script::Compile(String::New(source))->Run(); | 137 Local<Value> result = Script::Compile(String::New(source))->Run(); |
138 CHECK_EQ(get, get_count()); | 138 CHECK_EQ(get, get_count()); |
139 CHECK_EQ(set, set_count()); | 139 CHECK_EQ(set, set_count()); |
140 CHECK_EQ(query, query_count()); | 140 CHECK_EQ(query, query_count()); |
141 if (expectations == EXPECT_RESULT) { | 141 if (expectations == EXPECT_RESULT) { |
142 CHECK(!catcher.HasCaught()); | 142 CHECK(!catcher.HasCaught()); |
143 if (!value.IsEmpty()) { | 143 if (!value.IsEmpty()) { |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 HandleScope scope; | 584 HandleScope scope; |
585 | 585 |
586 { AbsentInPrototypeContext context; | 586 { AbsentInPrototypeContext context; |
587 context.Check("if (false) { var x = 0; }; x", | 587 context.Check("if (false) { var x = 0; }; x", |
588 0, | 588 0, |
589 0, | 589 0, |
590 1, // declaration | 590 1, // declaration |
591 EXPECT_RESULT, Undefined()); | 591 EXPECT_RESULT, Undefined()); |
592 } | 592 } |
593 } | 593 } |
OLD | NEW |