| 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 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 Object* array = READ_FIELD(this, kElementsOffset); | 1209 Object* array = READ_FIELD(this, kElementsOffset); |
| 1210 // In the assert below Dictionary is covered under FixedArray. | 1210 // In the assert below Dictionary is covered under FixedArray. |
| 1211 ASSERT(array->IsFixedArray() || array->IsPixelArray() || | 1211 ASSERT(array->IsFixedArray() || array->IsPixelArray() || |
| 1212 array->IsExternalArray()); | 1212 array->IsExternalArray()); |
| 1213 return reinterpret_cast<HeapObject*>(array); | 1213 return reinterpret_cast<HeapObject*>(array); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 | 1216 |
| 1217 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { | 1217 void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) { |
| 1218 ASSERT(map()->has_fast_elements() == | 1218 ASSERT(map()->has_fast_elements() == |
| 1219 (value->map() == HEAP->fixed_array_map() || | 1219 (value->map() == GetHeap()->fixed_array_map() || |
| 1220 value->map() == HEAP->fixed_cow_array_map())); | 1220 value->map() == GetHeap()->fixed_cow_array_map())); |
| 1221 // In the assert below Dictionary is covered under FixedArray. | 1221 // In the assert below Dictionary is covered under FixedArray. |
| 1222 ASSERT(value->IsFixedArray() || value->IsPixelArray() || | 1222 ASSERT(value->IsFixedArray() || value->IsPixelArray() || |
| 1223 value->IsExternalArray()); | 1223 value->IsExternalArray()); |
| 1224 WRITE_FIELD(this, kElementsOffset, value); | 1224 WRITE_FIELD(this, kElementsOffset, value); |
| 1225 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode); | 1225 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kElementsOffset, mode); |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 | 1228 |
| 1229 void JSObject::initialize_properties() { | 1229 void JSObject::initialize_properties() { |
| 1230 ASSERT(!HEAP->InNewSpace(HEAP->empty_fixed_array())); | 1230 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1231 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); | 1231 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); |
| 1232 } | 1232 } |
| 1233 | 1233 |
| 1234 | 1234 |
| 1235 void JSObject::initialize_elements() { | 1235 void JSObject::initialize_elements() { |
| 1236 ASSERT(map()->has_fast_elements()); | 1236 ASSERT(map()->has_fast_elements()); |
| 1237 ASSERT(!HEAP->InNewSpace(HEAP->empty_fixed_array())); | 1237 ASSERT(!GetHeap()->InNewSpace(GetHeap()->empty_fixed_array())); |
| 1238 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array()); | 1238 WRITE_FIELD(this, kElementsOffset, GetHeap()->empty_fixed_array()); |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 | 1241 |
| 1242 Object* JSObject::ResetElements() { | 1242 Object* JSObject::ResetElements() { |
| 1243 Object* obj = map()->GetFastElementsMap(); | 1243 Object* obj = map()->GetFastElementsMap(); |
| 1244 if (obj->IsFailure()) return obj; | 1244 if (obj->IsFailure()) return obj; |
| 1245 set_map(Map::cast(obj)); | 1245 set_map(Map::cast(obj)); |
| 1246 initialize_elements(); | 1246 initialize_elements(); |
| 1247 return this; | 1247 return this; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1579 if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) { | 1579 if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) { |
| 1580 return LinearSearch(name, nof); | 1580 return LinearSearch(name, nof); |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 // Slow case: perform binary search. | 1583 // Slow case: perform binary search. |
| 1584 return BinarySearch(name, 0, nof - 1); | 1584 return BinarySearch(name, 0, nof - 1); |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 | 1587 |
| 1588 int DescriptorArray::SearchWithCache(String* name) { | 1588 int DescriptorArray::SearchWithCache(String* name) { |
| 1589 int number = HEAP->isolate()->descriptor_lookup_cache()->Lookup(this, name); | 1589 int number = GetIsolate()->descriptor_lookup_cache()->Lookup(this, name); |
| 1590 if (number == DescriptorLookupCache::kAbsent) { | 1590 if (number == DescriptorLookupCache::kAbsent) { |
| 1591 number = Search(name); | 1591 number = Search(name); |
| 1592 HEAP->isolate()->descriptor_lookup_cache()->Update(this, name, number); | 1592 GetIsolate()->descriptor_lookup_cache()->Update(this, name, number); |
| 1593 } | 1593 } |
| 1594 return number; | 1594 return number; |
| 1595 } | 1595 } |
| 1596 | 1596 |
| 1597 | 1597 |
| 1598 String* DescriptorArray::GetKey(int descriptor_number) { | 1598 String* DescriptorArray::GetKey(int descriptor_number) { |
| 1599 ASSERT(descriptor_number < number_of_descriptors()); | 1599 ASSERT(descriptor_number < number_of_descriptors()); |
| 1600 return String::cast(get(ToKeyIndex(descriptor_number))); | 1600 return String::cast(get(ToKeyIndex(descriptor_number))); |
| 1601 } | 1601 } |
| 1602 | 1602 |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 | 2852 |
| 2853 | 2853 |
| 2854 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, | 2854 void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value, |
| 2855 WriteBarrierMode mode) { | 2855 WriteBarrierMode mode) { |
| 2856 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); | 2856 WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value)); |
| 2857 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kScopeInfoOffset, mode); | 2857 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kScopeInfoOffset, mode); |
| 2858 } | 2858 } |
| 2859 | 2859 |
| 2860 | 2860 |
| 2861 bool SharedFunctionInfo::is_compiled() { | 2861 bool SharedFunctionInfo::is_compiled() { |
| 2862 return code() != HEAP->isolate()->builtins()->builtin(Builtins::LazyCompile); | 2862 return code() != |
| 2863 Isolate::Current()->builtins()->builtin(Builtins::LazyCompile); |
| 2863 } | 2864 } |
| 2864 | 2865 |
| 2865 | 2866 |
| 2866 bool SharedFunctionInfo::IsApiFunction() { | 2867 bool SharedFunctionInfo::IsApiFunction() { |
| 2867 return function_data()->IsFunctionTemplateInfo(); | 2868 return function_data()->IsFunctionTemplateInfo(); |
| 2868 } | 2869 } |
| 2869 | 2870 |
| 2870 | 2871 |
| 2871 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 2872 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { |
| 2872 ASSERT(IsApiFunction()); | 2873 ASSERT(IsApiFunction()); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2987 if (map()->has_non_instance_prototype()) return map()->constructor(); | 2988 if (map()->has_non_instance_prototype()) return map()->constructor(); |
| 2988 return instance_prototype(); | 2989 return instance_prototype(); |
| 2989 } | 2990 } |
| 2990 | 2991 |
| 2991 bool JSFunction::should_have_prototype() { | 2992 bool JSFunction::should_have_prototype() { |
| 2992 return map()->function_with_prototype(); | 2993 return map()->function_with_prototype(); |
| 2993 } | 2994 } |
| 2994 | 2995 |
| 2995 | 2996 |
| 2996 bool JSFunction::is_compiled() { | 2997 bool JSFunction::is_compiled() { |
| 2997 return code() != HEAP->isolate()->builtins()->builtin(Builtins::LazyCompile); | 2998 return code() != GetIsolate()->builtins()->builtin(Builtins::LazyCompile); |
| 2998 } | 2999 } |
| 2999 | 3000 |
| 3000 | 3001 |
| 3001 int JSFunction::NumberOfLiterals() { | 3002 int JSFunction::NumberOfLiterals() { |
| 3002 return literals()->length(); | 3003 return literals()->length(); |
| 3003 } | 3004 } |
| 3004 | 3005 |
| 3005 | 3006 |
| 3006 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { | 3007 Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) { |
| 3007 ASSERT(0 <= id && id < kJSBuiltinsCount); | 3008 ASSERT(0 <= id && id < kJSBuiltinsCount); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 bool JSObject::AllowsSetElementsLength() { | 3265 bool JSObject::AllowsSetElementsLength() { |
| 3265 bool result = elements()->IsFixedArray(); | 3266 bool result = elements()->IsFixedArray(); |
| 3266 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); | 3267 ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements())); |
| 3267 return result; | 3268 return result; |
| 3268 } | 3269 } |
| 3269 | 3270 |
| 3270 | 3271 |
| 3271 Object* JSObject::EnsureWritableFastElements() { | 3272 Object* JSObject::EnsureWritableFastElements() { |
| 3272 ASSERT(HasFastElements()); | 3273 ASSERT(HasFastElements()); |
| 3273 FixedArray* elems = FixedArray::cast(elements()); | 3274 FixedArray* elems = FixedArray::cast(elements()); |
| 3274 if (elems->map() != HEAP->fixed_cow_array_map()) return elems; | 3275 Isolate* isolate = GetIsolate(); |
| 3275 Object* writable_elems = HEAP->CopyFixedArrayWithMap(elems, | 3276 if (elems->map() != isolate->heap()->fixed_cow_array_map()) return elems; |
| 3276 HEAP->fixed_array_map()); | 3277 Object* writable_elems = isolate->heap()->CopyFixedArrayWithMap( |
| 3278 elems, isolate->heap()->fixed_array_map()); |
| 3277 if (writable_elems->IsFailure()) return writable_elems; | 3279 if (writable_elems->IsFailure()) return writable_elems; |
| 3278 set_elements(FixedArray::cast(writable_elems)); | 3280 set_elements(FixedArray::cast(writable_elems)); |
| 3279 COUNTERS->cow_arrays_converted()->Increment(); | 3281 isolate->counters()->cow_arrays_converted()->Increment(); |
| 3280 return writable_elems; | 3282 return writable_elems; |
| 3281 } | 3283 } |
| 3282 | 3284 |
| 3283 | 3285 |
| 3284 StringDictionary* JSObject::property_dictionary() { | 3286 StringDictionary* JSObject::property_dictionary() { |
| 3285 ASSERT(!HasFastProperties()); | 3287 ASSERT(!HasFastProperties()); |
| 3286 return StringDictionary::cast(properties()); | 3288 return StringDictionary::cast(properties()); |
| 3287 } | 3289 } |
| 3288 | 3290 |
| 3289 | 3291 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 #undef WRITE_INT_FIELD | 3639 #undef WRITE_INT_FIELD |
| 3638 #undef READ_SHORT_FIELD | 3640 #undef READ_SHORT_FIELD |
| 3639 #undef WRITE_SHORT_FIELD | 3641 #undef WRITE_SHORT_FIELD |
| 3640 #undef READ_BYTE_FIELD | 3642 #undef READ_BYTE_FIELD |
| 3641 #undef WRITE_BYTE_FIELD | 3643 #undef WRITE_BYTE_FIELD |
| 3642 | 3644 |
| 3643 | 3645 |
| 3644 } } // namespace v8::internal | 3646 } } // namespace v8::internal |
| 3645 | 3647 |
| 3646 #endif // V8_OBJECTS_INL_H_ | 3648 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |