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

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

Issue 8822008: Elide write barriers and remove some heap_object->GetHeap() calls on (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/objects.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 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
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
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_
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698