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

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

Issue 22745003: Remove platform-specific dead code for KeyedStores (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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/code-stubs.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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 Handle<GlobalObject>::cast(current), 1143 Handle<GlobalObject>::cast(current),
1144 name, 1144 name,
1145 scratch, 1145 scratch,
1146 miss); 1146 miss);
1147 } 1147 }
1148 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1148 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1149 } 1149 }
1150 } 1150 }
1151 1151
1152 1152
1153 // Convert and store int passed in register ival to IEEE 754 single precision
1154 // floating point value at memory location (dst + 4 * wordoffset)
1155 // If VFP3 is available use it for conversion.
1156 static void StoreIntAsFloat(MacroAssembler* masm,
1157 Register dst,
1158 Register wordoffset,
1159 Register ival,
1160 Register scratch1) {
1161 __ vmov(s0, ival);
1162 __ add(scratch1, dst, Operand(wordoffset, LSL, 2));
1163 __ vcvt_f32_s32(s0, s0);
1164 __ vstr(s0, scratch1, 0);
1165 }
1166
1167
1168 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { 1153 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
1169 __ Jump(code, RelocInfo::CODE_TARGET); 1154 __ Jump(code, RelocInfo::CODE_TARGET);
1170 } 1155 }
1171 1156
1172 1157
1173 #undef __ 1158 #undef __
1174 #define __ ACCESS_MASM(masm()) 1159 #define __ ACCESS_MASM(masm())
1175 1160
1176 1161
1177 Register StubCompiler::CheckPrototypes(Handle<JSObject> object, 1162 Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after
3183 3168
3184 // ---------- S t a t e -------------- 3169 // ---------- S t a t e --------------
3185 // -- lr : return address 3170 // -- lr : return address
3186 // -- r0 : key 3171 // -- r0 : key
3187 // -- r1 : receiver 3172 // -- r1 : receiver
3188 // ----------------------------------- 3173 // -----------------------------------
3189 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3174 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3190 } 3175 }
3191 3176
3192 3177
3193 static void GenerateSmiKeyCheck(MacroAssembler* masm,
3194 Register key,
3195 Register scratch0,
3196 DwVfpRegister double_scratch0,
3197 LowDwVfpRegister double_scratch1,
3198 Label* fail) {
3199 Label key_ok;
3200 // Check for smi or a smi inside a heap number. We convert the heap
3201 // number and check if the conversion is exact and fits into the smi
3202 // range.
3203 __ JumpIfSmi(key, &key_ok);
3204 __ CheckMap(key,
3205 scratch0,
3206 Heap::kHeapNumberMapRootIndex,
3207 fail,
3208 DONT_DO_SMI_CHECK);
3209 __ sub(ip, key, Operand(kHeapObjectTag));
3210 __ vldr(double_scratch0, ip, HeapNumber::kValueOffset);
3211 __ TryDoubleToInt32Exact(scratch0, double_scratch0, double_scratch1);
3212 __ b(ne, fail);
3213 __ TrySmiTag(key, scratch0, fail);
3214 __ bind(&key_ok);
3215 }
3216
3217
3218 void KeyedStoreStubCompiler::GenerateStoreExternalArray(
3219 MacroAssembler* masm,
3220 ElementsKind elements_kind) {
3221 // ---------- S t a t e --------------
3222 // -- r0 : value
3223 // -- r1 : key
3224 // -- r2 : receiver
3225 // -- lr : return address
3226 // -----------------------------------
3227 Label slow, check_heap_number, miss_force_generic;
3228
3229 // Register usage.
3230 Register value = r0;
3231 Register key = r1;
3232 Register receiver = r2;
3233 // r3 mostly holds the elements array or the destination external array.
3234
3235 // This stub is meant to be tail-jumped to, the receiver must already
3236 // have been verified by the caller to not be a smi.
3237
3238 // Check that the key is a smi or a heap number convertible to a smi.
3239 GenerateSmiKeyCheck(masm, key, r4, d1, d2, &miss_force_generic);
3240
3241 __ ldr(r3, FieldMemOperand(receiver, JSObject::kElementsOffset));
3242
3243 // Check that the index is in range
3244 __ ldr(ip, FieldMemOperand(r3, ExternalArray::kLengthOffset));
3245 __ cmp(key, ip);
3246 // Unsigned comparison catches both negative and too-large values.
3247 __ b(hs, &miss_force_generic);
3248
3249 // Handle both smis and HeapNumbers in the fast path. Go to the
3250 // runtime for all other kinds of values.
3251 // r3: external array.
3252 if (elements_kind == EXTERNAL_PIXEL_ELEMENTS) {
3253 // Double to pixel conversion is only implemented in the runtime for now.
3254 __ UntagAndJumpIfNotSmi(r5, value, &slow);
3255 } else {
3256 __ UntagAndJumpIfNotSmi(r5, value, &check_heap_number);
3257 }
3258 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3259
3260 // r3: base pointer of external storage.
3261 // r5: value (integer).
3262 switch (elements_kind) {
3263 case EXTERNAL_PIXEL_ELEMENTS:
3264 // Clamp the value to [0..255].
3265 __ Usat(r5, 8, Operand(r5));
3266 __ strb(r5, MemOperand(r3, key, LSR, 1));
3267 break;
3268 case EXTERNAL_BYTE_ELEMENTS:
3269 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3270 __ strb(r5, MemOperand(r3, key, LSR, 1));
3271 break;
3272 case EXTERNAL_SHORT_ELEMENTS:
3273 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3274 __ strh(r5, MemOperand(r3, key, LSL, 0));
3275 break;
3276 case EXTERNAL_INT_ELEMENTS:
3277 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3278 __ str(r5, MemOperand(r3, key, LSL, 1));
3279 break;
3280 case EXTERNAL_FLOAT_ELEMENTS:
3281 // Perform int-to-float conversion and store to memory.
3282 __ SmiUntag(r4, key);
3283 StoreIntAsFloat(masm, r3, r4, r5, r7);
3284 break;
3285 case EXTERNAL_DOUBLE_ELEMENTS:
3286 __ vmov(s2, r5);
3287 __ vcvt_f64_s32(d0, s2);
3288 __ add(r3, r3, Operand(key, LSL, 2));
3289 // r3: effective address of the double element
3290 __ vstr(d0, r3, 0);
3291 break;
3292 case FAST_ELEMENTS:
3293 case FAST_SMI_ELEMENTS:
3294 case FAST_DOUBLE_ELEMENTS:
3295 case FAST_HOLEY_ELEMENTS:
3296 case FAST_HOLEY_SMI_ELEMENTS:
3297 case FAST_HOLEY_DOUBLE_ELEMENTS:
3298 case DICTIONARY_ELEMENTS:
3299 case NON_STRICT_ARGUMENTS_ELEMENTS:
3300 UNREACHABLE();
3301 break;
3302 }
3303
3304 // Entry registers are intact, r0 holds the value which is the return value.
3305 __ Ret();
3306
3307 if (elements_kind != EXTERNAL_PIXEL_ELEMENTS) {
3308 // r3: external array.
3309 __ bind(&check_heap_number);
3310 __ CompareObjectType(value, r5, r6, HEAP_NUMBER_TYPE);
3311 __ b(ne, &slow);
3312
3313 __ ldr(r3, FieldMemOperand(r3, ExternalArray::kExternalPointerOffset));
3314
3315 // r3: base pointer of external storage.
3316
3317 // The WebGL specification leaves the behavior of storing NaN and
3318 // +/-Infinity into integer arrays basically undefined. For more
3319 // reproducible behavior, convert these to zero.
3320
3321 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS) {
3322 // vldr requires offset to be a multiple of 4 so we can not
3323 // include -kHeapObjectTag into it.
3324 __ sub(r5, r0, Operand(kHeapObjectTag));
3325 __ vldr(d0, r5, HeapNumber::kValueOffset);
3326 __ add(r5, r3, Operand(key, LSL, 1));
3327 __ vcvt_f32_f64(s0, d0);
3328 __ vstr(s0, r5, 0);
3329 } else if (elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3330 __ sub(r5, r0, Operand(kHeapObjectTag));
3331 __ vldr(d0, r5, HeapNumber::kValueOffset);
3332 __ add(r5, r3, Operand(key, LSL, 2));
3333 __ vstr(d0, r5, 0);
3334 } else {
3335 // Hoisted load. vldr requires offset to be a multiple of 4 so we can
3336 // not include -kHeapObjectTag into it.
3337 __ sub(r5, value, Operand(kHeapObjectTag));
3338 __ vldr(d0, r5, HeapNumber::kValueOffset);
3339 __ ECMAToInt32(r5, d0, r6, r7, r9, d1);
3340
3341 switch (elements_kind) {
3342 case EXTERNAL_BYTE_ELEMENTS:
3343 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS:
3344 __ strb(r5, MemOperand(r3, key, LSR, 1));
3345 break;
3346 case EXTERNAL_SHORT_ELEMENTS:
3347 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS:
3348 __ strh(r5, MemOperand(r3, key, LSL, 0));
3349 break;
3350 case EXTERNAL_INT_ELEMENTS:
3351 case EXTERNAL_UNSIGNED_INT_ELEMENTS:
3352 __ str(r5, MemOperand(r3, key, LSL, 1));
3353 break;
3354 case EXTERNAL_PIXEL_ELEMENTS:
3355 case EXTERNAL_FLOAT_ELEMENTS:
3356 case EXTERNAL_DOUBLE_ELEMENTS:
3357 case FAST_ELEMENTS:
3358 case FAST_SMI_ELEMENTS:
3359 case FAST_DOUBLE_ELEMENTS:
3360 case FAST_HOLEY_ELEMENTS:
3361 case FAST_HOLEY_SMI_ELEMENTS:
3362 case FAST_HOLEY_DOUBLE_ELEMENTS:
3363 case DICTIONARY_ELEMENTS:
3364 case NON_STRICT_ARGUMENTS_ELEMENTS:
3365 UNREACHABLE();
3366 break;
3367 }
3368 }
3369
3370 // Entry registers are intact, r0 holds the value which is the return
3371 // value.
3372 __ Ret();
3373 }
3374
3375 // Slow case, key and receiver still in r0 and r1.
3376 __ bind(&slow);
3377 __ IncrementCounter(
3378 masm->isolate()->counters()->keyed_load_external_array_slow(),
3379 1, r2, r3);
3380
3381 // ---------- S t a t e --------------
3382 // -- lr : return address
3383 // -- r0 : key
3384 // -- r1 : receiver
3385 // -----------------------------------
3386 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3387
3388 // Miss case, call the runtime.
3389 __ bind(&miss_force_generic);
3390
3391 // ---------- S t a t e --------------
3392 // -- lr : return address
3393 // -- r0 : key
3394 // -- r1 : receiver
3395 // -----------------------------------
3396 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3397 }
3398
3399
3400 void KeyedStoreStubCompiler::GenerateStoreFastElement(
3401 MacroAssembler* masm,
3402 bool is_js_array,
3403 ElementsKind elements_kind,
3404 KeyedAccessStoreMode store_mode) {
3405 // ----------- S t a t e -------------
3406 // -- r0 : value
3407 // -- r1 : key
3408 // -- r2 : receiver
3409 // -- lr : return address
3410 // -- r3 : scratch
3411 // -- r4 : scratch (elements)
3412 // -----------------------------------
3413 Label miss_force_generic, transition_elements_kind, grow, slow;
3414 Label finish_store, check_capacity;
3415
3416 Register value_reg = r0;
3417 Register key_reg = r1;
3418 Register receiver_reg = r2;
3419 Register scratch = r4;
3420 Register elements_reg = r3;
3421 Register length_reg = r5;
3422 Register scratch2 = r6;
3423
3424 // This stub is meant to be tail-jumped to, the receiver must already
3425 // have been verified by the caller to not be a smi.
3426
3427 // Check that the key is a smi or a heap number convertible to a smi.
3428 GenerateSmiKeyCheck(masm, key_reg, r4, d1, d2, &miss_force_generic);
3429
3430 if (IsFastSmiElementsKind(elements_kind)) {
3431 __ JumpIfNotSmi(value_reg, &transition_elements_kind);
3432 }
3433
3434 // Check that the key is within bounds.
3435 __ ldr(elements_reg,
3436 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3437 if (is_js_array) {
3438 __ ldr(scratch, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3439 } else {
3440 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3441 }
3442 // Compare smis.
3443 __ cmp(key_reg, scratch);
3444 if (is_js_array && IsGrowStoreMode(store_mode)) {
3445 __ b(hs, &grow);
3446 } else {
3447 __ b(hs, &miss_force_generic);
3448 }
3449
3450 // Make sure elements is a fast element array, not 'cow'.
3451 __ CheckMap(elements_reg,
3452 scratch,
3453 Heap::kFixedArrayMapRootIndex,
3454 &miss_force_generic,
3455 DONT_DO_SMI_CHECK);
3456
3457 __ bind(&finish_store);
3458 if (IsFastSmiElementsKind(elements_kind)) {
3459 __ add(scratch,
3460 elements_reg,
3461 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3462 __ add(scratch, scratch, Operand::PointerOffsetFromSmiKey(key_reg));
3463 __ str(value_reg, MemOperand(scratch));
3464 } else {
3465 ASSERT(IsFastObjectElementsKind(elements_kind));
3466 __ add(scratch,
3467 elements_reg,
3468 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
3469 __ add(scratch, scratch, Operand::PointerOffsetFromSmiKey(key_reg));
3470 __ str(value_reg, MemOperand(scratch));
3471 __ mov(receiver_reg, value_reg);
3472 __ RecordWrite(elements_reg, // Object.
3473 scratch, // Address.
3474 receiver_reg, // Value.
3475 kLRHasNotBeenSaved,
3476 kDontSaveFPRegs);
3477 }
3478 // value_reg (r0) is preserved.
3479 // Done.
3480 __ Ret();
3481
3482 __ bind(&miss_force_generic);
3483 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3484
3485 __ bind(&transition_elements_kind);
3486 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss);
3487
3488 if (is_js_array && IsGrowStoreMode(store_mode)) {
3489 // Grow the array by a single element if possible.
3490 __ bind(&grow);
3491
3492 // Make sure the array is only growing by a single element, anything else
3493 // must be handled by the runtime. Flags already set by previous compare.
3494 __ b(ne, &miss_force_generic);
3495
3496 // Check for the empty array, and preallocate a small backing store if
3497 // possible.
3498 __ ldr(length_reg,
3499 FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3500 __ ldr(elements_reg,
3501 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3502 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex);
3503 __ b(ne, &check_capacity);
3504
3505 int size = FixedArray::SizeFor(JSArray::kPreallocatedArrayElements);
3506 __ Allocate(size, elements_reg, scratch, scratch2, &slow, TAG_OBJECT);
3507
3508 __ LoadRoot(scratch, Heap::kFixedArrayMapRootIndex);
3509 __ str(scratch, FieldMemOperand(elements_reg, JSObject::kMapOffset));
3510 __ mov(scratch, Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
3511 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3512 __ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
3513 for (int i = 1; i < JSArray::kPreallocatedArrayElements; ++i) {
3514 __ str(scratch, FieldMemOperand(elements_reg, FixedArray::SizeFor(i)));
3515 }
3516
3517 // Store the element at index zero.
3518 __ str(value_reg, FieldMemOperand(elements_reg, FixedArray::SizeFor(0)));
3519
3520 // Install the new backing store in the JSArray.
3521 __ str(elements_reg,
3522 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3523 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg,
3524 scratch, kLRHasNotBeenSaved, kDontSaveFPRegs,
3525 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3526
3527 // Increment the length of the array.
3528 __ mov(length_reg, Operand(Smi::FromInt(1)));
3529 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3530 __ Ret();
3531
3532 __ bind(&check_capacity);
3533 // Check for cow elements, in general they are not handled by this stub
3534 __ CheckMap(elements_reg,
3535 scratch,
3536 Heap::kFixedCOWArrayMapRootIndex,
3537 &miss_force_generic,
3538 DONT_DO_SMI_CHECK);
3539
3540 __ ldr(scratch, FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3541 __ cmp(length_reg, scratch);
3542 __ b(hs, &slow);
3543
3544 // Grow the array and finish the store.
3545 __ add(length_reg, length_reg, Operand(Smi::FromInt(1)));
3546 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3547 __ jmp(&finish_store);
3548
3549 __ bind(&slow);
3550 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3551 }
3552 }
3553
3554
3555 void KeyedStoreStubCompiler::GenerateStoreFastDoubleElement(
3556 MacroAssembler* masm,
3557 bool is_js_array,
3558 KeyedAccessStoreMode store_mode) {
3559 // ----------- S t a t e -------------
3560 // -- r0 : value
3561 // -- r1 : key
3562 // -- r2 : receiver
3563 // -- lr : return address
3564 // -- r3 : scratch (elements backing store)
3565 // -- r4 : scratch
3566 // -- r5 : scratch
3567 // -----------------------------------
3568 Label miss_force_generic, transition_elements_kind, grow, slow;
3569 Label finish_store, check_capacity;
3570
3571 Register value_reg = r0;
3572 Register key_reg = r1;
3573 Register receiver_reg = r2;
3574 Register elements_reg = r3;
3575 Register scratch1 = r4;
3576 Register scratch2 = r5;
3577 Register length_reg = r7;
3578
3579 // This stub is meant to be tail-jumped to, the receiver must already
3580 // have been verified by the caller to not be a smi.
3581
3582 // Check that the key is a smi or a heap number convertible to a smi.
3583 GenerateSmiKeyCheck(masm, key_reg, r4, d1, d2, &miss_force_generic);
3584
3585 __ ldr(elements_reg,
3586 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3587
3588 // Check that the key is within bounds.
3589 if (is_js_array) {
3590 __ ldr(scratch1, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3591 } else {
3592 __ ldr(scratch1,
3593 FieldMemOperand(elements_reg, FixedArray::kLengthOffset));
3594 }
3595 // Compare smis, unsigned compare catches both negative and out-of-bound
3596 // indexes.
3597 __ cmp(key_reg, scratch1);
3598 if (IsGrowStoreMode(store_mode)) {
3599 __ b(hs, &grow);
3600 } else {
3601 __ b(hs, &miss_force_generic);
3602 }
3603
3604 __ bind(&finish_store);
3605 __ StoreNumberToDoubleElements(value_reg, key_reg, elements_reg,
3606 scratch1, d0, &transition_elements_kind);
3607 __ Ret();
3608
3609 // Handle store cache miss, replacing the ic with the generic stub.
3610 __ bind(&miss_force_generic);
3611 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_MissForceGeneric);
3612
3613 __ bind(&transition_elements_kind);
3614 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Miss);
3615
3616 if (is_js_array && IsGrowStoreMode(store_mode)) {
3617 // Grow the array by a single element if possible.
3618 __ bind(&grow);
3619
3620 // Make sure the array is only growing by a single element, anything else
3621 // must be handled by the runtime. Flags already set by previous compare.
3622 __ b(ne, &miss_force_generic);
3623
3624 // Transition on values that can't be stored in a FixedDoubleArray.
3625 Label value_is_smi;
3626 __ JumpIfSmi(value_reg, &value_is_smi);
3627 __ ldr(scratch1, FieldMemOperand(value_reg, HeapObject::kMapOffset));
3628 __ CompareRoot(scratch1, Heap::kHeapNumberMapRootIndex);
3629 __ b(ne, &transition_elements_kind);
3630 __ bind(&value_is_smi);
3631
3632 // Check for the empty array, and preallocate a small backing store if
3633 // possible.
3634 __ ldr(length_reg,
3635 FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3636 __ ldr(elements_reg,
3637 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3638 __ CompareRoot(elements_reg, Heap::kEmptyFixedArrayRootIndex);
3639 __ b(ne, &check_capacity);
3640
3641 int size = FixedDoubleArray::SizeFor(JSArray::kPreallocatedArrayElements);
3642 __ Allocate(size, elements_reg, scratch1, scratch2, &slow, TAG_OBJECT);
3643
3644 // Initialize the new FixedDoubleArray.
3645 __ LoadRoot(scratch1, Heap::kFixedDoubleArrayMapRootIndex);
3646 __ str(scratch1, FieldMemOperand(elements_reg, JSObject::kMapOffset));
3647 __ mov(scratch1,
3648 Operand(Smi::FromInt(JSArray::kPreallocatedArrayElements)));
3649 __ str(scratch1,
3650 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset));
3651
3652 __ mov(scratch1, elements_reg);
3653 __ StoreNumberToDoubleElements(value_reg, key_reg, scratch1,
3654 scratch2, d0, &transition_elements_kind);
3655
3656 __ mov(scratch1, Operand(kHoleNanLower32));
3657 __ mov(scratch2, Operand(kHoleNanUpper32));
3658 for (int i = 1; i < JSArray::kPreallocatedArrayElements; i++) {
3659 int offset = FixedDoubleArray::OffsetOfElementAt(i);
3660 __ str(scratch1, FieldMemOperand(elements_reg, offset));
3661 __ str(scratch2, FieldMemOperand(elements_reg, offset + kPointerSize));
3662 }
3663
3664 // Install the new backing store in the JSArray.
3665 __ str(elements_reg,
3666 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3667 __ RecordWriteField(receiver_reg, JSObject::kElementsOffset, elements_reg,
3668 scratch1, kLRHasNotBeenSaved, kDontSaveFPRegs,
3669 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK);
3670
3671 // Increment the length of the array.
3672 __ mov(length_reg, Operand(Smi::FromInt(1)));
3673 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3674 __ ldr(elements_reg,
3675 FieldMemOperand(receiver_reg, JSObject::kElementsOffset));
3676 __ Ret();
3677
3678 __ bind(&check_capacity);
3679 // Make sure that the backing store can hold additional elements.
3680 __ ldr(scratch1,
3681 FieldMemOperand(elements_reg, FixedDoubleArray::kLengthOffset));
3682 __ cmp(length_reg, scratch1);
3683 __ b(hs, &slow);
3684
3685 // Grow the array and finish the store.
3686 __ add(length_reg, length_reg, Operand(Smi::FromInt(1)));
3687 __ str(length_reg, FieldMemOperand(receiver_reg, JSArray::kLengthOffset));
3688 __ jmp(&finish_store);
3689
3690 __ bind(&slow);
3691 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3692 }
3693 }
3694
3695
3696 #undef __ 3178 #undef __
3697 3179
3698 } } // namespace v8::internal 3180 } } // namespace v8::internal
3699 3181
3700 #endif // V8_TARGET_ARCH_ARM 3182 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698