| 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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 value_ &= ~kOverflowMask; | 985 value_ &= ~kOverflowMask; |
| 986 } | 986 } |
| 987 | 987 |
| 988 | 988 |
| 989 MapWord MapWord::EncodeAddress(Address map_address, int offset) { | 989 MapWord MapWord::EncodeAddress(Address map_address, int offset) { |
| 990 // Offset is the distance in live bytes from the first live object in the | 990 // Offset is the distance in live bytes from the first live object in the |
| 991 // same page. The offset between two objects in the same page should not | 991 // same page. The offset between two objects in the same page should not |
| 992 // exceed the object area size of a page. | 992 // exceed the object area size of a page. |
| 993 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); | 993 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); |
| 994 | 994 |
| 995 int compact_offset = offset >> kObjectAlignmentBits; | 995 uintptr_t compact_offset = offset >> kObjectAlignmentBits; |
| 996 ASSERT(compact_offset < (1 << kForwardingOffsetBits)); | 996 ASSERT(compact_offset < (1 << kForwardingOffsetBits)); |
| 997 | 997 |
| 998 Page* map_page = Page::FromAddress(map_address); | 998 Page* map_page = Page::FromAddress(map_address); |
| 999 ASSERT_MAP_PAGE_INDEX(map_page->mc_page_index); | 999 ASSERT_MAP_PAGE_INDEX(map_page->mc_page_index); |
| 1000 | 1000 |
| 1001 int map_page_offset = | 1001 uintptr_t map_page_offset = |
| 1002 map_page->Offset(map_address) >> kObjectAlignmentBits; | 1002 map_page->Offset(map_address) >> kMapAlignmentBits; |
| 1003 | 1003 |
| 1004 uintptr_t encoding = | 1004 uintptr_t encoding = |
| 1005 (compact_offset << kForwardingOffsetShift) | | 1005 (compact_offset << kForwardingOffsetShift) | |
| 1006 (map_page_offset << kMapPageOffsetShift) | | 1006 (map_page_offset << kMapPageOffsetShift) | |
| 1007 (map_page->mc_page_index << kMapPageIndexShift); | 1007 (map_page->mc_page_index << kMapPageIndexShift); |
| 1008 return MapWord(encoding); | 1008 return MapWord(encoding); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 | 1011 |
| 1012 Address MapWord::DecodeMapAddress(MapSpace* map_space) { | 1012 Address MapWord::DecodeMapAddress(MapSpace* map_space) { |
| 1013 int map_page_index = | 1013 int map_page_index = |
| 1014 static_cast<int>((value_ & kMapPageIndexMask) >> kMapPageIndexShift); | 1014 static_cast<int>((value_ & kMapPageIndexMask) >> kMapPageIndexShift); |
| 1015 ASSERT_MAP_PAGE_INDEX(map_page_index); | 1015 ASSERT_MAP_PAGE_INDEX(map_page_index); |
| 1016 | 1016 |
| 1017 int map_page_offset = static_cast<int>( | 1017 int map_page_offset = static_cast<int>( |
| 1018 ((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) | 1018 ((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) << |
| 1019 << kObjectAlignmentBits); | 1019 kMapAlignmentBits); |
| 1020 | 1020 |
| 1021 return (map_space->PageAddress(map_page_index) + map_page_offset); | 1021 return (map_space->PageAddress(map_page_index) + map_page_offset); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 | 1024 |
| 1025 int MapWord::DecodeOffset() { | 1025 int MapWord::DecodeOffset() { |
| 1026 // The offset field is represented in the kForwardingOffsetBits | 1026 // The offset field is represented in the kForwardingOffsetBits |
| 1027 // most-significant bits. | 1027 // most-significant bits. |
| 1028 int offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits; | 1028 int offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits; |
| 1029 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); | 1029 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2480 ACCESSORS(Script, name, Object, kNameOffset) | 2480 ACCESSORS(Script, name, Object, kNameOffset) |
| 2481 ACCESSORS(Script, id, Object, kIdOffset) | 2481 ACCESSORS(Script, id, Object, kIdOffset) |
| 2482 ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset) | 2482 ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset) |
| 2483 ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset) | 2483 ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset) |
| 2484 ACCESSORS(Script, data, Object, kDataOffset) | 2484 ACCESSORS(Script, data, Object, kDataOffset) |
| 2485 ACCESSORS(Script, context_data, Object, kContextOffset) | 2485 ACCESSORS(Script, context_data, Object, kContextOffset) |
| 2486 ACCESSORS(Script, wrapper, Proxy, kWrapperOffset) | 2486 ACCESSORS(Script, wrapper, Proxy, kWrapperOffset) |
| 2487 ACCESSORS(Script, type, Smi, kTypeOffset) | 2487 ACCESSORS(Script, type, Smi, kTypeOffset) |
| 2488 ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset) | 2488 ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset) |
| 2489 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) | 2489 ACCESSORS(Script, line_ends, Object, kLineEndsOffset) |
| 2490 ACCESSORS(Script, eval_from_function, Object, kEvalFromFunctionOffset) | 2490 ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset) |
| 2491 ACCESSORS(Script, eval_from_instructions_offset, Smi, | 2491 ACCESSORS(Script, eval_from_instructions_offset, Smi, |
| 2492 kEvalFrominstructionsOffsetOffset) | 2492 kEvalFrominstructionsOffsetOffset) |
| 2493 | 2493 |
| 2494 #ifdef ENABLE_DEBUGGER_SUPPORT | 2494 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2495 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) | 2495 ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex) |
| 2496 ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex) | 2496 ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex) |
| 2497 ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex) | 2497 ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex) |
| 2498 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) | 2498 ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex) |
| 2499 | 2499 |
| 2500 ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex) | 2500 ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex) |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3178 #undef WRITE_INT_FIELD | 3178 #undef WRITE_INT_FIELD |
| 3179 #undef READ_SHORT_FIELD | 3179 #undef READ_SHORT_FIELD |
| 3180 #undef WRITE_SHORT_FIELD | 3180 #undef WRITE_SHORT_FIELD |
| 3181 #undef READ_BYTE_FIELD | 3181 #undef READ_BYTE_FIELD |
| 3182 #undef WRITE_BYTE_FIELD | 3182 #undef WRITE_BYTE_FIELD |
| 3183 | 3183 |
| 3184 | 3184 |
| 3185 } } // namespace v8::internal | 3185 } } // namespace v8::internal |
| 3186 | 3186 |
| 3187 #endif // V8_OBJECTS_INL_H_ | 3187 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |