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

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 7134067: Merge r8237 to V8 3.2 branch. Fix bug v8:1434, optimized compare of undefined can fail. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.2/
Patch Set: '' Created 9 years, 6 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/lithium-codegen-arm.h ('k') | src/hydrogen.h » ('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 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 if (instr->needs_check()) { 3553 if (instr->needs_check()) {
3554 __ tst(ToRegister(input), Operand(kSmiTagMask)); 3554 __ tst(ToRegister(input), Operand(kSmiTagMask));
3555 DeoptimizeIf(ne, instr->environment()); 3555 DeoptimizeIf(ne, instr->environment());
3556 } 3556 }
3557 __ SmiUntag(ToRegister(input)); 3557 __ SmiUntag(ToRegister(input));
3558 } 3558 }
3559 3559
3560 3560
3561 void LCodeGen::EmitNumberUntagD(Register input_reg, 3561 void LCodeGen::EmitNumberUntagD(Register input_reg,
3562 DoubleRegister result_reg, 3562 DoubleRegister result_reg,
3563 bool deoptimize_on_undefined,
3563 LEnvironment* env) { 3564 LEnvironment* env) {
3564 Register scratch = scratch0(); 3565 Register scratch = scratch0();
3565 SwVfpRegister flt_scratch = s0; 3566 SwVfpRegister flt_scratch = s0;
3566 ASSERT(!result_reg.is(d0)); 3567 ASSERT(!result_reg.is(d0));
3567 3568
3568 Label load_smi, heap_number, done; 3569 Label load_smi, heap_number, done;
3569 3570
3570 // Smi check. 3571 // Smi check.
3571 __ tst(input_reg, Operand(kSmiTagMask)); 3572 __ tst(input_reg, Operand(kSmiTagMask));
3572 __ b(eq, &load_smi); 3573 __ b(eq, &load_smi);
3573 3574
3574 // Heap number map check. 3575 // Heap number map check.
3575 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); 3576 __ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset));
3576 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); 3577 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
3577 __ cmp(scratch, Operand(ip)); 3578 __ cmp(scratch, Operand(ip));
3578 __ b(eq, &heap_number); 3579 if (deoptimize_on_undefined) {
3580 DeoptimizeIf(ne, env);
3581 } else {
3582 Label heap_number;
3583 __ b(eq, &heap_number);
3579 3584
3580 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); 3585 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
3581 __ cmp(input_reg, Operand(ip)); 3586 __ cmp(input_reg, Operand(ip));
3582 DeoptimizeIf(ne, env); 3587 DeoptimizeIf(ne, env);
3583 3588
3584 // Convert undefined to NaN. 3589 // Convert undefined to NaN.
3585 __ LoadRoot(ip, Heap::kNanValueRootIndex); 3590 __ LoadRoot(ip, Heap::kNanValueRootIndex);
3586 __ sub(ip, ip, Operand(kHeapObjectTag)); 3591 __ sub(ip, ip, Operand(kHeapObjectTag));
3587 __ vldr(result_reg, ip, HeapNumber::kValueOffset); 3592 __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3588 __ jmp(&done); 3593 __ jmp(&done);
3589 3594
3595 __ bind(&heap_number);
3596 }
3590 // Heap number to double register conversion. 3597 // Heap number to double register conversion.
3591 __ bind(&heap_number);
3592 __ sub(ip, input_reg, Operand(kHeapObjectTag)); 3598 __ sub(ip, input_reg, Operand(kHeapObjectTag));
3593 __ vldr(result_reg, ip, HeapNumber::kValueOffset); 3599 __ vldr(result_reg, ip, HeapNumber::kValueOffset);
3594 __ jmp(&done); 3600 __ jmp(&done);
3595 3601
3596 // Smi to double register conversion 3602 // Smi to double register conversion
3597 __ bind(&load_smi); 3603 __ bind(&load_smi);
3598 __ SmiUntag(input_reg); // Untag smi before converting to float. 3604 __ SmiUntag(input_reg); // Untag smi before converting to float.
3599 __ vmov(flt_scratch, input_reg); 3605 __ vmov(flt_scratch, input_reg);
3600 __ vcvt_f64_s32(result_reg, flt_scratch); 3606 __ vcvt_f64_s32(result_reg, flt_scratch);
3601 __ SmiTag(input_reg); // Retag smi. 3607 __ SmiTag(input_reg); // Retag smi.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 3716
3711 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { 3717 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3712 LOperand* input = instr->InputAt(0); 3718 LOperand* input = instr->InputAt(0);
3713 ASSERT(input->IsRegister()); 3719 ASSERT(input->IsRegister());
3714 LOperand* result = instr->result(); 3720 LOperand* result = instr->result();
3715 ASSERT(result->IsDoubleRegister()); 3721 ASSERT(result->IsDoubleRegister());
3716 3722
3717 Register input_reg = ToRegister(input); 3723 Register input_reg = ToRegister(input);
3718 DoubleRegister result_reg = ToDoubleRegister(result); 3724 DoubleRegister result_reg = ToDoubleRegister(result);
3719 3725
3720 EmitNumberUntagD(input_reg, result_reg, instr->environment()); 3726 EmitNumberUntagD(input_reg, result_reg,
3727 instr->hydrogen()->deoptimize_on_undefined(),
3728 instr->environment());
3721 } 3729 }
3722 3730
3723 3731
3724 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 3732 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3725 Register result_reg = ToRegister(instr->result()); 3733 Register result_reg = ToRegister(instr->result());
3726 Register scratch1 = scratch0(); 3734 Register scratch1 = scratch0();
3727 Register scratch2 = ToRegister(instr->TempAt(0)); 3735 Register scratch2 = ToRegister(instr->TempAt(0));
3728 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0)); 3736 DwVfpRegister double_input = ToDoubleRegister(instr->InputAt(0));
3729 DwVfpRegister double_scratch = double_scratch0(); 3737 DwVfpRegister double_scratch = double_scratch0();
3730 SwVfpRegister single_scratch = double_scratch0().low(); 3738 SwVfpRegister single_scratch = double_scratch0().low();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 ASSERT(!environment->HasBeenRegistered()); 4206 ASSERT(!environment->HasBeenRegistered());
4199 RegisterEnvironmentForDeoptimization(environment); 4207 RegisterEnvironmentForDeoptimization(environment);
4200 ASSERT(osr_pc_offset_ == -1); 4208 ASSERT(osr_pc_offset_ == -1);
4201 osr_pc_offset_ = masm()->pc_offset(); 4209 osr_pc_offset_ = masm()->pc_offset();
4202 } 4210 }
4203 4211
4204 4212
4205 #undef __ 4213 #undef __
4206 4214
4207 } } // namespace v8::internal 4215 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698