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

Side by Side Diff: src/spaces.h

Issue 21095008: Revert the latest set of platform changes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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/sampler.cc ('k') | src/spaces.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 2011 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
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 }; 1437 };
1438 1438
1439 1439
1440 // The free list category holds a pointer to the top element and a pointer to 1440 // The free list category holds a pointer to the top element and a pointer to
1441 // the end element of the linked list of free memory blocks. 1441 // the end element of the linked list of free memory blocks.
1442 class FreeListCategory { 1442 class FreeListCategory {
1443 public: 1443 public:
1444 FreeListCategory() : 1444 FreeListCategory() :
1445 top_(NULL), 1445 top_(NULL),
1446 end_(NULL), 1446 end_(NULL),
1447 mutex_(OS::CreateMutex()),
1447 available_(0) {} 1448 available_(0) {}
1448 1449
1449 ~FreeListCategory() {} 1450 ~FreeListCategory() {
1451 delete mutex_;
1452 }
1450 1453
1451 intptr_t Concatenate(FreeListCategory* category); 1454 intptr_t Concatenate(FreeListCategory* category);
1452 1455
1453 void Reset(); 1456 void Reset();
1454 1457
1455 void Free(FreeListNode* node, int size_in_bytes); 1458 void Free(FreeListNode* node, int size_in_bytes);
1456 1459
1457 FreeListNode* PickNodeFromList(int *node_size); 1460 FreeListNode* PickNodeFromList(int *node_size);
1458 FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size); 1461 FreeListNode* PickNodeFromList(int size_in_bytes, int *node_size);
1459 1462
1460 intptr_t EvictFreeListItemsInList(Page* p); 1463 intptr_t EvictFreeListItemsInList(Page* p);
1461 1464
1462 void RepairFreeList(Heap* heap); 1465 void RepairFreeList(Heap* heap);
1463 1466
1464 FreeListNode** GetTopAddress() { return &top_; } 1467 FreeListNode** GetTopAddress() { return &top_; }
1465 FreeListNode* top() const { return top_; } 1468 FreeListNode* top() const { return top_; }
1466 void set_top(FreeListNode* top) { top_ = top; } 1469 void set_top(FreeListNode* top) { top_ = top; }
1467 1470
1468 FreeListNode** GetEndAddress() { return &end_; } 1471 FreeListNode** GetEndAddress() { return &end_; }
1469 FreeListNode* end() const { return end_; } 1472 FreeListNode* end() const { return end_; }
1470 void set_end(FreeListNode* end) { end_ = end; } 1473 void set_end(FreeListNode* end) { end_ = end; }
1471 1474
1472 int* GetAvailableAddress() { return &available_; } 1475 int* GetAvailableAddress() { return &available_; }
1473 int available() const { return available_; } 1476 int available() const { return available_; }
1474 void set_available(int available) { available_ = available; } 1477 void set_available(int available) { available_ = available; }
1475 1478
1476 Mutex* mutex() { return &mutex_; } 1479 Mutex* mutex() { return mutex_; }
1477 1480
1478 #ifdef DEBUG 1481 #ifdef DEBUG
1479 intptr_t SumFreeList(); 1482 intptr_t SumFreeList();
1480 int FreeListLength(); 1483 int FreeListLength();
1481 #endif 1484 #endif
1482 1485
1483 private: 1486 private:
1484 FreeListNode* top_; 1487 FreeListNode* top_;
1485 FreeListNode* end_; 1488 FreeListNode* end_;
1486 Mutex mutex_; 1489 Mutex* mutex_;
1487 1490
1488 // Total available bytes in all blocks of this free list category. 1491 // Total available bytes in all blocks of this free list category.
1489 int available_; 1492 int available_;
1490 }; 1493 };
1491 1494
1492 1495
1493 // The free list for the old space. The free list is organized in such a way 1496 // The free list for the old space. The free list is organized in such a way
1494 // as to encourage objects allocated around the same time to be near each 1497 // as to encourage objects allocated around the same time to be near each
1495 // other. The normal way to allocate is intended to be by bumping a 'top' 1498 // other. The normal way to allocate is intended to be by bumping a 'top'
1496 // pointer until it hits a 'limit' pointer. When the limit is hit we need to 1499 // pointer until it hits a 'limit' pointer. When the limit is hit we need to
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2874 } 2877 }
2875 // Must be small, since an iteration is used for lookup. 2878 // Must be small, since an iteration is used for lookup.
2876 static const int kMaxComments = 64; 2879 static const int kMaxComments = 64;
2877 }; 2880 };
2878 #endif 2881 #endif
2879 2882
2880 2883
2881 } } // namespace v8::internal 2884 } } // namespace v8::internal
2882 2885
2883 #endif // V8_SPACES_H_ 2886 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/sampler.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698