Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: test/cctest/test-accessors.cc

Issue 156623002: swap in global proxy on accessors (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: all arches done Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 LocalContext switch_context; 599 LocalContext switch_context;
600 switch_context->Global()->Set(v8_str("fun"), fun); 600 switch_context->Global()->Set(v8_str("fun"), fun);
601 v8::TryCatch try_catch; 601 v8::TryCatch try_catch;
602 expected_current_context = env.local(); 602 expected_current_context = env.local();
603 expected_calling_context = switch_context.local(); 603 expected_calling_context = switch_context.local();
604 CompileRun( 604 CompileRun(
605 "var o = Object.create(null, { n: { get:fun } });" 605 "var o = Object.create(null, { n: { get:fun } });"
606 "for (var i = 0; i < 10; i++) o.n;"); 606 "for (var i = 0; i < 10; i++) o.n;");
607 CHECK(!try_catch.HasCaught()); 607 CHECK(!try_catch.HasCaught());
608 } 608 }
609
610
611 THREADED_TEST(GlobalObjectAccessor) {
612 LocalContext env;
613 v8::Isolate* isolate = env->GetIsolate();
614 v8::HandleScope scope(isolate);
615 CompileRun(
616 "var set_value = 1;"
617 "Object.defineProperty(this.__proto__, 'x', {"
618 " get : function() { return this; },"
619 " set : function() { set_value = this; }"
620 "});"
621 "function getter() { return x; }"
622 "function setter() { x = 1; }"
623 "for (var i = 0; i < 4; i++) { getter(); setter(); }");
624 CHECK(v8::Utils::OpenHandle(*CompileRun("getter()"))->IsJSGlobalProxy());
625 CHECK(v8::Utils::OpenHandle(*CompileRun("set_value"))->IsJSGlobalProxy());
626 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698