| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 int size = SeqAsciiString::SizeFor(str.length()); | 118 int size = SeqAsciiString::SizeFor(str.length()); |
| 119 | 119 |
| 120 // Allocate string. | 120 // Allocate string. |
| 121 Object* result; | 121 Object* result; |
| 122 { MaybeObject* maybe_result = (size > MaxObjectSizeInPagedSpace()) | 122 { MaybeObject* maybe_result = (size > MaxObjectSizeInPagedSpace()) |
| 123 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) | 123 ? lo_space_->AllocateRaw(size, NOT_EXECUTABLE) |
| 124 : old_data_space_->AllocateRaw(size); | 124 : old_data_space_->AllocateRaw(size); |
| 125 if (!maybe_result->ToObject(&result)) return maybe_result; | 125 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 126 } | 126 } |
| 127 | 127 |
| 128 reinterpret_cast<HeapObject*>(result)->set_map(map); | 128 // String maps are all immortal immovable objects. |
| 129 reinterpret_cast<HeapObject*>(result)->set_map_unsafe(map); |
| 129 // Set length and hash fields of the allocated string. | 130 // Set length and hash fields of the allocated string. |
| 130 String* answer = String::cast(result); | 131 String* answer = String::cast(result); |
| 131 answer->set_length(str.length()); | 132 answer->set_length(str.length()); |
| 132 answer->set_hash_field(hash_field); | 133 answer->set_hash_field(hash_field); |
| 133 | 134 |
| 134 ASSERT_EQ(size, answer->Size()); | 135 ASSERT_EQ(size, answer->Size()); |
| 135 | 136 |
| 136 // Fill in the characters. | 137 // Fill in the characters. |
| 137 memcpy(answer->address() + SeqAsciiString::kHeaderSize, | 138 memcpy(answer->address() + SeqAsciiString::kHeaderSize, |
| 138 str.start(), str.length()); | 139 str.start(), str.length()); |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 702 |
| 702 | 703 |
| 703 Heap* _inline_get_heap_() { | 704 Heap* _inline_get_heap_() { |
| 704 return HEAP; | 705 return HEAP; |
| 705 } | 706 } |
| 706 | 707 |
| 707 | 708 |
| 708 } } // namespace v8::internal | 709 } } // namespace v8::internal |
| 709 | 710 |
| 710 #endif // V8_HEAP_INL_H_ | 711 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |