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

Side by Side Diff: src/dateparser.cc

Issue 8098: - Added conditional write barrier to object accessors.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 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/builtins.cc ('k') | src/heap.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 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 day = comp_[0]; 142 day = comp_[0];
143 year = comp_[1]; 143 year = comp_[1];
144 } 144 }
145 } 145 }
146 146
147 if (Between(year, 0, 49)) year += 2000; 147 if (Between(year, 0, 49)) year += 2000;
148 else if (Between(year, 50, 99)) year += 1900; 148 else if (Between(year, 50, 99)) year += 1900;
149 149
150 if (!Smi::IsValid(year) || !IsMonth(month) || !IsDay(day)) return false; 150 if (!Smi::IsValid(year) || !IsMonth(month) || !IsDay(day)) return false;
151 151
152 output->set(YEAR, Smi::FromInt(year)); 152 output->set(YEAR,
153 output->set(MONTH, Smi::FromInt(month - 1)); // 0-based 153 Smi::FromInt(year),
154 output->set(DAY, Smi::FromInt(day)); 154 SKIP_WRITE_BARRIER);
155 output->set(MONTH,
156 Smi::FromInt(month - 1),
157 SKIP_WRITE_BARRIER); // 0-based
158 output->set(DAY,
159 Smi::FromInt(day),
160 SKIP_WRITE_BARRIER);
155 return true; 161 return true;
156 } 162 }
157 163
158 164
159 bool DateParser::TimeComposer::Write(FixedArray* output) { 165 bool DateParser::TimeComposer::Write(FixedArray* output) {
160 // All time slots default to 0 166 // All time slots default to 0
161 while (index_ < kSize) { 167 while (index_ < kSize) {
162 comp_[index_++] = 0; 168 comp_[index_++] = 0;
163 } 169 }
164 170
165 int& hour = comp_[0]; 171 int& hour = comp_[0];
166 int& minute = comp_[1]; 172 int& minute = comp_[1];
167 int& second = comp_[2]; 173 int& second = comp_[2];
168 174
169 if (hour_offset_ != kNone) { 175 if (hour_offset_ != kNone) {
170 if (!IsHour12(hour)) return false; 176 if (!IsHour12(hour)) return false;
171 hour %= 12; 177 hour %= 12;
172 hour += hour_offset_; 178 hour += hour_offset_;
173 } 179 }
174 180
175 if (!IsHour(hour) || !IsMinute(minute) || !IsSecond(second)) return false; 181 if (!IsHour(hour) || !IsMinute(minute) || !IsSecond(second)) return false;
176 182
177 output->set(HOUR, Smi::FromInt(hour)); 183 output->set(HOUR,
178 output->set(MINUTE, Smi::FromInt(minute)); 184 Smi::FromInt(hour),
179 output->set(SECOND, Smi::FromInt(second)); 185 SKIP_WRITE_BARRIER);
186 output->set(MINUTE,
187 Smi::FromInt(minute),
188 SKIP_WRITE_BARRIER);
189 output->set(SECOND,
190 Smi::FromInt(second),
191 SKIP_WRITE_BARRIER);
180 return true; 192 return true;
181 } 193 }
182 194
183 195
184 bool DateParser::TimeZoneComposer::Write(FixedArray* output) { 196 bool DateParser::TimeZoneComposer::Write(FixedArray* output) {
185 if (sign_ != kNone) { 197 if (sign_ != kNone) {
186 if (hour_ == kNone) hour_ = 0; 198 if (hour_ == kNone) hour_ = 0;
187 if (minute_ == kNone) minute_ = 0; 199 if (minute_ == kNone) minute_ = 0;
188 int total_seconds = sign_ * (hour_ * 3600 + minute_ * 60); 200 int total_seconds = sign_ * (hour_ * 3600 + minute_ * 60);
189 if (!Smi::IsValid(total_seconds)) return false; 201 if (!Smi::IsValid(total_seconds)) return false;
190 output->set(UTC_OFFSET, Smi::FromInt(total_seconds)); 202 output->set(UTC_OFFSET,
203 Smi::FromInt(total_seconds),
204 SKIP_WRITE_BARRIER);
191 } else { 205 } else {
192 output->set(UTC_OFFSET, Heap::null_value()); 206 output->set(UTC_OFFSET,
207 Heap::null_value(),
208 SKIP_WRITE_BARRIER);
193 } 209 }
194 return true; 210 return true;
195 } 211 }
196 212
197 213
198 const int8_t 214 const int8_t
199 DateParser::KeywordTable::array[][DateParser::KeywordTable::kEntrySize] = { 215 DateParser::KeywordTable::array[][DateParser::KeywordTable::kEntrySize] = {
200 {'j', 'a', 'n', DateParser::MONTH_NAME, 1}, 216 {'j', 'a', 'n', DateParser::MONTH_NAME, 1},
201 {'f', 'e', 'b', DateParser::MONTH_NAME, 2}, 217 {'f', 'e', 'b', DateParser::MONTH_NAME, 2},
202 {'m', 'a', 'r', DateParser::MONTH_NAME, 3}, 218 {'m', 'a', 'r', DateParser::MONTH_NAME, 3},
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 if (j == kPrefixLength && 256 if (j == kPrefixLength &&
241 (len <= kPrefixLength || array[i][kTypeOffset] == MONTH_NAME)) { 257 (len <= kPrefixLength || array[i][kTypeOffset] == MONTH_NAME)) {
242 return i; 258 return i;
243 } 259 }
244 } 260 }
245 return i; 261 return i;
246 } 262 }
247 263
248 264
249 } } // namespace v8::internal 265 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698