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

Unified Diff: src/heap.cc

Issue 21117: Allow the morphing of strings to external strings to avoid having to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 10 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/heap.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 1251)
+++ src/heap.cc (working copy)
@@ -1519,16 +1519,9 @@
Object* Heap::AllocateExternalStringFromTwoByte(
ExternalTwoByteString::Resource* resource) {
- Map* map;
int length = resource->length();
- if (length <= String::kMaxShortStringSize) {
- map = short_external_string_map();
- } else if (length <= String::kMaxMediumStringSize) {
- map = medium_external_string_map();
- } else {
- map = long_external_string_map();
- }
+ Map* map = ExternalTwoByteString::StringMap(length);
Object* result = Allocate(map, NEW_SPACE);
if (result->IsFailure()) return result;
@@ -1542,16 +1535,9 @@
Object* Heap::AllocateExternalSymbolFromTwoByte(
ExternalTwoByteString::Resource* resource) {
- Map* map;
int length = resource->length();
- if (length <= String::kMaxShortStringSize) {
- map = short_external_symbol_map();
- } else if (length <= String::kMaxMediumStringSize) {
- map = medium_external_symbol_map();
- } else {
- map = long_external_symbol_map();
- }
+ Map* map = ExternalTwoByteString::SymbolMap(length);
Object* result = Allocate(map, OLD_DATA_SPACE);
if (result->IsFailure()) return result;
@@ -1618,6 +1604,18 @@
}
+void Heap::CreateFillerObjectAt(Address addr, int size) {
+ if (size == 0) return;
+ HeapObject* filler = HeapObject::FromAddress(addr);
+ if (size == kPointerSize) {
+ filler->set_map(Heap::one_word_filler_map());
+ } else {
+ filler->set_map(Heap::byte_array_map());
+ ByteArray::cast(filler)->set_length(ByteArray::LengthFor(size));
+ }
+}
+
+
Object* Heap::CreateCode(const CodeDesc& desc,
ScopeInfo<>* sinfo,
Code::Flags flags,
@@ -2069,18 +2067,24 @@
return long_sliced_ascii_symbol_map();
}
- if (map == short_external_string_map()) return short_external_string_map();
- if (map == medium_external_string_map()) return medium_external_string_map();
- if (map == long_external_string_map()) return long_external_string_map();
+ if (map == short_external_string_map()) {
+ return short_external_symbol_map();
+ }
+ if (map == medium_external_string_map()) {
+ return medium_external_symbol_map();
+ }
+ if (map == long_external_string_map()) {
+ return long_external_symbol_map();
+ }
if (map == short_external_ascii_string_map()) {
- return short_external_ascii_string_map();
+ return short_external_ascii_symbol_map();
}
if (map == medium_external_ascii_string_map()) {
- return medium_external_ascii_string_map();
+ return medium_external_ascii_symbol_map();
}
if (map == long_external_ascii_string_map()) {
- return long_external_ascii_string_map();
+ return long_external_ascii_symbol_map();
}
// No match found.
« no previous file with comments | « src/heap.h ('k') | src/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698