| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2916 AllocationUtils::GetAllocationLimitReference(isolate(), flags); | 2916 AllocationUtils::GetAllocationLimitReference(isolate(), flags); |
| 2917 | 2917 |
| 2918 intptr_t top = | 2918 intptr_t top = |
| 2919 reinterpret_cast<intptr_t>(allocation_top.address()); | 2919 reinterpret_cast<intptr_t>(allocation_top.address()); |
| 2920 intptr_t limit = | 2920 intptr_t limit = |
| 2921 reinterpret_cast<intptr_t>(allocation_limit.address()); | 2921 reinterpret_cast<intptr_t>(allocation_limit.address()); |
| 2922 ASSERT((limit - top) == kPointerSize); | 2922 ASSERT((limit - top) == kPointerSize); |
| 2923 | 2923 |
| 2924 // Set up allocation top address and object size registers. | 2924 // Set up allocation top address and object size registers. |
| 2925 Register topaddr = scratch1; | 2925 Register topaddr = scratch1; |
| 2926 Register obj_size_reg = scratch2; | |
| 2927 li(topaddr, Operand(allocation_top)); | 2926 li(topaddr, Operand(allocation_top)); |
| 2928 li(obj_size_reg, Operand(object_size)); | |
| 2929 | 2927 |
| 2930 // This code stores a temporary value in t9. | 2928 // This code stores a temporary value in t9. |
| 2931 if ((flags & RESULT_CONTAINS_TOP) == 0) { | 2929 if ((flags & RESULT_CONTAINS_TOP) == 0) { |
| 2932 // Load allocation top into result and allocation limit into t9. | 2930 // Load allocation top into result and allocation limit into t9. |
| 2933 lw(result, MemOperand(topaddr)); | 2931 lw(result, MemOperand(topaddr)); |
| 2934 lw(t9, MemOperand(topaddr, kPointerSize)); | 2932 lw(t9, MemOperand(topaddr, kPointerSize)); |
| 2935 } else { | 2933 } else { |
| 2936 if (emit_debug_code()) { | 2934 if (emit_debug_code()) { |
| 2937 // Assert that result actually contains top on entry. t9 is used | 2935 // Assert that result actually contains top on entry. t9 is used |
| 2938 // immediately below so this use of t9 does not cause difference with | 2936 // immediately below so this use of t9 does not cause difference with |
| 2939 // respect to register content between debug and release mode. | 2937 // respect to register content between debug and release mode. |
| 2940 lw(t9, MemOperand(topaddr)); | 2938 lw(t9, MemOperand(topaddr)); |
| 2941 Check(eq, kUnexpectedAllocationTop, result, Operand(t9)); | 2939 Check(eq, kUnexpectedAllocationTop, result, Operand(t9)); |
| 2942 } | 2940 } |
| 2943 // Load allocation limit into t9. Result already contains allocation top. | 2941 // Load allocation limit into t9. Result already contains allocation top. |
| 2944 lw(t9, MemOperand(topaddr, limit - top)); | 2942 lw(t9, MemOperand(topaddr, limit - top)); |
| 2945 } | 2943 } |
| 2946 | 2944 |
| 2945 if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| 2946 // Align the next allocation. Storing the filler map without checking top is |
| 2947 // always safe because the limit of the heap is always aligned. |
| 2948 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); |
| 2949 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
| 2950 And(scratch2, result, Operand(kDoubleAlignmentMask)); |
| 2951 Label aligned; |
| 2952 Branch(&aligned, eq, scratch2, Operand(zero_reg)); |
| 2953 li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map())); |
| 2954 sw(scratch2, MemOperand(result)); |
| 2955 Addu(result, result, Operand(kDoubleSize / 2)); |
| 2956 bind(&aligned); |
| 2957 } |
| 2958 |
| 2947 // Calculate new top and bail out if new space is exhausted. Use result | 2959 // Calculate new top and bail out if new space is exhausted. Use result |
| 2948 // to calculate the new top. | 2960 // to calculate the new top. |
| 2949 Addu(scratch2, result, Operand(obj_size_reg)); | 2961 Addu(scratch2, result, Operand(object_size)); |
| 2950 Branch(gc_required, Ugreater, scratch2, Operand(t9)); | 2962 Branch(gc_required, Ugreater, scratch2, Operand(t9)); |
| 2951 sw(scratch2, MemOperand(topaddr)); | 2963 sw(scratch2, MemOperand(topaddr)); |
| 2952 | 2964 |
| 2953 // Tag object if requested. | 2965 // Tag object if requested. |
| 2954 if ((flags & TAG_OBJECT) != 0) { | 2966 if ((flags & TAG_OBJECT) != 0) { |
| 2955 Addu(result, result, Operand(kHeapObjectTag)); | 2967 Addu(result, result, Operand(kHeapObjectTag)); |
| 2956 } | 2968 } |
| 2957 } | 2969 } |
| 2958 | 2970 |
| 2959 | 2971 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3007 // Assert that result actually contains top on entry. t9 is used | 3019 // Assert that result actually contains top on entry. t9 is used |
| 3008 // immediately below so this use of t9 does not cause difference with | 3020 // immediately below so this use of t9 does not cause difference with |
| 3009 // respect to register content between debug and release mode. | 3021 // respect to register content between debug and release mode. |
| 3010 lw(t9, MemOperand(topaddr)); | 3022 lw(t9, MemOperand(topaddr)); |
| 3011 Check(eq, kUnexpectedAllocationTop, result, Operand(t9)); | 3023 Check(eq, kUnexpectedAllocationTop, result, Operand(t9)); |
| 3012 } | 3024 } |
| 3013 // Load allocation limit into t9. Result already contains allocation top. | 3025 // Load allocation limit into t9. Result already contains allocation top. |
| 3014 lw(t9, MemOperand(topaddr, limit - top)); | 3026 lw(t9, MemOperand(topaddr, limit - top)); |
| 3015 } | 3027 } |
| 3016 | 3028 |
| 3029 if ((flags & DOUBLE_ALIGNMENT) != 0) { |
| 3030 // Align the next allocation. Storing the filler map without checking top is |
| 3031 // always safe because the limit of the heap is always aligned. |
| 3032 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0); |
| 3033 ASSERT(kPointerAlignment * 2 == kDoubleAlignment); |
| 3034 And(scratch2, result, Operand(kDoubleAlignmentMask)); |
| 3035 Label aligned; |
| 3036 Branch(&aligned, eq, scratch2, Operand(zero_reg)); |
| 3037 li(scratch2, Operand(isolate()->factory()->one_pointer_filler_map())); |
| 3038 sw(scratch2, MemOperand(result)); |
| 3039 Addu(result, result, Operand(kDoubleSize / 2)); |
| 3040 bind(&aligned); |
| 3041 } |
| 3042 |
| 3017 // Calculate new top and bail out if new space is exhausted. Use result | 3043 // Calculate new top and bail out if new space is exhausted. Use result |
| 3018 // to calculate the new top. Object size may be in words so a shift is | 3044 // to calculate the new top. Object size may be in words so a shift is |
| 3019 // required to get the number of bytes. | 3045 // required to get the number of bytes. |
| 3020 if ((flags & SIZE_IN_WORDS) != 0) { | 3046 if ((flags & SIZE_IN_WORDS) != 0) { |
| 3021 sll(scratch2, object_size, kPointerSizeLog2); | 3047 sll(scratch2, object_size, kPointerSizeLog2); |
| 3022 Addu(scratch2, result, scratch2); | 3048 Addu(scratch2, result, scratch2); |
| 3023 } else { | 3049 } else { |
| 3024 Addu(scratch2, result, Operand(object_size)); | 3050 Addu(scratch2, result, Operand(object_size)); |
| 3025 } | 3051 } |
| 3026 Branch(gc_required, Ugreater, scratch2, Operand(t9)); | 3052 Branch(gc_required, Ugreater, scratch2, Operand(t9)); |
| (...skipping 2542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5569 opcode == BGTZL); | 5595 opcode == BGTZL); |
| 5570 opcode = (cond == eq) ? BEQ : BNE; | 5596 opcode = (cond == eq) ? BEQ : BNE; |
| 5571 instr = (instr & ~kOpcodeMask) | opcode; | 5597 instr = (instr & ~kOpcodeMask) | opcode; |
| 5572 masm_.emit(instr); | 5598 masm_.emit(instr); |
| 5573 } | 5599 } |
| 5574 | 5600 |
| 5575 | 5601 |
| 5576 } } // namespace v8::internal | 5602 } } // namespace v8::internal |
| 5577 | 5603 |
| 5578 #endif // V8_TARGET_ARCH_MIPS | 5604 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |