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

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

Issue 7044049: Add boolean flag to HChange and LNumberUntagD to not convert undefined to NaN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: fix typo 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 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after
3552 if (instr->needs_check()) { 3552 if (instr->needs_check()) {
3553 Condition is_smi = __ CheckSmi(input); 3553 Condition is_smi = __ CheckSmi(input);
3554 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); 3554 DeoptimizeIf(NegateCondition(is_smi), instr->environment());
3555 } 3555 }
3556 __ SmiToInteger32(input, input); 3556 __ SmiToInteger32(input, input);
3557 } 3557 }
3558 3558
3559 3559
3560 void LCodeGen::EmitNumberUntagD(Register input_reg, 3560 void LCodeGen::EmitNumberUntagD(Register input_reg,
3561 XMMRegister result_reg, 3561 XMMRegister result_reg,
3562 bool deoptimize_on_undefined,
3562 LEnvironment* env) { 3563 LEnvironment* env) {
3563 Label load_smi, heap_number, done; 3564 Label load_smi, done;
3564 3565
3565 // Smi check. 3566 // Smi check.
3566 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); 3567 __ JumpIfSmi(input_reg, &load_smi, Label::kNear);
3567 3568
3568 // Heap number map check. 3569 // Heap number map check.
3569 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), 3570 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset),
3570 Heap::kHeapNumberMapRootIndex); 3571 Heap::kHeapNumberMapRootIndex);
3571 __ j(equal, &heap_number, Label::kNear); 3572 if (deoptimize_on_undefined) {
3573 DeoptimizeIf(not_equal, env);
3574 } else {
3575 Label heap_number;
3576 __ j(equal, &heap_number, Label::kNear);
3572 3577
3573 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); 3578 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex);
3574 DeoptimizeIf(not_equal, env); 3579 DeoptimizeIf(not_equal, env);
3575 3580
3576 // Convert undefined to NaN. Compute NaN as 0/0. 3581 // Convert undefined to NaN. Compute NaN as 0/0.
3577 __ xorps(result_reg, result_reg); 3582 __ xorps(result_reg, result_reg);
3578 __ divsd(result_reg, result_reg); 3583 __ divsd(result_reg, result_reg);
3579 __ jmp(&done, Label::kNear); 3584 __ jmp(&done, Label::kNear);
3580 3585
3586 __ bind(&heap_number);
3587 }
3581 // Heap number to XMM conversion. 3588 // Heap number to XMM conversion.
3582 __ bind(&heap_number);
3583 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); 3589 __ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset));
3584 __ jmp(&done, Label::kNear); 3590 __ jmp(&done, Label::kNear);
3585 3591
3586 // Smi to XMM conversion 3592 // Smi to XMM conversion
3587 __ bind(&load_smi); 3593 __ bind(&load_smi);
3588 __ SmiToInteger32(kScratchRegister, input_reg); 3594 __ SmiToInteger32(kScratchRegister, input_reg);
3589 __ cvtlsi2sd(result_reg, kScratchRegister); 3595 __ cvtlsi2sd(result_reg, kScratchRegister);
3590 __ bind(&done); 3596 __ bind(&done);
3591 } 3597 }
3592 3598
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3663 3669
3664 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { 3670 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) {
3665 LOperand* input = instr->InputAt(0); 3671 LOperand* input = instr->InputAt(0);
3666 ASSERT(input->IsRegister()); 3672 ASSERT(input->IsRegister());
3667 LOperand* result = instr->result(); 3673 LOperand* result = instr->result();
3668 ASSERT(result->IsDoubleRegister()); 3674 ASSERT(result->IsDoubleRegister());
3669 3675
3670 Register input_reg = ToRegister(input); 3676 Register input_reg = ToRegister(input);
3671 XMMRegister result_reg = ToDoubleRegister(result); 3677 XMMRegister result_reg = ToDoubleRegister(result);
3672 3678
3673 EmitNumberUntagD(input_reg, result_reg, instr->environment()); 3679 EmitNumberUntagD(input_reg, result_reg,
3680 instr->hydrogen()->deoptimize_on_undefined(),
3681 instr->environment());
3674 } 3682 }
3675 3683
3676 3684
3677 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 3685 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
3678 LOperand* input = instr->InputAt(0); 3686 LOperand* input = instr->InputAt(0);
3679 ASSERT(input->IsDoubleRegister()); 3687 ASSERT(input->IsDoubleRegister());
3680 LOperand* result = instr->result(); 3688 LOperand* result = instr->result();
3681 ASSERT(result->IsRegister()); 3689 ASSERT(result->IsRegister());
3682 3690
3683 XMMRegister input_reg = ToDoubleRegister(input); 3691 XMMRegister input_reg = ToDoubleRegister(input);
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
4253 RegisterEnvironmentForDeoptimization(environment); 4261 RegisterEnvironmentForDeoptimization(environment);
4254 ASSERT(osr_pc_offset_ == -1); 4262 ASSERT(osr_pc_offset_ == -1);
4255 osr_pc_offset_ = masm()->pc_offset(); 4263 osr_pc_offset_ = masm()->pc_offset();
4256 } 4264 }
4257 4265
4258 #undef __ 4266 #undef __
4259 4267
4260 } } // namespace v8::internal 4268 } } // namespace v8::internal
4261 4269
4262 #endif // V8_TARGET_ARCH_X64 4270 #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