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

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

Issue 11593007: Replace the use CharacterStreams in Heap::AllocateSymbolInternal and String::ComputeHash (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: issues addressed Created 8 years 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/unicode.h ('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
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc
index 6f0f96df906cf147f15d9f8d0ba42a6c42d12f9b..652a60af53bfec386b79f350a605e094b67bcf7c 100644
--- a/test/cctest/test-strings.cc
+++ b/test/cctest/test-strings.cc
@@ -345,37 +345,24 @@ void AccumulateStats(Handle<String> cons_string, ConsStringStats* stats) {
void AccumulateStatsWithOperator(
ConsString* cons_string, ConsStringStats* stats) {
- // Init op.
+ unsigned offset = 0;
+ int32_t type = cons_string->map()->instance_type();
+ unsigned length = static_cast<unsigned>(cons_string->length());
ConsStringIteratorOp op;
- op.Reset();
- // Use response for initial search and on blown stack.
- ConsStringIteratorOp::ContinueResponse response;
- response.string_ = cons_string;
- response.offset_ = 0;
- response.type_ = cons_string->map()->instance_type();
- response.length_ = (uint32_t) cons_string->length();
+ String* string = op.Operate(cons_string, &offset, &type, &length);
+ CHECK(string != NULL);
while (true) {
- String* string = op.Operate(ConsString::cast(response.string_),
- &response.offset_,
- &response.type_,
- &response.length_);
- CHECK(string != NULL);
- while (true) {
- // Accumulate stats.
- stats->leaves_++;
- stats->chars_ += string->length();
- // Check for completion.
- bool keep_going_fast_check = op.HasMore();
- bool keep_going = op.ContinueOperation(&response);
- if (!keep_going) return;
- // Verify no false positives for fast check.
- CHECK(keep_going_fast_check);
- CHECK(response.string_ != NULL);
- // Blew stack. Restart outer loop.
- if (response.string_->IsConsString()) break;
- string = response.string_;
- }
- };
+ ASSERT(!string->IsConsString());
+ // Accumulate stats.
+ stats->leaves_++;
+ stats->chars_ += string->length();
+ // Check for completion.
+ bool keep_going_fast_check = op.HasMore();
+ string = op.ContinueOperation(&type, &length);
+ if (string == NULL) return;
+ // Verify no false positives for fast check.
+ CHECK(keep_going_fast_check);
+ }
}
« no previous file with comments | « src/unicode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698