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

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

Issue 6683022: [Isolates] Merge 7111:7152 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 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/arm/assembler-arm.cc ('k') | src/arm/deoptimizer-arm.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 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // requested when VFP3 is supported d6 and d7 will still be scratched. If 390 // requested when VFP3 is supported d6 and d7 will still be scratched. If
391 // either r0 or r1 is not a number (not smi and not heap number object) the 391 // either r0 or r1 is not a number (not smi and not heap number object) the
392 // not_number label is jumped to with r0 and r1 intact. 392 // not_number label is jumped to with r0 and r1 intact.
393 static void LoadOperands(MacroAssembler* masm, 393 static void LoadOperands(MacroAssembler* masm,
394 FloatingPointHelper::Destination destination, 394 FloatingPointHelper::Destination destination,
395 Register heap_number_map, 395 Register heap_number_map,
396 Register scratch1, 396 Register scratch1,
397 Register scratch2, 397 Register scratch2,
398 Label* not_number); 398 Label* not_number);
399 399
400 // Loads the number from object into dst as a 32-bit integer if possible. If 400 // Convert the smi or heap number in object to an int32 using the rules
401 // the object cannot be converted to a 32-bit integer control continues at 401 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated
402 // the label not_int32. If VFP is supported double_scratch is used 402 // and brought into the range -2^31 .. +2^31 - 1.
403 // but not scratch2. 403 static void ConvertNumberToInt32(MacroAssembler* masm,
404 // Floating point value in the 32-bit integer range will be rounded 404 Register object,
405 // to an integer. 405 Register dst,
406 static void LoadNumberAsInteger(MacroAssembler* masm, 406 Register heap_number_map,
407 Register object, 407 Register scratch1,
408 Register dst, 408 Register scratch2,
409 Register heap_number_map, 409 Register scratch3,
410 Register scratch1, 410 DwVfpRegister double_scratch,
411 Register scratch2, 411 Label* not_int32);
412 DwVfpRegister double_scratch,
413 Label* not_int32);
414 412
415 // Load the number from object into double_dst in the double format. 413 // Load the number from object into double_dst in the double format.
416 // Control will jump to not_int32 if the value cannot be exactly represented 414 // Control will jump to not_int32 if the value cannot be exactly represented
417 // by a 32-bit integer. 415 // by a 32-bit integer.
418 // Floating point value in the 32-bit integer range that are not exact integer 416 // Floating point value in the 32-bit integer range that are not exact integer
419 // won't be loaded. 417 // won't be loaded.
420 static void LoadNumberAsInt32Double(MacroAssembler* masm, 418 static void LoadNumberAsInt32Double(MacroAssembler* masm,
421 Register object, 419 Register object,
422 Destination destination, 420 Destination destination,
423 DwVfpRegister double_dst, 421 DwVfpRegister double_dst,
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 ConvertToDoubleStub stub(dst2, dst1, scratch1, scratch2); 598 ConvertToDoubleStub stub(dst2, dst1, scratch1, scratch2);
601 __ push(lr); 599 __ push(lr);
602 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET); 600 __ Call(stub.GetCode(), RelocInfo::CODE_TARGET);
603 __ pop(lr); 601 __ pop(lr);
604 } 602 }
605 603
606 __ bind(&done); 604 __ bind(&done);
607 } 605 }
608 606
609 607
610 void FloatingPointHelper::LoadNumberAsInteger(MacroAssembler* masm, 608 void FloatingPointHelper::ConvertNumberToInt32(MacroAssembler* masm,
611 Register object, 609 Register object,
612 Register dst, 610 Register dst,
613 Register heap_number_map, 611 Register heap_number_map,
614 Register scratch1, 612 Register scratch1,
615 Register scratch2, 613 Register scratch2,
616 DwVfpRegister double_scratch, 614 Register scratch3,
617 Label* not_int32) { 615 DwVfpRegister double_scratch,
616 Label* not_number) {
618 if (FLAG_debug_code) { 617 if (FLAG_debug_code) {
619 __ AbortIfNotRootValue(heap_number_map, 618 __ AbortIfNotRootValue(heap_number_map,
620 Heap::kHeapNumberMapRootIndex, 619 Heap::kHeapNumberMapRootIndex,
621 "HeapNumberMap register clobbered."); 620 "HeapNumberMap register clobbered.");
622 } 621 }
623 Label is_smi, done; 622 Label is_smi;
623 Label done;
624 Label not_in_int32_range;
625
624 __ JumpIfSmi(object, &is_smi); 626 __ JumpIfSmi(object, &is_smi);
625 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset)); 627 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMapOffset));
626 __ cmp(scratch1, heap_number_map); 628 __ cmp(scratch1, heap_number_map);
627 __ b(ne, not_int32); 629 __ b(ne, not_number);
628 __ ConvertToInt32( 630 __ ConvertToInt32(object,
629 object, dst, scratch1, scratch2, double_scratch, not_int32); 631 dst,
632 scratch1,
633 scratch2,
634 double_scratch,
635 &not_in_int32_range);
630 __ jmp(&done); 636 __ jmp(&done);
637
638 __ bind(&not_in_int32_range);
639 __ ldr(scratch2, FieldMemOperand(object, HeapNumber::kExponentOffset));
640 __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMantissaOffset));
641
642 // Register scratch1 contains mantissa word, scratch2 contains
643 // sign, exponent and mantissa. Extract biased exponent into dst.
644 __ Ubfx(dst,
645 scratch2,
646 HeapNumber::kExponentShift,
647 HeapNumber::kExponentBits);
648
649 // Express exponent as delta to 31.
650 __ sub(dst, dst, Operand(HeapNumber::kExponentBias + 31));
651
652 Label normal_exponent;
653 // If the delta is larger than kMantissaBits plus one, all bits
654 // would be shifted away, which means that we can return 0.
655 __ cmp(dst, Operand(HeapNumber::kMantissaBits + 1));
656 __ b(&normal_exponent, lt);
657 __ mov(dst, Operand(0));
658 __ jmp(&done);
659
660 __ bind(&normal_exponent);
661 const int kShiftBase = HeapNumber::kNonMantissaBitsInTopWord - 1;
662 // Calculate shift.
663 __ add(scratch3, dst, Operand(kShiftBase));
664
665 // Put implicit 1 before the mantissa part in scratch2.
666 __ orr(scratch2,
667 scratch2,
668 Operand(1 << HeapNumber::kMantissaBitsInTopWord));
669
670 // Save sign.
671 Register sign = dst;
672 __ and_(sign, scratch2, Operand(HeapNumber::kSignMask));
673
674 // Shift mantisssa bits the correct position in high word.
675 __ mov(scratch2, Operand(scratch2, LSL, scratch3));
676
677 // Replace the shifted bits with bits from the lower mantissa word.
678 Label pos_shift, shift_done;
679 __ rsb(scratch3, scratch3, Operand(32), SetCC);
680 __ b(&pos_shift, ge);
681
682 // Negate scratch3.
683 __ rsb(scratch3, scratch3, Operand(0));
684 __ mov(scratch1, Operand(scratch1, LSL, scratch3));
685 __ jmp(&shift_done);
686
687 __ bind(&pos_shift);
688 __ mov(scratch1, Operand(scratch1, LSR, scratch3));
689
690 __ bind(&shift_done);
691 __ orr(scratch2, scratch2, Operand(scratch1));
692
693 // Restore sign if necessary.
694 __ cmp(sign, Operand(0));
695 __ rsb(dst, scratch2, Operand(0), LeaveCC, ne);
696 __ mov(dst, scratch2, LeaveCC, eq);
697 __ jmp(&done);
698
631 __ bind(&is_smi); 699 __ bind(&is_smi);
632 __ SmiUntag(dst, object); 700 __ SmiUntag(dst, object);
633 __ bind(&done); 701 __ bind(&done);
634 } 702 }
635 703
636 704
637 void FloatingPointHelper::LoadNumberAsInt32Double(MacroAssembler* masm, 705 void FloatingPointHelper::LoadNumberAsInt32Double(MacroAssembler* masm,
638 Register object, 706 Register object,
639 Destination destination, 707 Destination destination,
640 DwVfpRegister double_dst, 708 DwVfpRegister double_dst,
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3021 3089
3022 3090
3023 void TypeRecordingBinaryOpStub::GenerateFPOperation(MacroAssembler* masm, 3091 void TypeRecordingBinaryOpStub::GenerateFPOperation(MacroAssembler* masm,
3024 bool smi_operands, 3092 bool smi_operands,
3025 Label* not_numbers, 3093 Label* not_numbers,
3026 Label* gc_required) { 3094 Label* gc_required) {
3027 Register left = r1; 3095 Register left = r1;
3028 Register right = r0; 3096 Register right = r0;
3029 Register scratch1 = r7; 3097 Register scratch1 = r7;
3030 Register scratch2 = r9; 3098 Register scratch2 = r9;
3099 Register scratch3 = r4;
3031 3100
3032 ASSERT(smi_operands || (not_numbers != NULL)); 3101 ASSERT(smi_operands || (not_numbers != NULL));
3033 if (smi_operands && FLAG_debug_code) { 3102 if (smi_operands && FLAG_debug_code) {
3034 __ AbortIfNotSmi(left); 3103 __ AbortIfNotSmi(left);
3035 __ AbortIfNotSmi(right); 3104 __ AbortIfNotSmi(right);
3036 } 3105 }
3037 3106
3038 Register heap_number_map = r6; 3107 Register heap_number_map = r6;
3039 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); 3108 __ LoadRoot(heap_number_map, Heap::kHeapNumberMapRootIndex);
3040 3109
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3109 case Token::BIT_XOR: 3178 case Token::BIT_XOR:
3110 case Token::BIT_AND: 3179 case Token::BIT_AND:
3111 case Token::SAR: 3180 case Token::SAR:
3112 case Token::SHR: 3181 case Token::SHR:
3113 case Token::SHL: { 3182 case Token::SHL: {
3114 if (smi_operands) { 3183 if (smi_operands) {
3115 __ SmiUntag(r3, left); 3184 __ SmiUntag(r3, left);
3116 __ SmiUntag(r2, right); 3185 __ SmiUntag(r2, right);
3117 } else { 3186 } else {
3118 // Convert operands to 32-bit integers. Right in r2 and left in r3. 3187 // Convert operands to 32-bit integers. Right in r2 and left in r3.
3119 FloatingPointHelper::LoadNumberAsInteger(masm, 3188 FloatingPointHelper::ConvertNumberToInt32(masm,
3120 left, 3189 left,
3121 r3, 3190 r3,
3122 heap_number_map, 3191 heap_number_map,
3123 scratch1, 3192 scratch1,
3124 scratch2, 3193 scratch2,
3125 d0, 3194 scratch3,
3126 not_numbers); 3195 d0,
3127 FloatingPointHelper::LoadNumberAsInteger(masm, 3196 not_numbers);
3128 right, 3197 FloatingPointHelper::ConvertNumberToInt32(masm,
3129 r2, 3198 right,
3130 heap_number_map, 3199 r2,
3131 scratch1, 3200 heap_number_map,
3132 scratch2, 3201 scratch1,
3133 d0, 3202 scratch2,
3134 not_numbers); 3203 scratch3,
3204 d0,
3205 not_numbers);
3135 } 3206 }
3136 3207
3137 Label result_not_a_smi; 3208 Label result_not_a_smi;
3138 switch (op_) { 3209 switch (op_) {
3139 case Token::BIT_OR: 3210 case Token::BIT_OR:
3140 __ orr(r2, r3, Operand(r2)); 3211 __ orr(r2, r3, Operand(r2));
3141 break; 3212 break;
3142 case Token::BIT_XOR: 3213 case Token::BIT_XOR:
3143 __ eor(r2, r3, Operand(r2)); 3214 __ eor(r2, r3, Operand(r2));
3144 break; 3215 break;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 __ bind(&transition); 3642 __ bind(&transition);
3572 GenerateTypeTransition(masm); 3643 GenerateTypeTransition(masm);
3573 } 3644 }
3574 3645
3575 __ bind(&call_runtime); 3646 __ bind(&call_runtime);
3576 GenerateCallRuntime(masm); 3647 GenerateCallRuntime(masm);
3577 } 3648 }
3578 3649
3579 3650
3580 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { 3651 void TypeRecordingBinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) {
3581 Label not_numbers, call_runtime; 3652 Label call_runtime;
3582 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER); 3653 ASSERT(operands_type_ == TRBinaryOpIC::HEAP_NUMBER);
3583 3654
3584 GenerateFPOperation(masm, false, &not_numbers, &call_runtime); 3655 GenerateFPOperation(masm, false, &call_runtime, &call_runtime);
3585
3586 __ bind(&not_numbers);
3587 GenerateTypeTransition(masm);
3588 3656
3589 __ bind(&call_runtime); 3657 __ bind(&call_runtime);
3590 GenerateCallRuntime(masm); 3658 GenerateCallRuntime(masm);
3591 } 3659 }
3592 3660
3593 3661
3594 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) { 3662 void TypeRecordingBinaryOpStub::GenerateGeneric(MacroAssembler* masm) {
3595 Label call_runtime, call_string_add_or_runtime; 3663 Label call_runtime, call_string_add_or_runtime;
3596 3664
3597 GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS); 3665 GenerateSmiCode(masm, &call_runtime, ALLOW_HEAPNUMBER_RESULTS);
(...skipping 3248 matching lines...) Expand 10 before | Expand all | Expand 10 after
6846 __ str(pc, MemOperand(sp, 0)); 6914 __ str(pc, MemOperand(sp, 0));
6847 __ Jump(target); // Call the C++ function. 6915 __ Jump(target); // Call the C++ function.
6848 } 6916 }
6849 6917
6850 6918
6851 #undef __ 6919 #undef __
6852 6920
6853 } } // namespace v8::internal 6921 } } // namespace v8::internal
6854 6922
6855 #endif // V8_TARGET_ARCH_ARM 6923 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/deoptimizer-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698