OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 const v8::FunctionCallbackInfo<v8::Value>& args) { | 156 const v8::FunctionCallbackInfo<v8::Value>& args) { |
157 ApiTestFuzzer::Fuzz(); | 157 ApiTestFuzzer::Fuzz(); |
158 v8::Handle<v8::Array> result = v8::Array::New(args.Length()); | 158 v8::Handle<v8::Array> result = v8::Array::New(args.Length()); |
159 for (int i = 0; i < args.Length(); i++) { | 159 for (int i = 0; i < args.Length(); i++) { |
160 result->Set(v8::Integer::New(i), args[i]); | 160 result->Set(v8::Integer::New(i), args[i]); |
161 } | 161 } |
162 args.GetReturnValue().Set(result); | 162 args.GetReturnValue().Set(result); |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 // Tests that call v8::V8::Dispose() cannot be threaded. | |
167 TEST(InitializeAndDisposeOnce) { | |
168 CHECK(v8::V8::Initialize()); | |
169 CHECK(v8::V8::Dispose()); | |
170 } | |
171 | |
172 | |
173 // Tests that call v8::V8::Dispose() cannot be threaded. | |
174 TEST(InitializeAndDisposeMultiple) { | |
175 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | |
176 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); | |
177 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | |
178 // TODO(mstarzinger): This should fail gracefully instead of asserting. | |
179 // for (int i = 0; i < 3; ++i) CHECK(v8::V8::Initialize()); | |
Michael Starzinger
2013/09/04 13:24:29
Note that this check has been asserting before thi
| |
180 for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); | |
181 } | |
182 | |
183 | |
166 THREADED_TEST(Handles) { | 184 THREADED_TEST(Handles) { |
167 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 185 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
168 Local<Context> local_env; | 186 Local<Context> local_env; |
169 { | 187 { |
170 LocalContext env; | 188 LocalContext env; |
171 local_env = env.local(); | 189 local_env = env.local(); |
172 } | 190 } |
173 | 191 |
174 // Local context should still be live. | 192 // Local context should still be live. |
175 CHECK(!local_env.IsEmpty()); | 193 CHECK(!local_env.IsEmpty()); |
(...skipping 20236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
20412 "setAge(100);" | 20430 "setAge(100);" |
20413 "setAge(101);" | 20431 "setAge(101);" |
20414 "setAge(102);" | 20432 "setAge(102);" |
20415 "%OptimizeFunctionOnNextCall(setAge);" | 20433 "%OptimizeFunctionOnNextCall(setAge);" |
20416 "setAge(103);"); | 20434 "setAge(103);"); |
20417 ExpectInt32("obj.age", 100000); | 20435 ExpectInt32("obj.age", 100000); |
20418 ExpectInt32("obj.interceptor_age", 103); | 20436 ExpectInt32("obj.interceptor_age", 103); |
20419 } | 20437 } |
20420 | 20438 |
20421 #endif // V8_OS_POSIX | 20439 #endif // V8_OS_POSIX |
OLD | NEW |