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

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

Issue 18591: Make sure that the prototype of the initial map is created in the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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/heap.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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 5589 matching lines...) Expand 10 before | Expand all | Expand 10 after
5600 CompileRun("for (var j = 0; j < 10; j++) new RegExp('');"); 5600 CompileRun("for (var j = 0; j < 10; j++) new RegExp('');");
5601 } 5601 }
5602 // Test CallIC. 5602 // Test CallIC.
5603 for (int i = 0; i < 2; i++) { 5603 for (int i = 0; i < 2; i++) {
5604 LocalContext context; 5604 LocalContext context;
5605 context->Global()->Set(v8_str("tmp"), v8::True()); 5605 context->Global()->Set(v8_str("tmp"), v8::True());
5606 context->Global()->Delete(v8_str("tmp")); 5606 context->Global()->Delete(v8_str("tmp"));
5607 CompileRun("for (var j = 0; j < 10; j++) RegExp('')"); 5607 CompileRun("for (var j = 0; j < 10; j++) RegExp('')");
5608 } 5608 }
5609 } 5609 }
5610
5611
5612 // Test that cross-context new calls use the context of the callee to
5613 // create the new JavaScript object.
5614 THREADED_TEST(CrossContextNew) {
5615 v8::HandleScope scope;
5616 v8::Persistent<Context> context0 = Context::New();
5617 v8::Persistent<Context> context1 = Context::New();
5618
5619 // Allow cross-domain access.
5620 Local<String> token = v8_str("<security token>");
5621 context0->SetSecurityToken(token);
5622 context1->SetSecurityToken(token);
5623
5624 // Set an 'x' property on the Object prototype and define a
5625 // constructor function in context0.
5626 context0->Enter();
5627 CompileRun("Object.prototype.x = 42; function C() {};");
5628 context0->Exit();
5629
5630 // Call the constructor function from context0 and check that the
5631 // result has the 'x' property.
5632 context1->Enter();
5633 context1->Global()->Set(v8_str("other"), context0->Global());
5634 Local<Value> value = CompileRun("var instance = new other.C(); instance.x");
5635 CHECK(value->IsInt32());
5636 CHECK_EQ(42, value->Int32Value());
5637 context1->Exit();
5638
5639 // Dispose the contexts to allow them to be garbage collected.
5640 context0.Dispose();
5641 context1.Dispose();
5642 }
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698