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

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

Issue 260003006: Added a Isolate* parameter to Serializer::enabled(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
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 23 matching lines...) Expand all
34 #include "code-stubs.h" 34 #include "code-stubs.h"
35 #include "deoptimizer.h" 35 #include "deoptimizer.h"
36 #include "stub-cache.h" 36 #include "stub-cache.h"
37 #include "codegen.h" 37 #include "codegen.h"
38 #include "hydrogen-osr.h" 38 #include "hydrogen-osr.h"
39 39
40 namespace v8 { 40 namespace v8 {
41 namespace internal { 41 namespace internal {
42 42
43 43
44 static SaveFPRegsMode GetSaveFPRegsMode() { 44 static SaveFPRegsMode GetSaveFPRegsMode(Isolate* isolate) {
45 // We don't need to save floating point regs when generating the snapshot 45 // We don't need to save floating point regs when generating the snapshot
46 return CpuFeatures::IsSafeForSnapshot(SSE2) ? kSaveFPRegs : kDontSaveFPRegs; 46 return CpuFeatures::IsSafeForSnapshot(isolate, SSE2) ? kSaveFPRegs
47 : kDontSaveFPRegs;
47 } 48 }
48 49
49 50
50 // When invoking builtins, we need to record the safepoint in the middle of 51 // When invoking builtins, we need to record the safepoint in the middle of
51 // the invoke instruction sequence generated by the macro assembler. 52 // the invoke instruction sequence generated by the macro assembler.
52 class SafepointGenerator V8_FINAL : public CallWrapper { 53 class SafepointGenerator V8_FINAL : public CallWrapper {
53 public: 54 public:
54 SafepointGenerator(LCodeGen* codegen, 55 SafepointGenerator(LCodeGen* codegen,
55 LPointerMap* pointers, 56 LPointerMap* pointers,
56 Safepoint::DeoptMode mode) 57 Safepoint::DeoptMode mode)
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr); 400 if (!CpuFeatures::IsSupported(SSE2)) FlushX87StackIfNecessary(instr);
400 } 401 }
401 402
402 403
403 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { 404 void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) {
404 if (!CpuFeatures::IsSupported(SSE2)) { 405 if (!CpuFeatures::IsSupported(SSE2)) {
405 if (instr->IsGoto()) { 406 if (instr->IsGoto()) {
406 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr)); 407 x87_stack_.LeavingBlock(current_block_, LGoto::cast(instr));
407 } else if (FLAG_debug_code && FLAG_enable_slow_asserts && 408 } else if (FLAG_debug_code && FLAG_enable_slow_asserts &&
408 !instr->IsGap() && !instr->IsReturn()) { 409 !instr->IsGap() && !instr->IsReturn()) {
409 if (instr->ClobbersDoubleRegisters()) { 410 if (instr->ClobbersDoubleRegisters(isolate())) {
410 if (instr->HasDoubleRegisterResult()) { 411 if (instr->HasDoubleRegisterResult()) {
411 ASSERT_EQ(1, x87_stack_.depth()); 412 ASSERT_EQ(1, x87_stack_.depth());
412 } else { 413 } else {
413 ASSERT_EQ(0, x87_stack_.depth()); 414 ASSERT_EQ(0, x87_stack_.depth());
414 } 415 }
415 } 416 }
416 __ VerifyX87StackDepth(x87_stack_.depth()); 417 __ VerifyX87StackDepth(x87_stack_.depth());
417 } 418 }
418 } 419 }
419 } 420 }
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 void LCodeGen::X87PrepareBinaryOp( 699 void LCodeGen::X87PrepareBinaryOp(
699 X87Register left, X87Register right, X87Register result) { 700 X87Register left, X87Register right, X87Register result) {
700 // You need to use DefineSameAsFirst for x87 instructions 701 // You need to use DefineSameAsFirst for x87 instructions
701 ASSERT(result.is(left)); 702 ASSERT(result.is(left));
702 x87_stack_.Fxch(right, 1); 703 x87_stack_.Fxch(right, 1);
703 x87_stack_.Fxch(left); 704 x87_stack_.Fxch(left);
704 } 705 }
705 706
706 707
707 void LCodeGen::X87Stack::FlushIfNecessary(LInstruction* instr, LCodeGen* cgen) { 708 void LCodeGen::X87Stack::FlushIfNecessary(LInstruction* instr, LCodeGen* cgen) {
708 if (stack_depth_ > 0 && instr->ClobbersDoubleRegisters()) { 709 if (stack_depth_ > 0 && instr->ClobbersDoubleRegisters(isolate())) {
709 bool double_inputs = instr->HasDoubleRegisterInput(); 710 bool double_inputs = instr->HasDoubleRegisterInput();
710 711
711 // Flush stack from tos down, since FreeX87() will mess with tos 712 // Flush stack from tos down, since FreeX87() will mess with tos
712 for (int i = stack_depth_-1; i >= 0; i--) { 713 for (int i = stack_depth_-1; i >= 0; i--) {
713 X87Register reg = stack_[i]; 714 X87Register reg = stack_[i];
714 // Skip registers which contain the inputs for the next instruction 715 // Skip registers which contain the inputs for the next instruction
715 // when flushing the stack 716 // when flushing the stack
716 if (double_inputs && instr->IsDoubleInput(reg, cgen)) { 717 if (double_inputs && instr->IsDoubleInput(reg, cgen)) {
717 continue; 718 continue;
718 } 719 }
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 } 1986 }
1986 1987
1987 1988
1988 void LCodeGen::DoConstantD(LConstantD* instr) { 1989 void LCodeGen::DoConstantD(LConstantD* instr) {
1989 double v = instr->value(); 1990 double v = instr->value();
1990 uint64_t int_val = BitCast<uint64_t, double>(v); 1991 uint64_t int_val = BitCast<uint64_t, double>(v);
1991 int32_t lower = static_cast<int32_t>(int_val); 1992 int32_t lower = static_cast<int32_t>(int_val);
1992 int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt)); 1993 int32_t upper = static_cast<int32_t>(int_val >> (kBitsPerInt));
1993 ASSERT(instr->result()->IsDoubleRegister()); 1994 ASSERT(instr->result()->IsDoubleRegister());
1994 1995
1995 if (!CpuFeatures::IsSafeForSnapshot(SSE2)) { 1996 if (!CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
1996 __ push(Immediate(upper)); 1997 __ push(Immediate(upper));
1997 __ push(Immediate(lower)); 1998 __ push(Immediate(lower));
1998 X87Register reg = ToX87Register(instr->result()); 1999 X87Register reg = ToX87Register(instr->result());
1999 X87Mov(reg, Operand(esp, 0)); 2000 X87Mov(reg, Operand(esp, 0));
2000 __ add(Operand(esp), Immediate(kDoubleSize)); 2001 __ add(Operand(esp), Immediate(kDoubleSize));
2001 } else { 2002 } else {
2002 CpuFeatureScope scope1(masm(), SSE2); 2003 CpuFeatureScope scope1(masm(), SSE2);
2003 XMMRegister res = ToDoubleRegister(instr->result()); 2004 XMMRegister res = ToDoubleRegister(instr->result());
2004 if (int_val == 0) { 2005 if (int_val == 0) {
2005 __ xorps(res, res); 2006 __ xorps(res, res);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 __ j(parity_even, &return_left, Label::kNear); // left == NaN. 2259 __ j(parity_even, &return_left, Label::kNear); // left == NaN.
2259 __ bind(&return_right); 2260 __ bind(&return_right);
2260 __ movaps(left_reg, right_reg); 2261 __ movaps(left_reg, right_reg);
2261 2262
2262 __ bind(&return_left); 2263 __ bind(&return_left);
2263 } 2264 }
2264 } 2265 }
2265 2266
2266 2267
2267 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { 2268 void LCodeGen::DoArithmeticD(LArithmeticD* instr) {
2268 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 2269 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
2269 CpuFeatureScope scope(masm(), SSE2); 2270 CpuFeatureScope scope(masm(), SSE2);
2270 XMMRegister left = ToDoubleRegister(instr->left()); 2271 XMMRegister left = ToDoubleRegister(instr->left());
2271 XMMRegister right = ToDoubleRegister(instr->right()); 2272 XMMRegister right = ToDoubleRegister(instr->right());
2272 XMMRegister result = ToDoubleRegister(instr->result()); 2273 XMMRegister result = ToDoubleRegister(instr->result());
2273 switch (instr->op()) { 2274 switch (instr->op()) {
2274 case Token::ADD: 2275 case Token::ADD:
2275 __ addsd(left, right); 2276 __ addsd(left, right);
2276 break; 2277 break;
2277 case Token::SUB: 2278 case Token::SUB:
2278 __ subsd(left, right); 2279 __ subsd(left, right);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 __ CmpInstanceType(map, SYMBOL_TYPE); 2504 __ CmpInstanceType(map, SYMBOL_TYPE);
2504 __ j(equal, instr->TrueLabel(chunk_)); 2505 __ j(equal, instr->TrueLabel(chunk_));
2505 } 2506 }
2506 2507
2507 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) { 2508 if (expected.Contains(ToBooleanStub::HEAP_NUMBER)) {
2508 // heap number -> false iff +0, -0, or NaN. 2509 // heap number -> false iff +0, -0, or NaN.
2509 Label not_heap_number; 2510 Label not_heap_number;
2510 __ cmp(FieldOperand(reg, HeapObject::kMapOffset), 2511 __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
2511 factory()->heap_number_map()); 2512 factory()->heap_number_map());
2512 __ j(not_equal, &not_heap_number, Label::kNear); 2513 __ j(not_equal, &not_heap_number, Label::kNear);
2513 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 2514 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
2514 CpuFeatureScope scope(masm(), SSE2); 2515 CpuFeatureScope scope(masm(), SSE2);
2515 XMMRegister xmm_scratch = double_scratch0(); 2516 XMMRegister xmm_scratch = double_scratch0();
2516 __ xorps(xmm_scratch, xmm_scratch); 2517 __ xorps(xmm_scratch, xmm_scratch);
2517 __ ucomisd(xmm_scratch, FieldOperand(reg, HeapNumber::kValueOffset)); 2518 __ ucomisd(xmm_scratch, FieldOperand(reg, HeapNumber::kValueOffset));
2518 } else { 2519 } else {
2519 __ fldz(); 2520 __ fldz();
2520 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); 2521 __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset));
2521 __ FCmp(); 2522 __ FCmp();
2522 } 2523 }
2523 __ j(zero, instr->FalseLabel(chunk_)); 2524 __ j(zero, instr->FalseLabel(chunk_));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 2591
2591 if (left->IsConstantOperand() && right->IsConstantOperand()) { 2592 if (left->IsConstantOperand() && right->IsConstantOperand()) {
2592 // We can statically evaluate the comparison. 2593 // We can statically evaluate the comparison.
2593 double left_val = ToDouble(LConstantOperand::cast(left)); 2594 double left_val = ToDouble(LConstantOperand::cast(left));
2594 double right_val = ToDouble(LConstantOperand::cast(right)); 2595 double right_val = ToDouble(LConstantOperand::cast(right));
2595 int next_block = EvalComparison(instr->op(), left_val, right_val) ? 2596 int next_block = EvalComparison(instr->op(), left_val, right_val) ?
2596 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_); 2597 instr->TrueDestination(chunk_) : instr->FalseDestination(chunk_);
2597 EmitGoto(next_block); 2598 EmitGoto(next_block);
2598 } else { 2599 } else {
2599 if (instr->is_double()) { 2600 if (instr->is_double()) {
2600 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 2601 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
2601 CpuFeatureScope scope(masm(), SSE2); 2602 CpuFeatureScope scope(masm(), SSE2);
2602 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); 2603 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right));
2603 } else { 2604 } else {
2604 X87LoadForUsage(ToX87Register(right), ToX87Register(left)); 2605 X87LoadForUsage(ToX87Register(right), ToX87Register(left));
2605 __ FCmp(); 2606 __ FCmp();
2606 } 2607 }
2607 // Don't base result on EFLAGS when a NaN is involved. Instead 2608 // Don't base result on EFLAGS when a NaN is involved. Instead
2608 // jump to the false block. 2609 // jump to the false block.
2609 __ j(parity_even, instr->FalseLabel(chunk_)); 2610 __ j(parity_even, instr->FalseLabel(chunk_));
2610 } else { 2611 } else {
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 if (instr->hydrogen()->NeedsWriteBarrier()) { 3267 if (instr->hydrogen()->NeedsWriteBarrier()) {
3267 SmiCheck check_needed = 3268 SmiCheck check_needed =
3268 instr->hydrogen()->value()->IsHeapObject() 3269 instr->hydrogen()->value()->IsHeapObject()
3269 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 3270 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
3270 Register temp = ToRegister(instr->temp()); 3271 Register temp = ToRegister(instr->temp());
3271 int offset = Context::SlotOffset(instr->slot_index()); 3272 int offset = Context::SlotOffset(instr->slot_index());
3272 __ RecordWriteContextSlot(context, 3273 __ RecordWriteContextSlot(context,
3273 offset, 3274 offset,
3274 value, 3275 value,
3275 temp, 3276 temp,
3276 GetSaveFPRegsMode(), 3277 GetSaveFPRegsMode(isolate()),
3277 EMIT_REMEMBERED_SET, 3278 EMIT_REMEMBERED_SET,
3278 check_needed); 3279 check_needed);
3279 } 3280 }
3280 3281
3281 __ bind(&skip_assignment); 3282 __ bind(&skip_assignment);
3282 } 3283 }
3283 3284
3284 3285
3285 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { 3286 void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) {
3286 HObjectAccess access = instr->hydrogen()->access(); 3287 HObjectAccess access = instr->hydrogen()->access();
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4433 } else { 4434 } else {
4434 Register temp = ToRegister(instr->temp()); 4435 Register temp = ToRegister(instr->temp());
4435 Register temp_map = ToRegister(instr->temp_map()); 4436 Register temp_map = ToRegister(instr->temp_map());
4436 __ mov(temp_map, transition); 4437 __ mov(temp_map, transition);
4437 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map); 4438 __ mov(FieldOperand(object, HeapObject::kMapOffset), temp_map);
4438 // Update the write barrier for the map field. 4439 // Update the write barrier for the map field.
4439 __ RecordWriteField(object, 4440 __ RecordWriteField(object,
4440 HeapObject::kMapOffset, 4441 HeapObject::kMapOffset,
4441 temp_map, 4442 temp_map,
4442 temp, 4443 temp,
4443 GetSaveFPRegsMode(), 4444 GetSaveFPRegsMode(isolate()),
4444 OMIT_REMEMBERED_SET, 4445 OMIT_REMEMBERED_SET,
4445 OMIT_SMI_CHECK); 4446 OMIT_SMI_CHECK);
4446 } 4447 }
4447 } 4448 }
4448 4449
4449 // Do the store. 4450 // Do the store.
4450 Register write_register = object; 4451 Register write_register = object;
4451 if (!access.IsInobject()) { 4452 if (!access.IsInobject()) {
4452 write_register = ToRegister(instr->temp()); 4453 write_register = ToRegister(instr->temp());
4453 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset)); 4454 __ mov(write_register, FieldOperand(object, JSObject::kPropertiesOffset));
(...skipping 20 matching lines...) Expand all
4474 } 4475 }
4475 4476
4476 if (instr->hydrogen()->NeedsWriteBarrier()) { 4477 if (instr->hydrogen()->NeedsWriteBarrier()) {
4477 Register value = ToRegister(instr->value()); 4478 Register value = ToRegister(instr->value());
4478 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object; 4479 Register temp = access.IsInobject() ? ToRegister(instr->temp()) : object;
4479 // Update the write barrier for the object for in-object properties. 4480 // Update the write barrier for the object for in-object properties.
4480 __ RecordWriteField(write_register, 4481 __ RecordWriteField(write_register,
4481 offset, 4482 offset,
4482 value, 4483 value,
4483 temp, 4484 temp,
4484 GetSaveFPRegsMode(), 4485 GetSaveFPRegsMode(isolate()),
4485 EMIT_REMEMBERED_SET, 4486 EMIT_REMEMBERED_SET,
4486 check_needed); 4487 check_needed);
4487 } 4488 }
4488 } 4489 }
4489 4490
4490 4491
4491 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { 4492 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
4492 ASSERT(ToRegister(instr->context()).is(esi)); 4493 ASSERT(ToRegister(instr->context()).is(esi));
4493 ASSERT(ToRegister(instr->object()).is(edx)); 4494 ASSERT(ToRegister(instr->object()).is(edx));
4494 ASSERT(ToRegister(instr->value()).is(eax)); 4495 ASSERT(ToRegister(instr->value()).is(eax));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
4534 } 4535 }
4535 Operand operand(BuildFastArrayOperand( 4536 Operand operand(BuildFastArrayOperand(
4536 instr->elements(), 4537 instr->elements(),
4537 key, 4538 key,
4538 instr->hydrogen()->key()->representation(), 4539 instr->hydrogen()->key()->representation(),
4539 elements_kind, 4540 elements_kind,
4540 0, 4541 0,
4541 instr->additional_index())); 4542 instr->additional_index()));
4542 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 4543 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
4543 elements_kind == FLOAT32_ELEMENTS) { 4544 elements_kind == FLOAT32_ELEMENTS) {
4544 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 4545 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
4545 CpuFeatureScope scope(masm(), SSE2); 4546 CpuFeatureScope scope(masm(), SSE2);
4546 XMMRegister xmm_scratch = double_scratch0(); 4547 XMMRegister xmm_scratch = double_scratch0();
4547 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value())); 4548 __ cvtsd2ss(xmm_scratch, ToDoubleRegister(instr->value()));
4548 __ movss(operand, xmm_scratch); 4549 __ movss(operand, xmm_scratch);
4549 } else { 4550 } else {
4550 __ fld(0); 4551 __ fld(0);
4551 __ fstp_s(operand); 4552 __ fstp_s(operand);
4552 } 4553 }
4553 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS || 4554 } else if (elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
4554 elements_kind == FLOAT64_ELEMENTS) { 4555 elements_kind == FLOAT64_ELEMENTS) {
4555 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 4556 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
4556 CpuFeatureScope scope(masm(), SSE2); 4557 CpuFeatureScope scope(masm(), SSE2);
4557 __ movsd(operand, ToDoubleRegister(instr->value())); 4558 __ movsd(operand, ToDoubleRegister(instr->value()));
4558 } else { 4559 } else {
4559 X87Mov(operand, ToX87Register(instr->value())); 4560 X87Mov(operand, ToX87Register(instr->value()));
4560 } 4561 }
4561 } else { 4562 } else {
4562 Register value = ToRegister(instr->value()); 4563 Register value = ToRegister(instr->value());
4563 switch (elements_kind) { 4564 switch (elements_kind) {
4564 case EXTERNAL_UINT8_CLAMPED_ELEMENTS: 4565 case EXTERNAL_UINT8_CLAMPED_ELEMENTS:
4565 case EXTERNAL_UINT8_ELEMENTS: 4566 case EXTERNAL_UINT8_ELEMENTS:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4604 ExternalReference canonical_nan_reference = 4605 ExternalReference canonical_nan_reference =
4605 ExternalReference::address_of_canonical_non_hole_nan(); 4606 ExternalReference::address_of_canonical_non_hole_nan();
4606 Operand double_store_operand = BuildFastArrayOperand( 4607 Operand double_store_operand = BuildFastArrayOperand(
4607 instr->elements(), 4608 instr->elements(),
4608 instr->key(), 4609 instr->key(),
4609 instr->hydrogen()->key()->representation(), 4610 instr->hydrogen()->key()->representation(),
4610 FAST_DOUBLE_ELEMENTS, 4611 FAST_DOUBLE_ELEMENTS,
4611 FixedDoubleArray::kHeaderSize - kHeapObjectTag, 4612 FixedDoubleArray::kHeaderSize - kHeapObjectTag,
4612 instr->additional_index()); 4613 instr->additional_index());
4613 4614
4614 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 4615 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
4615 CpuFeatureScope scope(masm(), SSE2); 4616 CpuFeatureScope scope(masm(), SSE2);
4616 XMMRegister value = ToDoubleRegister(instr->value()); 4617 XMMRegister value = ToDoubleRegister(instr->value());
4617 4618
4618 if (instr->NeedsCanonicalization()) { 4619 if (instr->NeedsCanonicalization()) {
4619 Label have_value; 4620 Label have_value;
4620 4621
4621 __ ucomisd(value, value); 4622 __ ucomisd(value, value);
4622 __ j(parity_odd, &have_value, Label::kNear); // NaN. 4623 __ j(parity_odd, &have_value, Label::kNear); // NaN.
4623 4624
4624 __ movsd(value, Operand::StaticVariable(canonical_nan_reference)); 4625 __ movsd(value, Operand::StaticVariable(canonical_nan_reference));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4706 Register value = ToRegister(instr->value()); 4707 Register value = ToRegister(instr->value());
4707 ASSERT(!instr->key()->IsConstantOperand()); 4708 ASSERT(!instr->key()->IsConstantOperand());
4708 SmiCheck check_needed = 4709 SmiCheck check_needed =
4709 instr->hydrogen()->value()->IsHeapObject() 4710 instr->hydrogen()->value()->IsHeapObject()
4710 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; 4711 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK;
4711 // Compute address of modified element and store it into key register. 4712 // Compute address of modified element and store it into key register.
4712 __ lea(key, operand); 4713 __ lea(key, operand);
4713 __ RecordWrite(elements, 4714 __ RecordWrite(elements,
4714 key, 4715 key,
4715 value, 4716 value,
4716 GetSaveFPRegsMode(), 4717 GetSaveFPRegsMode(isolate()),
4717 EMIT_REMEMBERED_SET, 4718 EMIT_REMEMBERED_SET,
4718 check_needed); 4719 check_needed);
4719 } 4720 }
4720 } 4721 }
4721 4722
4722 4723
4723 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) { 4724 void LCodeGen::DoStoreKeyed(LStoreKeyed* instr) {
4724 // By cases...external, fast-double, fast 4725 // By cases...external, fast-double, fast
4725 if (instr->is_typed_elements()) { 4726 if (instr->is_typed_elements()) {
4726 DoStoreKeyedExternalArray(instr); 4727 DoStoreKeyedExternalArray(instr);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
5443 5444
5444 5445
5445 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 5446 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
5446 LOperand* input = instr->value(); 5447 LOperand* input = instr->value();
5447 ASSERT(input->IsDoubleRegister()); 5448 ASSERT(input->IsDoubleRegister());
5448 LOperand* result = instr->result(); 5449 LOperand* result = instr->result();
5449 ASSERT(result->IsRegister()); 5450 ASSERT(result->IsRegister());
5450 Register result_reg = ToRegister(result); 5451 Register result_reg = ToRegister(result);
5451 5452
5452 if (instr->truncating()) { 5453 if (instr->truncating()) {
5453 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 5454 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
5454 CpuFeatureScope scope(masm(), SSE2); 5455 CpuFeatureScope scope(masm(), SSE2);
5455 XMMRegister input_reg = ToDoubleRegister(input); 5456 XMMRegister input_reg = ToDoubleRegister(input);
5456 __ TruncateDoubleToI(result_reg, input_reg); 5457 __ TruncateDoubleToI(result_reg, input_reg);
5457 } else { 5458 } else {
5458 X87Register input_reg = ToX87Register(input); 5459 X87Register input_reg = ToX87Register(input);
5459 X87Fxch(input_reg); 5460 X87Fxch(input_reg);
5460 __ TruncateX87TOSToI(result_reg); 5461 __ TruncateX87TOSToI(result_reg);
5461 } 5462 }
5462 } else { 5463 } else {
5463 Label bailout, done; 5464 Label bailout, done;
5464 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 5465 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
5465 CpuFeatureScope scope(masm(), SSE2); 5466 CpuFeatureScope scope(masm(), SSE2);
5466 XMMRegister input_reg = ToDoubleRegister(input); 5467 XMMRegister input_reg = ToDoubleRegister(input);
5467 XMMRegister xmm_scratch = double_scratch0(); 5468 XMMRegister xmm_scratch = double_scratch0();
5468 __ DoubleToI(result_reg, input_reg, xmm_scratch, 5469 __ DoubleToI(result_reg, input_reg, xmm_scratch,
5469 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear); 5470 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear);
5470 } else { 5471 } else {
5471 X87Register input_reg = ToX87Register(input); 5472 X87Register input_reg = ToX87Register(input);
5472 X87Fxch(input_reg); 5473 X87Fxch(input_reg);
5473 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), 5474 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(),
5474 &bailout, Label::kNear); 5475 &bailout, Label::kNear);
5475 } 5476 }
5476 __ jmp(&done, Label::kNear); 5477 __ jmp(&done, Label::kNear);
5477 __ bind(&bailout); 5478 __ bind(&bailout);
5478 DeoptimizeIf(no_condition, instr->environment()); 5479 DeoptimizeIf(no_condition, instr->environment());
5479 __ bind(&done); 5480 __ bind(&done);
5480 } 5481 }
5481 } 5482 }
5482 5483
5483 5484
5484 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) { 5485 void LCodeGen::DoDoubleToSmi(LDoubleToSmi* instr) {
5485 LOperand* input = instr->value(); 5486 LOperand* input = instr->value();
5486 ASSERT(input->IsDoubleRegister()); 5487 ASSERT(input->IsDoubleRegister());
5487 LOperand* result = instr->result(); 5488 LOperand* result = instr->result();
5488 ASSERT(result->IsRegister()); 5489 ASSERT(result->IsRegister());
5489 Register result_reg = ToRegister(result); 5490 Register result_reg = ToRegister(result);
5490 5491
5491 Label bailout, done; 5492 Label bailout, done;
5492 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 5493 if (CpuFeatures::IsSafeForSnapshot(isolate(), SSE2)) {
5493 CpuFeatureScope scope(masm(), SSE2); 5494 CpuFeatureScope scope(masm(), SSE2);
5494 XMMRegister input_reg = ToDoubleRegister(input); 5495 XMMRegister input_reg = ToDoubleRegister(input);
5495 XMMRegister xmm_scratch = double_scratch0(); 5496 XMMRegister xmm_scratch = double_scratch0();
5496 __ DoubleToI(result_reg, input_reg, xmm_scratch, 5497 __ DoubleToI(result_reg, input_reg, xmm_scratch,
5497 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear); 5498 instr->hydrogen()->GetMinusZeroMode(), &bailout, Label::kNear);
5498 } else { 5499 } else {
5499 X87Register input_reg = ToX87Register(input); 5500 X87Register input_reg = ToX87Register(input);
5500 X87Fxch(input_reg); 5501 X87Fxch(input_reg);
5501 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(), 5502 __ X87TOSToI(result_reg, instr->hydrogen()->GetMinusZeroMode(),
5502 &bailout, Label::kNear); 5503 &bailout, Label::kNear);
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
6446 __ bind(deferred->exit()); 6447 __ bind(deferred->exit());
6447 __ bind(&done); 6448 __ bind(&done);
6448 } 6449 }
6449 6450
6450 6451
6451 #undef __ 6452 #undef __
6452 6453
6453 } } // namespace v8::internal 6454 } } // namespace v8::internal
6454 6455
6455 #endif // V8_TARGET_ARCH_IA32 6456 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698