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

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

Issue 149458: Remove the descriptor stream abstractions.... (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
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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 return GetContentArray()->get(ToValueIndex(descriptor_number)); 1343 return GetContentArray()->get(ToValueIndex(descriptor_number));
1344 } 1344 }
1345 1345
1346 1346
1347 Smi* DescriptorArray::GetDetails(int descriptor_number) { 1347 Smi* DescriptorArray::GetDetails(int descriptor_number) {
1348 ASSERT(descriptor_number < number_of_descriptors()); 1348 ASSERT(descriptor_number < number_of_descriptors());
1349 return Smi::cast(GetContentArray()->get(ToDetailsIndex(descriptor_number))); 1349 return Smi::cast(GetContentArray()->get(ToDetailsIndex(descriptor_number)));
1350 } 1350 }
1351 1351
1352 1352
1353 PropertyType DescriptorArray::GetType(int descriptor_number) {
1354 ASSERT(descriptor_number < number_of_descriptors());
1355 return PropertyDetails(GetDetails(descriptor_number)).type();
1356 }
1357
1358
1359 int DescriptorArray::GetFieldIndex(int descriptor_number) {
1360 return Descriptor::IndexFromValue(GetValue(descriptor_number));
1361 }
1362
1363
1364 JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) {
1365 return JSFunction::cast(GetValue(descriptor_number));
1366 }
1367
1368
1369 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
1370 ASSERT(GetType(descriptor_number) == CALLBACKS);
1371 return GetValue(descriptor_number);
1372 }
1373
1374
1375 AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
1376 ASSERT(GetType(descriptor_number) == CALLBACKS);
1377 Proxy* p = Proxy::cast(GetCallbacksObject(descriptor_number));
1378 return reinterpret_cast<AccessorDescriptor*>(p->proxy());
1379 }
1380
1381
1382 bool DescriptorArray::IsProperty(int descriptor_number) {
1383 return GetType(descriptor_number) < FIRST_PHANTOM_PROPERTY_TYPE;
1384 }
1385
1386
1387 bool DescriptorArray::IsTransition(int descriptor_number) {
1388 PropertyType t = GetType(descriptor_number);
1389 return t == MAP_TRANSITION || t == CONSTANT_TRANSITION;
1390 }
1391
1392
1393 bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
1394 return GetType(descriptor_number) == NULL_DESCRIPTOR;
1395 }
1396
1397
1398 bool DescriptorArray::IsDontEnum(int descriptor_number) {
1399 return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum();
1400 }
1401
1402
1353 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) { 1403 void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
1354 desc->Init(GetKey(descriptor_number), 1404 desc->Init(GetKey(descriptor_number),
1355 GetValue(descriptor_number), 1405 GetValue(descriptor_number),
1356 GetDetails(descriptor_number)); 1406 GetDetails(descriptor_number));
1357 } 1407 }
1358 1408
1359 1409
1360 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) { 1410 void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
1361 // Range check. 1411 // Range check.
1362 ASSERT(descriptor_number < number_of_descriptors()); 1412 ASSERT(descriptor_number < number_of_descriptors());
1363 1413
1364 // Make sure non of the elements in desc are in new space. 1414 // Make sure non of the elements in desc are in new space.
1365 ASSERT(!Heap::InNewSpace(desc->GetKey())); 1415 ASSERT(!Heap::InNewSpace(desc->GetKey()));
1366 ASSERT(!Heap::InNewSpace(desc->GetValue())); 1416 ASSERT(!Heap::InNewSpace(desc->GetValue()));
1367 1417
1368 fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey()); 1418 fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey());
1369 FixedArray* content_array = GetContentArray(); 1419 FixedArray* content_array = GetContentArray();
1370 fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue()); 1420 fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue());
1371 fast_set(content_array, ToDetailsIndex(descriptor_number), 1421 fast_set(content_array, ToDetailsIndex(descriptor_number),
1372 desc->GetDetails().AsSmi()); 1422 desc->GetDetails().AsSmi());
1373 } 1423 }
1374 1424
1375 1425
1426 void DescriptorArray::SetFrom(int index, DescriptorArray* src, int src_index) {
1427 Descriptor desc;
1428 src->Get(src_index, &desc);
1429 Set(index, &desc);
1430 }
1431
1432
1376 void DescriptorArray::Swap(int first, int second) { 1433 void DescriptorArray::Swap(int first, int second) {
1377 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second)); 1434 fast_swap(this, ToKeyIndex(first), ToKeyIndex(second));
1378 FixedArray* content_array = GetContentArray(); 1435 FixedArray* content_array = GetContentArray();
1379 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second)); 1436 fast_swap(content_array, ToValueIndex(first), ToValueIndex(second));
1380 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second)); 1437 fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
1381 } 1438 }
1382 1439
1383 1440
1384 bool NumberDictionary::requires_slow_elements() { 1441 bool NumberDictionary::requires_slow_elements() {
1385 Object* max_index_object = get(kMaxNumberKeyIndex); 1442 Object* max_index_object = get(kMaxNumberKeyIndex);
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 #undef WRITE_INT_FIELD 2764 #undef WRITE_INT_FIELD
2708 #undef READ_SHORT_FIELD 2765 #undef READ_SHORT_FIELD
2709 #undef WRITE_SHORT_FIELD 2766 #undef WRITE_SHORT_FIELD
2710 #undef READ_BYTE_FIELD 2767 #undef READ_BYTE_FIELD
2711 #undef WRITE_BYTE_FIELD 2768 #undef WRITE_BYTE_FIELD
2712 2769
2713 2770
2714 } } // namespace v8::internal 2771 } } // namespace v8::internal
2715 2772
2716 #endif // V8_OBJECTS_INL_H_ 2773 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/factory.cc ('K') | « src/objects-debug.cc ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698