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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 "}" | 500 "}" |
501 "for (var i = 0; i < 100; i++) {" | 501 "for (var i = 0; i < 100; i++) {" |
502 " foo();" | 502 " foo();" |
503 "}"))->Run(); | 503 "}"))->Run(); |
504 } | 504 } |
505 | 505 |
506 | 506 |
507 static void AllocateHandles(Local<String> name, | 507 static void AllocateHandles(Local<String> name, |
508 const v8::PropertyCallbackInfo<v8::Value>& info) { | 508 const v8::PropertyCallbackInfo<v8::Value>& info) { |
509 for (int i = 0; i < i::kHandleBlockSize + 1; i++) { | 509 for (int i = 0; i < i::kHandleBlockSize + 1; i++) { |
510 v8::Local<v8::Value>::New(name); | 510 v8::Local<v8::Value>::New(info.GetIsolate(), name); |
511 } | 511 } |
512 info.GetReturnValue().Set(v8::Integer::New(100)); | 512 info.GetReturnValue().Set(v8::Integer::New(100)); |
513 } | 513 } |
514 | 514 |
515 | 515 |
516 THREADED_TEST(HandleScopeSegment) { | 516 THREADED_TEST(HandleScopeSegment) { |
517 // Check that we can return values past popping of handle scope | 517 // Check that we can return values past popping of handle scope |
518 // segments. | 518 // segments. |
519 LocalContext env; | 519 LocalContext env; |
520 v8::HandleScope scope(env->GetIsolate()); | 520 v8::HandleScope scope(env->GetIsolate()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 v8::HandleScope scope(isolate); | 562 v8::HandleScope scope(isolate); |
563 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); | 563 v8::Handle<v8::Function> fun = v8::Function::New(isolate, handle_property); |
564 LocalContext switch_context; | 564 LocalContext switch_context; |
565 switch_context->Global()->Set(v8_str("fun"), fun); | 565 switch_context->Global()->Set(v8_str("fun"), fun); |
566 v8::TryCatch try_catch; | 566 v8::TryCatch try_catch; |
567 CompileRun( | 567 CompileRun( |
568 "var o = Object.create(null, { n: { get:fun } });" | 568 "var o = Object.create(null, { n: { get:fun } });" |
569 "for (var i = 0; i < 10; i++) o.n;"); | 569 "for (var i = 0; i < 10; i++) o.n;"); |
570 CHECK(!try_catch.HasCaught()); | 570 CHECK(!try_catch.HasCaught()); |
571 } | 571 } |
OLD | NEW |