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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 "for (var i = 0; i < 5; i++) {" | 453 "for (var i = 0; i < 5; i++) {" |
454 " try { obj.x = i; } catch (e) { result += e; }" | 454 " try { obj.x = i; } catch (e) { result += e; }" |
455 "}; result"))->Run(); | 455 "}; result"))->Run(); |
456 CHECK_EQ(v8_str("01234"), result); | 456 CHECK_EQ(v8_str("01234"), result); |
457 } | 457 } |
458 | 458 |
459 | 459 |
460 static void AllocGetter(Local<String> name, | 460 static void AllocGetter(Local<String> name, |
461 const v8::PropertyCallbackInfo<v8::Value>& info) { | 461 const v8::PropertyCallbackInfo<v8::Value>& info) { |
462 ApiTestFuzzer::Fuzz(); | 462 ApiTestFuzzer::Fuzz(); |
463 info.GetReturnValue().Set(v8::Array::New(1000)); | 463 info.GetReturnValue().Set(v8::Array::New(info.GetIsolate(), 1000)); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 THREADED_TEST(Gc) { | 467 THREADED_TEST(Gc) { |
468 LocalContext env; | 468 LocalContext env; |
469 v8::HandleScope scope(env->GetIsolate()); | 469 v8::HandleScope scope(env->GetIsolate()); |
470 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 470 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
471 obj->SetAccessor(v8_str("xxx"), AllocGetter); | 471 obj->SetAccessor(v8_str("xxx"), AllocGetter); |
472 env->Global()->Set(v8_str("obj"), obj->NewInstance()); | 472 env->Global()->Set(v8_str("obj"), obj->NewInstance()); |
473 Script::Compile(String::NewFromUtf8( | 473 Script::Compile(String::NewFromUtf8( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 env->GetIsolate(), | 536 env->GetIsolate(), |
537 "var result;" | 537 "var result;" |
538 "for (var i = 0; i < 4; i++)" | 538 "for (var i = 0; i < 4; i++)" |
539 " result = obj.xxx;" | 539 " result = obj.xxx;" |
540 "result;"))->Run(); | 540 "result;"))->Run(); |
541 CHECK_EQ(100, result->Int32Value()); | 541 CHECK_EQ(100, result->Int32Value()); |
542 } | 542 } |
543 | 543 |
544 | 544 |
545 void JSONStringifyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { | 545 void JSONStringifyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) { |
546 v8::Handle<v8::Array> array = v8::Array::New(1); | 546 v8::Handle<v8::Array> array = v8::Array::New(info.GetIsolate(), 1); |
547 array->Set(0, v8_str("regress")); | 547 array->Set(0, v8_str("regress")); |
548 info.GetReturnValue().Set(array); | 548 info.GetReturnValue().Set(array); |
549 } | 549 } |
550 | 550 |
551 | 551 |
552 void JSONStringifyGetter(Local<String> name, | 552 void JSONStringifyGetter(Local<String> name, |
553 const v8::PropertyCallbackInfo<v8::Value>& info) { | 553 const v8::PropertyCallbackInfo<v8::Value>& info) { |
554 info.GetReturnValue().Set(v8_str("crbug-161028")); | 554 info.GetReturnValue().Set(v8_str("crbug-161028")); |
555 } | 555 } |
556 | 556 |
(...skipping 17 matching lines...) Expand all Loading... |
574 v8::HandleScope scope(isolate); | 574 v8::HandleScope scope(isolate); |
575 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); | 575 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); |
576 LocalContext switch_context; | 576 LocalContext switch_context; |
577 switch_context->Global()->Set(v8_str("fun"), fun); | 577 switch_context->Global()->Set(v8_str("fun"), fun); |
578 v8::TryCatch try_catch; | 578 v8::TryCatch try_catch; |
579 CompileRun( | 579 CompileRun( |
580 "var o = Object.create(null, { n: { get:fun } });" | 580 "var o = Object.create(null, { n: { get:fun } });" |
581 "for (var i = 0; i < 10; i++) o.n;"); | 581 "for (var i = 0; i < 10; i++) o.n;"); |
582 CHECK(!try_catch.HasCaught()); | 582 CHECK(!try_catch.HasCaught()); |
583 } | 583 } |
OLD | NEW |