| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 V(String, empty_string, EmptyString) \ | 94 V(String, empty_string, EmptyString) \ |
| 95 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 95 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
| 96 V(Map, neander_map, NeanderMap) \ | 96 V(Map, neander_map, NeanderMap) \ |
| 97 V(JSObject, message_listeners, MessageListeners) \ | 97 V(JSObject, message_listeners, MessageListeners) \ |
| 98 V(Proxy, prototype_accessors, PrototypeAccessors) \ | 98 V(Proxy, prototype_accessors, PrototypeAccessors) \ |
| 99 V(NumberDictionary, code_stubs, CodeStubs) \ | 99 V(NumberDictionary, code_stubs, CodeStubs) \ |
| 100 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ | 100 V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \ |
| 101 V(Code, js_entry_code, JsEntryCode) \ | 101 V(Code, js_entry_code, JsEntryCode) \ |
| 102 V(Code, js_construct_entry_code, JsConstructEntryCode) \ | 102 V(Code, js_construct_entry_code, JsConstructEntryCode) \ |
| 103 V(Code, c_entry_code, CEntryCode) \ | 103 V(Code, c_entry_code, CEntryCode) \ |
| 104 V(Code, debugger_statement_code, DebuggerStatementCode) \ | |
| 105 V(FixedArray, number_string_cache, NumberStringCache) \ | 104 V(FixedArray, number_string_cache, NumberStringCache) \ |
| 106 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ | 105 V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \ |
| 107 V(FixedArray, natives_source_cache, NativesSourceCache) \ | 106 V(FixedArray, natives_source_cache, NativesSourceCache) \ |
| 108 V(Object, last_script_id, LastScriptId) \ | 107 V(Object, last_script_id, LastScriptId) \ |
| 109 V(Script, empty_script, EmptyScript) \ | 108 V(Script, empty_script, EmptyScript) \ |
| 110 V(Smi, real_stack_limit, RealStackLimit) \ | 109 V(Smi, real_stack_limit, RealStackLimit) \ |
| 111 | 110 |
| 112 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP | 111 #if V8_TARGET_ARCH_ARM && V8_NATIVE_REGEXP |
| 113 #define STRONG_ROOT_LIST(V) \ | 112 #define STRONG_ROOT_LIST(V) \ |
| 114 UNCONDITIONAL_STRONG_ROOT_LIST(V) \ | 113 UNCONDITIONAL_STRONG_ROOT_LIST(V) \ |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 static void InitializeJSObjectFromMap(JSObject* obj, | 1043 static void InitializeJSObjectFromMap(JSObject* obj, |
| 1045 FixedArray* properties, | 1044 FixedArray* properties, |
| 1046 Map* map); | 1045 Map* map); |
| 1047 | 1046 |
| 1048 static bool CreateInitialMaps(); | 1047 static bool CreateInitialMaps(); |
| 1049 static bool CreateInitialObjects(); | 1048 static bool CreateInitialObjects(); |
| 1050 | 1049 |
| 1051 // These four Create*EntryStub functions are here because of a gcc-4.4 bug | 1050 // These four Create*EntryStub functions are here because of a gcc-4.4 bug |
| 1052 // that assigns wrong vtable entries. | 1051 // that assigns wrong vtable entries. |
| 1053 static void CreateCEntryStub(); | 1052 static void CreateCEntryStub(); |
| 1054 static void CreateCEntryDebugBreakStub(); | |
| 1055 static void CreateJSEntryStub(); | 1053 static void CreateJSEntryStub(); |
| 1056 static void CreateJSConstructEntryStub(); | 1054 static void CreateJSConstructEntryStub(); |
| 1057 static void CreateRegExpCEntryStub(); | 1055 static void CreateRegExpCEntryStub(); |
| 1058 | 1056 |
| 1059 static void CreateFixedStubs(); | 1057 static void CreateFixedStubs(); |
| 1060 | 1058 |
| 1061 static Object* CreateOddball(Map* map, | 1059 static Object* CreateOddball(Map* map, |
| 1062 const char* to_string, | 1060 const char* to_string, |
| 1063 Object* to_number); | 1061 Object* to_number); |
| 1064 | 1062 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 } | 1381 } |
| 1384 } | 1382 } |
| 1385 | 1383 |
| 1386 // Clear the cache. | 1384 // Clear the cache. |
| 1387 static void Clear(); | 1385 static void Clear(); |
| 1388 | 1386 |
| 1389 static const int kAbsent = -2; | 1387 static const int kAbsent = -2; |
| 1390 private: | 1388 private: |
| 1391 static int Hash(DescriptorArray* array, String* name) { | 1389 static int Hash(DescriptorArray* array, String* name) { |
| 1392 // Uses only lower 32 bits if pointers are larger. | 1390 // Uses only lower 32 bits if pointers are larger. |
| 1393 uintptr_t array_hash = | 1391 uint32_t array_hash = |
| 1394 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(array)) >> 2; | 1392 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(array)) >> 2; |
| 1395 uintptr_t name_hash = | 1393 uint32_t name_hash = |
| 1396 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)) >> 2; | 1394 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)) >> 2; |
| 1397 return (array_hash ^ name_hash) % kLength; | 1395 return (array_hash ^ name_hash) % kLength; |
| 1398 } | 1396 } |
| 1399 | 1397 |
| 1400 static const int kLength = 64; | 1398 static const int kLength = 64; |
| 1401 struct Key { | 1399 struct Key { |
| 1402 DescriptorArray* array; | 1400 DescriptorArray* array; |
| 1403 String* name; | 1401 String* name; |
| 1404 }; | 1402 }; |
| 1405 | 1403 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1610 | 1608 |
| 1611 private: | 1609 private: |
| 1612 inline Object* Get(double input) { | 1610 inline Object* Get(double input) { |
| 1613 Converter c; | 1611 Converter c; |
| 1614 c.dbl = input; | 1612 c.dbl = input; |
| 1615 int hash = Hash(c); | 1613 int hash = Hash(c); |
| 1616 Element e = elements_[hash]; | 1614 Element e = elements_[hash]; |
| 1617 if (e.in[0] == c.integers[0] && | 1615 if (e.in[0] == c.integers[0] && |
| 1618 e.in[1] == c.integers[1]) { | 1616 e.in[1] == c.integers[1]) { |
| 1619 ASSERT(e.output != NULL); | 1617 ASSERT(e.output != NULL); |
| 1618 Counters::transcendental_cache_hit.Increment(); |
| 1620 return e.output; | 1619 return e.output; |
| 1621 } | 1620 } |
| 1622 double answer = Calculate(input); | 1621 double answer = Calculate(input); |
| 1623 Object* heap_number = Heap::AllocateHeapNumber(answer); | 1622 Object* heap_number = Heap::AllocateHeapNumber(answer); |
| 1624 if (!heap_number->IsFailure()) { | 1623 if (!heap_number->IsFailure()) { |
| 1625 elements_[hash].in[0] = c.integers[0]; | 1624 elements_[hash].in[0] = c.integers[0]; |
| 1626 elements_[hash].in[1] = c.integers[1]; | 1625 elements_[hash].in[1] = c.integers[1]; |
| 1627 elements_[hash].output = heap_number; | 1626 elements_[hash].output = heap_number; |
| 1628 } | 1627 } |
| 1628 Counters::transcendental_cache_miss.Increment(); |
| 1629 return heap_number; | 1629 return heap_number; |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 inline double Calculate(double input) { | 1632 inline double Calculate(double input) { |
| 1633 switch (type_) { | 1633 switch (type_) { |
| 1634 case ACOS: | 1634 case ACOS: |
| 1635 return acos(input); | 1635 return acos(input); |
| 1636 case ASIN: | 1636 case ASIN: |
| 1637 return asin(input); | 1637 return asin(input); |
| 1638 case ATAN: | 1638 case ATAN: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1659 union Converter { | 1659 union Converter { |
| 1660 double dbl; | 1660 double dbl; |
| 1661 uint32_t integers[2]; | 1661 uint32_t integers[2]; |
| 1662 }; | 1662 }; |
| 1663 inline static int Hash(const Converter& c) { | 1663 inline static int Hash(const Converter& c) { |
| 1664 uint32_t hash = (c.integers[0] ^ c.integers[1]); | 1664 uint32_t hash = (c.integers[0] ^ c.integers[1]); |
| 1665 hash ^= hash >> 16; | 1665 hash ^= hash >> 16; |
| 1666 hash ^= hash >> 8; | 1666 hash ^= hash >> 8; |
| 1667 return (hash & (kCacheSize - 1)); | 1667 return (hash & (kCacheSize - 1)); |
| 1668 } | 1668 } |
| 1669 |
| 1670 static Address cache_array_address() { |
| 1671 // Used to create an external reference. |
| 1672 return reinterpret_cast<Address>(caches_); |
| 1673 } |
| 1674 |
| 1675 // Allow access to the caches_ array as an ExternalReference. |
| 1676 friend class ExternalReference; |
| 1677 // Inline implementation of the caching. |
| 1678 friend class TranscendentalCacheStub; |
| 1679 |
| 1669 static TranscendentalCache* caches_[kNumberOfCaches]; | 1680 static TranscendentalCache* caches_[kNumberOfCaches]; |
| 1670 Element elements_[kCacheSize]; | 1681 Element elements_[kCacheSize]; |
| 1671 Type type_; | 1682 Type type_; |
| 1672 }; | 1683 }; |
| 1673 | 1684 |
| 1674 | 1685 |
| 1675 // External strings table is a place where all external strings are | 1686 // External strings table is a place where all external strings are |
| 1676 // registered. We need to keep track of such strings to properly | 1687 // registered. We need to keep track of such strings to properly |
| 1677 // finalize them. | 1688 // finalize them. |
| 1678 class ExternalStringTable : public AllStatic { | 1689 class ExternalStringTable : public AllStatic { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1701 | 1712 |
| 1702 // To speed up scavenge collections new space string are kept | 1713 // To speed up scavenge collections new space string are kept |
| 1703 // separate from old space strings. | 1714 // separate from old space strings. |
| 1704 static List<Object*> new_space_strings_; | 1715 static List<Object*> new_space_strings_; |
| 1705 static List<Object*> old_space_strings_; | 1716 static List<Object*> old_space_strings_; |
| 1706 }; | 1717 }; |
| 1707 | 1718 |
| 1708 } } // namespace v8::internal | 1719 } } // namespace v8::internal |
| 1709 | 1720 |
| 1710 #endif // V8_HEAP_H_ | 1721 #endif // V8_HEAP_H_ |
| OLD | NEW |