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

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

Issue 10905075: Revert r12430, r12432, r12433 (basic support for Latin1). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/objects.h » ('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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 77
78 void PromotionQueue::ActivateGuardIfOnTheSamePage() { 78 void PromotionQueue::ActivateGuardIfOnTheSamePage() {
79 guard_ = guard_ || 79 guard_ = guard_ ||
80 heap_->new_space()->active_space()->current_page()->address() == 80 heap_->new_space()->active_space()->current_page()->address() ==
81 GetHeadPage()->address(); 81 GetHeadPage()->address();
82 } 82 }
83 83
84 84
85 MaybeObject* Heap::AllocateStringFromUtf8(Vector<const char> str, 85 MaybeObject* Heap::AllocateStringFromUtf8(Vector<const char> str,
86 PretenureFlag pretenure, 86 PretenureFlag pretenure) {
87 String::AsciiHint ascii_hint) { 87 // Check for ASCII first since this is the common case.
88 if ((ascii_hint == String::MAYBE_ASCII && 88 if (String::IsAscii(str.start(), str.length())) {
89 String::IsAscii(str.start(), str.length())) ||
90 ascii_hint == String::ASCII) {
91 // Assert that the ASCII-hint is correct.
92 ASSERT(ascii_hint != String::ASCII ||
93 String::IsAscii(str.start(), str.length()));
94 // If the string is ASCII, we do not need to convert the characters 89 // If the string is ASCII, we do not need to convert the characters
95 // since UTF8 is backwards compatible with ASCII. 90 // since UTF8 is backwards compatible with ASCII.
96 return AllocateStringFromAscii(str, pretenure); 91 return AllocateStringFromAscii(str, pretenure);
97 } 92 }
98 // Non-ASCII and we need to decode. 93 // Non-ASCII and we need to decode.
99 return AllocateStringFromUtf8Slow(str, pretenure); 94 return AllocateStringFromUtf8Slow(str, pretenure);
100 } 95 }
101 96
102 97
103 MaybeObject* Heap::AllocateStringFromLatin1(Vector<const char> str,
104 PretenureFlag pretenure,
105 String::AsciiHint ascii_hint) {
106 if ((ascii_hint == String::MAYBE_ASCII &&
107 String::IsAscii(str.start(), str.length())) ||
108 ascii_hint == String::ASCII) {
109 // Assert that the strict ASCII-hint is correct.
110 ASSERT(ascii_hint != String::ASCII ||
111 String::IsAscii(str.start(), str.length()));
112 // If the string is ASCII, we do not need to convert the characters
113 // since Latin1 is backwards compatible with ASCII.
114 return AllocateStringFromAscii(str, pretenure);
115 }
116 // Non-ASCII and we need to decode.
117 return AllocateStringFromLatin1Slow(str, pretenure);
118 }
119
120
121 MaybeObject* Heap::AllocateSymbol(Vector<const char> str, 98 MaybeObject* Heap::AllocateSymbol(Vector<const char> str,
122 int chars, 99 int chars,
123 uint32_t hash_field) { 100 uint32_t hash_field) {
124 unibrow::Utf8InputBuffer<> buffer(str.start(), 101 unibrow::Utf8InputBuffer<> buffer(str.start(),
125 static_cast<unsigned>(str.length())); 102 static_cast<unsigned>(str.length()));
126 return AllocateInternalSymbol(&buffer, chars, hash_field); 103 return AllocateInternalSymbol(&buffer, chars, hash_field);
127 } 104 }
128 105
129 106
130 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str, 107 MaybeObject* Heap::AllocateAsciiSymbol(Vector<const char> str,
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 AssertNoAllocation::~AssertNoAllocation() { } 819 AssertNoAllocation::~AssertNoAllocation() { }
843 DisableAssertNoAllocation::DisableAssertNoAllocation() { } 820 DisableAssertNoAllocation::DisableAssertNoAllocation() { }
844 DisableAssertNoAllocation::~DisableAssertNoAllocation() { } 821 DisableAssertNoAllocation::~DisableAssertNoAllocation() { }
845 822
846 #endif 823 #endif
847 824
848 825
849 } } // namespace v8::internal 826 } } // namespace v8::internal
850 827
851 #endif // V8_HEAP_INL_H_ 828 #endif // V8_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698