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

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

Issue 11315004: Count external string resources that were assigned to symbol strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: with minor test fix Created 8 years, 2 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/api.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 3be068009e275e53bb60903d812af6f841ab6069..70d1cde9caafd6823f67d6fb83df81a0a9825734 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -14816,11 +14816,13 @@ THREADED_TEST(GetHeapStatistics) {
class VisitorImpl : public v8::ExternalResourceVisitor {
public:
- VisitorImpl(TestResource* r1, TestResource* r2)
+ VisitorImpl(TestResource* r1, TestResource* r2, TestResource* r3)
: resource1_(r1),
resource2_(r2),
+ resource3_(r3),
found_resource1_(false),
- found_resource2_(false) {}
+ found_resource2_(false),
+ found_resource3_(false) {}
virtual ~VisitorImpl() {}
virtual void VisitExternalString(v8::Handle<v8::String> string) {
if (!string->IsExternal()) {
@@ -14838,17 +14840,24 @@ class VisitorImpl : public v8::ExternalResourceVisitor {
CHECK(!found_resource2_);
found_resource2_ = true;
}
+ if (resource3_ == resource) {
+ CHECK(!found_resource3_);
+ found_resource3_ = true;
+ }
}
void CheckVisitedResources() {
CHECK(found_resource1_);
CHECK(found_resource2_);
+ CHECK(found_resource3_);
}
private:
v8::String::ExternalStringResource* resource1_;
v8::String::ExternalStringResource* resource2_;
+ v8::String::ExternalStringResource* resource3_;
bool found_resource1_;
bool found_resource2_;
+ bool found_resource3_;
};
TEST(VisitExternalStrings) {
@@ -14860,12 +14869,17 @@ TEST(VisitExternalStrings) {
v8::Local<v8::String> string1 = v8::String::NewExternal(resource1);
TestResource* resource2 = new TestResource(two_byte_string);
v8::Local<v8::String> string2 = v8::String::NewExternal(resource2);
+ TestResource* resource3 = new TestResource(two_byte_string);
+ v8::Local<v8::String> symbol = v8::String::NewSymbol(string);
+ symbol->MakeExternal(resource3);
- // We need to add usages for string1 and string2 to avoid warnings in GCC 4.7
+ // We need to add usages for string1, string2 and symbol string
+ // to avoid warnings in GCC 4.7
CHECK(string1->IsExternal());
CHECK(string2->IsExternal());
+ CHECK(symbol->IsExternal());
- VisitorImpl visitor(resource1, resource2);
+ VisitorImpl visitor(resource1, resource2, resource3);
v8::V8::VisitExternalResources(&visitor);
visitor.CheckVisitedResources();
}
« 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