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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 index -= map()->inobject_properties(); | 1336 index -= map()->inobject_properties(); |
1337 ASSERT(index < 0); | 1337 ASSERT(index < 0); |
1338 int offset = map()->instance_size() + (index * kPointerSize); | 1338 int offset = map()->instance_size() + (index * kPointerSize); |
1339 WRITE_FIELD(this, offset, value); | 1339 WRITE_FIELD(this, offset, value); |
1340 CONDITIONAL_WRITE_BARRIER(this, offset, mode); | 1340 CONDITIONAL_WRITE_BARRIER(this, offset, mode); |
1341 return value; | 1341 return value; |
1342 } | 1342 } |
1343 | 1343 |
1344 | 1344 |
1345 | 1345 |
1346 void JSObject::InitializeBody(int object_size) { | 1346 void JSObject::InitializeBody(int object_size, Object* value) { |
1347 Object* value = Heap::undefined_value(); | 1347 ASSERT(!value->IsHeapObject() || !Heap::InNewSpace(value)); |
1348 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 1348 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
1349 WRITE_FIELD(this, offset, value); | 1349 WRITE_FIELD(this, offset, value); |
1350 } | 1350 } |
1351 } | 1351 } |
1352 | 1352 |
1353 | 1353 |
1354 bool JSObject::HasFastProperties() { | 1354 bool JSObject::HasFastProperties() { |
1355 return !properties()->IsDictionary(); | 1355 return !properties()->IsDictionary(); |
1356 } | 1356 } |
1357 | 1357 |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 } else { | 2272 } else { |
2273 set_bit_field2(bit_field2() & ~(1 << kIsExtensible)); | 2273 set_bit_field2(bit_field2() & ~(1 << kIsExtensible)); |
2274 } | 2274 } |
2275 } | 2275 } |
2276 | 2276 |
2277 bool Map::is_extensible() { | 2277 bool Map::is_extensible() { |
2278 return ((1 << kIsExtensible) & bit_field2()) != 0; | 2278 return ((1 << kIsExtensible) & bit_field2()) != 0; |
2279 } | 2279 } |
2280 | 2280 |
2281 | 2281 |
| 2282 void Map::set_attached_to_shared_function_info(bool value) { |
| 2283 if (value) { |
| 2284 set_bit_field2(bit_field2() | (1 << kAttachedToSharedFunctionInfo)); |
| 2285 } else { |
| 2286 set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo)); |
| 2287 } |
| 2288 } |
| 2289 |
| 2290 bool Map::attached_to_shared_function_info() { |
| 2291 return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0; |
| 2292 } |
| 2293 |
| 2294 |
| 2295 JSFunction* Map::unchecked_constructor() { |
| 2296 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); |
| 2297 } |
| 2298 |
2282 | 2299 |
2283 Code::Flags Code::flags() { | 2300 Code::Flags Code::flags() { |
2284 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 2301 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); |
2285 } | 2302 } |
2286 | 2303 |
2287 | 2304 |
2288 void Code::set_flags(Code::Flags flags) { | 2305 void Code::set_flags(Code::Flags flags) { |
2289 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= (kFlagsKindMask >> kFlagsKindShift)+1); | 2306 STATIC_ASSERT(Code::NUMBER_OF_KINDS <= (kFlagsKindMask >> kFlagsKindShift)+1); |
2290 // Make sure that all call stubs have an arguments count. | 2307 // Make sure that all call stubs have an arguments count. |
2291 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && | 2308 ASSERT((ExtractKindFromFlags(flags) != CALL_IC && |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) | 2581 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
2565 | 2582 |
2566 ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex) | 2583 ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex) |
2567 ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex) | 2584 ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex) |
2568 ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex) | 2585 ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex) |
2569 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) | 2586 ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex) |
2570 #endif | 2587 #endif |
2571 | 2588 |
2572 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) | 2589 ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset) |
2573 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) | 2590 ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset) |
| 2591 ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset) |
2574 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, | 2592 ACCESSORS(SharedFunctionInfo, instance_class_name, Object, |
2575 kInstanceClassNameOffset) | 2593 kInstanceClassNameOffset) |
2576 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) | 2594 ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset) |
2577 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) | 2595 ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset) |
2578 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) | 2596 ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset) |
2579 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) | 2597 ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset) |
2580 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object, | 2598 ACCESSORS(SharedFunctionInfo, this_property_assignments, Object, |
2581 kThisPropertyAssignmentsOffset) | 2599 kThisPropertyAssignmentsOffset) |
2582 | 2600 |
2583 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, | 2601 BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 | 2673 |
2656 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, function_token_position, | 2674 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, function_token_position, |
2657 kFunctionTokenPositionOffset) | 2675 kFunctionTokenPositionOffset) |
2658 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, compiler_hints, | 2676 PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, compiler_hints, |
2659 kCompilerHintsOffset) | 2677 kCompilerHintsOffset) |
2660 | 2678 |
2661 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, this_property_assignments_count, | 2679 PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, this_property_assignments_count, |
2662 kThisPropertyAssignmentsCountOffset) | 2680 kThisPropertyAssignmentsCountOffset) |
2663 #endif | 2681 #endif |
2664 | 2682 |
| 2683 |
| 2684 int SharedFunctionInfo::construction_count() { |
| 2685 return READ_BYTE_FIELD(this, kConstructionCountOffset); |
| 2686 } |
| 2687 |
| 2688 |
| 2689 void SharedFunctionInfo::set_construction_count(int value) { |
| 2690 ASSERT(0 <= value && value < 256); |
| 2691 WRITE_BYTE_FIELD(this, kConstructionCountOffset, static_cast<byte>(value)); |
| 2692 } |
| 2693 |
| 2694 |
| 2695 bool SharedFunctionInfo::live_objects_may_exist() { |
| 2696 return (compiler_hints() & (1 << kLiveObjectsMayExist)) != 0; |
| 2697 } |
| 2698 |
| 2699 |
| 2700 void SharedFunctionInfo::set_live_objects_may_exist(bool value) { |
| 2701 if (value) { |
| 2702 set_compiler_hints(compiler_hints() | (1 << kLiveObjectsMayExist)); |
| 2703 } else { |
| 2704 set_compiler_hints(compiler_hints() & ~(1 << kLiveObjectsMayExist)); |
| 2705 } |
| 2706 } |
| 2707 |
| 2708 |
| 2709 bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() { |
| 2710 return initial_map() != Heap::undefined_value(); |
| 2711 } |
| 2712 |
| 2713 |
2665 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | 2714 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) |
2666 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | 2715 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) |
2667 | 2716 |
2668 bool Script::HasValidSource() { | 2717 bool Script::HasValidSource() { |
2669 Object* src = this->source(); | 2718 Object* src = this->source(); |
2670 if (!src->IsString()) return true; | 2719 if (!src->IsString()) return true; |
2671 String* src_str = String::cast(src); | 2720 String* src_str = String::cast(src); |
2672 if (!StringShape(src_str).IsExternal()) return true; | 2721 if (!StringShape(src_str).IsExternal()) return true; |
2673 if (src_str->IsAsciiRepresentation()) { | 2722 if (src_str->IsAsciiRepresentation()) { |
2674 return ExternalAsciiString::cast(src)->resource() != NULL; | 2723 return ExternalAsciiString::cast(src)->resource() != NULL; |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3489 #undef WRITE_INT_FIELD | 3538 #undef WRITE_INT_FIELD |
3490 #undef READ_SHORT_FIELD | 3539 #undef READ_SHORT_FIELD |
3491 #undef WRITE_SHORT_FIELD | 3540 #undef WRITE_SHORT_FIELD |
3492 #undef READ_BYTE_FIELD | 3541 #undef READ_BYTE_FIELD |
3493 #undef WRITE_BYTE_FIELD | 3542 #undef WRITE_BYTE_FIELD |
3494 | 3543 |
3495 | 3544 |
3496 } } // namespace v8::internal | 3545 } } // namespace v8::internal |
3497 | 3546 |
3498 #endif // V8_OBJECTS_INL_H_ | 3547 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |