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

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

Issue 109015: Revert workaround for http://crbug.com/9746. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | « test/cctest/test-debug.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-strings.cc
===================================================================
--- test/cctest/test-strings.cc (revision 1858)
+++ test/cctest/test-strings.cc (working copy)
@@ -394,16 +394,14 @@
public:
TwoByteResource(const uint16_t* data, size_t length, bool* destructed)
: data_(data), length_(length), destructed_(destructed) {
- if (destructed_ != NULL) {
- *destructed_ = false;
- }
+ CHECK_NE(destructed, NULL);
+ *destructed_ = false;
}
virtual ~TwoByteResource() {
- if (destructed_ != NULL) {
- CHECK(!*destructed_);
- *destructed_ = true;
- }
+ CHECK_NE(destructed_, NULL);
+ CHECK(!*destructed_);
+ *destructed_ = true;
}
const uint16_t* data() const { return data_; }
@@ -416,49 +414,6 @@
};
-TEST(ExternalCrBug9746) {
- InitializeVM();
- v8::HandleScope handle_scope;
-
- // This set of tests verifies that the workaround for Chromium bug 9746
- // works correctly. In certain situations the external resource of a symbol
- // is collected while the symbol is still part of the symbol table.
- static uint16_t two_byte_data[] = {
- 't', 'w', 'o', '-', 'b', 'y', 't', 'e', ' ', 'd', 'a', 't', 'a'
- };
- static size_t two_byte_length =
- sizeof(two_byte_data) / sizeof(two_byte_data[0]);
- static const char* one_byte_data = "two-byte data";
-
- // Allocate an external string resource and external string.
- TwoByteResource* resource = new TwoByteResource(two_byte_data,
- two_byte_length,
- NULL);
- Handle<String> string = Factory::NewExternalStringFromTwoByte(resource);
- Vector<const char> one_byte_vec = CStrVector(one_byte_data);
- Handle<String> compare = Factory::NewStringFromAscii(one_byte_vec);
-
- // Verify the correct behaviour before "collecting" the external resource.
- CHECK(string->IsEqualTo(one_byte_vec));
- CHECK(string->Equals(*compare));
-
- // "Collect" the external resource manually by setting the external resource
- // pointer to NULL. Then redo the comparisons, they should not match AND
- // not crash.
- Handle<ExternalTwoByteString> external(ExternalTwoByteString::cast(*string));
- external->set_resource(NULL);
- CHECK_EQ(false, string->IsEqualTo(one_byte_vec));
-#if !defined(DEBUG)
- // These tests only work in non-debug as there are ASSERTs in the code that
- // do prevent the ability to even get into the broken code when running the
- // debug version of V8.
- CHECK_EQ(false, string->Equals(*compare));
- CHECK_EQ(false, compare->Equals(*string));
- CHECK_EQ(false, string->Equals(Heap::empty_string()));
-#endif // !defined(DEBUG)
-}
-
-
// Regression test case for http://crbug.com/9746. The problem was
// that when we marked objects reachable only through weak pointers,
// we ended up keeping a sliced symbol alive, even though we already
@@ -514,7 +469,7 @@
CHECK(buffer->IsTwoByteRepresentation());
// Finally, base a script on the slice of the external string and
- // get its wrapper. This allocated yet another weak handle that
+ // get its wrapper. This allocates yet another weak handle that
// indirectly refers to the external string.
Handle<Script> script = Factory::NewScript(slice);
Handle<JSObject> wrapper = GetScriptWrapper(script);
« no previous file with comments | « test/cctest/test-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698