| OLD | NEW |
| 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 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 return this; | 1562 return this; |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 | 1565 |
| 1566 MaybeObject* JSObject::MigrateInstance() { | 1566 MaybeObject* JSObject::MigrateInstance() { |
| 1567 // Converting any field to the most specific type will cause the | 1567 // Converting any field to the most specific type will cause the |
| 1568 // GeneralizeFieldRepresentation algorithm to create the most general existing | 1568 // GeneralizeFieldRepresentation algorithm to create the most general existing |
| 1569 // transition that matches the object. This achieves what is needed. | 1569 // transition that matches the object. This achieves what is needed. |
| 1570 Map* original_map = map(); | 1570 Map* original_map = map(); |
| 1571 MaybeObject* maybe_result = GeneralizeFieldRepresentation( | 1571 MaybeObject* maybe_result = GeneralizeFieldRepresentation( |
| 1572 0, Representation::None()); | 1572 0, Representation::None(), ALLOW_AS_CONSTANT); |
| 1573 JSObject* result; | 1573 JSObject* result; |
| 1574 if (FLAG_trace_migration && maybe_result->To(&result)) { | 1574 if (FLAG_trace_migration && maybe_result->To(&result)) { |
| 1575 PrintInstanceMigration(stdout, original_map, result->map()); | 1575 PrintInstanceMigration(stdout, original_map, result->map()); |
| 1576 } | 1576 } |
| 1577 return maybe_result; | 1577 return maybe_result; |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 | 1580 |
| 1581 MaybeObject* JSObject::TryMigrateInstance() { | 1581 MaybeObject* JSObject::TryMigrateInstance() { |
| 1582 Map* new_map = map()->CurrentMapForDeprecated(); | 1582 Map* new_map = map()->CurrentMapForDeprecated(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1858 } | 1858 } |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 | 1861 |
| 1862 bool JSObject::HasFastProperties() { | 1862 bool JSObject::HasFastProperties() { |
| 1863 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); | 1863 ASSERT(properties()->IsDictionary() == map()->is_dictionary_map()); |
| 1864 return !properties()->IsDictionary(); | 1864 return !properties()->IsDictionary(); |
| 1865 } | 1865 } |
| 1866 | 1866 |
| 1867 | 1867 |
| 1868 bool JSObject::TooManyFastProperties(int properties, | 1868 bool JSObject::TooManyFastProperties(StoreFromKeyed store_mode) { |
| 1869 JSObject::StoreFromKeyed store_mode) { | |
| 1870 // Allow extra fast properties if the object has more than | 1869 // Allow extra fast properties if the object has more than |
| 1871 // kFastPropertiesSoftLimit in-object properties. When this is the case, | 1870 // kFastPropertiesSoftLimit in-object properties. When this is the case, it is |
| 1872 // it is very unlikely that the object is being used as a dictionary | 1871 // very unlikely that the object is being used as a dictionary and there is a |
| 1873 // and there is a good chance that allowing more map transitions | 1872 // good chance that allowing more map transitions will be worth it. |
| 1874 // will be worth it. | 1873 Map* map = this->map(); |
| 1875 int inobject = map()->inobject_properties(); | 1874 if (map->unused_property_fields() != 0) return false; |
| 1875 |
| 1876 int inobject = map->inobject_properties(); |
| 1876 | 1877 |
| 1877 int limit; | 1878 int limit; |
| 1878 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) { | 1879 if (store_mode == CERTAINLY_NOT_STORE_FROM_KEYED) { |
| 1879 limit = Max(inobject, kMaxFastProperties); | 1880 limit = Max(inobject, kMaxFastProperties); |
| 1880 } else { | 1881 } else { |
| 1881 limit = Max(inobject, kFastPropertiesSoftLimit); | 1882 limit = Max(inobject, kFastPropertiesSoftLimit); |
| 1882 } | 1883 } |
| 1883 return properties > limit; | 1884 return properties()->length() > limit; |
| 1884 } | 1885 } |
| 1885 | 1886 |
| 1886 | 1887 |
| 1887 void Struct::InitializeBody(int object_size) { | 1888 void Struct::InitializeBody(int object_size) { |
| 1888 Object* value = GetHeap()->undefined_value(); | 1889 Object* value = GetHeap()->undefined_value(); |
| 1889 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 1890 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
| 1890 WRITE_FIELD(this, offset, value); | 1891 WRITE_FIELD(this, offset, value); |
| 1891 } | 1892 } |
| 1892 } | 1893 } |
| 1893 | 1894 |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 return PropertyDetails(Smi::cast(details)); | 2355 return PropertyDetails(Smi::cast(details)); |
| 2355 } | 2356 } |
| 2356 | 2357 |
| 2357 | 2358 |
| 2358 PropertyType DescriptorArray::GetType(int descriptor_number) { | 2359 PropertyType DescriptorArray::GetType(int descriptor_number) { |
| 2359 return GetDetails(descriptor_number).type(); | 2360 return GetDetails(descriptor_number).type(); |
| 2360 } | 2361 } |
| 2361 | 2362 |
| 2362 | 2363 |
| 2363 int DescriptorArray::GetFieldIndex(int descriptor_number) { | 2364 int DescriptorArray::GetFieldIndex(int descriptor_number) { |
| 2365 ASSERT(GetDetails(descriptor_number).type() == FIELD); |
| 2364 return GetDetails(descriptor_number).field_index(); | 2366 return GetDetails(descriptor_number).field_index(); |
| 2365 } | 2367 } |
| 2366 | 2368 |
| 2367 | 2369 |
| 2368 Object* DescriptorArray::GetConstant(int descriptor_number) { | 2370 Object* DescriptorArray::GetConstant(int descriptor_number) { |
| 2369 return GetValue(descriptor_number); | 2371 return GetValue(descriptor_number); |
| 2370 } | 2372 } |
| 2371 | 2373 |
| 2372 | 2374 |
| 2373 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { | 2375 Object* DescriptorArray::GetCallbacksObject(int descriptor_number) { |
| (...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4077 Kind kind = this->kind(); | 4079 Kind kind = this->kind(); |
| 4078 switch (kind) { | 4080 switch (kind) { |
| 4079 #define CASE(name) case name: return true; | 4081 #define CASE(name) case name: return true; |
| 4080 IC_KIND_LIST(CASE) | 4082 IC_KIND_LIST(CASE) |
| 4081 #undef CASE | 4083 #undef CASE |
| 4082 default: return false; | 4084 default: return false; |
| 4083 } | 4085 } |
| 4084 } | 4086 } |
| 4085 | 4087 |
| 4086 | 4088 |
| 4087 bool Code::is_debug_break() { | 4089 bool Code::is_debug_stub() { |
| 4088 return ic_state() == DEBUG_STUB && extra_ic_state() == DEBUG_BREAK; | 4090 return ic_state() == DEBUG_STUB; |
| 4089 } | 4091 } |
| 4090 | 4092 |
| 4091 | 4093 |
| 4092 Code::Flags Code::ComputeFlags(Kind kind, | 4094 Code::Flags Code::ComputeFlags(Kind kind, |
| 4093 InlineCacheState ic_state, | 4095 InlineCacheState ic_state, |
| 4094 ExtraICState extra_ic_state, | 4096 ExtraICState extra_ic_state, |
| 4095 StubType type, | 4097 StubType type, |
| 4096 int argc, | 4098 int argc, |
| 4097 InlineCacheHolderFlag holder) { | 4099 InlineCacheHolderFlag holder) { |
| 4098 ASSERT(argc <= Code::kMaxArguments); | 4100 ASSERT(argc <= Code::kMaxArguments); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4446 kDescriptorOffset) | 4448 kDescriptorOffset) |
| 4447 | 4449 |
| 4448 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) | 4450 ACCESSORS(ExecutableAccessorInfo, getter, Object, kGetterOffset) |
| 4449 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) | 4451 ACCESSORS(ExecutableAccessorInfo, setter, Object, kSetterOffset) |
| 4450 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) | 4452 ACCESSORS(ExecutableAccessorInfo, data, Object, kDataOffset) |
| 4451 | 4453 |
| 4452 ACCESSORS(Box, value, Object, kValueOffset) | 4454 ACCESSORS(Box, value, Object, kValueOffset) |
| 4453 | 4455 |
| 4454 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) | 4456 ACCESSORS(AccessorPair, getter, Object, kGetterOffset) |
| 4455 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) | 4457 ACCESSORS(AccessorPair, setter, Object, kSetterOffset) |
| 4458 ACCESSORS_TO_SMI(AccessorPair, access_flags, kAccessFlagsOffset) |
| 4456 | 4459 |
| 4457 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) | 4460 ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset) |
| 4458 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) | 4461 ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset) |
| 4459 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) | 4462 ACCESSORS(AccessCheckInfo, data, Object, kDataOffset) |
| 4460 | 4463 |
| 4461 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) | 4464 ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset) |
| 4462 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) | 4465 ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset) |
| 4463 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) | 4466 ACCESSORS(InterceptorInfo, query, Object, kQueryOffset) |
| 4464 ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset) | 4467 ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset) |
| 4465 ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset) | 4468 ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4566 | 4569 |
| 4567 | 4570 |
| 4568 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) | 4571 SMI_ACCESSORS(FunctionTemplateInfo, length, kLengthOffset) |
| 4569 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 4572 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
| 4570 kHiddenPrototypeBit) | 4573 kHiddenPrototypeBit) |
| 4571 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) | 4574 BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit) |
| 4572 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, | 4575 BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check, |
| 4573 kNeedsAccessCheckBit) | 4576 kNeedsAccessCheckBit) |
| 4574 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, | 4577 BOOL_ACCESSORS(FunctionTemplateInfo, flag, read_only_prototype, |
| 4575 kReadOnlyPrototypeBit) | 4578 kReadOnlyPrototypeBit) |
| 4579 BOOL_ACCESSORS(FunctionTemplateInfo, flag, remove_prototype, |
| 4580 kRemovePrototypeBit) |
| 4576 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, | 4581 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression, |
| 4577 kIsExpressionBit) | 4582 kIsExpressionBit) |
| 4578 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, | 4583 BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel, |
| 4579 kIsTopLevelBit) | 4584 kIsTopLevelBit) |
| 4580 | 4585 |
| 4581 BOOL_ACCESSORS(SharedFunctionInfo, | 4586 BOOL_ACCESSORS(SharedFunctionInfo, |
| 4582 compiler_hints, | 4587 compiler_hints, |
| 4583 allows_lazy_compilation, | 4588 allows_lazy_compilation, |
| 4584 kAllowLazyCompilation) | 4589 kAllowLazyCompilation) |
| 4585 BOOL_ACCESSORS(SharedFunctionInfo, | 4590 BOOL_ACCESSORS(SharedFunctionInfo, |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4951 return code() == GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile); | 4956 return code() == GetIsolate()->builtins()->builtin(Builtins::kLazyRecompile); |
| 4952 } | 4957 } |
| 4953 | 4958 |
| 4954 | 4959 |
| 4955 bool JSFunction::IsMarkedForInstallingRecompiledCode() { | 4960 bool JSFunction::IsMarkedForInstallingRecompiledCode() { |
| 4956 return code() == GetIsolate()->builtins()->builtin( | 4961 return code() == GetIsolate()->builtins()->builtin( |
| 4957 Builtins::kInstallRecompiledCode); | 4962 Builtins::kInstallRecompiledCode); |
| 4958 } | 4963 } |
| 4959 | 4964 |
| 4960 | 4965 |
| 4961 bool JSFunction::IsMarkedForParallelRecompilation() { | 4966 bool JSFunction::IsMarkedForConcurrentRecompilation() { |
| 4962 return code() == GetIsolate()->builtins()->builtin( | 4967 return code() == GetIsolate()->builtins()->builtin( |
| 4963 Builtins::kParallelRecompile); | 4968 Builtins::kConcurrentRecompile); |
| 4964 } | 4969 } |
| 4965 | 4970 |
| 4966 | 4971 |
| 4967 bool JSFunction::IsInRecompileQueue() { | 4972 bool JSFunction::IsInRecompileQueue() { |
| 4968 return code() == GetIsolate()->builtins()->builtin( | 4973 return code() == GetIsolate()->builtins()->builtin( |
| 4969 Builtins::kInRecompileQueue); | 4974 Builtins::kInRecompileQueue); |
| 4970 } | 4975 } |
| 4971 | 4976 |
| 4972 | 4977 |
| 4973 Code* JSFunction::code() { | 4978 Code* JSFunction::code() { |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5842 } | 5847 } |
| 5843 | 5848 |
| 5844 | 5849 |
| 5845 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { | 5850 bool AccessorInfo::IsCompatibleReceiver(Object* receiver) { |
| 5846 Object* function_template = expected_receiver_type(); | 5851 Object* function_template = expected_receiver_type(); |
| 5847 if (!function_template->IsFunctionTemplateInfo()) return true; | 5852 if (!function_template->IsFunctionTemplateInfo()) return true; |
| 5848 return receiver->IsInstanceOf(FunctionTemplateInfo::cast(function_template)); | 5853 return receiver->IsInstanceOf(FunctionTemplateInfo::cast(function_template)); |
| 5849 } | 5854 } |
| 5850 | 5855 |
| 5851 | 5856 |
| 5857 void AccessorPair::set_access_flags(v8::AccessControl access_control) { |
| 5858 int current = access_flags()->value(); |
| 5859 current = BooleanBit::set(current, |
| 5860 kProhibitsOverwritingBit, |
| 5861 access_control & PROHIBITS_OVERWRITING); |
| 5862 current = BooleanBit::set(current, |
| 5863 kAllCanReadBit, |
| 5864 access_control & ALL_CAN_READ); |
| 5865 current = BooleanBit::set(current, |
| 5866 kAllCanWriteBit, |
| 5867 access_control & ALL_CAN_WRITE); |
| 5868 set_access_flags(Smi::FromInt(current)); |
| 5869 } |
| 5870 |
| 5871 |
| 5872 bool AccessorPair::all_can_read() { |
| 5873 return BooleanBit::get(access_flags(), kAllCanReadBit); |
| 5874 } |
| 5875 |
| 5876 |
| 5877 bool AccessorPair::all_can_write() { |
| 5878 return BooleanBit::get(access_flags(), kAllCanWriteBit); |
| 5879 } |
| 5880 |
| 5881 |
| 5882 bool AccessorPair::prohibits_overwriting() { |
| 5883 return BooleanBit::get(access_flags(), kProhibitsOverwritingBit); |
| 5884 } |
| 5885 |
| 5886 |
| 5852 template<typename Shape, typename Key> | 5887 template<typename Shape, typename Key> |
| 5853 void Dictionary<Shape, Key>::SetEntry(int entry, | 5888 void Dictionary<Shape, Key>::SetEntry(int entry, |
| 5854 Object* key, | 5889 Object* key, |
| 5855 Object* value) { | 5890 Object* value) { |
| 5856 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 5891 SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); |
| 5857 } | 5892 } |
| 5858 | 5893 |
| 5859 | 5894 |
| 5860 template<typename Shape, typename Key> | 5895 template<typename Shape, typename Key> |
| 5861 void Dictionary<Shape, Key>::SetEntry(int entry, | 5896 void Dictionary<Shape, Key>::SetEntry(int entry, |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6257 #undef WRITE_UINT32_FIELD | 6292 #undef WRITE_UINT32_FIELD |
| 6258 #undef READ_SHORT_FIELD | 6293 #undef READ_SHORT_FIELD |
| 6259 #undef WRITE_SHORT_FIELD | 6294 #undef WRITE_SHORT_FIELD |
| 6260 #undef READ_BYTE_FIELD | 6295 #undef READ_BYTE_FIELD |
| 6261 #undef WRITE_BYTE_FIELD | 6296 #undef WRITE_BYTE_FIELD |
| 6262 | 6297 |
| 6263 | 6298 |
| 6264 } } // namespace v8::internal | 6299 } } // namespace v8::internal |
| 6265 | 6300 |
| 6266 #endif // V8_OBJECTS_INL_H_ | 6301 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |