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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 const v8::PropertyCallbackInfo<v8::Value>& info) { | 347 const v8::PropertyCallbackInfo<v8::Value>& info) { |
348 CheckAccessorArgsCorrect(name, info); | 348 CheckAccessorArgsCorrect(name, info); |
349 ApiTestFuzzer::Fuzz(); | 349 ApiTestFuzzer::Fuzz(); |
350 CheckAccessorArgsCorrect(name, info); | 350 CheckAccessorArgsCorrect(name, info); |
351 info.GetReturnValue().Set(v8::Handle<v8::Value>()); | 351 info.GetReturnValue().Set(v8::Handle<v8::Value>()); |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 THREADED_TEST(EmptyResult) { | 355 THREADED_TEST(EmptyResult) { |
356 LocalContext context; | 356 LocalContext context; |
357 v8::HandleScope scope(context->GetIsolate()); | 357 v8::Isolate* isolate = context->GetIsolate(); |
| 358 v8::HandleScope scope(isolate); |
358 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 359 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
359 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data")); | 360 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data")); |
360 v8::Handle<v8::Object> inst = obj->NewInstance(); | 361 v8::Handle<v8::Object> inst = obj->NewInstance(); |
361 context->Global()->Set(v8::String::New("obj"), inst); | 362 context->Global()->Set(v8::String::New("obj"), inst); |
362 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx")); | 363 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx")); |
363 for (int i = 0; i < 10; i++) { | 364 for (int i = 0; i < 10; i++) { |
364 Local<Value> result = scr->Run(); | 365 Local<Value> result = scr->Run(); |
365 CHECK(result == v8::Undefined()); | 366 CHECK(result == v8::Undefined(isolate)); |
366 } | 367 } |
367 } | 368 } |
368 | 369 |
369 | 370 |
370 THREADED_TEST(NoReuseRegress) { | 371 THREADED_TEST(NoReuseRegress) { |
371 // Check that the IC generated for the one test doesn't get reused | 372 // Check that the IC generated for the one test doesn't get reused |
372 // for the other. | 373 // for the other. |
373 v8::HandleScope scope(CcTest::isolate()); | 374 v8::Isolate* isolate = CcTest::isolate(); |
| 375 v8::HandleScope scope(isolate); |
374 { | 376 { |
375 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 377 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
376 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data")); | 378 obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data")); |
377 LocalContext context; | 379 LocalContext context; |
378 v8::Handle<v8::Object> inst = obj->NewInstance(); | 380 v8::Handle<v8::Object> inst = obj->NewInstance(); |
379 context->Global()->Set(v8::String::New("obj"), inst); | 381 context->Global()->Set(v8::String::New("obj"), inst); |
380 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx")); | 382 Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx")); |
381 for (int i = 0; i < 2; i++) { | 383 for (int i = 0; i < 2; i++) { |
382 Local<Value> result = scr->Run(); | 384 Local<Value> result = scr->Run(); |
383 CHECK(result == v8::Undefined()); | 385 CHECK(result == v8::Undefined(isolate)); |
384 } | 386 } |
385 } | 387 } |
386 { | 388 { |
387 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 389 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
388 obj->SetAccessor(v8_str("xxx"), | 390 obj->SetAccessor(v8_str("xxx"), |
389 CheckAccessorArgsCorrect, | 391 CheckAccessorArgsCorrect, |
390 NULL, | 392 NULL, |
391 v8::String::New("data")); | 393 v8::String::New("data")); |
392 LocalContext context; | 394 LocalContext context; |
393 v8::Handle<v8::Object> inst = obj->NewInstance(); | 395 v8::Handle<v8::Object> inst = obj->NewInstance(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 v8::HandleScope scope(isolate); | 562 v8::HandleScope scope(isolate); |
561 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); | 563 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); |
562 LocalContext switch_context; | 564 LocalContext switch_context; |
563 switch_context->Global()->Set(v8_str("fun"), fun); | 565 switch_context->Global()->Set(v8_str("fun"), fun); |
564 v8::TryCatch try_catch; | 566 v8::TryCatch try_catch; |
565 CompileRun( | 567 CompileRun( |
566 "var o = Object.create(null, { n: { get:fun } });" | 568 "var o = Object.create(null, { n: { get:fun } });" |
567 "for (var i = 0; i < 10; i++) o.n;"); | 569 "for (var i = 0; i < 10; i++) o.n;"); |
568 CHECK(!try_catch.HasCaught()); | 570 CHECK(!try_catch.HasCaught()); |
569 } | 571 } |
OLD | NEW |