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/x64/lithium-codegen-x64.cc

Issue 7003109: Merge r8237 to V8 3.3 branch. Fix bug v8:1434, optimized compare of undefined can fail. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.3/
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/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.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 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3562 if (instr->needs_check()) { 3562 if (instr->needs_check()) {
3563 Condition is_smi = __ CheckSmi(input); 3563 Condition is_smi = __ CheckSmi(input);
3564 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); 3564 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
3565 } 3565 }
3566 __ SmiToInteger32(input, input); 3566 __ SmiToInteger32(input, input);
3567 } 3567 }
3568 3568
3569 3569
3570 void LCodeGen::EmitNumberUntagD(Register input_reg, 3570 void LCodeGen::EmitNumberUntagD(Register input_reg,
3571 XMMRegister result_reg, 3571 XMMRegister result_reg,
3572 bool deoptimize_on_undefined,
3572 LEnvironment* env) { 3573 LEnvironment* env) {
3573 Label load_smi, heap_number, done; 3574 Label load_smi, done;
3574 3575
3575 // Smi check. 3576 // Smi check.
3576 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); 3577 __ JumpIfSmi(input_reg, &load_smi, Label::kNear);
3577 3578
3578 // Heap number map check. 3579 // Heap number map check.
3579 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), 3580 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
3580 Heap::kHeapNumberMapRootIndex); 3581 Heap::kHeapNumberMapRootIndex);
3581 __ j(equal, &heap_number, Label::kNear); 3582 if (deoptimize_on_undefined) {
3583 DeoptimizeIf(not_equal, env);
3584 } else {
3585 Label heap_number;
3586 __ j(equal, &heap_number, Label::kNear);
3582 3587
3583 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); 3588 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex);
3584 DeoptimizeIf(not_equal, env); 3589 DeoptimizeIf(not_equal, env);
3585 3590
3586 // Convert undefined to NaN. Compute NaN as 0/0. 3591 // Convert undefined to NaN. Compute NaN as 0/0.
3587 __ xorps(result_reg, result_reg); 3592 __ xorps(result_reg, result_reg);
3588 __ divsd(result_reg, result_reg); 3593 __ divsd(result_reg, result_reg);
3589 __ jmp(&done, Label::kNear); 3594 __ jmp(&done, Label::kNear);
3590 3595
3596 __ bind(&heap_number);
3597 }
3591 // Heap number to XMM conversion. 3598 // Heap number to XMM conversion.
3592 __ bind(&heap_number);
3593 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); 3599 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset));
3594 __ jmp(&done, Label::kNear); 3600 __ jmp(&done, Label::kNear);
3595 3601
3596 // Smi to XMM conversion 3602 // Smi to XMM conversion
3597 __ bind(&load_smi); 3603 __ bind(&load_smi);
3598 __ SmiToInteger32(kScratchRegister, input_reg); 3604 __ SmiToInteger32(kScratchRegister, input_reg);
3599 __ cvtlsi2sd(result_reg, kScratchRegister); 3605 __ cvtlsi2sd(result_reg, kScratchRegister);
3600 __ bind(&done); 3606 __ bind(&done);
3601 } 3607 }
3602 3608
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 3679
3674 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { 3680 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3675 LOperand* input = instr->InputAt(0); 3681 LOperand* input = instr->InputAt(0);
3676 ASSERT(input->IsRegister()); 3682 ASSERT(input->IsRegister());
3677 LOperand* result = instr->result(); 3683 LOperand* result = instr->result();
3678 ASSERT(result->IsDoubleRegister()); 3684 ASSERT(result->IsDoubleRegister());
3679 3685
3680 Register input_reg = ToRegister(input); 3686 Register input_reg = ToRegister(input);
3681 XMMRegister result_reg = ToDoubleRegister(result); 3687 XMMRegister result_reg = ToDoubleRegister(result);
3682 3688
3683 EmitNumberUntagD(input_reg, result_reg, instr->environment()); 3689 EmitNumberUntagD(input_reg, result_reg,
3690 instr->hydrogen()->deoptimize_on_undefined(),
3691 instr->environment());
3684 } 3692 }
3685 3693
3686 3694
3687 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 3695 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3688 LOperand* input = instr->InputAt(0); 3696 LOperand* input = instr->InputAt(0);
3689 ASSERT(input->IsDoubleRegister()); 3697 ASSERT(input->IsDoubleRegister());
3690 LOperand* result = instr->result(); 3698 LOperand* result = instr->result();
3691 ASSERT(result->IsRegister()); 3699 ASSERT(result->IsRegister());
3692 3700
3693 XMMRegister input_reg = ToDoubleRegister(input); 3701 XMMRegister input_reg = ToDoubleRegister(input);
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
4263 RegisterEnvironmentForDeoptimization(environment); 4271 RegisterEnvironmentForDeoptimization(environment);
4264 ASSERT(osr_pc_offset_ == -1); 4272 ASSERT(osr_pc_offset_ == -1);
4265 osr_pc_offset_ = masm()->pc_offset(); 4273 osr_pc_offset_ = masm()->pc_offset();
4266 } 4274 }
4267 4275
4268 #undef __ 4276 #undef __
4269 4277
4270 } } // namespace v8::internal 4278 } } // namespace v8::internal
4271 4279
4272 #endif // V8_TARGET_ARCH_X64 4280 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.h ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698