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

Side by Side Diff: src/objects.cc

Issue 219213003: Fixed power-of-2 predicates, excluding 0. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 6 years, 8 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.h ('k') | src/utils.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 13896 matching lines...) Expand 10 before | Expand all | Expand 10 after
13907 kElementsStartOffset, 13907 kElementsStartOffset,
13908 kHeaderSize + length() * kPointerSize); 13908 kHeaderSize + length() * kPointerSize);
13909 } 13909 }
13910 13910
13911 13911
13912 template<typename Shape, typename Key> 13912 template<typename Shape, typename Key>
13913 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap, 13913 MaybeObject* HashTable<Shape, Key>::Allocate(Heap* heap,
13914 int at_least_space_for, 13914 int at_least_space_for,
13915 MinimumCapacity capacity_option, 13915 MinimumCapacity capacity_option,
13916 PretenureFlag pretenure) { 13916 PretenureFlag pretenure) {
13917 ASSERT(!capacity_option || IS_POWER_OF_TWO(at_least_space_for)); 13917 ASSERT(!capacity_option || IsPowerOf2(at_least_space_for));
13918 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) 13918 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY)
13919 ? at_least_space_for 13919 ? at_least_space_for
13920 : ComputeCapacity(at_least_space_for); 13920 : ComputeCapacity(at_least_space_for);
13921 if (capacity > HashTable::kMaxCapacity) { 13921 if (capacity > HashTable::kMaxCapacity) {
13922 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); 13922 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true);
13923 } 13923 }
13924 13924
13925 Object* obj; 13925 Object* obj;
13926 { MaybeObject* maybe_obj = 13926 { MaybeObject* maybe_obj =
13927 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure); 13927 heap-> AllocateHashTable(EntryToIndex(capacity), pretenure);
(...skipping 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
16479 #define ERROR_MESSAGES_TEXTS(C, T) T, 16479 #define ERROR_MESSAGES_TEXTS(C, T) T,
16480 static const char* error_messages_[] = { 16480 static const char* error_messages_[] = {
16481 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16481 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16482 }; 16482 };
16483 #undef ERROR_MESSAGES_TEXTS 16483 #undef ERROR_MESSAGES_TEXTS
16484 return error_messages_[reason]; 16484 return error_messages_[reason];
16485 } 16485 }
16486 16486
16487 16487
16488 } } // namespace v8::internal 16488 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698