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

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

Issue 8344045: Fast elements conversions in crankshaft using generated code. (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
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 7026 matching lines...) Expand 10 before | Expand all | Expand 10 after
7037 HeapObject::kMapOffset, 7037 HeapObject::kMapOffset,
7038 ebx, 7038 ebx,
7039 edi, 7039 edi,
7040 kDontSaveFPRegs, 7040 kDontSaveFPRegs,
7041 EMIT_REMEMBERED_SET, 7041 EMIT_REMEMBERED_SET,
7042 OMIT_SMI_CHECK); 7042 OMIT_SMI_CHECK);
7043 } 7043 }
7044 7044
7045 7045
7046 void FastElementsConversionStub::GenerateSmiOnlyToDouble( 7046 void FastElementsConversionStub::GenerateSmiOnlyToDouble(
7047 MacroAssembler* masm, StrictModeFlag strict_mode) { 7047 MacroAssembler* masm, Type type, StrictModeFlag strict_mode) {
7048 // ----------- S t a t e ------------- 7048 // ----------- S t a t e -------------
7049 // -- eax : value 7049 // -- eax : value
7050 // -- ebx : target map 7050 // -- ebx : target map
7051 // -- ecx : key 7051 // -- ecx : key
7052 // -- edx : receiver 7052 // -- edx : receiver
7053 // -- esp[0] : return address 7053 // -- esp[0] : return address
7054 // ----------------------------------- 7054 // -----------------------------------
7055 Label loop, entry, convert_hole, gc_required; 7055 Label loop, entry, convert_hole, gc_required;
7056 __ push(eax); 7056 __ push(eax);
7057 __ push(ebx); 7057 __ push(ebx);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
7095 Operand::StaticVariable(canonical_the_hole_nan_reference)); 7095 Operand::StaticVariable(canonical_the_hole_nan_reference));
7096 } 7096 }
7097 __ jmp(&entry); 7097 __ jmp(&entry);
7098 7098
7099 // Call into runtime if GC is required. 7099 // Call into runtime if GC is required.
7100 __ bind(&gc_required); 7100 __ bind(&gc_required);
7101 // Restore registers before jumping into runtime. 7101 // Restore registers before jumping into runtime.
7102 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 7102 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
7103 __ pop(ebx); 7103 __ pop(ebx);
7104 __ pop(eax); 7104 __ pop(eax);
7105 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); 7105 if (type == TRANSITION_ONLY) {
7106 __ pop(ebx);
7107 __ push(edx);
7108 __ push(ebx); // return address
7109 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1);
7110 } else {
7111 ASSERT(type == TRANSITION_AND_STORE);
7112 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode);
7113 }
7106 7114
7107 // Convert and copy elements 7115 // Convert and copy elements
7108 // esi: source FixedArray 7116 // esi: source FixedArray
7109 // edi: number of elements to convert/copy 7117 // edi: number of elements to convert/copy
7110 __ bind(&loop); 7118 __ bind(&loop);
7111 __ sub(edi, Immediate(Smi::FromInt(1))); 7119 __ sub(edi, Immediate(Smi::FromInt(1)));
7112 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize)); 7120 __ mov(ebx, FieldOperand(esi, edi, times_2, FixedArray::kHeaderSize));
7113 // ebx: current element from source 7121 // ebx: current element from source
7114 // edi: index of current element 7122 // edi: index of current element
7115 __ JumpIfNotSmi(ebx, &convert_hole); 7123 __ JumpIfNotSmi(ebx, &convert_hole);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); 7160 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx);
7153 __ RecordWriteField(edx, 7161 __ RecordWriteField(edx,
7154 HeapObject::kMapOffset, 7162 HeapObject::kMapOffset,
7155 ebx, 7163 ebx,
7156 edi, 7164 edi,
7157 kDontSaveFPRegs, 7165 kDontSaveFPRegs,
7158 EMIT_REMEMBERED_SET, 7166 EMIT_REMEMBERED_SET,
7159 OMIT_SMI_CHECK); 7167 OMIT_SMI_CHECK);
7160 // Restore esi. 7168 // Restore esi.
7161 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 7169 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
7170
7171 if (type == TRANSITION_ONLY) {
7172 __ mov(eax, edx);
7173 __ Ret();
7174 }
7162 } 7175 }
7163 7176
7164 7177
7165 void FastElementsConversionStub::GenerateDoubleToObject( 7178 void FastElementsConversionStub::GenerateDoubleToObject(
7166 MacroAssembler* masm, StrictModeFlag strict_mode) { 7179 MacroAssembler* masm, Type type, StrictModeFlag strict_mode) {
7167 // ----------- S t a t e ------------- 7180 // ----------- S t a t e -------------
7168 // -- eax : value 7181 // -- eax : value
7169 // -- ebx : target map 7182 // -- ebx : target map
7170 // -- ecx : key 7183 // -- ecx : key
7171 // -- edx : receiver 7184 // -- edx : receiver
7172 // -- esp[0] : return address 7185 // -- esp[0] : return address
7173 // ----------------------------------- 7186 // -----------------------------------
7174 Label loop, entry, convert_hole, gc_required; 7187 Label loop, entry, convert_hole, gc_required;
7175 __ push(eax); 7188 __ push(eax);
7176 __ push(edx); 7189 __ push(edx);
(...skipping 15 matching lines...) Expand all
7192 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); 7205 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
7193 7206
7194 __ jmp(&entry); 7207 __ jmp(&entry);
7195 7208
7196 // Call into runtime if GC is required. 7209 // Call into runtime if GC is required.
7197 __ bind(&gc_required); 7210 __ bind(&gc_required);
7198 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 7211 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
7199 __ pop(ebx); 7212 __ pop(ebx);
7200 __ pop(edx); 7213 __ pop(edx);
7201 __ pop(eax); 7214 __ pop(eax);
7202 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode); 7215 if (type == TRANSITION_ONLY) {
7203 7216 __ pop(ebx);
7217 __ push(edx);
7218 __ push(ebx); // return address
7219 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1);
7220 } else {
7221 ASSERT(type == TRANSITION_AND_STORE);
7222 KeyedStoreIC::GenerateRuntimeSetProperty(masm, strict_mode);
7223 }
7204 // Box doubles into heap numbers. 7224 // Box doubles into heap numbers.
7205 // edi: source FixedDoubleArray 7225 // edi: source FixedDoubleArray
7206 // eax: destination FixedArray 7226 // eax: destination FixedArray
7207 __ bind(&loop); 7227 __ bind(&loop);
7208 __ sub(ebx, Immediate(Smi::FromInt(1))); 7228 __ sub(ebx, Immediate(Smi::FromInt(1)));
7209 // ebx: index of current element (smi-tagged) 7229 // ebx: index of current element (smi-tagged)
7210 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); 7230 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32);
7211 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32)); 7231 __ cmp(FieldOperand(edi, ebx, times_4, offset), Immediate(kHoleNanUpper32));
7212 __ j(equal, &convert_hole); 7232 __ j(equal, &convert_hole);
7213 7233
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
7263 JSObject::kElementsOffset, 7283 JSObject::kElementsOffset,
7264 eax, 7284 eax,
7265 edi, 7285 edi,
7266 kDontSaveFPRegs, 7286 kDontSaveFPRegs,
7267 EMIT_REMEMBERED_SET, 7287 EMIT_REMEMBERED_SET,
7268 OMIT_SMI_CHECK); 7288 OMIT_SMI_CHECK);
7269 7289
7270 // Restore registers. 7290 // Restore registers.
7271 __ pop(eax); 7291 __ pop(eax);
7272 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 7292 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
7293
7294 if (type == TRANSITION_ONLY) {
7295 __ mov(eax, edx);
7296 __ Ret();
7297 }
7273 } 7298 }
7274 7299
7275 #undef __ 7300 #undef __
7276 7301
7277 } } // namespace v8::internal 7302 } } // namespace v8::internal
7278 7303
7279 #endif // V8_TARGET_ARCH_IA32 7304 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698