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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 8353002: Optimize fast element conversion in arm using batch store/loads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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 | « no previous file | src/arm/macro-assembler-arm.h » ('j') | src/arm/macro-assembler-arm.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 6914 matching lines...) Expand 10 before | Expand all | Expand 10 after
6925 // Used in KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField. 6925 // Used in KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField.
6926 { r2, r1, r3, EMIT_REMEMBERED_SET }, 6926 { r2, r1, r3, EMIT_REMEMBERED_SET },
6927 { r3, r1, r2, EMIT_REMEMBERED_SET }, 6927 { r3, r1, r2, EMIT_REMEMBERED_SET },
6928 // KeyedStoreStubCompiler::GenerateStoreFastElement. 6928 // KeyedStoreStubCompiler::GenerateStoreFastElement.
6929 { r4, r2, r3, EMIT_REMEMBERED_SET }, 6929 { r4, r2, r3, EMIT_REMEMBERED_SET },
6930 // FastElementsConversionStub::GenerateSmiOnlyToObject 6930 // FastElementsConversionStub::GenerateSmiOnlyToObject
6931 // and FastElementsConversionStub::GenerateSmiOnlyToDouble 6931 // and FastElementsConversionStub::GenerateSmiOnlyToDouble
6932 // and FastElementsConversionStub::GenerateDoubleToObject 6932 // and FastElementsConversionStub::GenerateDoubleToObject
6933 { r2, r3, r9, EMIT_REMEMBERED_SET }, 6933 { r2, r3, r9, EMIT_REMEMBERED_SET },
6934 // FastElementsConversionStub::GenerateDoubleToObject 6934 // FastElementsConversionStub::GenerateDoubleToObject
6935 { r6, r0, r2, EMIT_REMEMBERED_SET }, 6935 { r6, r2, r0, EMIT_REMEMBERED_SET },
6936 { r2, r6, r9, EMIT_REMEMBERED_SET }, 6936 { r2, r6, r9, EMIT_REMEMBERED_SET },
6937 // Null termination. 6937 // Null termination.
6938 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} 6938 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET}
6939 }; 6939 };
6940 6940
6941 6941
6942 bool RecordWriteStub::IsPregenerated() { 6942 bool RecordWriteStub::IsPregenerated() {
6943 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; 6943 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime;
6944 !entry->object.is(no_reg); 6944 !entry->object.is(no_reg);
6945 entry++) { 6945 entry++) {
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
7239 r3, 7239 r3,
7240 r9, 7240 r9,
7241 kLRHasBeenSaved, 7241 kLRHasBeenSaved,
7242 kDontSaveFPRegs, 7242 kDontSaveFPRegs,
7243 EMIT_REMEMBERED_SET, 7243 EMIT_REMEMBERED_SET,
7244 OMIT_SMI_CHECK); 7244 OMIT_SMI_CHECK);
7245 __ pop(lr); 7245 __ pop(lr);
7246 7246
7247 // Prepare for conversion loop. 7247 // Prepare for conversion loop.
7248 __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 7248 __ add(r3, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
7249 __ add(r6, r6, Operand(FixedDoubleArray::kHeaderSize)); 7249 __ add(r7, r6, Operand(FixedDoubleArray::kHeaderSize));
7250 __ add(r4, r6, Operand(r5, LSL, 2)); 7250 __ add(r6, r7, Operand(r5, LSL, 2));
7251 __ mov(r5, Operand(kHoleNanLower32)); 7251 __ mov(r4, Operand(kHoleNanLower32));
7252 __ mov(r7, Operand(kHoleNanUpper32)); 7252 __ mov(r5, Operand(kHoleNanUpper32));
7253 // r3: begin of source FixedArray element fields, not tagged 7253 // r3: begin of source FixedArray element fields, not tagged
7254 // r4: end of destination FixedDoubleArray, not tagged 7254 // r4: kHoleNanLower32
7255 // r6: begin of FixedDoubleArray element fields, not tagged 7255 // r5: kHoleNanUpper32
7256 // r5: kHoleNanLower32 7256 // r6: end of destination FixedDoubleArray, not tagged
7257 // r7: kHoleNanUpper32 7257 // r7: begin of FixedDoubleArray element fields, not tagged
7258 if (vfp3_supported) __ Push(r0, r1); 7258 if (vfp3_supported) __ Push(r1, r0);
7259 7259
7260 __ b(&entry); 7260 __ b(&entry);
7261 7261
7262 // Call into runtime if GC is required. 7262 // Call into runtime if GC is required.
7263 __ bind(&gc_required); 7263 __ bind(&gc_required);
7264 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); 7264 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode);
7265 7265
7266 // Convert and copy elements. 7266 // Convert and copy elements.
7267 __ bind(&loop); 7267 __ bind(&loop);
7268 __ ldr(r9, MemOperand(r3, 4, PostIndex)); 7268 __ ldr(r9, MemOperand(r3, 4, PostIndex));
7269 // r9: current element 7269 // r9: current element
7270 __ JumpIfNotSmi(r9, &convert_hole); 7270 __ JumpIfNotSmi(r9, &convert_hole);
7271 7271
7272 // Normal smi, convert to double and store. 7272 // Normal smi, convert to double and store.
7273 __ SmiUntag(r9); 7273 __ SmiUntag(r9);
7274 if (vfp3_supported) { 7274 if (vfp3_supported) {
7275 CpuFeatures::Scope scope(VFP3); 7275 CpuFeatures::Scope scope(VFP3);
7276 __ vmov(s0, r9); 7276 __ vmov(s0, r9);
7277 __ vcvt_f64_s32(d0, s0); 7277 __ vcvt_f64_s32(d0, s0);
7278 __ vstr(d0, r6, 0); 7278 __ vstr(d0, r7, 0);
7279 __ add(r6, r6, Operand(8)); 7279 __ add(r7, r7, Operand(8));
7280 } else { 7280 } else {
7281 FloatingPointHelper::ConvertIntToDouble(masm, 7281 FloatingPointHelper::ConvertIntToDouble(masm,
7282 r9, 7282 r9,
7283 FloatingPointHelper::kCoreRegisters, 7283 FloatingPointHelper::kCoreRegisters,
7284 d0, 7284 d0,
7285 r0, 7285 r0,
7286 r1, 7286 r1,
7287 ip, 7287 ip,
7288 s0); 7288 s0);
7289 __ str(r0, MemOperand(r6, 4, PostIndex)); // mantissa 7289 __ Strd(r0, r1, MemOperand(r7, 8, PostIndex));
7290 __ str(r1, MemOperand(r6, 4, PostIndex)); // exponent
7291 } 7290 }
7292 __ b(&entry); 7291 __ b(&entry);
7293 7292
7294 // Hole found, store the-hole NaN. 7293 // Hole found, store the-hole NaN.
7295 __ bind(&convert_hole); 7294 __ bind(&convert_hole);
7296 __ str(r5, MemOperand(r6, 4, PostIndex)); // mantissa 7295 __ Strd(r4, r5, MemOperand(r7, 8, PostIndex));
7297 __ str(r7, MemOperand(r6, 4, PostIndex)); // exponent
7298 7296
7299 __ bind(&entry); 7297 __ bind(&entry);
7300 __ cmp(r6, r4); 7298 __ cmp(r7, r6);
7301 __ b(lt, &loop); 7299 __ b(lt, &loop);
7302 7300
7303 if (vfp3_supported) __ Pop(r0, r1); 7301 if (vfp3_supported) __ Pop(r1, r0);
7304 } 7302 }
7305 7303
7306 7304
7307 void FastElementsConversionStub::GenerateDoubleToObject( 7305 void FastElementsConversionStub::GenerateDoubleToObject(
7308 MacroAssembler* masm, StrictModeFlag strict_mode) { 7306 MacroAssembler* masm, StrictModeFlag strict_mode) {
7309 // ----------- S t a t e ------------- 7307 // ----------- S t a t e -------------
7310 // -- r0 : value 7308 // -- r0 : value
7311 // -- r1 : key 7309 // -- r1 : key
7312 // -- r2 : receiver 7310 // -- r2 : receiver
7313 // -- lr : return address 7311 // -- lr : return address
7314 // -- r3 : target map, scratch for subsequent call 7312 // -- r3 : target map, scratch for subsequent call
7315 // -- r4 : scratch (elements) 7313 // -- r4 : scratch (elements)
7316 // ----------------------------------- 7314 // -----------------------------------
7317 Label entry, loop, convert_hole, gc_required; 7315 Label entry, loop, convert_hole, gc_required;
7318 7316
7319 __ push(lr); 7317 __ push(lr);
7320 __ Push(r0, r1, r2, r3); 7318 __ Push(r3, r2, r1, r0);
7321 7319
7322 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); 7320 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset));
7323 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); 7321 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset));
7324 // r4: source FixedDoubleArray 7322 // r4: source FixedDoubleArray
7325 // r5: number of elements (smi-tagged) 7323 // r5: number of elements (smi-tagged)
7326 7324
7327 // Allocate new FixedArray. 7325 // Allocate new FixedArray.
7328 __ mov(r0, Operand(FixedDoubleArray::kHeaderSize)); 7326 __ mov(r0, Operand(FixedDoubleArray::kHeaderSize));
7329 __ add(r0, r0, Operand(r5, LSL, 1)); 7327 __ add(r0, r0, Operand(r5, LSL, 1));
7330 __ AllocateInNewSpace(r0, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS); 7328 __ AllocateInNewSpace(r0, r6, r7, r9, &gc_required, NO_ALLOCATION_FLAGS);
(...skipping 14 matching lines...) Expand all
7345 // r3: begin of destination FixedArray element fields, not tagged 7343 // r3: begin of destination FixedArray element fields, not tagged
7346 // r4: begin of source FixedDoubleArray element fields, not tagged, +4 7344 // r4: begin of source FixedDoubleArray element fields, not tagged, +4
7347 // r5: end of destination FixedArray, not tagged 7345 // r5: end of destination FixedArray, not tagged
7348 // r6: destination FixedArray 7346 // r6: destination FixedArray
7349 // r7: the-hole pointer 7347 // r7: the-hole pointer
7350 // r9: heap number map 7348 // r9: heap number map
7351 __ b(&entry); 7349 __ b(&entry);
7352 7350
7353 // Call into runtime if GC is required. 7351 // Call into runtime if GC is required.
7354 __ bind(&gc_required); 7352 __ bind(&gc_required);
7355 __ Pop(r2, r3); 7353 __ Pop(r3, r2, r1, r0);
7356 __ Pop(r0, r1);
7357 __ pop(lr); 7354 __ pop(lr);
7358 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); 7355 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode);
7359 7356
7360 __ bind(&loop); 7357 __ bind(&loop);
7361 __ ldr(lr, MemOperand(r4, 8, PostIndex)); 7358 __ ldr(r1, MemOperand(r4, 8, PostIndex));
7362 // lr: current element's upper 32 bit 7359 // lr: current element's upper 32 bit
7363 // r4: address of next element's upper 32 bit 7360 // r4: address of next element's upper 32 bit
7364 __ cmp(lr, Operand(kHoleNanUpper32)); 7361 __ cmp(r1, Operand(kHoleNanUpper32));
7365 __ b(eq, &convert_hole); 7362 __ b(eq, &convert_hole);
7366 7363
7367 // Non-hole double, copy value into a heap number. 7364 // Non-hole double, copy value into a heap number.
7368 __ AllocateHeapNumber(r0, r1, r2, r9, &gc_required); 7365 __ AllocateHeapNumber(r2, r0, lr, r9, &gc_required);
7369 __ str(lr, FieldMemOperand(r0, HeapNumber::kExponentOffset)); 7366 // r2: new heap number
7370 __ ldr(lr, MemOperand(r4, 12, NegOffset)); 7367 __ ldr(r0, MemOperand(r4, 12, NegOffset));
7371 __ str(lr, FieldMemOperand(r0, HeapNumber::kMantissaOffset)); 7368 __ Strd(r0, r1, FieldMemOperand(r2, HeapNumber::kValueOffset));
7372 __ mov(r2, r3); 7369 __ mov(r0, r3);
7373 __ str(r0, MemOperand(r3, 4, PostIndex)); 7370 __ str(r2, MemOperand(r3, 4, PostIndex));
7374 __ RecordWrite(r6, 7371 __ RecordWrite(r6,
7372 r0,
7375 r2, 7373 r2,
7376 r0,
7377 kLRHasBeenSaved, 7374 kLRHasBeenSaved,
7378 kDontSaveFPRegs, 7375 kDontSaveFPRegs,
7379 EMIT_REMEMBERED_SET, 7376 EMIT_REMEMBERED_SET,
7380 OMIT_SMI_CHECK); 7377 OMIT_SMI_CHECK);
7381 __ b(&entry); 7378 __ b(&entry);
7382 7379
7383 // Replace the-hole NaN with the-hole pointer. 7380 // Replace the-hole NaN with the-hole pointer.
7384 __ bind(&convert_hole); 7381 __ bind(&convert_hole);
7385 __ str(r7, MemOperand(r3, 4, PostIndex)); 7382 __ str(r7, MemOperand(r3, 4, PostIndex));
7386 7383
7387 __ bind(&entry); 7384 __ bind(&entry);
7388 __ cmp(r3, r5); 7385 __ cmp(r3, r5);
7389 __ b(lt, &loop); 7386 __ b(lt, &loop);
7390 7387
7391 __ Pop(r2, r3); 7388 __ Pop(r3, r2, r1, r0);
7392 __ Pop(r0, r1);
7393 // Update receiver's map. 7389 // Update receiver's map.
7394 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); 7390 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset));
7395 __ RecordWriteField(r2, 7391 __ RecordWriteField(r2,
7396 HeapObject::kMapOffset, 7392 HeapObject::kMapOffset,
7397 r3, 7393 r3,
7398 r9, 7394 r9,
7399 kLRHasBeenSaved, 7395 kLRHasBeenSaved,
7400 kDontSaveFPRegs, 7396 kDontSaveFPRegs,
7401 EMIT_REMEMBERED_SET, 7397 EMIT_REMEMBERED_SET,
7402 OMIT_SMI_CHECK); 7398 OMIT_SMI_CHECK);
7403 // Replace receiver's backing store with newly created and filled FixedArray. 7399 // Replace receiver's backing store with newly created and filled FixedArray.
7404 __ str(r6, FieldMemOperand(r2, JSObject::kElementsOffset)); 7400 __ str(r6, FieldMemOperand(r2, JSObject::kElementsOffset));
7405 __ RecordWriteField(r2, 7401 __ RecordWriteField(r2,
7406 JSObject::kElementsOffset, 7402 JSObject::kElementsOffset,
7407 r6, 7403 r6,
7408 r9, 7404 r9,
7409 kLRHasBeenSaved, 7405 kLRHasBeenSaved,
7410 kDontSaveFPRegs, 7406 kDontSaveFPRegs,
7411 EMIT_REMEMBERED_SET, 7407 EMIT_REMEMBERED_SET,
7412 OMIT_SMI_CHECK); 7408 OMIT_SMI_CHECK);
7413 __ pop(lr); 7409 __ pop(lr);
7414 } 7410 }
7415 7411
7416 7412
7417 #undef __ 7413 #undef __
7418 7414
7419 } } // namespace v8::internal 7415 } } // namespace v8::internal
7420 7416
7421 #endif // V8_TARGET_ARCH_ARM 7417 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | src/arm/macro-assembler-arm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698