| OLD | NEW |
| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 number_of_locals += number_of_context_slots() - Context::MIN_CONTEXT_SLOTS; | 529 number_of_locals += number_of_context_slots() - Context::MIN_CONTEXT_SLOTS; |
| 530 } | 530 } |
| 531 return number_of_locals; | 531 return number_of_locals; |
| 532 } | 532 } |
| 533 | 533 |
| 534 | 534 |
| 535 int ContextSlotCache::Hash(Code* code, String* name) { | 535 int ContextSlotCache::Hash(Code* code, String* name) { |
| 536 // Uses only lower 32 bits if pointers are larger. | 536 // Uses only lower 32 bits if pointers are larger. |
| 537 uintptr_t addr_hash = | 537 uintptr_t addr_hash = |
| 538 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(code)) >> 2; | 538 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(code)) >> 2; |
| 539 return (addr_hash ^ name->Hash()) % kLength; | 539 return static_cast<int>((addr_hash ^ name->Hash()) % kLength); |
| 540 } | 540 } |
| 541 | 541 |
| 542 | 542 |
| 543 int ContextSlotCache::Lookup(Code* code, | 543 int ContextSlotCache::Lookup(Code* code, |
| 544 String* name, | 544 String* name, |
| 545 Variable::Mode* mode) { | 545 Variable::Mode* mode) { |
| 546 int index = Hash(code, name); | 546 int index = Hash(code, name); |
| 547 Key& key = keys_[index]; | 547 Key& key = keys_[index]; |
| 548 if ((key.code == code) && key.name->Equals(name)) { | 548 if ((key.code == code) && key.name->Equals(name)) { |
| 549 Value result(values_[index]); | 549 Value result(values_[index]); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 } | 640 } |
| 641 #endif // DEBUG | 641 #endif // DEBUG |
| 642 | 642 |
| 643 | 643 |
| 644 // Make sure the classes get instantiated by the template system. | 644 // Make sure the classes get instantiated by the template system. |
| 645 template class ScopeInfo<FreeStoreAllocationPolicy>; | 645 template class ScopeInfo<FreeStoreAllocationPolicy>; |
| 646 template class ScopeInfo<PreallocatedStorage>; | 646 template class ScopeInfo<PreallocatedStorage>; |
| 647 template class ScopeInfo<ZoneListAllocationPolicy>; | 647 template class ScopeInfo<ZoneListAllocationPolicy>; |
| 648 | 648 |
| 649 } } // namespace v8::internal | 649 } } // namespace v8::internal |
| OLD | NEW |