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

Side by Side Diff: src/heap-inl.h

Issue 11411005: Rename SeqAsciiString (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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/heap.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 int chars, 102 int chars,
103 uint32_t hash_field) { 103 uint32_t hash_field) {
104 unibrow::Utf8InputBuffer<> buffer(str.start(), 104 unibrow::Utf8InputBuffer<> buffer(str.start(),
105 static_cast<unsigned>(str.length())); 105 static_cast<unsigned>(str.length()));
106 return AllocateInternalSymbol(&buffer, chars, hash_field); 106 return AllocateInternalSymbol(&buffer, chars, hash_field);
107 } 107 }
108 108
109 109
110 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, 110 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str,
111 uint32_t hash_field) { 111 uint32_t hash_field) {
112 if (str.length() > SeqAsciiString::kMaxLength) { 112 if (str.length() > SeqOneByteString::kMaxLength) {
113 return Failure::OutOfMemoryException(); 113 return Failure::OutOfMemoryException();
114 } 114 }
115 // Compute map and object size. 115 // Compute map and object size.
116 Map* map = ascii_symbol_map(); 116 Map* map = ascii_symbol_map();
117 int size = SeqAsciiString::SizeFor(str.length()); 117 int size = SeqOneByteString::SizeFor(str.length());
118 118
119 // Allocate string. 119 // Allocate string.
120 Object* result; 120 Object* result;
121 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize) 121 { MaybeObject* maybe_result = (size > Page::kMaxNonCodeHeapObjectSize)
122 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) 122 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE)
123 : old_data_space_->AllocateRaw(size); 123 : old_data_space_->AllocateRaw(size);
124 if (!maybe_result->ToObject(&result)) return maybe_result; 124 if (!maybe_result->ToObject(&result)) return maybe_result;
125 } 125 }
126 126
127 // String maps are all immortal immovable objects. 127 // String maps are all immortal immovable objects.
128 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(map); 128 reinterpret_cast<HeapObject*>(result)->set_map_no_write_barrier(map);
129 // Set length and hash fields of the allocated string. 129 // Set length and hash fields of the allocated string.
130 String* answer = String::cast(result); 130 String* answer = String::cast(result);
131 answer->set_length(str.length()); 131 answer->set_length(str.length());
132 answer->set_hash_field(hash_field); 132 answer->set_hash_field(hash_field);
133 133
134 ASSERT_EQ(size, answer->Size()); 134 ASSERT_EQ(size, answer->Size());
135 135
136 // Fill in the characters. 136 // Fill in the characters.
137 memcpy(answer->address() + SeqAsciiString::kHeaderSize, 137 memcpy(answer->address() + SeqOneByteString::kHeaderSize,
138 str.start(), str.length()); 138 str.start(), str.length());
139 139
140 return answer; 140 return answer;
141 } 141 }
142 142
143 143
144 MaybeObject* Heap::AllocateTwoByteSymbol(Vector<const uc16> str, 144 MaybeObject* Heap::AllocateTwoByteSymbol(Vector<const uc16> str,
145 uint32_t hash_field) { 145 uint32_t hash_field) {
146 if (str.length() > SeqTwoByteString::kMaxLength) { 146 if (str.length() > SeqTwoByteString::kMaxLength) {
147 return Failure::OutOfMemoryException(); 147 return Failure::OutOfMemoryException();
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 AssertNoAllocation::~AssertNoAllocation() { } 804 AssertNoAllocation::~AssertNoAllocation() { }
805 DisableAssertNoAllocation::DisableAssertNoAllocation() { } 805 DisableAssertNoAllocation::DisableAssertNoAllocation() { }
806 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } 806 DisableAssertNoAllocation::~DisableAssertNoAllocation() { }
807 807
808 #endif 808 #endif
809 809
810 810
811 } } // namespace v8::internal 811 } } // namespace v8::internal
812 812
813 #endif // V8_HEAP_INL_H_ 813 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698