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

Side by Side Diff: src/heap.h

Issue 10825099: Use architecture-specific alignment for hashing in Descriptor lookup cache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: u Created 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 for (int i = 0; i < kLength; ++i) { 2388 for (int i = 0; i < kLength; ++i) {
2389 keys_[i].array = NULL; 2389 keys_[i].array = NULL;
2390 keys_[i].name = NULL; 2390 keys_[i].name = NULL;
2391 results_[i] = kAbsent; 2391 results_[i] = kAbsent;
2392 } 2392 }
2393 } 2393 }
2394 2394
2395 static int Hash(DescriptorArray* array, String* name) { 2395 static int Hash(DescriptorArray* array, String* name) {
2396 // Uses only lower 32 bits if pointers are larger. 2396 // Uses only lower 32 bits if pointers are larger.
2397 uint32_t array_hash = 2397 uint32_t array_hash =
2398 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(array)) >> 2; 2398 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(array))
2399 >> kPointerSizeLog2;
2399 uint32_t name_hash = 2400 uint32_t name_hash =
2400 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)) >> 2; 2401 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name))
2402 >> kPointerSizeLog2;
2401 return (array_hash ^ name_hash) % kLength; 2403 return (array_hash ^ name_hash) % kLength;
2402 } 2404 }
2403 2405
2404 static const int kLength = 64; 2406 static const int kLength = 64;
2405 struct Key { 2407 struct Key {
2406 DescriptorArray* array; 2408 DescriptorArray* array;
2407 String* name; 2409 String* name;
2408 }; 2410 };
2409 2411
2410 Key keys_[kLength]; 2412 Key keys_[kLength];
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 AssertNoAllocation no_alloc; // i.e. no gc allowed. 2767 AssertNoAllocation no_alloc; // i.e. no gc allowed.
2766 2768
2767 private: 2769 private:
2768 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2770 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2769 }; 2771 };
2770 #endif // DEBUG || LIVE_OBJECT_LIST 2772 #endif // DEBUG || LIVE_OBJECT_LIST
2771 2773
2772 } } // namespace v8::internal 2774 } } // namespace v8::internal
2773 2775
2774 #endif // V8_HEAP_H_ 2776 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698