| OLD | NEW |
| 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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 ExternalUnsignedIntArray::cast(this)->length()); | 1670 ExternalUnsignedIntArray::cast(this)->length()); |
| 1671 break; | 1671 break; |
| 1672 case EXTERNAL_FLOAT_ARRAY_TYPE: | 1672 case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 1673 accumulator->Add("<ExternalFloatArray[%u]>", | 1673 accumulator->Add("<ExternalFloatArray[%u]>", |
| 1674 ExternalFloatArray::cast(this)->length()); | 1674 ExternalFloatArray::cast(this)->length()); |
| 1675 break; | 1675 break; |
| 1676 case EXTERNAL_DOUBLE_ARRAY_TYPE: | 1676 case EXTERNAL_DOUBLE_ARRAY_TYPE: |
| 1677 accumulator->Add("<ExternalDoubleArray[%u]>", | 1677 accumulator->Add("<ExternalDoubleArray[%u]>", |
| 1678 ExternalDoubleArray::cast(this)->length()); | 1678 ExternalDoubleArray::cast(this)->length()); |
| 1679 break; | 1679 break; |
| 1680 case FIXED_UINT8_ARRAY_TYPE: |
| 1681 accumulator->Add("<FixedUint8Array[%u]>", |
| 1682 FixedUint8Array::cast(this)->length()); |
| 1683 break; |
| 1680 case SHARED_FUNCTION_INFO_TYPE: { | 1684 case SHARED_FUNCTION_INFO_TYPE: { |
| 1681 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this); | 1685 SharedFunctionInfo* shared = SharedFunctionInfo::cast(this); |
| 1682 SmartArrayPointer<char> debug_name = | 1686 SmartArrayPointer<char> debug_name = |
| 1683 shared->DebugName()->ToCString(); | 1687 shared->DebugName()->ToCString(); |
| 1684 if (debug_name[0] != 0) { | 1688 if (debug_name[0] != 0) { |
| 1685 accumulator->Add("<SharedFunctionInfo %s>", debug_name.get()); | 1689 accumulator->Add("<SharedFunctionInfo %s>", debug_name.get()); |
| 1686 } else { | 1690 } else { |
| 1687 accumulator->Add("<SharedFunctionInfo>"); | 1691 accumulator->Add("<SharedFunctionInfo>"); |
| 1688 } | 1692 } |
| 1689 break; | 1693 break; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 case FREE_SPACE_TYPE: | 1863 case FREE_SPACE_TYPE: |
| 1860 case EXTERNAL_PIXEL_ARRAY_TYPE: | 1864 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 1861 case EXTERNAL_BYTE_ARRAY_TYPE: | 1865 case EXTERNAL_BYTE_ARRAY_TYPE: |
| 1862 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 1866 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 1863 case EXTERNAL_SHORT_ARRAY_TYPE: | 1867 case EXTERNAL_SHORT_ARRAY_TYPE: |
| 1864 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 1868 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 1865 case EXTERNAL_INT_ARRAY_TYPE: | 1869 case EXTERNAL_INT_ARRAY_TYPE: |
| 1866 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 1870 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 1867 case EXTERNAL_FLOAT_ARRAY_TYPE: | 1871 case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 1868 case EXTERNAL_DOUBLE_ARRAY_TYPE: | 1872 case EXTERNAL_DOUBLE_ARRAY_TYPE: |
| 1873 case FIXED_INT8_ARRAY_TYPE: |
| 1874 case FIXED_UINT8_ARRAY_TYPE: |
| 1875 case FIXED_INT16_ARRAY_TYPE: |
| 1876 case FIXED_UINT16_ARRAY_TYPE: |
| 1877 case FIXED_INT32_ARRAY_TYPE: |
| 1878 case FIXED_UINT32_ARRAY_TYPE: |
| 1879 case FIXED_FLOAT32_ARRAY_TYPE: |
| 1880 case FIXED_FLOAT64_ARRAY_TYPE: |
| 1881 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: |
| 1869 break; | 1882 break; |
| 1870 case SHARED_FUNCTION_INFO_TYPE: { | 1883 case SHARED_FUNCTION_INFO_TYPE: { |
| 1871 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); | 1884 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); |
| 1872 break; | 1885 break; |
| 1873 } | 1886 } |
| 1874 | 1887 |
| 1875 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 1888 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
| 1876 case NAME##_TYPE: | 1889 case NAME##_TYPE: |
| 1877 STRUCT_LIST(MAKE_STRUCT_CASE) | 1890 STRUCT_LIST(MAKE_STRUCT_CASE) |
| 1878 #undef MAKE_STRUCT_CASE | 1891 #undef MAKE_STRUCT_CASE |
| (...skipping 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4198 name, value, attributes, value_type, mode, extensibility_check); | 4211 name, value, attributes, value_type, mode, extensibility_check); |
| 4199 } | 4212 } |
| 4200 | 4213 |
| 4201 if (lookup.IsFound() && | 4214 if (lookup.IsFound() && |
| 4202 (lookup.type() == INTERCEPTOR || lookup.type() == CALLBACKS)) { | 4215 (lookup.type() == INTERCEPTOR || lookup.type() == CALLBACKS)) { |
| 4203 object->LocalLookupRealNamedProperty(*name, &lookup); | 4216 object->LocalLookupRealNamedProperty(*name, &lookup); |
| 4204 } | 4217 } |
| 4205 | 4218 |
| 4206 // Check for accessor in prototype chain removed here in clone. | 4219 // Check for accessor in prototype chain removed here in clone. |
| 4207 if (!lookup.IsFound()) { | 4220 if (!lookup.IsFound()) { |
| 4221 object->map()->LookupTransition(*object, *name, &lookup); |
| 4222 TransitionFlag flag = lookup.IsFound() |
| 4223 ? OMIT_TRANSITION : INSERT_TRANSITION; |
| 4208 // Neither properties nor transitions found. | 4224 // Neither properties nor transitions found. |
| 4209 return AddProperty(object, name, value, attributes, kNonStrictMode, | 4225 return AddProperty(object, name, value, attributes, kNonStrictMode, |
| 4210 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode); | 4226 MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag); |
| 4211 } | 4227 } |
| 4212 | 4228 |
| 4213 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 4229 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 4214 PropertyAttributes old_attributes = ABSENT; | 4230 PropertyAttributes old_attributes = ABSENT; |
| 4215 bool is_observed = FLAG_harmony_observation && | 4231 bool is_observed = FLAG_harmony_observation && |
| 4216 object->map()->is_observed() && | 4232 object->map()->is_observed() && |
| 4217 *name != isolate->heap()->hidden_string(); | 4233 *name != isolate->heap()->hidden_string(); |
| 4218 if (is_observed && lookup.IsProperty()) { | 4234 if (is_observed && lookup.IsProperty()) { |
| 4219 if (lookup.IsDataProperty()) old_value = | 4235 if (lookup.IsDataProperty()) old_value = |
| 4220 Object::GetProperty(object, name); | 4236 Object::GetProperty(object, name); |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5370 case EXTERNAL_BYTE_ELEMENTS: | 5386 case EXTERNAL_BYTE_ELEMENTS: |
| 5371 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 5387 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 5372 case EXTERNAL_SHORT_ELEMENTS: | 5388 case EXTERNAL_SHORT_ELEMENTS: |
| 5373 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 5389 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 5374 case EXTERNAL_INT_ELEMENTS: | 5390 case EXTERNAL_INT_ELEMENTS: |
| 5375 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 5391 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 5376 case EXTERNAL_FLOAT_ELEMENTS: | 5392 case EXTERNAL_FLOAT_ELEMENTS: |
| 5377 case EXTERNAL_DOUBLE_ELEMENTS: | 5393 case EXTERNAL_DOUBLE_ELEMENTS: |
| 5378 case FAST_DOUBLE_ELEMENTS: | 5394 case FAST_DOUBLE_ELEMENTS: |
| 5379 case FAST_HOLEY_DOUBLE_ELEMENTS: | 5395 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 5396 case UINT8_ELEMENTS: |
| 5397 case INT8_ELEMENTS: |
| 5398 case UINT16_ELEMENTS: |
| 5399 case INT16_ELEMENTS: |
| 5400 case UINT32_ELEMENTS: |
| 5401 case INT32_ELEMENTS: |
| 5402 case FLOAT32_ELEMENTS: |
| 5403 case FLOAT64_ELEMENTS: |
| 5404 case UINT8_CLAMPED_ELEMENTS: |
| 5380 // Raw pixels and external arrays do not reference other | 5405 // Raw pixels and external arrays do not reference other |
| 5381 // objects. | 5406 // objects. |
| 5382 break; | 5407 break; |
| 5383 case FAST_SMI_ELEMENTS: | 5408 case FAST_SMI_ELEMENTS: |
| 5384 case FAST_HOLEY_SMI_ELEMENTS: | 5409 case FAST_HOLEY_SMI_ELEMENTS: |
| 5385 break; | 5410 break; |
| 5386 case FAST_ELEMENTS: | 5411 case FAST_ELEMENTS: |
| 5387 case FAST_HOLEY_ELEMENTS: | 5412 case FAST_HOLEY_ELEMENTS: |
| 5388 case DICTIONARY_ELEMENTS: { | 5413 case DICTIONARY_ELEMENTS: { |
| 5389 FixedArray* elements = FixedArray::cast(this->elements()); | 5414 FixedArray* elements = FixedArray::cast(this->elements()); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5862 case EXTERNAL_BYTE_ELEMENTS: | 5887 case EXTERNAL_BYTE_ELEMENTS: |
| 5863 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 5888 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 5864 case EXTERNAL_SHORT_ELEMENTS: | 5889 case EXTERNAL_SHORT_ELEMENTS: |
| 5865 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 5890 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 5866 case EXTERNAL_INT_ELEMENTS: | 5891 case EXTERNAL_INT_ELEMENTS: |
| 5867 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 5892 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 5868 case EXTERNAL_FLOAT_ELEMENTS: | 5893 case EXTERNAL_FLOAT_ELEMENTS: |
| 5869 case EXTERNAL_DOUBLE_ELEMENTS: | 5894 case EXTERNAL_DOUBLE_ELEMENTS: |
| 5870 case FAST_DOUBLE_ELEMENTS: | 5895 case FAST_DOUBLE_ELEMENTS: |
| 5871 case FAST_HOLEY_DOUBLE_ELEMENTS: | 5896 case FAST_HOLEY_DOUBLE_ELEMENTS: |
| 5897 case UINT8_ELEMENTS: |
| 5898 case INT8_ELEMENTS: |
| 5899 case UINT16_ELEMENTS: |
| 5900 case INT16_ELEMENTS: |
| 5901 case UINT32_ELEMENTS: |
| 5902 case INT32_ELEMENTS: |
| 5903 case FLOAT32_ELEMENTS: |
| 5904 case FLOAT64_ELEMENTS: |
| 5905 case UINT8_CLAMPED_ELEMENTS: |
| 5872 // No contained objects, nothing to do. | 5906 // No contained objects, nothing to do. |
| 5873 break; | 5907 break; |
| 5874 } | 5908 } |
| 5875 } | 5909 } |
| 5876 | 5910 |
| 5877 return copy; | 5911 return copy; |
| 5878 } | 5912 } |
| 5879 | 5913 |
| 5880 | 5914 |
| 5881 Handle<JSObject> JSObject::DeepWalk( | 5915 Handle<JSObject> JSObject::DeepWalk( |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6099 break; | 6133 break; |
| 6100 case EXTERNAL_PIXEL_ELEMENTS: | 6134 case EXTERNAL_PIXEL_ELEMENTS: |
| 6101 case EXTERNAL_BYTE_ELEMENTS: | 6135 case EXTERNAL_BYTE_ELEMENTS: |
| 6102 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6136 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 6103 case EXTERNAL_SHORT_ELEMENTS: | 6137 case EXTERNAL_SHORT_ELEMENTS: |
| 6104 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6138 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 6105 case EXTERNAL_INT_ELEMENTS: | 6139 case EXTERNAL_INT_ELEMENTS: |
| 6106 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6140 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 6107 case EXTERNAL_FLOAT_ELEMENTS: | 6141 case EXTERNAL_FLOAT_ELEMENTS: |
| 6108 case EXTERNAL_DOUBLE_ELEMENTS: | 6142 case EXTERNAL_DOUBLE_ELEMENTS: |
| 6143 case UINT8_ELEMENTS: |
| 6144 case INT8_ELEMENTS: |
| 6145 case UINT16_ELEMENTS: |
| 6146 case INT16_ELEMENTS: |
| 6147 case UINT32_ELEMENTS: |
| 6148 case INT32_ELEMENTS: |
| 6149 case FLOAT32_ELEMENTS: |
| 6150 case FLOAT64_ELEMENTS: |
| 6151 case UINT8_CLAMPED_ELEMENTS: |
| 6109 // Ignore getters and setters on pixel and external array elements. | 6152 // Ignore getters and setters on pixel and external array elements. |
| 6110 return; | 6153 return; |
| 6111 case DICTIONARY_ELEMENTS: | 6154 case DICTIONARY_ELEMENTS: |
| 6112 if (UpdateGetterSetterInDictionary(object->element_dictionary(), | 6155 if (UpdateGetterSetterInDictionary(object->element_dictionary(), |
| 6113 index, | 6156 index, |
| 6114 *getter, | 6157 *getter, |
| 6115 *setter, | 6158 *setter, |
| 6116 attributes)) { | 6159 attributes)) { |
| 6117 return; | 6160 return; |
| 6118 } | 6161 } |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6557 break; | 6600 break; |
| 6558 case EXTERNAL_PIXEL_ELEMENTS: | 6601 case EXTERNAL_PIXEL_ELEMENTS: |
| 6559 case EXTERNAL_BYTE_ELEMENTS: | 6602 case EXTERNAL_BYTE_ELEMENTS: |
| 6560 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6603 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 6561 case EXTERNAL_SHORT_ELEMENTS: | 6604 case EXTERNAL_SHORT_ELEMENTS: |
| 6562 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6605 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 6563 case EXTERNAL_INT_ELEMENTS: | 6606 case EXTERNAL_INT_ELEMENTS: |
| 6564 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6607 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 6565 case EXTERNAL_FLOAT_ELEMENTS: | 6608 case EXTERNAL_FLOAT_ELEMENTS: |
| 6566 case EXTERNAL_DOUBLE_ELEMENTS: | 6609 case EXTERNAL_DOUBLE_ELEMENTS: |
| 6610 case UINT8_ELEMENTS: |
| 6611 case INT8_ELEMENTS: |
| 6612 case UINT16_ELEMENTS: |
| 6613 case INT16_ELEMENTS: |
| 6614 case UINT32_ELEMENTS: |
| 6615 case INT32_ELEMENTS: |
| 6616 case FLOAT32_ELEMENTS: |
| 6617 case FLOAT64_ELEMENTS: |
| 6618 case UINT8_CLAMPED_ELEMENTS: |
| 6567 // Ignore getters and setters on pixel and external array | 6619 // Ignore getters and setters on pixel and external array |
| 6568 // elements. | 6620 // elements. |
| 6569 return factory->undefined_value(); | 6621 return factory->undefined_value(); |
| 6570 case DICTIONARY_ELEMENTS: | 6622 case DICTIONARY_ELEMENTS: |
| 6571 break; | 6623 break; |
| 6572 case NON_STRICT_ARGUMENTS_ELEMENTS: | 6624 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 6573 UNIMPLEMENTED(); | 6625 UNIMPLEMENTED(); |
| 6574 break; | 6626 break; |
| 6575 } | 6627 } |
| 6576 | 6628 |
| (...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7849 { MaybeObject* maybe_obj = key.AsObject(GetHeap()); | 7901 { MaybeObject* maybe_obj = key.AsObject(GetHeap()); |
| 7850 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 7902 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 7851 } | 7903 } |
| 7852 cache->set(EntryToIndex(entry), obj); | 7904 cache->set(EntryToIndex(entry), obj); |
| 7853 cache->set(EntryToIndex(entry) + 1, code); | 7905 cache->set(EntryToIndex(entry) + 1, code); |
| 7854 cache->ElementAdded(); | 7906 cache->ElementAdded(); |
| 7855 return cache; | 7907 return cache; |
| 7856 } | 7908 } |
| 7857 | 7909 |
| 7858 | 7910 |
| 7911 void FixedArray::Shrink(int new_length) { |
| 7912 ASSERT(0 <= new_length && new_length <= length()); |
| 7913 if (new_length < length()) { |
| 7914 RightTrimFixedArray<FROM_MUTATOR>(GetHeap(), this, length() - new_length); |
| 7915 } |
| 7916 } |
| 7917 |
| 7918 |
| 7859 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { | 7919 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { |
| 7860 ElementsAccessor* accessor = array->GetElementsAccessor(); | 7920 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 7861 MaybeObject* maybe_result = | 7921 MaybeObject* maybe_result = |
| 7862 accessor->AddElementsToFixedArray(array, array, this); | 7922 accessor->AddElementsToFixedArray(array, array, this); |
| 7863 FixedArray* result; | 7923 FixedArray* result; |
| 7864 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; | 7924 if (!maybe_result->To<FixedArray>(&result)) return maybe_result; |
| 7865 #ifdef ENABLE_SLOW_ASSERTS | 7925 #ifdef ENABLE_SLOW_ASSERTS |
| 7866 if (FLAG_enable_slow_asserts) { | 7926 if (FLAG_enable_slow_asserts) { |
| 7867 for (int i = 0; i < result->length(); i++) { | 7927 for (int i = 0; i < result->length(); i++) { |
| 7868 Object* current = result->get(i); | 7928 Object* current = result->get(i); |
| (...skipping 2952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10821 Address code_start_address = instruction_start(); | 10881 Address code_start_address = instruction_start(); |
| 10822 for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 10882 for (int i = 0; i < deopt_data->DeoptCount(); i++) { |
| 10823 if (deopt_data->Pc(i)->value() == -1) continue; | 10883 if (deopt_data->Pc(i)->value() == -1) continue; |
| 10824 Address address = code_start_address + deopt_data->Pc(i)->value(); | 10884 Address address = code_start_address + deopt_data->Pc(i)->value(); |
| 10825 if (address == pc) return true; | 10885 if (address == pc) return true; |
| 10826 } | 10886 } |
| 10827 return false; | 10887 return false; |
| 10828 } | 10888 } |
| 10829 | 10889 |
| 10830 | 10890 |
| 10831 bool Code::IsContextual() { | |
| 10832 ASSERT(is_inline_cache_stub()); | |
| 10833 Kind kind = this->kind(); | |
| 10834 if (kind == STORE_IC || kind == LOAD_IC || kind == CALL_IC) { | |
| 10835 ExtraICState extra_state = extra_ic_state(); | |
| 10836 return IC::GetContextualMode(extra_state) == CONTEXTUAL; | |
| 10837 } | |
| 10838 return false; | |
| 10839 } | |
| 10840 | |
| 10841 | |
| 10842 // Identify kind of code. | 10891 // Identify kind of code. |
| 10843 const char* Code::Kind2String(Kind kind) { | 10892 const char* Code::Kind2String(Kind kind) { |
| 10844 switch (kind) { | 10893 switch (kind) { |
| 10845 #define CASE(name) case name: return #name; | 10894 #define CASE(name) case name: return #name; |
| 10846 CODE_KIND_LIST(CASE) | 10895 CODE_KIND_LIST(CASE) |
| 10847 #undef CASE | 10896 #undef CASE |
| 10848 case NUMBER_OF_KINDS: break; | 10897 case NUMBER_OF_KINDS: break; |
| 10849 } | 10898 } |
| 10850 UNREACHABLE(); | 10899 UNREACHABLE(); |
| 10851 return NULL; | 10900 return NULL; |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11055 } | 11104 } |
| 11056 UNREACHABLE(); // keep the compiler happy | 11105 UNREACHABLE(); // keep the compiler happy |
| 11057 return NULL; | 11106 return NULL; |
| 11058 } | 11107 } |
| 11059 | 11108 |
| 11060 | 11109 |
| 11061 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) { | 11110 void Code::PrintExtraICState(FILE* out, Kind kind, ExtraICState extra) { |
| 11062 PrintF(out, "extra_ic_state = "); | 11111 PrintF(out, "extra_ic_state = "); |
| 11063 const char* name = NULL; | 11112 const char* name = NULL; |
| 11064 switch (kind) { | 11113 switch (kind) { |
| 11065 case CALL_IC: | |
| 11066 if (extra == STRING_INDEX_OUT_OF_BOUNDS) { | |
| 11067 name = "STRING_INDEX_OUT_OF_BOUNDS"; | |
| 11068 } | |
| 11069 break; | |
| 11070 case STORE_IC: | 11114 case STORE_IC: |
| 11071 case KEYED_STORE_IC: | 11115 case KEYED_STORE_IC: |
| 11072 if (extra == kStrictMode) { | 11116 if (extra == kStrictMode) { |
| 11073 name = "STRICT"; | 11117 name = "STRICT"; |
| 11074 } | 11118 } |
| 11075 break; | 11119 break; |
| 11076 default: | 11120 default: |
| 11077 break; | 11121 break; |
| 11078 } | 11122 } |
| 11079 if (name != NULL) { | 11123 if (name != NULL) { |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11751 for (int i = start; i < end; i++) { | 11795 for (int i = start; i < end; i++) { |
| 11752 if (object_at(i) == code) return true; | 11796 if (object_at(i) == code) return true; |
| 11753 } | 11797 } |
| 11754 return false; | 11798 return false; |
| 11755 } | 11799 } |
| 11756 | 11800 |
| 11757 | 11801 |
| 11758 bool DependentCode::MarkCodeForDeoptimization( | 11802 bool DependentCode::MarkCodeForDeoptimization( |
| 11759 Isolate* isolate, | 11803 Isolate* isolate, |
| 11760 DependentCode::DependencyGroup group) { | 11804 DependentCode::DependencyGroup group) { |
| 11761 ASSERT(AllowCodeDependencyChange::IsAllowed()); | |
| 11762 DisallowHeapAllocation no_allocation_scope; | 11805 DisallowHeapAllocation no_allocation_scope; |
| 11763 DependentCode::GroupStartIndexes starts(this); | 11806 DependentCode::GroupStartIndexes starts(this); |
| 11764 int start = starts.at(group); | 11807 int start = starts.at(group); |
| 11765 int end = starts.at(group + 1); | 11808 int end = starts.at(group + 1); |
| 11766 int code_entries = starts.number_of_entries(); | 11809 int code_entries = starts.number_of_entries(); |
| 11767 if (start == end) return false; | 11810 if (start == end) return false; |
| 11768 | 11811 |
| 11769 // Mark all the code that needs to be deoptimized. | 11812 // Mark all the code that needs to be deoptimized. |
| 11770 bool marked = false; | 11813 bool marked = false; |
| 11771 for (int i = start; i < end; i++) { | 11814 for (int i = start; i < end; i++) { |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12714 case EXTERNAL_FLOAT_ELEMENTS: { | 12757 case EXTERNAL_FLOAT_ELEMENTS: { |
| 12715 Handle<ExternalFloatArray> array( | 12758 Handle<ExternalFloatArray> array( |
| 12716 ExternalFloatArray::cast(object->elements())); | 12759 ExternalFloatArray::cast(object->elements())); |
| 12717 return ExternalFloatArray::SetValue(array, index, value); | 12760 return ExternalFloatArray::SetValue(array, index, value); |
| 12718 } | 12761 } |
| 12719 case EXTERNAL_DOUBLE_ELEMENTS: { | 12762 case EXTERNAL_DOUBLE_ELEMENTS: { |
| 12720 Handle<ExternalDoubleArray> array( | 12763 Handle<ExternalDoubleArray> array( |
| 12721 ExternalDoubleArray::cast(object->elements())); | 12764 ExternalDoubleArray::cast(object->elements())); |
| 12722 return ExternalDoubleArray::SetValue(array, index, value); | 12765 return ExternalDoubleArray::SetValue(array, index, value); |
| 12723 } | 12766 } |
| 12767 case UINT8_ELEMENTS: { |
| 12768 Handle<FixedUint8Array> array( |
| 12769 FixedUint8Array::cast(object->elements())); |
| 12770 return FixedUint8Array::SetValue(array, index, value); |
| 12771 } |
| 12772 case UINT8_CLAMPED_ELEMENTS: { |
| 12773 Handle<FixedUint8ClampedArray> array( |
| 12774 FixedUint8ClampedArray::cast(object->elements())); |
| 12775 return FixedUint8ClampedArray::SetValue(array, index, value); |
| 12776 } |
| 12777 case INT8_ELEMENTS: { |
| 12778 Handle<FixedInt8Array> array( |
| 12779 FixedInt8Array::cast(object->elements())); |
| 12780 return FixedInt8Array::SetValue(array, index, value); |
| 12781 } |
| 12782 case UINT16_ELEMENTS: { |
| 12783 Handle<FixedUint16Array> array( |
| 12784 FixedUint16Array::cast(object->elements())); |
| 12785 return FixedUint16Array::SetValue(array, index, value); |
| 12786 } |
| 12787 case INT16_ELEMENTS: { |
| 12788 Handle<FixedInt16Array> array( |
| 12789 FixedInt16Array::cast(object->elements())); |
| 12790 return FixedInt16Array::SetValue(array, index, value); |
| 12791 } |
| 12792 case UINT32_ELEMENTS: { |
| 12793 Handle<FixedUint32Array> array( |
| 12794 FixedUint32Array::cast(object->elements())); |
| 12795 return FixedUint32Array::SetValue(array, index, value); |
| 12796 } |
| 12797 case INT32_ELEMENTS: { |
| 12798 Handle<FixedInt32Array> array( |
| 12799 FixedInt32Array::cast(object->elements())); |
| 12800 return FixedInt32Array::SetValue(array, index, value); |
| 12801 } |
| 12802 case FLOAT32_ELEMENTS: { |
| 12803 Handle<FixedFloat32Array> array( |
| 12804 FixedFloat32Array::cast(object->elements())); |
| 12805 return FixedFloat32Array::SetValue(array, index, value); |
| 12806 } |
| 12807 case FLOAT64_ELEMENTS: { |
| 12808 Handle<FixedFloat64Array> array( |
| 12809 FixedFloat64Array::cast(object->elements())); |
| 12810 return FixedFloat64Array::SetValue(array, index, value); |
| 12811 } |
| 12724 case DICTIONARY_ELEMENTS: | 12812 case DICTIONARY_ELEMENTS: |
| 12725 return SetDictionaryElement(object, index, value, attributes, strict_mode, | 12813 return SetDictionaryElement(object, index, value, attributes, strict_mode, |
| 12726 check_prototype, | 12814 check_prototype, |
| 12727 set_mode); | 12815 set_mode); |
| 12728 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 12816 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
| 12729 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); | 12817 Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); |
| 12730 uint32_t length = parameter_map->length(); | 12818 uint32_t length = parameter_map->length(); |
| 12731 Handle<Object> probe = index < length - 2 ? | 12819 Handle<Object> probe = index < length - 2 ? |
| 12732 Handle<Object>(parameter_map->get(index + 2), isolate) : | 12820 Handle<Object>(parameter_map->get(index + 2), isolate) : |
| 12733 Handle<Object>(); | 12821 Handle<Object>(); |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13125 } | 13213 } |
| 13126 case EXTERNAL_BYTE_ELEMENTS: | 13214 case EXTERNAL_BYTE_ELEMENTS: |
| 13127 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 13215 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 13128 case EXTERNAL_SHORT_ELEMENTS: | 13216 case EXTERNAL_SHORT_ELEMENTS: |
| 13129 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 13217 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 13130 case EXTERNAL_INT_ELEMENTS: | 13218 case EXTERNAL_INT_ELEMENTS: |
| 13131 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 13219 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 13132 case EXTERNAL_FLOAT_ELEMENTS: | 13220 case EXTERNAL_FLOAT_ELEMENTS: |
| 13133 case EXTERNAL_DOUBLE_ELEMENTS: | 13221 case EXTERNAL_DOUBLE_ELEMENTS: |
| 13134 case EXTERNAL_PIXEL_ELEMENTS: | 13222 case EXTERNAL_PIXEL_ELEMENTS: |
| 13223 case UINT8_ELEMENTS: |
| 13224 case INT8_ELEMENTS: |
| 13225 case UINT16_ELEMENTS: |
| 13226 case INT16_ELEMENTS: |
| 13227 case UINT32_ELEMENTS: |
| 13228 case INT32_ELEMENTS: |
| 13229 case FLOAT32_ELEMENTS: |
| 13230 case FLOAT64_ELEMENTS: |
| 13231 case UINT8_CLAMPED_ELEMENTS: { |
| 13135 // External arrays are considered 100% used. | 13232 // External arrays are considered 100% used. |
| 13136 ExternalArray* external_array = ExternalArray::cast(elements()); | 13233 FixedArrayBase* external_array = FixedArrayBase::cast(elements()); |
| 13137 *capacity = external_array->length(); | 13234 *capacity = external_array->length(); |
| 13138 *used = external_array->length(); | 13235 *used = external_array->length(); |
| 13139 break; | 13236 break; |
| 13237 } |
| 13140 } | 13238 } |
| 13141 } | 13239 } |
| 13142 | 13240 |
| 13143 | 13241 |
| 13144 bool JSObject::ShouldConvertToSlowElements(int new_capacity) { | 13242 bool JSObject::ShouldConvertToSlowElements(int new_capacity) { |
| 13145 STATIC_ASSERT(kMaxUncheckedOldFastElementsLength <= | 13243 STATIC_ASSERT(kMaxUncheckedOldFastElementsLength <= |
| 13146 kMaxUncheckedFastElementsLength); | 13244 kMaxUncheckedFastElementsLength); |
| 13147 if (new_capacity <= kMaxUncheckedOldFastElementsLength || | 13245 if (new_capacity <= kMaxUncheckedOldFastElementsLength || |
| 13148 (new_capacity <= kMaxUncheckedFastElementsLength && | 13246 (new_capacity <= kMaxUncheckedFastElementsLength && |
| 13149 GetHeap()->InNewSpace(this))) { | 13247 GetHeap()->InNewSpace(this))) { |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13637 ASSERT(!storage || storage->length() >= counter); | 13735 ASSERT(!storage || storage->length() >= counter); |
| 13638 break; | 13736 break; |
| 13639 } | 13737 } |
| 13640 case EXTERNAL_BYTE_ELEMENTS: | 13738 case EXTERNAL_BYTE_ELEMENTS: |
| 13641 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 13739 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 13642 case EXTERNAL_SHORT_ELEMENTS: | 13740 case EXTERNAL_SHORT_ELEMENTS: |
| 13643 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 13741 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 13644 case EXTERNAL_INT_ELEMENTS: | 13742 case EXTERNAL_INT_ELEMENTS: |
| 13645 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 13743 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 13646 case EXTERNAL_FLOAT_ELEMENTS: | 13744 case EXTERNAL_FLOAT_ELEMENTS: |
| 13647 case EXTERNAL_DOUBLE_ELEMENTS: { | 13745 case EXTERNAL_DOUBLE_ELEMENTS: |
| 13648 int length = ExternalArray::cast(elements())->length(); | 13746 case UINT8_ELEMENTS: |
| 13747 case INT8_ELEMENTS: |
| 13748 case UINT16_ELEMENTS: |
| 13749 case INT16_ELEMENTS: |
| 13750 case UINT32_ELEMENTS: |
| 13751 case INT32_ELEMENTS: |
| 13752 case FLOAT32_ELEMENTS: |
| 13753 case FLOAT64_ELEMENTS: |
| 13754 case UINT8_CLAMPED_ELEMENTS: { |
| 13755 int length = FixedArrayBase::cast(elements())->length(); |
| 13649 while (counter < length) { | 13756 while (counter < length) { |
| 13650 if (storage != NULL) { | 13757 if (storage != NULL) { |
| 13651 storage->set(counter, Smi::FromInt(counter)); | 13758 storage->set(counter, Smi::FromInt(counter)); |
| 13652 } | 13759 } |
| 13653 counter++; | 13760 counter++; |
| 13654 } | 13761 } |
| 13655 ASSERT(!storage || storage->length() >= counter); | 13762 ASSERT(!storage || storage->length() >= counter); |
| 13656 break; | 13763 break; |
| 13657 } | 13764 } |
| 13658 case DICTIONARY_ELEMENTS: { | 13765 case DICTIONARY_ELEMENTS: { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13880 | 13987 |
| 13881 static uint32_t RegExpHash(String* string, Smi* flags) { | 13988 static uint32_t RegExpHash(String* string, Smi* flags) { |
| 13882 return string->Hash() + flags->value(); | 13989 return string->Hash() + flags->value(); |
| 13883 } | 13990 } |
| 13884 | 13991 |
| 13885 String* string_; | 13992 String* string_; |
| 13886 Smi* flags_; | 13993 Smi* flags_; |
| 13887 }; | 13994 }; |
| 13888 | 13995 |
| 13889 | 13996 |
| 13890 // Utf8StringKey carries a vector of chars as key. | 13997 MaybeObject* OneByteStringKey::AsObject(Heap* heap) { |
| 13891 class Utf8StringKey : public HashTableKey { | 13998 if (hash_field_ == 0) Hash(); |
| 13892 public: | 13999 return heap->AllocateOneByteInternalizedString(string_, hash_field_); |
| 13893 explicit Utf8StringKey(Vector<const char> string, uint32_t seed) | 14000 } |
| 13894 : string_(string), hash_field_(0), seed_(seed) { } | |
| 13895 | |
| 13896 bool IsMatch(Object* string) { | |
| 13897 return String::cast(string)->IsUtf8EqualTo(string_); | |
| 13898 } | |
| 13899 | |
| 13900 uint32_t Hash() { | |
| 13901 if (hash_field_ != 0) return hash_field_ >> String::kHashShift; | |
| 13902 hash_field_ = StringHasher::ComputeUtf8Hash(string_, seed_, &chars_); | |
| 13903 uint32_t result = hash_field_ >> String::kHashShift; | |
| 13904 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. | |
| 13905 return result; | |
| 13906 } | |
| 13907 | |
| 13908 uint32_t HashForObject(Object* other) { | |
| 13909 return String::cast(other)->Hash(); | |
| 13910 } | |
| 13911 | |
| 13912 MaybeObject* AsObject(Heap* heap) { | |
| 13913 if (hash_field_ == 0) Hash(); | |
| 13914 return heap->AllocateInternalizedStringFromUtf8(string_, | |
| 13915 chars_, | |
| 13916 hash_field_); | |
| 13917 } | |
| 13918 | |
| 13919 Vector<const char> string_; | |
| 13920 uint32_t hash_field_; | |
| 13921 int chars_; // Caches the number of characters when computing the hash code. | |
| 13922 uint32_t seed_; | |
| 13923 }; | |
| 13924 | 14001 |
| 13925 | 14002 |
| 13926 template <typename Char> | 14003 MaybeObject* SubStringOneByteStringKey::AsObject(Heap* heap) { |
| 13927 class SequentialStringKey : public HashTableKey { | 14004 if (hash_field_ == 0) Hash(); |
| 13928 public: | 14005 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); |
| 13929 explicit SequentialStringKey(Vector<const Char> string, uint32_t seed) | 14006 return heap->AllocateOneByteInternalizedString(chars, hash_field_); |
| 13930 : string_(string), hash_field_(0), seed_(seed) { } | 14007 } |
| 13931 | |
| 13932 uint32_t Hash() { | |
| 13933 hash_field_ = StringHasher::HashSequentialString<Char>(string_.start(), | |
| 13934 string_.length(), | |
| 13935 seed_); | |
| 13936 | |
| 13937 uint32_t result = hash_field_ >> String::kHashShift; | |
| 13938 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. | |
| 13939 return result; | |
| 13940 } | |
| 13941 | 14008 |
| 13942 | 14009 |
| 13943 uint32_t HashForObject(Object* other) { | 14010 MaybeObject* TwoByteStringKey::AsObject(Heap* heap) { |
| 13944 return String::cast(other)->Hash(); | 14011 if (hash_field_ == 0) Hash(); |
| 13945 } | 14012 return heap->AllocateTwoByteInternalizedString(string_, hash_field_); |
| 13946 | 14013 } |
| 13947 Vector<const Char> string_; | |
| 13948 uint32_t hash_field_; | |
| 13949 uint32_t seed_; | |
| 13950 }; | |
| 13951 | |
| 13952 | |
| 13953 | |
| 13954 class OneByteStringKey : public SequentialStringKey<uint8_t> { | |
| 13955 public: | |
| 13956 OneByteStringKey(Vector<const uint8_t> str, uint32_t seed) | |
| 13957 : SequentialStringKey<uint8_t>(str, seed) { } | |
| 13958 | |
| 13959 bool IsMatch(Object* string) { | |
| 13960 return String::cast(string)->IsOneByteEqualTo(string_); | |
| 13961 } | |
| 13962 | |
| 13963 MaybeObject* AsObject(Heap* heap) { | |
| 13964 if (hash_field_ == 0) Hash(); | |
| 13965 return heap->AllocateOneByteInternalizedString(string_, hash_field_); | |
| 13966 } | |
| 13967 }; | |
| 13968 | |
| 13969 | |
| 13970 class SubStringOneByteStringKey : public HashTableKey { | |
| 13971 public: | |
| 13972 explicit SubStringOneByteStringKey(Handle<SeqOneByteString> string, | |
| 13973 int from, | |
| 13974 int length) | |
| 13975 : string_(string), from_(from), length_(length) { } | |
| 13976 | |
| 13977 uint32_t Hash() { | |
| 13978 ASSERT(length_ >= 0); | |
| 13979 ASSERT(from_ + length_ <= string_->length()); | |
| 13980 uint8_t* chars = string_->GetChars() + from_; | |
| 13981 hash_field_ = StringHasher::HashSequentialString( | |
| 13982 chars, length_, string_->GetHeap()->HashSeed()); | |
| 13983 uint32_t result = hash_field_ >> String::kHashShift; | |
| 13984 ASSERT(result != 0); // Ensure that the hash value of 0 is never computed. | |
| 13985 return result; | |
| 13986 } | |
| 13987 | |
| 13988 | |
| 13989 uint32_t HashForObject(Object* other) { | |
| 13990 return String::cast(other)->Hash(); | |
| 13991 } | |
| 13992 | |
| 13993 bool IsMatch(Object* string) { | |
| 13994 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); | |
| 13995 return String::cast(string)->IsOneByteEqualTo(chars); | |
| 13996 } | |
| 13997 | |
| 13998 MaybeObject* AsObject(Heap* heap) { | |
| 13999 if (hash_field_ == 0) Hash(); | |
| 14000 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); | |
| 14001 return heap->AllocateOneByteInternalizedString(chars, hash_field_); | |
| 14002 } | |
| 14003 | |
| 14004 private: | |
| 14005 Handle<SeqOneByteString> string_; | |
| 14006 int from_; | |
| 14007 int length_; | |
| 14008 uint32_t hash_field_; | |
| 14009 }; | |
| 14010 | |
| 14011 | |
| 14012 class TwoByteStringKey : public SequentialStringKey<uc16> { | |
| 14013 public: | |
| 14014 explicit TwoByteStringKey(Vector<const uc16> str, uint32_t seed) | |
| 14015 : SequentialStringKey<uc16>(str, seed) { } | |
| 14016 | |
| 14017 bool IsMatch(Object* string) { | |
| 14018 return String::cast(string)->IsTwoByteEqualTo(string_); | |
| 14019 } | |
| 14020 | |
| 14021 MaybeObject* AsObject(Heap* heap) { | |
| 14022 if (hash_field_ == 0) Hash(); | |
| 14023 return heap->AllocateTwoByteInternalizedString(string_, hash_field_); | |
| 14024 } | |
| 14025 }; | |
| 14026 | 14014 |
| 14027 | 14015 |
| 14028 // InternalizedStringKey carries a string/internalized-string object as key. | 14016 // InternalizedStringKey carries a string/internalized-string object as key. |
| 14029 class InternalizedStringKey : public HashTableKey { | 14017 class InternalizedStringKey : public HashTableKey { |
| 14030 public: | 14018 public: |
| 14031 explicit InternalizedStringKey(String* string) | 14019 explicit InternalizedStringKey(String* string) |
| 14032 : string_(string) { } | 14020 : string_(string) { } |
| 14033 | 14021 |
| 14034 bool IsMatch(Object* string) { | 14022 bool IsMatch(Object* string) { |
| 14035 return String::cast(string)->Equals(string_); | 14023 return String::cast(string)->Equals(string_); |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15079 if (entry == kNotFound) { | 15067 if (entry == kNotFound) { |
| 15080 return false; | 15068 return false; |
| 15081 } else { | 15069 } else { |
| 15082 *result = String::cast(KeyAt(entry)); | 15070 *result = String::cast(KeyAt(entry)); |
| 15083 ASSERT(StringShape(*result).IsInternalized()); | 15071 ASSERT(StringShape(*result).IsInternalized()); |
| 15084 return true; | 15072 return true; |
| 15085 } | 15073 } |
| 15086 } | 15074 } |
| 15087 | 15075 |
| 15088 | 15076 |
| 15089 MaybeObject* StringTable::LookupUtf8String(Vector<const char> str, | |
| 15090 Object** s) { | |
| 15091 Utf8StringKey key(str, GetHeap()->HashSeed()); | |
| 15092 return LookupKey(&key, s); | |
| 15093 } | |
| 15094 | |
| 15095 | |
| 15096 MaybeObject* StringTable::LookupOneByteString(Vector<const uint8_t> str, | |
| 15097 Object** s) { | |
| 15098 OneByteStringKey key(str, GetHeap()->HashSeed()); | |
| 15099 return LookupKey(&key, s); | |
| 15100 } | |
| 15101 | |
| 15102 | |
| 15103 MaybeObject* StringTable::LookupSubStringOneByteString( | |
| 15104 Handle<SeqOneByteString> str, | |
| 15105 int from, | |
| 15106 int length, | |
| 15107 Object** s) { | |
| 15108 SubStringOneByteStringKey key(str, from, length); | |
| 15109 return LookupKey(&key, s); | |
| 15110 } | |
| 15111 | |
| 15112 | |
| 15113 MaybeObject* StringTable::LookupTwoByteString(Vector<const uc16> str, | |
| 15114 Object** s) { | |
| 15115 TwoByteStringKey key(str, GetHeap()->HashSeed()); | |
| 15116 return LookupKey(&key, s); | |
| 15117 } | |
| 15118 | |
| 15119 | |
| 15120 MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) { | 15077 MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) { |
| 15121 int entry = FindEntry(key); | 15078 int entry = FindEntry(key); |
| 15122 | 15079 |
| 15123 // String already in table. | 15080 // String already in table. |
| 15124 if (entry != kNotFound) { | 15081 if (entry != kNotFound) { |
| 15125 *s = KeyAt(entry); | 15082 *s = KeyAt(entry); |
| 15126 return this; | 15083 return this; |
| 15127 } | 15084 } |
| 15128 | 15085 |
| 15129 // Adding new string. Grow table if needed. | 15086 // Adding new string. Grow table if needed. |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16579 } | 16536 } |
| 16580 | 16537 |
| 16581 | 16538 |
| 16582 void JSTypedArray::Neuter() { | 16539 void JSTypedArray::Neuter() { |
| 16583 NeuterView(); | 16540 NeuterView(); |
| 16584 set_length(Smi::FromInt(0)); | 16541 set_length(Smi::FromInt(0)); |
| 16585 set_elements(GetHeap()->EmptyExternalArrayForMap(map())); | 16542 set_elements(GetHeap()->EmptyExternalArrayForMap(map())); |
| 16586 } | 16543 } |
| 16587 | 16544 |
| 16588 | 16545 |
| 16589 Type* PropertyCell::type() { | 16546 HeapType* PropertyCell::type() { |
| 16590 return static_cast<Type*>(type_raw()); | 16547 return static_cast<HeapType*>(type_raw()); |
| 16591 } | 16548 } |
| 16592 | 16549 |
| 16593 | 16550 |
| 16594 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { | 16551 void PropertyCell::set_type(HeapType* type, WriteBarrierMode ignored) { |
| 16595 ASSERT(IsPropertyCell()); | 16552 ASSERT(IsPropertyCell()); |
| 16596 set_type_raw(type, ignored); | 16553 set_type_raw(type, ignored); |
| 16597 } | 16554 } |
| 16598 | 16555 |
| 16599 | 16556 |
| 16600 Handle<Type> PropertyCell::UpdatedType(Handle<PropertyCell> cell, | 16557 Handle<HeapType> PropertyCell::UpdatedType(Handle<PropertyCell> cell, |
| 16601 Handle<Object> value) { | 16558 Handle<Object> value) { |
| 16602 Isolate* isolate = cell->GetIsolate(); | 16559 Isolate* isolate = cell->GetIsolate(); |
| 16603 Handle<Type> old_type(cell->type(), isolate); | 16560 Handle<HeapType> old_type(cell->type(), isolate); |
| 16604 // TODO(2803): Do not track ConsString as constant because they cannot be | 16561 // TODO(2803): Do not track ConsString as constant because they cannot be |
| 16605 // embedded into code. | 16562 // embedded into code. |
| 16606 Handle<Type> new_type = value->IsConsString() || value->IsTheHole() | 16563 Handle<HeapType> new_type = value->IsConsString() || value->IsTheHole() |
| 16607 ? Type::Any(isolate) : Type::Constant(value, isolate); | 16564 ? HeapType::Any(isolate) : HeapType::Constant(value, isolate); |
| 16608 | 16565 |
| 16609 if (new_type->Is(old_type)) { | 16566 if (new_type->Is(old_type)) { |
| 16610 return old_type; | 16567 return old_type; |
| 16611 } | 16568 } |
| 16612 | 16569 |
| 16613 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16570 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16614 isolate, DependentCode::kPropertyCellChangedGroup); | 16571 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16615 | 16572 |
| 16616 if (old_type->Is(Type::None()) || old_type->Is(Type::Undefined())) { | 16573 if (old_type->Is(HeapType::None()) || old_type->Is(HeapType::Undefined())) { |
| 16617 return new_type; | 16574 return new_type; |
| 16618 } | 16575 } |
| 16619 | 16576 |
| 16620 return Type::Any(isolate); | 16577 return HeapType::Any(isolate); |
| 16621 } | 16578 } |
| 16622 | 16579 |
| 16623 | 16580 |
| 16624 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, | 16581 void PropertyCell::SetValueInferType(Handle<PropertyCell> cell, |
| 16625 Handle<Object> value) { | 16582 Handle<Object> value) { |
| 16626 cell->set_value(*value); | 16583 cell->set_value(*value); |
| 16627 if (!Type::Any()->Is(cell->type())) { | 16584 if (!HeapType::Any()->Is(cell->type())) { |
| 16628 Handle<Type> new_type = UpdatedType(cell, value); | 16585 Handle<HeapType> new_type = UpdatedType(cell, value); |
| 16629 cell->set_type(*new_type); | 16586 cell->set_type(*new_type); |
| 16630 } | 16587 } |
| 16631 } | 16588 } |
| 16632 | 16589 |
| 16633 | 16590 |
| 16634 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { | 16591 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) { |
| 16635 Handle<DependentCode> dep(dependent_code()); | 16592 Handle<DependentCode> dep(dependent_code()); |
| 16636 Handle<DependentCode> codes = | 16593 Handle<DependentCode> codes = |
| 16637 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, | 16594 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup, |
| 16638 info->object_wrapper()); | 16595 info->object_wrapper()); |
| 16639 if (*codes != dependent_code()) set_dependent_code(*codes); | 16596 if (*codes != dependent_code()) set_dependent_code(*codes); |
| 16640 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16597 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
| 16641 Handle<HeapObject>(this), info->zone()); | 16598 Handle<HeapObject>(this), info->zone()); |
| 16642 } | 16599 } |
| 16643 | 16600 |
| 16644 | 16601 |
| 16645 const char* GetBailoutReason(BailoutReason reason) { | 16602 const char* GetBailoutReason(BailoutReason reason) { |
| 16646 ASSERT(reason < kLastErrorMessage); | 16603 ASSERT(reason < kLastErrorMessage); |
| 16647 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16604 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16648 static const char* error_messages_[] = { | 16605 static const char* error_messages_[] = { |
| 16649 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16606 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16650 }; | 16607 }; |
| 16651 #undef ERROR_MESSAGES_TEXTS | 16608 #undef ERROR_MESSAGES_TEXTS |
| 16652 return error_messages_[reason]; | 16609 return error_messages_[reason]; |
| 16653 } | 16610 } |
| 16654 | 16611 |
| 16655 | 16612 |
| 16656 } } // namespace v8::internal | 16613 } } // namespace v8::internal |
| OLD | NEW |