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 Local<Value> data = External::New(CcTest::isolate(), this); | 123 Local<Value> data = External::New(CcTest::isolate(), this); |
124 GetHolder(function)->SetHandler(v8::NamedPropertyHandlerConfiguration( | 124 GetHolder(function)->SetHandler(v8::NamedPropertyHandlerConfiguration( |
125 &HandleGet, &HandleSet, &HandleQuery, 0, 0, data)); | 125 &HandleGet, &HandleSet, &HandleQuery, 0, 0, data)); |
126 Local<Context> context = Context::New(isolate, | 126 Local<Context> context = Context::New(isolate, |
127 0, | 127 0, |
128 function->InstanceTemplate(), | 128 function->InstanceTemplate(), |
129 Local<Value>()); | 129 Local<Value>()); |
130 context_.Reset(isolate, context); | 130 context_.Reset(isolate, context); |
131 context->Enter(); | 131 context->Enter(); |
132 is_initialized_ = true; | 132 is_initialized_ = true; |
| 133 // Reset counts. Bootstrapping might have called into the interceptor. |
| 134 get_count_ = 0; |
| 135 set_count_ = 0; |
| 136 query_count_ = 0; |
133 PostInitializeContext(context); | 137 PostInitializeContext(context); |
134 } | 138 } |
135 | 139 |
136 | 140 |
137 void DeclarationContext::Check(const char* source, | 141 void DeclarationContext::Check(const char* source, |
138 int get, int set, int query, | 142 int get, int set, int query, |
139 Expectations expectations, | 143 Expectations expectations, |
140 v8::Handle<Value> value) { | 144 v8::Handle<Value> value) { |
141 InitializeIfNeeded(); | 145 InitializeIfNeeded(); |
142 // A retry after a GC may pollute the counts, so perform gc now | 146 // A retry after a GC may pollute the counts, so perform gc now |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 Undefined(CcTest::isolate())); | 1245 Undefined(CcTest::isolate())); |
1242 for (int i = 0; i < 4; i++) { | 1246 for (int i = 0; i < 4; i++) { |
1243 context.Check("f()", EXPECT_EXCEPTION); | 1247 context.Check("f()", EXPECT_EXCEPTION); |
1244 } | 1248 } |
1245 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, | 1249 context.Check("%OptimizeFunctionOnNextCall(f);", EXPECT_RESULT, |
1246 Undefined(CcTest::isolate())); | 1250 Undefined(CcTest::isolate())); |
1247 | 1251 |
1248 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); | 1252 context.Check("'use strict'; f(); let x = 2; x", EXPECT_EXCEPTION); |
1249 } | 1253 } |
1250 } | 1254 } |
OLD | NEW |