OLD | NEW |
1 // Copyright 2010 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 properties()->CopySize(properties()->length() + new_unused + 1); | 1272 properties()->CopySize(properties()->length() + new_unused + 1); |
1273 if (!maybe_values->ToObject(&values)) return maybe_values; | 1273 if (!maybe_values->ToObject(&values)) return maybe_values; |
1274 } | 1274 } |
1275 set_properties(FixedArray::cast(values)); | 1275 set_properties(FixedArray::cast(values)); |
1276 } | 1276 } |
1277 set_map(new_map); | 1277 set_map(new_map); |
1278 return FastPropertyAtPut(index, value); | 1278 return FastPropertyAtPut(index, value); |
1279 } | 1279 } |
1280 | 1280 |
1281 | 1281 |
| 1282 static bool IsIdentifier(UnicodeCache* cache, |
| 1283 unibrow::CharacterStream* buffer) { |
| 1284 // Checks whether the buffer contains an identifier (no escape). |
| 1285 if (!buffer->has_more()) return false; |
| 1286 if (!cache->IsIdentifierStart(buffer->GetNext())) { |
| 1287 return false; |
| 1288 } |
| 1289 while (buffer->has_more()) { |
| 1290 if (!cache->IsIdentifierPart(buffer->GetNext())) { |
| 1291 return false; |
| 1292 } |
| 1293 } |
| 1294 return true; |
| 1295 } |
| 1296 |
| 1297 |
1282 MaybeObject* JSObject::AddFastProperty(String* name, | 1298 MaybeObject* JSObject::AddFastProperty(String* name, |
1283 Object* value, | 1299 Object* value, |
1284 PropertyAttributes attributes) { | 1300 PropertyAttributes attributes) { |
1285 ASSERT(!IsJSGlobalProxy()); | 1301 ASSERT(!IsJSGlobalProxy()); |
1286 | 1302 |
1287 // Normalize the object if the name is an actual string (not the | 1303 // Normalize the object if the name is an actual string (not the |
1288 // hidden symbols) and is not a real identifier. | 1304 // hidden symbols) and is not a real identifier. |
1289 Isolate* isolate = GetHeap()->isolate(); | 1305 Isolate* isolate = GetHeap()->isolate(); |
1290 StringInputBuffer buffer(name); | 1306 StringInputBuffer buffer(name); |
1291 if (!isolate->scanner_constants()->IsIdentifier(&buffer) | 1307 if (!IsIdentifier(isolate->unicode_cache(), &buffer) |
1292 && name != isolate->heap()->hidden_symbol()) { | 1308 && name != isolate->heap()->hidden_symbol()) { |
1293 Object* obj; | 1309 Object* obj; |
1294 { MaybeObject* maybe_obj = | 1310 { MaybeObject* maybe_obj = |
1295 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); | 1311 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); |
1296 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 1312 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
1297 } | 1313 } |
1298 return AddSlowProperty(name, value, attributes); | 1314 return AddSlowProperty(name, value, attributes); |
1299 } | 1315 } |
1300 | 1316 |
1301 DescriptorArray* old_descriptors = map()->instance_descriptors(); | 1317 DescriptorArray* old_descriptors = map()->instance_descriptors(); |
(...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5416 return true; | 5432 return true; |
5417 } | 5433 } |
5418 // Rest cannot be marked as undetectable | 5434 // Rest cannot be marked as undetectable |
5419 return false; | 5435 return false; |
5420 } | 5436 } |
5421 | 5437 |
5422 | 5438 |
5423 bool String::IsEqualTo(Vector<const char> str) { | 5439 bool String::IsEqualTo(Vector<const char> str) { |
5424 Isolate* isolate = GetIsolate(); | 5440 Isolate* isolate = GetIsolate(); |
5425 int slen = length(); | 5441 int slen = length(); |
5426 Access<ScannerConstants::Utf8Decoder> | 5442 Access<UnicodeCache::Utf8Decoder> |
5427 decoder(isolate->scanner_constants()->utf8_decoder()); | 5443 decoder(isolate->unicode_cache()->utf8_decoder()); |
5428 decoder->Reset(str.start(), str.length()); | 5444 decoder->Reset(str.start(), str.length()); |
5429 int i; | 5445 int i; |
5430 for (i = 0; i < slen && decoder->has_more(); i++) { | 5446 for (i = 0; i < slen && decoder->has_more(); i++) { |
5431 uc32 r = decoder->GetNext(); | 5447 uc32 r = decoder->GetNext(); |
5432 if (Get(i) != r) return false; | 5448 if (Get(i) != r) return false; |
5433 } | 5449 } |
5434 return i == slen && !decoder->has_more(); | 5450 return i == slen && !decoder->has_more(); |
5435 } | 5451 } |
5436 | 5452 |
5437 | 5453 |
(...skipping 4863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10301 if (break_point_objects()->IsUndefined()) return 0; | 10317 if (break_point_objects()->IsUndefined()) return 0; |
10302 // Single beak point. | 10318 // Single beak point. |
10303 if (!break_point_objects()->IsFixedArray()) return 1; | 10319 if (!break_point_objects()->IsFixedArray()) return 1; |
10304 // Multiple break points. | 10320 // Multiple break points. |
10305 return FixedArray::cast(break_point_objects())->length(); | 10321 return FixedArray::cast(break_point_objects())->length(); |
10306 } | 10322 } |
10307 #endif | 10323 #endif |
10308 | 10324 |
10309 | 10325 |
10310 } } // namespace v8::internal | 10326 } } // namespace v8::internal |
OLD | NEW |