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

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

Issue 23890030: Rollback trunk to 3.21.15. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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/ia32/codegen-ia32.cc ('k') | src/ia32/macro-assembler-ia32.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 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 3959 matching lines...) Expand 10 before | Expand all | Expand 10 after
3970 __ cvttsd2si(output_reg, Operand(input_reg)); 3970 __ cvttsd2si(output_reg, Operand(input_reg));
3971 // Overflow is signalled with minint. 3971 // Overflow is signalled with minint.
3972 __ cmp(output_reg, 0x80000000u); 3972 __ cmp(output_reg, 0x80000000u);
3973 DeoptimizeIf(equal, instr->environment()); 3973 DeoptimizeIf(equal, instr->environment());
3974 __ jmp(&done, Label::kNear); 3974 __ jmp(&done, Label::kNear);
3975 3975
3976 // Non-zero negative reaches here. 3976 // Non-zero negative reaches here.
3977 __ bind(&negative_sign); 3977 __ bind(&negative_sign);
3978 // Truncate, then compare and compensate. 3978 // Truncate, then compare and compensate.
3979 __ cvttsd2si(output_reg, Operand(input_reg)); 3979 __ cvttsd2si(output_reg, Operand(input_reg));
3980 __ Cvtsi2sd(xmm_scratch, output_reg); 3980 __ cvtsi2sd(xmm_scratch, output_reg);
3981 __ ucomisd(input_reg, xmm_scratch); 3981 __ ucomisd(input_reg, xmm_scratch);
3982 __ j(equal, &done, Label::kNear); 3982 __ j(equal, &done, Label::kNear);
3983 __ sub(output_reg, Immediate(1)); 3983 __ sub(output_reg, Immediate(1));
3984 DeoptimizeIf(overflow, instr->environment()); 3984 DeoptimizeIf(overflow, instr->environment());
3985 3985
3986 __ bind(&done); 3986 __ bind(&done);
3987 } 3987 }
3988 } 3988 }
3989 3989
3990 3990
(...skipping 29 matching lines...) Expand all
4020 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then 4020 // CVTTSD2SI rounds towards zero, we use ceil(x - (-0.5)) and then
4021 // compare and compensate. 4021 // compare and compensate.
4022 __ movsd(input_temp, input_reg); // Do not alter input_reg. 4022 __ movsd(input_temp, input_reg); // Do not alter input_reg.
4023 __ subsd(input_temp, xmm_scratch); 4023 __ subsd(input_temp, xmm_scratch);
4024 __ cvttsd2si(output_reg, Operand(input_temp)); 4024 __ cvttsd2si(output_reg, Operand(input_temp));
4025 // Catch minint due to overflow, and to prevent overflow when compensating. 4025 // Catch minint due to overflow, and to prevent overflow when compensating.
4026 __ cmp(output_reg, 0x80000000u); 4026 __ cmp(output_reg, 0x80000000u);
4027 __ RecordComment("D2I conversion overflow"); 4027 __ RecordComment("D2I conversion overflow");
4028 DeoptimizeIf(equal, instr->environment()); 4028 DeoptimizeIf(equal, instr->environment());
4029 4029
4030 __ Cvtsi2sd(xmm_scratch, output_reg); 4030 __ cvtsi2sd(xmm_scratch, output_reg);
4031 __ ucomisd(xmm_scratch, input_temp); 4031 __ ucomisd(xmm_scratch, input_temp);
4032 __ j(equal, &done); 4032 __ j(equal, &done);
4033 __ sub(output_reg, Immediate(1)); 4033 __ sub(output_reg, Immediate(1));
4034 // No overflow because we already ruled out minint. 4034 // No overflow because we already ruled out minint.
4035 __ jmp(&done); 4035 __ jmp(&done);
4036 4036
4037 __ bind(&round_to_zero); 4037 __ bind(&round_to_zero);
4038 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if 4038 // We return 0 for the input range [+0, 0.5[, or [-0.5, 0.5[ if
4039 // we can ignore the difference between a result of -0 and +0. 4039 // we can ignore the difference between a result of -0 and +0.
4040 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { 4040 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
4971 } 4971 }
4972 4972
4973 4973
4974 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { 4974 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) {
4975 LOperand* input = instr->value(); 4975 LOperand* input = instr->value();
4976 LOperand* output = instr->result(); 4976 LOperand* output = instr->result();
4977 ASSERT(input->IsRegister() || input->IsStackSlot()); 4977 ASSERT(input->IsRegister() || input->IsStackSlot());
4978 ASSERT(output->IsDoubleRegister()); 4978 ASSERT(output->IsDoubleRegister());
4979 if (CpuFeatures::IsSupported(SSE2)) { 4979 if (CpuFeatures::IsSupported(SSE2)) {
4980 CpuFeatureScope scope(masm(), SSE2); 4980 CpuFeatureScope scope(masm(), SSE2);
4981 __ Cvtsi2sd(ToDoubleRegister(output), ToOperand(input)); 4981 __ cvtsi2sd(ToDoubleRegister(output), ToOperand(input));
4982 } else if (input->IsRegister()) { 4982 } else if (input->IsRegister()) {
4983 Register input_reg = ToRegister(input); 4983 Register input_reg = ToRegister(input);
4984 __ push(input_reg); 4984 __ push(input_reg);
4985 X87Mov(ToX87Register(output), Operand(esp, 0), kX87IntOperand); 4985 X87Mov(ToX87Register(output), Operand(esp, 0), kX87IntOperand);
4986 __ pop(input_reg); 4986 __ pop(input_reg);
4987 } else { 4987 } else {
4988 X87Mov(ToX87Register(output), ToOperand(input), kX87IntOperand); 4988 X87Mov(ToX87Register(output), ToOperand(input), kX87IntOperand);
4989 } 4989 }
4990 } 4990 }
4991 4991
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
5080 Label done; 5080 Label done;
5081 5081
5082 if (signedness == SIGNED_INT32) { 5082 if (signedness == SIGNED_INT32) {
5083 // There was overflow, so bits 30 and 31 of the original integer 5083 // There was overflow, so bits 30 and 31 of the original integer
5084 // disagree. Try to allocate a heap number in new space and store 5084 // disagree. Try to allocate a heap number in new space and store
5085 // the value in there. If that fails, call the runtime system. 5085 // the value in there. If that fails, call the runtime system.
5086 __ SmiUntag(reg); 5086 __ SmiUntag(reg);
5087 __ xor_(reg, 0x80000000); 5087 __ xor_(reg, 0x80000000);
5088 if (CpuFeatures::IsSupported(SSE2)) { 5088 if (CpuFeatures::IsSupported(SSE2)) {
5089 CpuFeatureScope feature_scope(masm(), SSE2); 5089 CpuFeatureScope feature_scope(masm(), SSE2);
5090 __ Cvtsi2sd(xmm0, Operand(reg)); 5090 __ cvtsi2sd(xmm0, Operand(reg));
5091 } else { 5091 } else {
5092 __ push(reg); 5092 __ push(reg);
5093 __ fild_s(Operand(esp, 0)); 5093 __ fild_s(Operand(esp, 0));
5094 __ pop(reg); 5094 __ pop(reg);
5095 } 5095 }
5096 } else { 5096 } else {
5097 if (CpuFeatures::IsSupported(SSE2)) { 5097 if (CpuFeatures::IsSupported(SSE2)) {
5098 CpuFeatureScope feature_scope(masm(), SSE2); 5098 CpuFeatureScope feature_scope(masm(), SSE2);
5099 __ LoadUint32(xmm0, reg, 5099 __ LoadUint32(xmm0, reg,
5100 ToDoubleRegister(LNumberTagU::cast(instr)->temp())); 5100 ToDoubleRegister(LNumberTagU::cast(instr)->temp()));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
5301 } 5301 }
5302 5302
5303 5303
5304 void LCodeGen::EmitNumberUntagD(Register input_reg, 5304 void LCodeGen::EmitNumberUntagD(Register input_reg,
5305 Register temp_reg, 5305 Register temp_reg,
5306 XMMRegister result_reg, 5306 XMMRegister result_reg,
5307 bool can_convert_undefined_to_nan, 5307 bool can_convert_undefined_to_nan,
5308 bool deoptimize_on_minus_zero, 5308 bool deoptimize_on_minus_zero,
5309 LEnvironment* env, 5309 LEnvironment* env,
5310 NumberUntagDMode mode) { 5310 NumberUntagDMode mode) {
5311 Label convert, load_smi, done; 5311 Label load_smi, done;
5312 5312
5313 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { 5313 if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) {
5314 // Smi check. 5314 // Smi check.
5315 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); 5315 __ JumpIfSmi(input_reg, &load_smi, Label::kNear);
5316 5316
5317 // Heap number map check. 5317 // Heap number map check.
5318 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), 5318 __ cmp(FieldOperand(input_reg, HeapObject::kMapOffset),
5319 factory()->heap_number_map()); 5319 factory()->heap_number_map());
5320 if (can_convert_undefined_to_nan) { 5320 if (!can_convert_undefined_to_nan) {
5321 __ j(not_equal, &convert, Label::kNear); 5321 DeoptimizeIf(not_equal, env);
5322 } else { 5322 } else {
5323 Label heap_number, convert;
5324 __ j(equal, &heap_number, Label::kNear);
5325
5326 // Convert undefined (and hole) to NaN.
5327 __ cmp(input_reg, factory()->undefined_value());
5323 DeoptimizeIf(not_equal, env); 5328 DeoptimizeIf(not_equal, env);
5329
5330 __ bind(&convert);
5331 ExternalReference nan =
5332 ExternalReference::address_of_canonical_non_hole_nan();
5333 __ movdbl(result_reg, Operand::StaticVariable(nan));
5334 __ jmp(&done, Label::kNear);
5335
5336 __ bind(&heap_number);
5324 } 5337 }
5325
5326 // Heap number to XMM conversion. 5338 // Heap number to XMM conversion.
5327 __ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); 5339 __ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset));
5328
5329 if (deoptimize_on_minus_zero) { 5340 if (deoptimize_on_minus_zero) {
5330 XMMRegister xmm_scratch = xmm0; 5341 XMMRegister xmm_scratch = xmm0;
5331 __ xorps(xmm_scratch, xmm_scratch); 5342 __ xorps(xmm_scratch, xmm_scratch);
5332 __ ucomisd(result_reg, xmm_scratch); 5343 __ ucomisd(result_reg, xmm_scratch);
5333 __ j(not_zero, &done, Label::kNear); 5344 __ j(not_zero, &done, Label::kNear);
5334 __ movmskpd(temp_reg, result_reg); 5345 __ movmskpd(temp_reg, result_reg);
5335 __ test_b(temp_reg, 1); 5346 __ test_b(temp_reg, 1);
5336 DeoptimizeIf(not_zero, env); 5347 DeoptimizeIf(not_zero, env);
5337 } 5348 }
5338 __ jmp(&done, Label::kNear); 5349 __ jmp(&done, Label::kNear);
5339
5340 if (can_convert_undefined_to_nan) {
5341 __ bind(&convert);
5342
5343 // Convert undefined (and hole) to NaN.
5344 __ cmp(input_reg, factory()->undefined_value());
5345 DeoptimizeIf(not_equal, env);
5346
5347 ExternalReference nan =
5348 ExternalReference::address_of_canonical_non_hole_nan();
5349 __ movdbl(result_reg, Operand::StaticVariable(nan));
5350 __ jmp(&done, Label::kNear);
5351 }
5352 } else { 5350 } else {
5353 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); 5351 ASSERT(mode == NUMBER_CANDIDATE_IS_SMI);
5354 } 5352 }
5355 5353
5356 __ bind(&load_smi); 5354 __ bind(&load_smi);
5357 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the 5355 // Smi to XMM conversion. Clobbering a temp is faster than re-tagging the
5358 // input register since we avoid dependencies. 5356 // input register since we avoid dependencies.
5359 __ mov(temp_reg, input_reg); 5357 __ mov(temp_reg, input_reg);
5360 __ SmiUntag(temp_reg); // Untag smi before converting to float. 5358 __ SmiUntag(temp_reg); // Untag smi before converting to float.
5361 __ Cvtsi2sd(result_reg, Operand(temp_reg)); 5359 __ cvtsi2sd(result_reg, Operand(temp_reg));
5362 __ bind(&done); 5360 __ bind(&done);
5363 } 5361 }
5364 5362
5365 5363
5366 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { 5364 void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
5367 Register input_reg = ToRegister(instr->value()); 5365 Register input_reg = ToRegister(instr->value());
5368 5366
5369 5367
5370 if (instr->truncating()) { 5368 if (instr->truncating()) {
5371 Label heap_number, slow_case; 5369 Label heap_number, slow_case;
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
6359 FixedArray::kHeaderSize - kPointerSize)); 6357 FixedArray::kHeaderSize - kPointerSize));
6360 __ bind(&done); 6358 __ bind(&done);
6361 } 6359 }
6362 6360
6363 6361
6364 #undef __ 6362 #undef __
6365 6363
6366 } } // namespace v8::internal 6364 } } // namespace v8::internal
6367 6365
6368 #endif // V8_TARGET_ARCH_IA32 6366 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698