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

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

Issue 172043: Context-independent script compilation. (Closed)
Patch Set: Created 11 years, 4 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
« no previous file with comments | « src/api.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 7720 matching lines...) Expand 10 before | Expand all | Expand 10 after
7731 7731
7732 result = CompileRun("pixels[1] = 23;" 7732 result = CompileRun("pixels[1] = 23;"
7733 "pixels.__proto__ = [];" 7733 "pixels.__proto__ = [];"
7734 "js_array.__proto__ = pixels;" 7734 "js_array.__proto__ = pixels;"
7735 "js_array.concat(pixels);"); 7735 "js_array.concat(pixels);");
7736 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); 7736 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value());
7737 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); 7737 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value());
7738 7738
7739 free(pixel_data); 7739 free(pixel_data);
7740 } 7740 }
7741
7742 THREADED_TEST(ScriptContextDependence) {
7743 v8::HandleScope scope;
7744 LocalContext c1;
7745 const char *source = "foo";
7746 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
7747 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
7748 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
7749 CHECK_EQ(dep->Run()->Int32Value(), 100);
7750 CHECK_EQ(indep->Run()->Int32Value(), 100);
7751 LocalContext c2;
7752 c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101));
7753 CHECK_EQ(dep->Run()->Int32Value(), 100);
7754 CHECK_EQ(indep->Run()->Int32Value(), 101);
7755 }
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698