OLD | NEW |
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 5008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5019 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 5019 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
5020 LOperand* input = instr->value(); | 5020 LOperand* input = instr->value(); |
5021 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 5021 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
5022 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 5022 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); |
5023 __ SmiTag(ToRegister(input)); | 5023 __ SmiTag(ToRegister(input)); |
5024 } | 5024 } |
5025 | 5025 |
5026 | 5026 |
5027 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 5027 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
5028 LOperand* input = instr->value(); | 5028 LOperand* input = instr->value(); |
| 5029 Register result = ToRegister(input); |
5029 ASSERT(input->IsRegister() && input->Equals(instr->result())); | 5030 ASSERT(input->IsRegister() && input->Equals(instr->result())); |
5030 if (instr->needs_check()) { | 5031 if (instr->needs_check()) { |
5031 __ test(ToRegister(input), Immediate(kSmiTagMask)); | 5032 __ test(result, Immediate(kSmiTagMask)); |
5032 DeoptimizeIf(not_zero, instr->environment()); | 5033 DeoptimizeIf(not_zero, instr->environment()); |
| 5034 } else if (instr->hydrogen()->value()->IsLoadKeyed()) { |
| 5035 HLoadKeyed* load = HLoadKeyed::cast(instr->hydrogen()->value()); |
| 5036 if (load->UsesMustHandleHole()) { |
| 5037 __ test(result, Immediate(kSmiTagMask)); |
| 5038 if (load->hole_mode() == ALLOW_RETURN_HOLE) { |
| 5039 Label done; |
| 5040 __ j(equal, &done); |
| 5041 __ xor_(result, result); |
| 5042 __ bind(&done); |
| 5043 } else { |
| 5044 DeoptimizeIf(not_zero, instr->environment()); |
| 5045 } |
| 5046 } else { |
| 5047 __ AssertSmi(result); |
| 5048 } |
5033 } else { | 5049 } else { |
5034 __ AssertSmi(ToRegister(input)); | 5050 __ AssertSmi(result); |
5035 } | 5051 } |
5036 __ SmiUntag(ToRegister(input)); | 5052 __ SmiUntag(result); |
5037 } | 5053 } |
5038 | 5054 |
5039 | 5055 |
5040 void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, | 5056 void LCodeGen::EmitNumberUntagDNoSSE2(Register input_reg, |
5041 Register temp_reg, | 5057 Register temp_reg, |
5042 bool deoptimize_on_undefined, | 5058 bool deoptimize_on_undefined, |
5043 bool deoptimize_on_minus_zero, | 5059 bool deoptimize_on_minus_zero, |
5044 LEnvironment* env, | 5060 LEnvironment* env, |
5045 NumberUntagDMode mode) { | 5061 NumberUntagDMode mode) { |
5046 Label load_smi, done; | 5062 Label load_smi, done; |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6511 FixedArray::kHeaderSize - kPointerSize)); | 6527 FixedArray::kHeaderSize - kPointerSize)); |
6512 __ bind(&done); | 6528 __ bind(&done); |
6513 } | 6529 } |
6514 | 6530 |
6515 | 6531 |
6516 #undef __ | 6532 #undef __ |
6517 | 6533 |
6518 } } // namespace v8::internal | 6534 } } // namespace v8::internal |
6519 | 6535 |
6520 #endif // V8_TARGET_ARCH_IA32 | 6536 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |