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