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

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

Issue 151155: Revert 2324 until we can fix build and test errors. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/objects-debug.cc ('k') | src/runtime.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 1363
1364 1364
1365 void DescriptorArray::Swap(int first, int second) { 1365 void DescriptorArray::Swap(int first, int second) {
1366 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); 1366 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second));
1367 FixedArray* content_array = GetContentArray(); 1367 FixedArray* content_array = GetContentArray();
1368 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); 1368 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second));
1369 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); 1369 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
1370 } 1370 }
1371 1371
1372 1372
1373 bool NumberDictionary::requires_slow_elements() { 1373 bool Dictionary::requires_slow_elements() {
1374 Object* max_index_object = get(kMaxNumberKeyIndex); 1374 Object* max_index_object = get(kMaxNumberKeyIndex);
1375 if (!max_index_object->IsSmi()) return false; 1375 if (!max_index_object->IsSmi()) return false;
1376 return 0 != 1376 return 0 !=
1377 (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask); 1377 (Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
1378 } 1378 }
1379 1379
1380 uint32_t NumberDictionary::max_number_key() { 1380
1381 uint32_t Dictionary::max_number_key() {
1381 ASSERT(!requires_slow_elements()); 1382 ASSERT(!requires_slow_elements());
1382 Object* max_index_object = get(kMaxNumberKeyIndex); 1383 Object* max_index_object = get(kMaxNumberKeyIndex);
1383 if (!max_index_object->IsSmi()) return 0; 1384 if (!max_index_object->IsSmi()) return 0;
1384 uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value()); 1385 uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
1385 return value >> kRequiresSlowElementsTagSize; 1386 return value >> kRequiresSlowElementsTagSize;
1386 } 1387 }
1387 1388
1388 void NumberDictionary::set_requires_slow_elements() { 1389
1390 void Dictionary::set_requires_slow_elements() {
1389 set(kMaxNumberKeyIndex, 1391 set(kMaxNumberKeyIndex,
1390 Smi::FromInt(kRequiresSlowElementsMask), 1392 Smi::FromInt(kRequiresSlowElementsMask),
1391 SKIP_WRITE_BARRIER); 1393 SKIP_WRITE_BARRIER);
1392 } 1394 }
1393 1395
1394 1396
1395 // ------------------------------------ 1397 // ------------------------------------
1396 // Cast operations 1398 // Cast operations
1397 1399
1398 1400
1399 CAST_ACCESSOR(FixedArray) 1401 CAST_ACCESSOR(FixedArray)
1400 CAST_ACCESSOR(DescriptorArray) 1402 CAST_ACCESSOR(DescriptorArray)
1403 CAST_ACCESSOR(Dictionary)
1401 CAST_ACCESSOR(SymbolTable) 1404 CAST_ACCESSOR(SymbolTable)
1402 CAST_ACCESSOR(CompilationCacheTable) 1405 CAST_ACCESSOR(CompilationCacheTable)
1403 CAST_ACCESSOR(MapCache) 1406 CAST_ACCESSOR(MapCache)
1404 CAST_ACCESSOR(String) 1407 CAST_ACCESSOR(String)
1405 CAST_ACCESSOR(SeqString) 1408 CAST_ACCESSOR(SeqString)
1406 CAST_ACCESSOR(SeqAsciiString) 1409 CAST_ACCESSOR(SeqAsciiString)
1407 CAST_ACCESSOR(SeqTwoByteString) 1410 CAST_ACCESSOR(SeqTwoByteString)
1408 CAST_ACCESSOR(ConsString) 1411 CAST_ACCESSOR(ConsString)
1409 CAST_ACCESSOR(SlicedString) 1412 CAST_ACCESSOR(SlicedString)
1410 CAST_ACCESSOR(ExternalString) 1413 CAST_ACCESSOR(ExternalString)
(...skipping 18 matching lines...) Expand all
1429 CAST_ACCESSOR(JSRegExp) 1432 CAST_ACCESSOR(JSRegExp)
1430 CAST_ACCESSOR(Proxy) 1433 CAST_ACCESSOR(Proxy)
1431 CAST_ACCESSOR(ByteArray) 1434 CAST_ACCESSOR(ByteArray)
1432 CAST_ACCESSOR(Struct) 1435 CAST_ACCESSOR(Struct)
1433 1436
1434 1437
1435 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name) 1438 #define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name)
1436 STRUCT_LIST(MAKE_STRUCT_CAST) 1439 STRUCT_LIST(MAKE_STRUCT_CAST)
1437 #undef MAKE_STRUCT_CAST 1440 #undef MAKE_STRUCT_CAST
1438 1441
1439 1442 template <int prefix_size, int elem_size>
1440 template <typename Shape, typename Key> 1443 HashTable<prefix_size, elem_size>* HashTable<prefix_size, elem_size>::cast(
1441 HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) { 1444 Object* obj) {
1442 ASSERT(obj->IsHashTable()); 1445 ASSERT(obj->IsHashTable());
1443 return reinterpret_cast<HashTable*>(obj); 1446 return reinterpret_cast<HashTable*>(obj);
1444 } 1447 }
1445 1448
1446 1449
1447 INT_ACCESSORS(Array, length, kLengthOffset) 1450 INT_ACCESSORS(Array, length, kLengthOffset)
1448 1451
1449 1452
1450 bool String::Equals(String* other) { 1453 bool String::Equals(String* other) {
1451 if (other == this) return true; 1454 if (other == this) return true;
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 bool JSObject::HasNamedInterceptor() { 2461 bool JSObject::HasNamedInterceptor() {
2459 return map()->has_named_interceptor(); 2462 return map()->has_named_interceptor();
2460 } 2463 }
2461 2464
2462 2465
2463 bool JSObject::HasIndexedInterceptor() { 2466 bool JSObject::HasIndexedInterceptor() {
2464 return map()->has_indexed_interceptor(); 2467 return map()->has_indexed_interceptor();
2465 } 2468 }
2466 2469
2467 2470
2468 StringDictionary* JSObject::property_dictionary() { 2471 Dictionary* JSObject::property_dictionary() {
2469 ASSERT(!HasFastProperties()); 2472 ASSERT(!HasFastProperties());
2470 return StringDictionary::cast(properties()); 2473 return Dictionary::cast(properties());
2471 } 2474 }
2472 2475
2473 2476
2474 NumberDictionary* JSObject::element_dictionary() { 2477 Dictionary* JSObject::element_dictionary() {
2475 ASSERT(!HasFastElements()); 2478 ASSERT(!HasFastElements());
2476 return NumberDictionary::cast(elements()); 2479 return Dictionary::cast(elements());
2477 } 2480 }
2478 2481
2479 2482
2480 bool String::HasHashCode() { 2483 bool String::HasHashCode() {
2481 return (length_field() & kHashComputedMask) != 0; 2484 return (length_field() & kHashComputedMask) != 0;
2482 } 2485 }
2483 2486
2484 2487
2485 uint32_t String::Hash() { 2488 uint32_t String::Hash() {
2486 // Fast case: has hash code already been computed? 2489 // Fast case: has hash code already been computed?
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 return AttributesField::decode(static_cast<uint32_t>(flag()->value())); 2633 return AttributesField::decode(static_cast<uint32_t>(flag()->value()));
2631 } 2634 }
2632 2635
2633 2636
2634 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) { 2637 void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
2635 ASSERT(AttributesField::is_valid(attributes)); 2638 ASSERT(AttributesField::is_valid(attributes));
2636 int rest_value = flag()->value() & ~AttributesField::mask(); 2639 int rest_value = flag()->value() & ~AttributesField::mask();
2637 set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes))); 2640 set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes)));
2638 } 2641 }
2639 2642
2640 template<typename Shape, typename Key> 2643 void Dictionary::SetEntry(int entry,
2641 void Dictionary<Shape, Key>::SetEntry(int entry, 2644 Object* key,
2642 Object* key, 2645 Object* value,
2643 Object* value, 2646 PropertyDetails details) {
2644 PropertyDetails details) {
2645 ASSERT(!key->IsString() || details.index() > 0); 2647 ASSERT(!key->IsString() || details.index() > 0);
2646 int index = HashTable<Shape, Key>::EntryToIndex(entry); 2648 int index = EntryToIndex(entry);
2647 WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(); 2649 WriteBarrierMode mode = GetWriteBarrierMode();
2648 FixedArray::set(index, key, mode); 2650 set(index, key, mode);
2649 FixedArray::set(index+1, value, mode); 2651 set(index+1, value, mode);
2650 FixedArray::fast_set(this, index+2, details.AsSmi()); 2652 fast_set(this, index+2, details.AsSmi());
2651 } 2653 }
2652 2654
2653 2655
2654 void Map::ClearCodeCache() { 2656 void Map::ClearCodeCache() {
2655 // No write barrier is needed since empty_fixed_array is not in new space. 2657 // No write barrier is needed since empty_fixed_array is not in new space.
2656 // Please note this function is used during marking: 2658 // Please note this function is used during marking:
2657 // - MarkCompactCollector::MarkUnmarkedObject 2659 // - MarkCompactCollector::MarkUnmarkedObject
2658 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array())); 2660 ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
2659 WRITE_FIELD(this, kCodeCacheOffset, Heap::empty_fixed_array()); 2661 WRITE_FIELD(this, kCodeCacheOffset, Heap::empty_fixed_array());
2660 } 2662 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 #undef WRITE_INT_FIELD 2698 #undef WRITE_INT_FIELD
2697 #undef READ_SHORT_FIELD 2699 #undef READ_SHORT_FIELD
2698 #undef WRITE_SHORT_FIELD 2700 #undef WRITE_SHORT_FIELD
2699 #undef READ_BYTE_FIELD 2701 #undef READ_BYTE_FIELD
2700 #undef WRITE_BYTE_FIELD 2702 #undef WRITE_BYTE_FIELD
2701 2703
2702 2704
2703 } } // namespace v8::internal 2705 } } // namespace v8::internal
2704 2706
2705 #endif // V8_OBJECTS_INL_H_ 2707 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698