| 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 20233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20244 }; | 20244 }; |
| 20245 | 20245 |
| 20246 InterruptThread i_thread; | 20246 InterruptThread i_thread; |
| 20247 int counter_; | 20247 int counter_; |
| 20248 }; | 20248 }; |
| 20249 | 20249 |
| 20250 | 20250 |
| 20251 TEST(RequestMultipleInterrupts) { RequestMultipleInterrupts().RunTest(); } | 20251 TEST(RequestMultipleInterrupts) { RequestMultipleInterrupts().RunTest(); } |
| 20252 | 20252 |
| 20253 | 20253 |
| 20254 static bool interrupt_was_called = false; |
| 20255 |
| 20256 |
| 20257 void SmallScriptsInterruptCallback(v8::Isolate* isolate, void* data) { |
| 20258 interrupt_was_called = true; |
| 20259 } |
| 20260 |
| 20261 |
| 20262 TEST(RequestInterruptSmallScripts) { |
| 20263 LocalContext env; |
| 20264 v8::Isolate* isolate = CcTest::isolate(); |
| 20265 v8::HandleScope scope(isolate); |
| 20266 |
| 20267 interrupt_was_called = false; |
| 20268 isolate->RequestInterrupt(&SmallScriptsInterruptCallback, NULL); |
| 20269 CompileRun("(function(x){return x;})(1);"); |
| 20270 CHECK(interrupt_was_called); |
| 20271 } |
| 20272 |
| 20273 |
| 20254 static Local<Value> function_new_expected_env; | 20274 static Local<Value> function_new_expected_env; |
| 20255 static void FunctionNewCallback(const v8::FunctionCallbackInfo<Value>& info) { | 20275 static void FunctionNewCallback(const v8::FunctionCallbackInfo<Value>& info) { |
| 20256 CHECK(function_new_expected_env->Equals(info.Data())); | 20276 CHECK(function_new_expected_env->Equals(info.Data())); |
| 20257 info.GetReturnValue().Set(17); | 20277 info.GetReturnValue().Set(17); |
| 20258 } | 20278 } |
| 20259 | 20279 |
| 20260 | 20280 |
| 20261 THREADED_TEST(FunctionNew) { | 20281 THREADED_TEST(FunctionNew) { |
| 20262 LocalContext env; | 20282 LocalContext env; |
| 20263 v8::Isolate* isolate = env->GetIsolate(); | 20283 v8::Isolate* isolate = env->GetIsolate(); |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21869 } | 21889 } |
| 21870 { | 21890 { |
| 21871 v8::TryCatch try_catch; | 21891 v8::TryCatch try_catch; |
| 21872 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); | 21892 uint16_t* data = reinterpret_cast<uint16_t*>(buffer); |
| 21873 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, | 21893 CHECK(v8::String::NewFromTwoByte(isolate, data, v8::String::kNormalString, |
| 21874 length).IsEmpty()); | 21894 length).IsEmpty()); |
| 21875 CHECK(!try_catch.HasCaught()); | 21895 CHECK(!try_catch.HasCaught()); |
| 21876 } | 21896 } |
| 21877 free(buffer); | 21897 free(buffer); |
| 21878 } | 21898 } |
| OLD | NEW |