Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 12413026: MIPS: Allow direct allocation in old pointer space. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2894 matching lines...) Expand 10 before | Expand all | Expand 10 after
2905 sw(a2, MemOperand(a3)); 2905 sw(a2, MemOperand(a3));
2906 2906
2907 // Get the code object (a1) and state (a2). Clear the context and frame 2907 // Get the code object (a1) and state (a2). Clear the context and frame
2908 // pointer (0 was saved in the handler). 2908 // pointer (0 was saved in the handler).
2909 MultiPop(a1.bit() | a2.bit() | cp.bit() | fp.bit()); 2909 MultiPop(a1.bit() | a2.bit() | cp.bit() | fp.bit());
2910 2910
2911 JumpToHandlerEntry(); 2911 JumpToHandlerEntry();
2912 } 2912 }
2913 2913
2914 2914
2915 void MacroAssembler::AllocateInNewSpace(int object_size, 2915 void MacroAssembler::Allocate(int object_size,
2916 Register result, 2916 Register result,
2917 Register scratch1, 2917 Register scratch1,
2918 Register scratch2, 2918 Register scratch2,
2919 Label* gc_required, 2919 Label* gc_required,
2920 AllocationFlags flags) { 2920 AllocationFlags flags) {
2921 if (!FLAG_inline_new) { 2921 if (!FLAG_inline_new) {
2922 if (emit_debug_code()) { 2922 if (emit_debug_code()) {
2923 // Trash the registers to simulate an allocation failure. 2923 // Trash the registers to simulate an allocation failure.
2924 li(result, 0x7091); 2924 li(result, 0x7091);
2925 li(scratch1, 0x7191); 2925 li(scratch1, 0x7191);
2926 li(scratch2, 0x7291); 2926 li(scratch2, 0x7291);
2927 } 2927 }
2928 jmp(gc_required); 2928 jmp(gc_required);
2929 return; 2929 return;
2930 } 2930 }
2931 2931
2932 ASSERT(!result.is(scratch1)); 2932 ASSERT(!result.is(scratch1));
2933 ASSERT(!result.is(scratch2)); 2933 ASSERT(!result.is(scratch2));
2934 ASSERT(!scratch1.is(scratch2)); 2934 ASSERT(!scratch1.is(scratch2));
2935 ASSERT(!scratch1.is(t9)); 2935 ASSERT(!scratch1.is(t9));
2936 ASSERT(!scratch2.is(t9)); 2936 ASSERT(!scratch2.is(t9));
2937 ASSERT(!result.is(t9)); 2937 ASSERT(!result.is(t9));
2938 2938
2939 // Make object size into bytes. 2939 // Make object size into bytes.
2940 if ((flags & SIZE_IN_WORDS) != 0) { 2940 if ((flags & SIZE_IN_WORDS) != 0) {
2941 object_size *= kPointerSize; 2941 object_size *= kPointerSize;
2942 } 2942 }
2943 ASSERT_EQ(0, object_size & kObjectAlignmentMask); 2943 ASSERT_EQ(0, object_size & kObjectAlignmentMask);
2944 2944
2945 // Check relative positions of allocation top and limit addresses. 2945 // Check relative positions of allocation top and limit addresses.
2946 // ARM adds additional checks to make sure the ldm instruction can be 2946 // ARM adds additional checks to make sure the ldm instruction can be
2947 // used. On MIPS we don't have ldm so we don't need additional checks either. 2947 // used. On MIPS we don't have ldm so we don't need additional checks either.
2948 ExternalReference new_space_allocation_top = 2948 ExternalReference allocation_top =
2949 ExternalReference::new_space_allocation_top_address(isolate()); 2949 AllocationUtils::GetAllocationTopReference(isolate(), flags);
2950 ExternalReference new_space_allocation_limit = 2950 ExternalReference allocation_limit =
2951 ExternalReference::new_space_allocation_limit_address(isolate()); 2951 AllocationUtils::GetAllocationLimitReference(isolate(), flags);
2952
2952 intptr_t top = 2953 intptr_t top =
2953 reinterpret_cast<intptr_t>(new_space_allocation_top.address()); 2954 reinterpret_cast<intptr_t>(allocation_top.address());
2954 intptr_t limit = 2955 intptr_t limit =
2955 reinterpret_cast<intptr_t>(new_space_allocation_limit.address()); 2956 reinterpret_cast<intptr_t>(allocation_limit.address());
2956 ASSERT((limit - top) == kPointerSize); 2957 ASSERT((limit - top) == kPointerSize);
2957 2958
2958 // Set up allocation top address and object size registers. 2959 // Set up allocation top address and object size registers.
2959 Register topaddr = scratch1; 2960 Register topaddr = scratch1;
2960 Register obj_size_reg = scratch2; 2961 Register obj_size_reg = scratch2;
2961 li(topaddr, Operand(new_space_allocation_top)); 2962 li(topaddr, Operand(allocation_top));
2962 li(obj_size_reg, Operand(object_size)); 2963 li(obj_size_reg, Operand(object_size));
2963 2964
2964 // This code stores a temporary value in t9. 2965 // This code stores a temporary value in t9.
2965 if ((flags & RESULT_CONTAINS_TOP) == 0) { 2966 if ((flags & RESULT_CONTAINS_TOP) == 0) {
2966 // Load allocation top into result and allocation limit into t9. 2967 // Load allocation top into result and allocation limit into t9.
2967 lw(result, MemOperand(topaddr)); 2968 lw(result, MemOperand(topaddr));
2968 lw(t9, MemOperand(topaddr, kPointerSize)); 2969 lw(t9, MemOperand(topaddr, kPointerSize));
2969 } else { 2970 } else {
2970 if (emit_debug_code()) { 2971 if (emit_debug_code()) {
2971 // Assert that result actually contains top on entry. t9 is used 2972 // Assert that result actually contains top on entry. t9 is used
(...skipping 18 matching lines...) Expand all
2990 } 2991 }
2991 } 2992 }
2992 2993
2993 2994
2994 void MacroAssembler::AllocateInNewSpace(Register object_size, 2995 void MacroAssembler::AllocateInNewSpace(Register object_size,
2995 Register result, 2996 Register result,
2996 Register scratch1, 2997 Register scratch1,
2997 Register scratch2, 2998 Register scratch2,
2998 Label* gc_required, 2999 Label* gc_required,
2999 AllocationFlags flags) { 3000 AllocationFlags flags) {
3001 ASSERT((flags & PRETENURE_OLD_POINTER_SPACE) == 0);
3000 if (!FLAG_inline_new) { 3002 if (!FLAG_inline_new) {
3001 if (emit_debug_code()) { 3003 if (emit_debug_code()) {
3002 // Trash the registers to simulate an allocation failure. 3004 // Trash the registers to simulate an allocation failure.
3003 li(result, 0x7091); 3005 li(result, 0x7091);
3004 li(scratch1, 0x7191); 3006 li(scratch1, 0x7191);
3005 li(scratch2, 0x7291); 3007 li(scratch2, 0x7291);
3006 } 3008 }
3007 jmp(gc_required); 3009 jmp(gc_required);
3008 return; 3010 return;
3009 } 3011 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3152 scratch1, 3154 scratch1,
3153 scratch2); 3155 scratch2);
3154 } 3156 }
3155 3157
3156 3158
3157 void MacroAssembler::AllocateTwoByteConsString(Register result, 3159 void MacroAssembler::AllocateTwoByteConsString(Register result,
3158 Register length, 3160 Register length,
3159 Register scratch1, 3161 Register scratch1,
3160 Register scratch2, 3162 Register scratch2,
3161 Label* gc_required) { 3163 Label* gc_required) {
3162 AllocateInNewSpace(ConsString::kSize, 3164 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
3163 result, 3165 TAG_OBJECT);
3164 scratch1,
3165 scratch2,
3166 gc_required,
3167 TAG_OBJECT);
3168 InitializeNewString(result, 3166 InitializeNewString(result,
3169 length, 3167 length,
3170 Heap::kConsStringMapRootIndex, 3168 Heap::kConsStringMapRootIndex,
3171 scratch1, 3169 scratch1,
3172 scratch2); 3170 scratch2);
3173 } 3171 }
3174 3172
3175 3173
3176 void MacroAssembler::AllocateAsciiConsString(Register result, 3174 void MacroAssembler::AllocateAsciiConsString(Register result,
3177 Register length, 3175 Register length,
3178 Register scratch1, 3176 Register scratch1,
3179 Register scratch2, 3177 Register scratch2,
3180 Label* gc_required) { 3178 Label* gc_required) {
3181 AllocateInNewSpace(ConsString::kSize, 3179 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
3182 result, 3180 TAG_OBJECT);
3183 scratch1,
3184 scratch2,
3185 gc_required,
3186 TAG_OBJECT);
3187 InitializeNewString(result, 3181 InitializeNewString(result,
3188 length, 3182 length,
3189 Heap::kConsAsciiStringMapRootIndex, 3183 Heap::kConsAsciiStringMapRootIndex,
3190 scratch1, 3184 scratch1,
3191 scratch2); 3185 scratch2);
3192 } 3186 }
3193 3187
3194 3188
3195 void MacroAssembler::AllocateTwoByteSlicedString(Register result, 3189 void MacroAssembler::AllocateTwoByteSlicedString(Register result,
3196 Register length, 3190 Register length,
3197 Register scratch1, 3191 Register scratch1,
3198 Register scratch2, 3192 Register scratch2,
3199 Label* gc_required) { 3193 Label* gc_required) {
3200 AllocateInNewSpace(SlicedString::kSize, 3194 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
3201 result, 3195 TAG_OBJECT);
3202 scratch1,
3203 scratch2,
3204 gc_required,
3205 TAG_OBJECT);
3206 3196
3207 InitializeNewString(result, 3197 InitializeNewString(result,
3208 length, 3198 length,
3209 Heap::kSlicedStringMapRootIndex, 3199 Heap::kSlicedStringMapRootIndex,
3210 scratch1, 3200 scratch1,
3211 scratch2); 3201 scratch2);
3212 } 3202 }
3213 3203
3214 3204
3215 void MacroAssembler::AllocateAsciiSlicedString(Register result, 3205 void MacroAssembler::AllocateAsciiSlicedString(Register result,
3216 Register length, 3206 Register length,
3217 Register scratch1, 3207 Register scratch1,
3218 Register scratch2, 3208 Register scratch2,
3219 Label* gc_required) { 3209 Label* gc_required) {
3220 AllocateInNewSpace(SlicedString::kSize, 3210 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
3221 result, 3211 TAG_OBJECT);
3222 scratch1,
3223 scratch2,
3224 gc_required,
3225 TAG_OBJECT);
3226 3212
3227 InitializeNewString(result, 3213 InitializeNewString(result,
3228 length, 3214 length,
3229 Heap::kSlicedAsciiStringMapRootIndex, 3215 Heap::kSlicedAsciiStringMapRootIndex,
3230 scratch1, 3216 scratch1,
3231 scratch2); 3217 scratch2);
3232 } 3218 }
3233 3219
3234 3220
3235 // Allocates a heap number or jumps to the label if the young space is full and 3221 // Allocates a heap number or jumps to the label if the young space is full and
3236 // a scavenge is needed. 3222 // a scavenge is needed.
3237 void MacroAssembler::AllocateHeapNumber(Register result, 3223 void MacroAssembler::AllocateHeapNumber(Register result,
3238 Register scratch1, 3224 Register scratch1,
3239 Register scratch2, 3225 Register scratch2,
3240 Register heap_number_map, 3226 Register heap_number_map,
3241 Label* need_gc, 3227 Label* need_gc,
3242 TaggingMode tagging_mode) { 3228 TaggingMode tagging_mode) {
3243 // Allocate an object in the heap for the heap number and tag it as a heap 3229 // Allocate an object in the heap for the heap number and tag it as a heap
3244 // object. 3230 // object.
3245 AllocateInNewSpace(HeapNumber::kSize, 3231 Allocate(HeapNumber::kSize, result, scratch1, scratch2, need_gc,
3246 result, 3232 tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS);
3247 scratch1,
3248 scratch2,
3249 need_gc,
3250 tagging_mode == TAG_RESULT ? TAG_OBJECT :
3251 NO_ALLOCATION_FLAGS);
3252 3233
3253 // Store heap number map in the allocated object. 3234 // Store heap number map in the allocated object.
3254 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 3235 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
3255 if (tagging_mode == TAG_RESULT) { 3236 if (tagging_mode == TAG_RESULT) {
3256 sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); 3237 sw(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
3257 } else { 3238 } else {
3258 sw(heap_number_map, MemOperand(result, HeapObject::kMapOffset)); 3239 sw(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
3259 } 3240 }
3260 } 3241 }
3261 3242
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after
5571 opcode == BGTZL); 5552 opcode == BGTZL);
5572 opcode = (cond == eq) ? BEQ : BNE; 5553 opcode = (cond == eq) ? BEQ : BNE;
5573 instr = (instr & ~kOpcodeMask) | opcode; 5554 instr = (instr & ~kOpcodeMask) | opcode;
5574 masm_.emit(instr); 5555 masm_.emit(instr);
5575 } 5556 }
5576 5557
5577 5558
5578 } } // namespace v8::internal 5559 } } // namespace v8::internal
5579 5560
5580 #endif // V8_TARGET_ARCH_MIPS 5561 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.h ('k') | src/mips/stub-cache-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698