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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 bool Object::IsSymbolTable() { | 557 bool Object::IsSymbolTable() { |
558 return IsHashTable() && this == Heap::raw_unchecked_symbol_table(); | 558 return IsHashTable() && this == Heap::raw_unchecked_symbol_table(); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 bool Object::IsCompilationCacheTable() { | 562 bool Object::IsCompilationCacheTable() { |
563 return IsHashTable(); | 563 return IsHashTable(); |
564 } | 564 } |
565 | 565 |
566 | 566 |
567 bool Object::IsCodeCacheHashTable() { | |
568 return IsHashTable(); | |
569 } | |
570 | |
571 | |
572 bool Object::IsMapCache() { | 567 bool Object::IsMapCache() { |
573 return IsHashTable(); | 568 return IsHashTable(); |
574 } | 569 } |
575 | 570 |
576 | 571 |
577 bool Object::IsPrimitive() { | 572 bool Object::IsPrimitive() { |
578 return IsOddball() || IsNumber() || IsString(); | 573 return IsOddball() || IsNumber() || IsString(); |
579 } | 574 } |
580 | 575 |
581 | 576 |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 | 1556 |
1562 | 1557 |
1563 // ------------------------------------ | 1558 // ------------------------------------ |
1564 // Cast operations | 1559 // Cast operations |
1565 | 1560 |
1566 | 1561 |
1567 CAST_ACCESSOR(FixedArray) | 1562 CAST_ACCESSOR(FixedArray) |
1568 CAST_ACCESSOR(DescriptorArray) | 1563 CAST_ACCESSOR(DescriptorArray) |
1569 CAST_ACCESSOR(SymbolTable) | 1564 CAST_ACCESSOR(SymbolTable) |
1570 CAST_ACCESSOR(CompilationCacheTable) | 1565 CAST_ACCESSOR(CompilationCacheTable) |
1571 CAST_ACCESSOR(CodeCacheHashTable) | |
1572 CAST_ACCESSOR(MapCache) | 1566 CAST_ACCESSOR(MapCache) |
1573 CAST_ACCESSOR(String) | 1567 CAST_ACCESSOR(String) |
1574 CAST_ACCESSOR(SeqString) | 1568 CAST_ACCESSOR(SeqString) |
1575 CAST_ACCESSOR(SeqAsciiString) | 1569 CAST_ACCESSOR(SeqAsciiString) |
1576 CAST_ACCESSOR(SeqTwoByteString) | 1570 CAST_ACCESSOR(SeqTwoByteString) |
1577 CAST_ACCESSOR(ConsString) | 1571 CAST_ACCESSOR(ConsString) |
1578 CAST_ACCESSOR(ExternalString) | 1572 CAST_ACCESSOR(ExternalString) |
1579 CAST_ACCESSOR(ExternalAsciiString) | 1573 CAST_ACCESSOR(ExternalAsciiString) |
1580 CAST_ACCESSOR(ExternalTwoByteString) | 1574 CAST_ACCESSOR(ExternalTwoByteString) |
1581 CAST_ACCESSOR(JSObject) | 1575 CAST_ACCESSOR(JSObject) |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2254 | 2248 |
2255 void Map::set_prototype(Object* value, WriteBarrierMode mode) { | 2249 void Map::set_prototype(Object* value, WriteBarrierMode mode) { |
2256 ASSERT(value->IsNull() || value->IsJSObject()); | 2250 ASSERT(value->IsNull() || value->IsJSObject()); |
2257 WRITE_FIELD(this, kPrototypeOffset, value); | 2251 WRITE_FIELD(this, kPrototypeOffset, value); |
2258 CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, mode); | 2252 CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, mode); |
2259 } | 2253 } |
2260 | 2254 |
2261 | 2255 |
2262 ACCESSORS(Map, instance_descriptors, DescriptorArray, | 2256 ACCESSORS(Map, instance_descriptors, DescriptorArray, |
2263 kInstanceDescriptorsOffset) | 2257 kInstanceDescriptorsOffset) |
2264 ACCESSORS(Map, code_cache, Object, kCodeCacheOffset) | 2258 ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset) |
2265 ACCESSORS(Map, constructor, Object, kConstructorOffset) | 2259 ACCESSORS(Map, constructor, Object, kConstructorOffset) |
2266 | 2260 |
2267 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) | 2261 ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset) |
2268 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) | 2262 ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset) |
2269 | 2263 |
2270 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) | 2264 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset) |
2271 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) | 2265 ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset) |
2272 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) | 2266 ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset) |
2273 | 2267 |
2274 ACCESSORS(JSGlobalProxy, context, Object, kContextOffset) | 2268 ACCESSORS(JSGlobalProxy, context, Object, kContextOffset) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 kStartPositionAndTypeOffset) | 2386 kStartPositionAndTypeOffset) |
2393 INT_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) | 2387 INT_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset) |
2394 INT_ACCESSORS(SharedFunctionInfo, function_token_position, | 2388 INT_ACCESSORS(SharedFunctionInfo, function_token_position, |
2395 kFunctionTokenPositionOffset) | 2389 kFunctionTokenPositionOffset) |
2396 INT_ACCESSORS(SharedFunctionInfo, compiler_hints, | 2390 INT_ACCESSORS(SharedFunctionInfo, compiler_hints, |
2397 kCompilerHintsOffset) | 2391 kCompilerHintsOffset) |
2398 INT_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, | 2392 INT_ACCESSORS(SharedFunctionInfo, this_property_assignments_count, |
2399 kThisPropertyAssignmentsCountOffset) | 2393 kThisPropertyAssignmentsCountOffset) |
2400 | 2394 |
2401 | 2395 |
2402 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | |
2403 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | |
2404 | |
2405 bool Script::HasValidSource() { | 2396 bool Script::HasValidSource() { |
2406 Object* src = this->source(); | 2397 Object* src = this->source(); |
2407 if (!src->IsString()) return true; | 2398 if (!src->IsString()) return true; |
2408 String* src_str = String::cast(src); | 2399 String* src_str = String::cast(src); |
2409 if (!StringShape(src_str).IsExternal()) return true; | 2400 if (!StringShape(src_str).IsExternal()) return true; |
2410 if (src_str->IsAsciiRepresentation()) { | 2401 if (src_str->IsAsciiRepresentation()) { |
2411 return ExternalAsciiString::cast(src)->resource() != NULL; | 2402 return ExternalAsciiString::cast(src)->resource() != NULL; |
2412 } else if (src_str->IsTwoByteRepresentation()) { | 2403 } else if (src_str->IsTwoByteRepresentation()) { |
2413 return ExternalTwoByteString::cast(src)->resource() != NULL; | 2404 return ExternalTwoByteString::cast(src)->resource() != NULL; |
2414 } | 2405 } |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 FixedArray::set(index, key, mode); | 2986 FixedArray::set(index, key, mode); |
2996 FixedArray::set(index+1, value, mode); | 2987 FixedArray::set(index+1, value, mode); |
2997 FixedArray::fast_set(this, index+2, details.AsSmi()); | 2988 FixedArray::fast_set(this, index+2, details.AsSmi()); |
2998 } | 2989 } |
2999 | 2990 |
3000 | 2991 |
3001 void Map::ClearCodeCache() { | 2992 void Map::ClearCodeCache() { |
3002 // No write barrier is needed since empty_fixed_array is not in new space. | 2993 // No write barrier is needed since empty_fixed_array is not in new space. |
3003 // Please note this function is used during marking: | 2994 // Please note this function is used during marking: |
3004 // - MarkCompactCollector::MarkUnmarkedObject | 2995 // - MarkCompactCollector::MarkUnmarkedObject |
3005 ASSERT(!Heap::InNewSpace(Heap::undefined_value())); | 2996 ASSERT(!Heap::InNewSpace(Heap::raw_unchecked_empty_fixed_array())); |
3006 WRITE_FIELD(this, kCodeCacheOffset, Heap::undefined_value()); | 2997 WRITE_FIELD(this, kCodeCacheOffset, Heap::raw_unchecked_empty_fixed_array()); |
3007 } | 2998 } |
3008 | 2999 |
3009 | 3000 |
3010 void JSArray::EnsureSize(int required_size) { | 3001 void JSArray::EnsureSize(int required_size) { |
3011 ASSERT(HasFastElements()); | 3002 ASSERT(HasFastElements()); |
3012 Array* elts = elements(); | 3003 Array* elts = elements(); |
3013 const int kArraySizeThatFitsComfortablyInNewSpace = 128; | 3004 const int kArraySizeThatFitsComfortablyInNewSpace = 128; |
3014 if (elts->length() < required_size) { | 3005 if (elts->length() < required_size) { |
3015 // Doubling in size would be overkill, but leave some slack to avoid | 3006 // Doubling in size would be overkill, but leave some slack to avoid |
3016 // constantly growing. | 3007 // constantly growing. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3059 #undef WRITE_INT_FIELD | 3050 #undef WRITE_INT_FIELD |
3060 #undef READ_SHORT_FIELD | 3051 #undef READ_SHORT_FIELD |
3061 #undef WRITE_SHORT_FIELD | 3052 #undef WRITE_SHORT_FIELD |
3062 #undef READ_BYTE_FIELD | 3053 #undef READ_BYTE_FIELD |
3063 #undef WRITE_BYTE_FIELD | 3054 #undef WRITE_BYTE_FIELD |
3064 | 3055 |
3065 | 3056 |
3066 } } // namespace v8::internal | 3057 } } // namespace v8::internal |
3067 | 3058 |
3068 #endif // V8_OBJECTS_INL_H_ | 3059 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |