| 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 5267 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5278       // Pop FPU stack before deoptimizing. | 5278       // Pop FPU stack before deoptimizing. | 
| 5279       __ fstp(0); | 5279       __ fstp(0); | 
| 5280       DeoptimizeIf(not_zero, env); | 5280       DeoptimizeIf(not_zero, env); | 
| 5281     } | 5281     } | 
| 5282     __ jmp(&done, Label::kNear); | 5282     __ jmp(&done, Label::kNear); | 
| 5283   } else { | 5283   } else { | 
| 5284     ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 5284     ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 
| 5285   } | 5285   } | 
| 5286 | 5286 | 
| 5287   __ bind(&load_smi); | 5287   __ bind(&load_smi); | 
| 5288   __ SmiUntag(input_reg);  // Untag smi before converting to float. | 5288   // Clobbering a temp is faster than re-tagging the | 
| 5289   __ push(input_reg); | 5289   // input register since we avoid dependencies. | 
|  | 5290   __ mov(temp_reg, input_reg); | 
|  | 5291   __ SmiUntag(temp_reg);  // Untag smi before converting to float. | 
|  | 5292   __ push(temp_reg); | 
| 5290   __ fild_s(Operand(esp, 0)); | 5293   __ fild_s(Operand(esp, 0)); | 
| 5291   __ pop(input_reg); | 5294   __ add(esp, Immediate(kPointerSize)); | 
| 5292   __ SmiTag(input_reg);  // Retag smi. |  | 
| 5293   __ bind(&done); | 5295   __ bind(&done); | 
| 5294   X87CommitWrite(res_reg); | 5296   X87CommitWrite(res_reg); | 
| 5295 } | 5297 } | 
| 5296 | 5298 | 
| 5297 | 5299 | 
| 5298 void LCodeGen::EmitNumberUntagD(Register input_reg, | 5300 void LCodeGen::EmitNumberUntagD(Register input_reg, | 
| 5299                                 Register temp_reg, | 5301                                 Register temp_reg, | 
| 5300                                 XMMRegister result_reg, | 5302                                 XMMRegister result_reg, | 
| 5301                                 bool can_convert_undefined_to_nan, | 5303                                 bool can_convert_undefined_to_nan, | 
| 5302                                 bool deoptimize_on_minus_zero, | 5304                                 bool deoptimize_on_minus_zero, | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5338       __ j(not_zero, &done, Label::kNear); | 5340       __ j(not_zero, &done, Label::kNear); | 
| 5339       __ movmskpd(temp_reg, result_reg); | 5341       __ movmskpd(temp_reg, result_reg); | 
| 5340       __ test_b(temp_reg, 1); | 5342       __ test_b(temp_reg, 1); | 
| 5341       DeoptimizeIf(not_zero, env); | 5343       DeoptimizeIf(not_zero, env); | 
| 5342     } | 5344     } | 
| 5343     __ jmp(&done, Label::kNear); | 5345     __ jmp(&done, Label::kNear); | 
| 5344   } else { | 5346   } else { | 
| 5345     ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 5347     ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); | 
| 5346   } | 5348   } | 
| 5347 | 5349 | 
| 5348   // Smi to XMM conversion |  | 
| 5349   __ bind(&load_smi); | 5350   __ bind(&load_smi); | 
| 5350   __ SmiUntag(input_reg);  // Untag smi before converting to float. | 5351   // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the | 
| 5351   __ cvtsi2sd(result_reg, Operand(input_reg)); | 5352   // input register since we avoid dependencies. | 
| 5352   __ SmiTag(input_reg);  // Retag smi. | 5353   __ mov(temp_reg, input_reg); | 
|  | 5354   __ SmiUntag(temp_reg);  // Untag smi before converting to float. | 
|  | 5355   __ cvtsi2sd(result_reg, Operand(temp_reg)); | 
| 5353   __ bind(&done); | 5356   __ bind(&done); | 
| 5354 } | 5357 } | 
| 5355 | 5358 | 
| 5356 | 5359 | 
| 5357 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 5360 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { | 
| 5358   Register input_reg = ToRegister(instr->value()); | 5361   Register input_reg = ToRegister(instr->value()); | 
| 5359 | 5362 | 
| 5360 | 5363 | 
| 5361   if (instr->truncating()) { | 5364   if (instr->truncating()) { | 
| 5362     Label heap_number, slow_case; | 5365     Label heap_number, slow_case; | 
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5416   __ JumpIfNotSmi(input_reg, deferred->entry()); | 5419   __ JumpIfNotSmi(input_reg, deferred->entry()); | 
| 5417   __ SmiUntag(input_reg); | 5420   __ SmiUntag(input_reg); | 
| 5418   __ bind(deferred->exit()); | 5421   __ bind(deferred->exit()); | 
| 5419 } | 5422 } | 
| 5420 | 5423 | 
| 5421 | 5424 | 
| 5422 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 5425 void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { | 
| 5423   LOperand* input = instr->value(); | 5426   LOperand* input = instr->value(); | 
| 5424   ASSERT(input->IsRegister()); | 5427   ASSERT(input->IsRegister()); | 
| 5425   LOperand* temp = instr->temp(); | 5428   LOperand* temp = instr->temp(); | 
| 5426   ASSERT(temp == NULL || temp->IsRegister()); | 5429   ASSERT(temp->IsRegister()); | 
| 5427   LOperand* result = instr->result(); | 5430   LOperand* result = instr->result(); | 
| 5428   ASSERT(result->IsDoubleRegister()); | 5431   ASSERT(result->IsDoubleRegister()); | 
| 5429 | 5432 | 
| 5430   Register input_reg = ToRegister(input); | 5433   Register input_reg = ToRegister(input); | 
| 5431   bool deoptimize_on_minus_zero = | 5434   bool deoptimize_on_minus_zero = | 
| 5432       instr->hydrogen()->deoptimize_on_minus_zero(); | 5435       instr->hydrogen()->deoptimize_on_minus_zero(); | 
| 5433   Register temp_reg = deoptimize_on_minus_zero ? ToRegister(temp) : no_reg; | 5436   Register temp_reg = ToRegister(temp); | 
| 5434 | 5437 | 
| 5435   HValue* value = instr->hydrogen()->value(); | 5438   HValue* value = instr->hydrogen()->value(); | 
| 5436   NumberUntagDMode mode = value->representation().IsSmi() | 5439   NumberUntagDMode mode = value->representation().IsSmi() | 
| 5437       ? NUMBER_CANDIDATE_IS_SMI : NUMBER_CANDIDATE_IS_ANY_TAGGED; | 5440       ? NUMBER_CANDIDATE_IS_SMI : NUMBER_CANDIDATE_IS_ANY_TAGGED; | 
| 5438 | 5441 | 
| 5439   if (CpuFeatures::IsSupported(SSE2)) { | 5442   if (CpuFeatures::IsSupported(SSE2)) { | 
| 5440     CpuFeatureScope scope(masm(), SSE2); | 5443     CpuFeatureScope scope(masm(), SSE2); | 
| 5441     XMMRegister result_reg = ToDoubleRegister(result); | 5444     XMMRegister result_reg = ToDoubleRegister(result); | 
| 5442     EmitNumberUntagD(input_reg, | 5445     EmitNumberUntagD(input_reg, | 
| 5443                      temp_reg, | 5446                      temp_reg, | 
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6350                               FixedArray::kHeaderSize - kPointerSize)); | 6353                               FixedArray::kHeaderSize - kPointerSize)); | 
| 6351   __ bind(&done); | 6354   __ bind(&done); | 
| 6352 } | 6355 } | 
| 6353 | 6356 | 
| 6354 | 6357 | 
| 6355 #undef __ | 6358 #undef __ | 
| 6356 | 6359 | 
| 6357 } }  // namespace v8::internal | 6360 } }  // namespace v8::internal | 
| 6358 | 6361 | 
| 6359 #endif  // V8_TARGET_ARCH_IA32 | 6362 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW | 
|---|