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

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

Issue 653893002: Version 3.29.88.8 (merged r24189, r24226, r24271) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.29
Patch Set: Created 6 years, 2 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/version.cc ('k') | src/x87/lithium-x87.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 4003 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 X87Register input_reg = ToX87Register(instr->value()); 4014 X87Register input_reg = ToX87Register(instr->value());
4015 X87Fxch(input_reg); 4015 X87Fxch(input_reg);
4016 __ sub(esp, Immediate(kPointerSize)); 4016 __ sub(esp, Immediate(kPointerSize));
4017 __ fstp_s(MemOperand(esp, 0)); 4017 __ fstp_s(MemOperand(esp, 0));
4018 X87Fld(MemOperand(esp, 0), kX87FloatOperand); 4018 X87Fld(MemOperand(esp, 0), kX87FloatOperand);
4019 __ add(esp, Immediate(kPointerSize)); 4019 __ add(esp, Immediate(kPointerSize));
4020 } 4020 }
4021 4021
4022 4022
4023 void LCodeGen::DoMathSqrt(LMathSqrt* instr) { 4023 void LCodeGen::DoMathSqrt(LMathSqrt* instr) {
4024 X87Register input_reg = ToX87Register(instr->value()); 4024 X87Register input = ToX87Register(instr->value());
4025 X87Register output_reg = ToX87Register(instr->result()); 4025 X87Register result_reg = ToX87Register(instr->result());
4026 DCHECK(output_reg.is(input_reg)); 4026 Register temp_result = ToRegister(instr->temp1());
4027 USE(output_reg); 4027 Register temp = ToRegister(instr->temp2());
4028 X87Fxch(input_reg); 4028 Label slow, done, smi, finish;
4029 __ fsqrt(); 4029 DCHECK(result_reg.is(input));
4030
4031 // Store input into Heap number and call runtime function kMathExpRT.
4032 if (FLAG_inline_new) {
4033 __ AllocateHeapNumber(temp_result, temp, no_reg, &slow);
4034 __ jmp(&done, Label::kNear);
4035 }
4036
4037 // Slow case: Call the runtime system to do the number allocation.
4038 __ bind(&slow);
4039 {
4040 // TODO(3095996): Put a valid pointer value in the stack slot where the
4041 // result register is stored, as this register is in the pointer map, but
4042 // contains an integer value.
4043 __ Move(temp_result, Immediate(0));
4044
4045 // Preserve the value of all registers.
4046 PushSafepointRegistersScope scope(this);
4047
4048 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4049 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
4050 RecordSafepointWithRegisters(
4051 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4052 __ StoreToSafepointRegisterSlot(temp_result, eax);
4053 }
4054 __ bind(&done);
4055 X87LoadForUsage(input);
4056 __ fstp_d(FieldOperand(temp_result, HeapNumber::kValueOffset));
4057
4058 {
4059 // Preserve the value of all registers.
4060 PushSafepointRegistersScope scope(this);
4061
4062 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
4063 __ push(temp_result);
4064 __ CallRuntimeSaveDoubles(Runtime::kMathSqrtRT);
4065 RecordSafepointWithRegisters(
4066 instr->pointer_map(), 0, Safepoint::kNoLazyDeopt);
4067 __ StoreToSafepointRegisterSlot(temp_result, eax);
4068 }
4069 X87PrepareToWrite(result_reg);
4070 // return value of MathExpRT is Smi or Heap Number.
4071 __ JumpIfSmi(temp_result, &smi);
4072 // Heap number(double)
4073 __ fld_d(FieldOperand(temp_result, HeapNumber::kValueOffset));
4074 __ jmp(&finish);
4075 // SMI
4076 __ bind(&smi);
4077 __ SmiUntag(temp_result);
4078 __ push(temp_result);
4079 __ fild_s(MemOperand(esp, 0));
4080 __ pop(temp_result);
4081 __ bind(&finish);
4082 X87CommitWrite(result_reg);
4030 } 4083 }
4031 4084
4032 4085
4033 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) { 4086 void LCodeGen::DoMathPowHalf(LMathPowHalf* instr) {
4034 X87Register input_reg = ToX87Register(instr->value()); 4087 X87Register input_reg = ToX87Register(instr->value());
4035 DCHECK(ToX87Register(instr->result()).is(input_reg)); 4088 DCHECK(ToX87Register(instr->result()).is(input_reg));
4036 X87Fxch(input_reg); 4089 X87Fxch(input_reg);
4037 // Note that according to ECMA-262 15.8.2.13: 4090 // Note that according to ECMA-262 15.8.2.13:
4038 // Math.pow(-Infinity, 0.5) == Infinity 4091 // Math.pow(-Infinity, 0.5) == Infinity
4039 // Math.sqrt(-Infinity) == NaN 4092 // Math.sqrt(-Infinity) == NaN
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
5295 Register result_reg = ToRegister(result); 5348 Register result_reg = ToRegister(result);
5296 5349
5297 if (instr->truncating()) { 5350 if (instr->truncating()) {
5298 X87Register input_reg = ToX87Register(input); 5351 X87Register input_reg = ToX87Register(input);
5299 X87Fxch(input_reg); 5352 X87Fxch(input_reg);
5300 __ TruncateX87TOSToI(result_reg); 5353 __ TruncateX87TOSToI(result_reg);
5301 } else { 5354 } else {
5302 Label lost_precision, is_nan, minus_zero, done; 5355 Label lost_precision, is_nan, minus_zero, done;
5303 X87Register input_reg = ToX87Register(input); 5356 X87Register input_reg = ToX87Register(input);
5304 X87Fxch(input_reg); 5357 X87Fxch(input_reg);
5358 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear;
5305 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), 5359 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(),
5306 &lost_precision, &is_nan, &minus_zero, Label::kNear); 5360 &lost_precision, &is_nan, &minus_zero, dist);
5307 __ jmp(&done, Label::kNear); 5361 __ jmp(&done);
5308 __ bind(&lost_precision); 5362 __ bind(&lost_precision);
5309 DeoptimizeIf(no_condition, instr, "lost precision"); 5363 DeoptimizeIf(no_condition, instr, "lost precision");
5310 __ bind(&is_nan); 5364 __ bind(&is_nan);
5311 DeoptimizeIf(no_condition, instr, "NaN"); 5365 DeoptimizeIf(no_condition, instr, "NaN");
5312 __ bind(&minus_zero); 5366 __ bind(&minus_zero);
5313 DeoptimizeIf(no_condition, instr, "minus zero"); 5367 DeoptimizeIf(no_condition, instr, "minus zero");
5314 __ bind(&done); 5368 __ bind(&done);
5315 } 5369 }
5316 } 5370 }
5317 5371
5318 5372
5319 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { 5373 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5320 LOperand* input = instr->value(); 5374 LOperand* input = instr->value();
5321 DCHECK(input->IsDoubleRegister()); 5375 DCHECK(input->IsDoubleRegister());
5322 LOperand* result = instr->result(); 5376 LOperand* result = instr->result();
5323 DCHECK(result->IsRegister()); 5377 DCHECK(result->IsRegister());
5324 Register result_reg = ToRegister(result); 5378 Register result_reg = ToRegister(result);
5325 5379
5326 Label lost_precision, is_nan, minus_zero, done; 5380 Label lost_precision, is_nan, minus_zero, done;
5327 X87Register input_reg = ToX87Register(input); 5381 X87Register input_reg = ToX87Register(input);
5328 X87Fxch(input_reg); 5382 X87Fxch(input_reg);
5383 Label::Distance dist = DeoptEveryNTimes() ? Label::kFar : Label::kNear;
5329 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), 5384 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(),
5330 &lost_precision, &is_nan, &minus_zero, 5385 &lost_precision, &is_nan, &minus_zero, dist);
5331 DeoptEveryNTimes() ? Label::kFar : Label::kNear); 5386 __ jmp(&done);
5332 __ jmp(&done, Label::kNear);
5333 __ bind(&lost_precision); 5387 __ bind(&lost_precision);
5334 DeoptimizeIf(no_condition, instr, "lost precision"); 5388 DeoptimizeIf(no_condition, instr, "lost precision");
5335 __ bind(&is_nan); 5389 __ bind(&is_nan);
5336 DeoptimizeIf(no_condition, instr, "NaN"); 5390 DeoptimizeIf(no_condition, instr, "NaN");
5337 __ bind(&minus_zero); 5391 __ bind(&minus_zero);
5338 DeoptimizeIf(no_condition, instr, "minus zero"); 5392 DeoptimizeIf(no_condition, instr, "minus zero");
5339 __ bind(&done); 5393 __ bind(&done);
5340 __ SmiTag(result_reg); 5394 __ SmiTag(result_reg);
5341 DeoptimizeIf(overflow, instr, "overflow"); 5395 DeoptimizeIf(overflow, instr, "overflow");
5342 } 5396 }
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
6242 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6296 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6243 RecordSafepoint(Safepoint::kNoLazyDeopt); 6297 RecordSafepoint(Safepoint::kNoLazyDeopt);
6244 } 6298 }
6245 6299
6246 6300
6247 #undef __ 6301 #undef __
6248 6302
6249 } } // namespace v8::internal 6303 } } // namespace v8::internal
6250 6304
6251 #endif // V8_TARGET_ARCH_X87 6305 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x87/lithium-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698