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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 9837109: Improve performance of keyed loads/stores which have a HeapNumber index. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 8 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/ia32/stub-cache-ia32.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 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 case FAST_DOUBLE_ELEMENTS: 3361 case FAST_DOUBLE_ELEMENTS:
3362 case DICTIONARY_ELEMENTS: 3362 case DICTIONARY_ELEMENTS:
3363 case NON_STRICT_ARGUMENTS_ELEMENTS: 3363 case NON_STRICT_ARGUMENTS_ELEMENTS:
3364 UNREACHABLE(); 3364 UNREACHABLE();
3365 return false; 3365 return false;
3366 } 3366 }
3367 return false; 3367 return false;
3368 } 3368 }
3369 3369
3370 3370
3371 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3372 Register key,
3373 Register scratch0,
3374 Register scratch1,
3375 DwVfpRegister double_scratch0,
3376 Label* fail) {
3377 if (CpuFeatures::IsSupported(VFP3)) {
3378 CpuFeatures::Scope scope(VFP3);
3379 Label key_ok;
3380 // Check for smi or a smi inside a heap number. We convert the heap
3381 // number and check if the conversion is exact and fits into the smi
3382 // range.
3383 __ JumpIfSmi(key, &key_ok);
3384 __ CheckMap(key,
3385 scratch0,
3386 Heap::kHeapNumberMapRootIndex,
3387 fail,
3388 DONT_DO_SMI_CHECK);
3389 __ sub(ip, key, Operand(kHeapObjectTag));
3390 __ vldr(double_scratch0, ip, HeapNumber::kValueOffset);
3391 __ EmitVFPTruncate(kRoundToZero,
3392 double_scratch0.low(),
3393 double_scratch0,
3394 scratch0,
3395 scratch1,
3396 kCheckForInexactConversion);
3397 __ b(ne, fail);
3398 __ vmov(scratch0, double_scratch0.low());
3399 __ TrySmiTag(scratch0, fail, scratch1);
3400 __ mov(key, scratch0);
3401 __ bind(&key_ok);
3402 } else {
3403 // Check that the key is a smi.
3404 __ JumpIfNotSmi(key, fail);
3405 }
3406 }
3407
3408
3371 void KeyedLoadStubCompiler::GenerateLoadExternalArray( 3409 void KeyedLoadStubCompiler::GenerateLoadExternalArray(
3372 MacroAssembler* masm, 3410 MacroAssembler* masm,
3373 ElementsKind elements_kind) { 3411 ElementsKind elements_kind) {
3374 // ---------- S t a t e -------------- 3412 // ---------- S t a t e --------------
3375 // -- lr : return address 3413 // -- lr : return address
3376 // -- r0 : key 3414 // -- r0 : key
3377 // -- r1 : receiver 3415 // -- r1 : receiver
3378 // ----------------------------------- 3416 // -----------------------------------
3379 Label miss_force_generic, slow, failed_allocation; 3417 Label miss_force_generic, slow, failed_allocation;
3380 3418
3381 Register key = r0; 3419 Register key = r0;
3382 Register receiver = r1; 3420 Register receiver = r1;
3383 3421
3384 // This stub is meant to be tail-jumped to, the receiver must already 3422 // This stub is meant to be tail-jumped to, the receiver must already
3385 // have been verified by the caller to not be a smi. 3423 // have been verified by the caller to not be a smi.
3386 3424
3387 // Check that the key is a smi. 3425 // Check that the key is a smi or a heap number convertible to a smi.
3388 __ JumpIfNotSmi(key, &miss_force_generic); 3426 GenerateSmiKeyCheck(masm, key, r4, r5, d1, &miss_force_generic);
3389 3427
3390 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset)); 3428 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset));
3391 // r3: elements array 3429 // r3: elements array
3392 3430
3393 // Check that the index is in range. 3431 // Check that the index is in range.
3394 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset)); 3432 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3395 __ cmp(key, ip); 3433 __ cmp(key, ip);
3396 // Unsigned comparison catches both negative and too-large values. 3434 // Unsigned comparison catches both negative and too-large values.
3397 __ b(hs, &miss_force_generic); 3435 __ b(hs, &miss_force_generic);
3398 3436
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
3708 3746
3709 // Register usage. 3747 // Register usage.
3710 Register value = r0; 3748 Register value = r0;
3711 Register key = r1; 3749 Register key = r1;
3712 Register receiver = r2; 3750 Register receiver = r2;
3713 // r3 mostly holds the elements array or the destination external array. 3751 // r3 mostly holds the elements array or the destination external array.
3714 3752
3715 // This stub is meant to be tail-jumped to, the receiver must already 3753 // This stub is meant to be tail-jumped to, the receiver must already
3716 // have been verified by the caller to not be a smi. 3754 // have been verified by the caller to not be a smi.
3717 3755
3718 // Check that the key is a smi. 3756 // Check that the key is a smi or a heap number convertible to a smi.
3719 __ JumpIfNotSmi(key, &miss_force_generic); 3757 GenerateSmiKeyCheck(masm, key, r4, r5, d1, &miss_force_generic);
3720 3758
3721 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset)); 3759 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset));
3722 3760
3723 // Check that the index is in range 3761 // Check that the index is in range
3724 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset)); 3762 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3725 __ cmp(key, ip); 3763 __ cmp(key, ip);
3726 // Unsigned comparison catches both negative and too-large values. 3764 // Unsigned comparison catches both negative and too-large values.
3727 __ b(hs, &miss_force_generic); 3765 __ b(hs, &miss_force_generic);
3728 3766
3729 // Handle both smis and HeapNumbers in the fast path. Go to the 3767 // Handle both smis and HeapNumbers in the fast path. Go to the
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4034 // ----------- S t a t e ------------- 4072 // ----------- S t a t e -------------
4035 // -- lr : return address 4073 // -- lr : return address
4036 // -- r0 : key 4074 // -- r0 : key
4037 // -- r1 : receiver 4075 // -- r1 : receiver
4038 // ----------------------------------- 4076 // -----------------------------------
4039 Label miss_force_generic; 4077 Label miss_force_generic;
4040 4078
4041 // This stub is meant to be tail-jumped to, the receiver must already 4079 // This stub is meant to be tail-jumped to, the receiver must already
4042 // have been verified by the caller to not be a smi. 4080 // have been verified by the caller to not be a smi.
4043 4081
4044 // Check that the key is a smi. 4082 // Check that the key is a smi or a heap number convertible to a smi.
4045 __ JumpIfNotSmi(r0, &miss_force_generic); 4083 GenerateSmiKeyCheck(masm, r0, r4, r5, d1, &miss_force_generic);
4046 4084
4047 // Get the elements array. 4085 // Get the elements array.
4048 __ ldr(r2, FieldMemOperand(r1, JSObject::kElementsOffset)); 4086 __ ldr(r2, FieldMemOperand(r1, JSObject::kElementsOffset));
4049 __ AssertFastElements(r2); 4087 __ AssertFastElements(r2);
4050 4088
4051 // Check that the key is within bounds. 4089 // Check that the key is within bounds.
4052 __ ldr(r3, FieldMemOperand(r2, FixedArray::kLengthOffset)); 4090 __ ldr(r3, FieldMemOperand(r2, FixedArray::kLengthOffset));
4053 __ cmp(r0, Operand(r3)); 4091 __ cmp(r0, Operand(r3));
4054 __ b(hs, &miss_force_generic); 4092 __ b(hs, &miss_force_generic);
4055 4093
(...skipping 30 matching lines...) Expand all
4086 Register heap_number_reg = r2; 4124 Register heap_number_reg = r2;
4087 Register indexed_double_offset = r3; 4125 Register indexed_double_offset = r3;
4088 Register scratch = r4; 4126 Register scratch = r4;
4089 Register scratch2 = r5; 4127 Register scratch2 = r5;
4090 Register scratch3 = r6; 4128 Register scratch3 = r6;
4091 Register heap_number_map = r7; 4129 Register heap_number_map = r7;
4092 4130
4093 // This stub is meant to be tail-jumped to, the receiver must already 4131 // This stub is meant to be tail-jumped to, the receiver must already
4094 // have been verified by the caller to not be a smi. 4132 // have been verified by the caller to not be a smi.
4095 4133
4096 // Check that the key is a smi. 4134 // Check that the key is a smi or a heap number convertible to a smi.
4097 __ JumpIfNotSmi(key_reg, &miss_force_generic); 4135 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic);
4098 4136
4099 // Get the elements array. 4137 // Get the elements array.
4100 __ ldr(elements_reg, 4138 __ ldr(elements_reg,
4101 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4139 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4102 4140
4103 // Check that the key is within bounds. 4141 // Check that the key is within bounds.
4104 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4142 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
4105 __ cmp(key_reg, Operand(scratch)); 4143 __ cmp(key_reg, Operand(scratch));
4106 __ b(hs, &miss_force_generic); 4144 __ b(hs, &miss_force_generic);
4107 4145
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4162 Register key_reg = r1; 4200 Register key_reg = r1;
4163 Register receiver_reg = r2; 4201 Register receiver_reg = r2;
4164 Register scratch = r4; 4202 Register scratch = r4;
4165 Register elements_reg = r3; 4203 Register elements_reg = r3;
4166 Register length_reg = r5; 4204 Register length_reg = r5;
4167 Register scratch2 = r6; 4205 Register scratch2 = r6;
4168 4206
4169 // This stub is meant to be tail-jumped to, the receiver must already 4207 // This stub is meant to be tail-jumped to, the receiver must already
4170 // have been verified by the caller to not be a smi. 4208 // have been verified by the caller to not be a smi.
4171 4209
4172 // Check that the key is a smi. 4210 // Check that the key is a smi or a heap number convertible to a smi.
4173 __ JumpIfNotSmi(key_reg, &miss_force_generic); 4211 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic);
4174 4212
4175 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) { 4213 if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
4176 __ JumpIfNotSmi(value_reg, &transition_elements_kind); 4214 __ JumpIfNotSmi(value_reg, &transition_elements_kind);
4177 } 4215 }
4178 4216
4179 // Check that the key is within bounds. 4217 // Check that the key is within bounds.
4180 __ ldr(elements_reg, 4218 __ ldr(elements_reg,
4181 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4219 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4182 if (is_js_array) { 4220 if (is_js_array) {
4183 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4221 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 Register receiver_reg = r2; 4367 Register receiver_reg = r2;
4330 Register elements_reg = r3; 4368 Register elements_reg = r3;
4331 Register scratch1 = r4; 4369 Register scratch1 = r4;
4332 Register scratch2 = r5; 4370 Register scratch2 = r5;
4333 Register scratch3 = r6; 4371 Register scratch3 = r6;
4334 Register scratch4 = r7; 4372 Register scratch4 = r7;
4335 Register length_reg = r7; 4373 Register length_reg = r7;
4336 4374
4337 // This stub is meant to be tail-jumped to, the receiver must already 4375 // This stub is meant to be tail-jumped to, the receiver must already
4338 // have been verified by the caller to not be a smi. 4376 // have been verified by the caller to not be a smi.
4339 __ JumpIfNotSmi(key_reg, &miss_force_generic); 4377
4378 // Check that the key is a smi or a heap number convertible to a smi.
4379 GenerateSmiKeyCheck(masm, key_reg, r4, r5, d1, &miss_force_generic);
4340 4380
4341 __ ldr(elements_reg, 4381 __ ldr(elements_reg,
4342 FieldMemOperand(receiver_reg, JSObject::kElementsOffset)); 4382 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
4343 4383
4344 // Check that the key is within bounds. 4384 // Check that the key is within bounds.
4345 if (is_js_array) { 4385 if (is_js_array) {
4346 __ ldr(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset)); 4386 __ ldr(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
4347 } else { 4387 } else {
4348 __ ldr(scratch1, 4388 __ ldr(scratch1,
4349 FieldMemOperand(elements_reg, FixedArray::kLengthOffset)); 4389 FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4486 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4447 } 4487 }
4448 } 4488 }
4449 4489
4450 4490
4451 #undef __ 4491 #undef __
4452 4492
4453 } } // namespace v8::internal 4493 } } // namespace v8::internal
4454 4494
4455 #endif // V8_TARGET_ARCH_ARM 4495 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698