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

Side by Side Diff: src/objects.cc

Issue 67125: Verify the symbol table contents before and after all... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 672
673 673
674 bool String::MakeExternal(v8::String::ExternalStringResource* resource) { 674 bool String::MakeExternal(v8::String::ExternalStringResource* resource) {
675 #ifdef DEBUG 675 #ifdef DEBUG
676 { // NOLINT (presubmit.py gets confused about if and braces) 676 { // NOLINT (presubmit.py gets confused about if and braces)
677 // Assert that the resource and the string are equivalent. 677 // Assert that the resource and the string are equivalent.
678 ASSERT(static_cast<size_t>(this->length()) == resource->length()); 678 ASSERT(static_cast<size_t>(this->length()) == resource->length());
679 SmartPointer<uc16> smart_chars = this->ToWideCString(); 679 SmartPointer<uc16> smart_chars = this->ToWideCString();
680 ASSERT(memcmp(*smart_chars, 680 ASSERT(memcmp(*smart_chars,
681 resource->data(), 681 resource->data(),
682 resource->length()*sizeof(**smart_chars)) == 0); 682 resource->length() * sizeof(**smart_chars)) == 0);
683 } 683 }
684 #endif // DEBUG 684 #endif // DEBUG
685 685
686 int size = this->Size(); // Byte size of the original string. 686 int size = this->Size(); // Byte size of the original string.
687 if (size < ExternalString::kSize) { 687 if (size < ExternalString::kSize) {
688 // The string is too small to fit an external String in its place. This can 688 // The string is too small to fit an external String in its place. This can
689 // only happen for zero length strings. 689 // only happen for zero length strings.
690 return false; 690 return false;
691 } 691 }
692 ASSERT(size >= ExternalString::kSize); 692 ASSERT(size >= ExternalString::kSize);
(...skipping 5604 matching lines...) Expand 10 before | Expand all | Expand 10 after
6297 } 6297 }
6298 6298
6299 uint32_t Hash() { return string_->Hash(); } 6299 uint32_t Hash() { return string_->Hash(); }
6300 6300
6301 Object* GetObject() { 6301 Object* GetObject() {
6302 // If the string is a cons string, attempt to flatten it so that 6302 // If the string is a cons string, attempt to flatten it so that
6303 // symbols will most often be flat strings. 6303 // symbols will most often be flat strings.
6304 if (StringShape(string_).IsCons()) { 6304 if (StringShape(string_).IsCons()) {
6305 ConsString* cons_string = ConsString::cast(string_); 6305 ConsString* cons_string = ConsString::cast(string_);
6306 cons_string->TryFlatten(); 6306 cons_string->TryFlatten();
6307 if (cons_string->second() == Heap::empty_string()) { 6307 if (cons_string->second()->length() == 0) {
6308 string_ = cons_string->first(); 6308 string_ = cons_string->first();
6309 } 6309 }
6310 } 6310 }
6311 // Transform string to symbol if possible. 6311 // Transform string to symbol if possible.
6312 Map* map = Heap::SymbolMapForString(string_); 6312 Map* map = Heap::SymbolMapForString(string_);
6313 if (map != NULL) { 6313 if (map != NULL) {
6314 string_->set_map(map); 6314 string_->set_map(map);
6315 ASSERT(string_->IsSymbol());
6315 return string_; 6316 return string_;
6316 } 6317 }
6317 // Otherwise allocate a new symbol. 6318 // Otherwise allocate a new symbol.
6318 StringInputBuffer buffer(string_); 6319 StringInputBuffer buffer(string_);
6319 return Heap::AllocateInternalSymbol(&buffer, 6320 return Heap::AllocateInternalSymbol(&buffer,
6320 string_->length(), 6321 string_->length(),
6321 string_->length_field()); 6322 string_->length_field());
6322 } 6323 }
6323 6324
6324 static uint32_t StringHash(Object* obj) { 6325 static uint32_t StringHash(Object* obj) {
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
7417 // No break point. 7418 // No break point.
7418 if (break_point_objects()->IsUndefined()) return 0; 7419 if (break_point_objects()->IsUndefined()) return 0;
7419 // Single beak point. 7420 // Single beak point.
7420 if (!break_point_objects()->IsFixedArray()) return 1; 7421 if (!break_point_objects()->IsFixedArray()) return 1;
7421 // Multiple break points. 7422 // Multiple break points.
7422 return FixedArray::cast(break_point_objects())->length(); 7423 return FixedArray::cast(break_point_objects())->length();
7423 } 7424 }
7424 7425
7425 7426
7426 } } // namespace v8::internal 7427 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698