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

Unified Diff: test/cctest/test-api.cc

Issue 14425011: api: Object::CachedProperty Base URL: gh:v8/v8.git@master
Patch Set: globalize reference Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 4f5efea8b4883cd405b5141b43a0f141f92f4a83..61339781214bb92efe0d3ff6143a708b7396f4ca 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -6404,6 +6404,24 @@ THREADED_TEST(ObjectInstantiation) {
}
+THREADED_TEST(ObjectPropertyCache) {
+ v8::HandleScope scope(v8::Isolate::GetCurrent());
+ const char* extension_list[] = { "v8/gc" };
+ v8::ExtensionConfiguration extensions(1, extension_list);
+ LocalContext context(&extensions);
+
+ v8::Handle<v8::Object> obj = v8::Object::New();
+ Handle<String> symbol = String::NewSymbol("key");
+ Handle<v8::Number> num = v8::Number::New(42);
+ static v8::Object::CachedProperty property(symbol);
+ for (int i = 0; i < 100; i++) {
+ obj->Set(property, num);
+ CHECK_EQ(obj->Get(property)->Int32Value(), 42);
+ if (i % 10 == 0) v8_compile("gc();")->Run();
+ }
+}
+
+
static int StrCmp16(uint16_t* a, uint16_t* b) {
while (true) {
if (*a == 0 && *b == 0) return 0;
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698