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

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

Issue 11759008: Introduce ENABLE_LATIN_1 compile flag (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix FilterASCII Created 7 years, 11 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/heap.cc ('k') | src/hydrogen.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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 return chars == str.length(); 105 return chars == str.length();
106 } 106 }
107 107
108 108
109 template<> 109 template<>
110 bool inline Heap::IsOneByte(String* str, int chars) { 110 bool inline Heap::IsOneByte(String* str, int chars) {
111 return str->IsOneByteRepresentation(); 111 return str->IsOneByteRepresentation();
112 } 112 }
113 113
114 114
115 MaybeObject* Heap::AllocateSymbol(Vector<const char> str, 115 MaybeObject* Heap::AllocateSymbolFromUtf8(Vector<const char> str,
116 int chars, 116 int chars,
117 uint32_t hash_field) { 117 uint32_t hash_field) {
118 if (IsOneByte(str, chars)) return AllocateAsciiSymbol(str, hash_field); 118 if (IsOneByte(str, chars)) {
119 return AllocateOneByteSymbol(Vector<const uint8_t>::cast(str), hash_field);
120 }
119 return AllocateInternalSymbol<false>(str, chars, hash_field); 121 return AllocateInternalSymbol<false>(str, chars, hash_field);
120 } 122 }
121 123
122 124
123 template<typename T> 125 template<typename T>
124 MaybeObject* Heap::AllocateInternalSymbol(T t, int chars, uint32_t hash_field) { 126 MaybeObject* Heap::AllocateInternalSymbol(T t, int chars, uint32_t hash_field) {
125 if (IsOneByte(t, chars)) { 127 if (IsOneByte(t, chars)) {
126 return AllocateInternalSymbol<true>(t, chars, hash_field); 128 return AllocateInternalSymbol<true>(t, chars, hash_field);
127 } 129 }
128 return AllocateInternalSymbol<false>(t, chars, hash_field); 130 return AllocateInternalSymbol<false>(t, chars, hash_field);
129 } 131 }
130 132
131 133
132 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, 134 MaybeObject* Heap::AllocateOneByteSymbol(Vector<const uint8_t> str,
133 uint32_t hash_field) { 135 uint32_t hash_field) {
134 if (str.length() > SeqOneByteString::kMaxLength) { 136 if (str.length() > SeqOneByteString::kMaxLength) {
135 return Failure::OutOfMemoryException(); 137 return Failure::OutOfMemoryException();
136 } 138 }
137 // Compute map and object size. 139 // Compute map and object size.
138 Map* map = ascii_symbol_map(); 140 Map* map = ascii_symbol_map();
139 int size = SeqOneByteString::SizeFor(str.length()); 141 int size = SeqOneByteString::SizeFor(str.length());
140 142
141 // Allocate string. 143 // Allocate string.
142 Object* result; 144 Object* result;
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 AssertNoAllocation::~AssertNoAllocation() { } 828 AssertNoAllocation::~AssertNoAllocation() { }
827 DisableAssertNoAllocation::DisableAssertNoAllocation() { } 829 DisableAssertNoAllocation::DisableAssertNoAllocation() { }
828 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } 830 DisableAssertNoAllocation::~DisableAssertNoAllocation() { }
829 831
830 #endif 832 #endif
831 833
832 834
833 } } // namespace v8::internal 835 } } // namespace v8::internal
834 836
835 #endif // V8_HEAP_INL_H_ 837 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698