OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 DCHECK(!env.IsEmpty()); | 558 DCHECK(!env.IsEmpty()); |
559 { | 559 { |
560 v8::HandleScope handle_scope(v8_isolate); | 560 v8::HandleScope handle_scope(v8_isolate); |
561 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 561 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
562 // After execution, e's function context refers to the global object. | 562 // After execution, e's function context refers to the global object. |
563 CompileRun( | 563 CompileRun( |
564 "var e;" | 564 "var e;" |
565 "(function() {" | 565 "(function() {" |
566 " e = function(s) { eval (s); }" | 566 " e = function(s) { eval (s); }" |
567 "})();" | 567 "})();" |
568 "var o = this;"); | 568 "var o = this;" |
| 569 "var r = Math.random();" |
| 570 "var f = (function(a, b) {}).bind(1, 2, 3);"); |
569 } | 571 } |
570 // Make sure all builtin scripts are cached. | 572 // Make sure all builtin scripts are cached. |
571 { | 573 { |
572 HandleScope scope(isolate); | 574 HandleScope scope(isolate); |
573 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 575 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
574 isolate->bootstrapper()->NativesSourceLookup(i); | 576 isolate->bootstrapper()->NativesSourceLookup(i); |
575 } | 577 } |
576 } | 578 } |
577 // If we don't do this then we end up with a stray root pointing at the | 579 // If we don't do this then we end up with a stray root pointing at the |
578 // context even after we have disposed of env. | 580 // context even after we have disposed of env. |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 { | 1347 { |
1346 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1348 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
1347 script = v8::ScriptCompiler::CompileUnbound( | 1349 script = v8::ScriptCompiler::CompileUnbound( |
1348 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1350 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
1349 } | 1351 } |
1350 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1352 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
1351 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); | 1353 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); |
1352 } | 1354 } |
1353 isolate2->Dispose(); | 1355 isolate2->Dispose(); |
1354 } | 1356 } |
OLD | NEW |