OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 } | 402 } |
403 | 403 |
404 | 404 |
405 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { | 405 XMMRegister LCodeGen::ToDoubleRegister(LOperand* op) const { |
406 ASSERT(op->IsDoubleRegister()); | 406 ASSERT(op->IsDoubleRegister()); |
407 return ToDoubleRegister(op->index()); | 407 return ToDoubleRegister(op->index()); |
408 } | 408 } |
409 | 409 |
410 | 410 |
411 bool LCodeGen::IsInteger32Constant(LConstantOperand* op) const { | 411 bool LCodeGen::IsInteger32Constant(LConstantOperand* op) const { |
412 return op->IsConstantOperand() && | 412 return chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); |
413 chunk_->LookupLiteralRepresentation(op).IsSmiOrInteger32(); | |
414 } | 413 } |
415 | 414 |
416 | 415 |
417 bool LCodeGen::IsSmiConstant(LConstantOperand* op) const { | 416 bool LCodeGen::IsSmiConstant(LConstantOperand* op) const { |
418 return op->IsConstantOperand() && | 417 return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
419 chunk_->LookupLiteralRepresentation(op).IsSmi(); | |
420 } | 418 } |
421 | 419 |
422 | 420 |
423 bool LCodeGen::IsTaggedConstant(LConstantOperand* op) const { | |
424 return op->IsConstantOperand() && | |
425 chunk_->LookupLiteralRepresentation(op).IsTagged(); | |
426 } | |
427 | |
428 | |
429 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { | 421 int32_t LCodeGen::ToInteger32(LConstantOperand* op) const { |
430 HConstant* constant = chunk_->LookupConstant(op); | 422 HConstant* constant = chunk_->LookupConstant(op); |
431 return constant->Integer32Value(); | 423 return constant->Integer32Value(); |
432 } | 424 } |
433 | 425 |
434 | 426 |
435 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { | 427 Smi* LCodeGen::ToSmi(LConstantOperand* op) const { |
436 HConstant* constant = chunk_->LookupConstant(op); | 428 HConstant* constant = chunk_->LookupConstant(op); |
437 return Smi::FromInt(constant->Integer32Value()); | 429 return Smi::FromInt(constant->Integer32Value()); |
438 } | 430 } |
(...skipping 3509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3948 __ Store(MemOperand(object, offset), value, representation); | 3940 __ Store(MemOperand(object, offset), value, representation); |
3949 } | 3941 } |
3950 return; | 3942 return; |
3951 } | 3943 } |
3952 | 3944 |
3953 Register object = ToRegister(instr->object()); | 3945 Register object = ToRegister(instr->object()); |
3954 Handle<Map> transition = instr->transition(); | 3946 Handle<Map> transition = instr->transition(); |
3955 SmiCheck check_needed = hinstr->value()->IsHeapObject() | 3947 SmiCheck check_needed = hinstr->value()->IsHeapObject() |
3956 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; | 3948 ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
3957 | 3949 |
3958 if (representation.IsSmi()) { | 3950 ASSERT(!(representation.IsSmi() && |
3959 if (instr->value()->IsConstantOperand()) { | 3951 instr->value()->IsConstantOperand() && |
3960 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3952 !IsInteger32Constant(LConstantOperand::cast(instr->value())))); |
3961 if (!IsInteger32Constant(operand_value) && | 3953 if (representation.IsHeapObject()) { |
3962 !IsSmiConstant(operand_value)) { | |
3963 DeoptimizeIf(no_condition, instr->environment()); | |
3964 } | |
3965 } | |
3966 } else if (representation.IsHeapObject()) { | |
3967 if (instr->value()->IsConstantOperand()) { | 3954 if (instr->value()->IsConstantOperand()) { |
3968 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); | 3955 LConstantOperand* operand_value = LConstantOperand::cast(instr->value()); |
3969 if (IsInteger32Constant(operand_value)) { | 3956 if (IsInteger32Constant(operand_value)) { |
3970 DeoptimizeIf(no_condition, instr->environment()); | 3957 DeoptimizeIf(no_condition, instr->environment()); |
3971 } | 3958 } |
3972 } else { | 3959 } else { |
3973 if (!hinstr->value()->type().IsHeapObject()) { | 3960 if (!hinstr->value()->type().IsHeapObject()) { |
3974 Register value = ToRegister(instr->value()); | 3961 Register value = ToRegister(instr->value()); |
3975 Condition cc = masm()->CheckSmi(value); | 3962 Condition cc = masm()->CheckSmi(value); |
3976 DeoptimizeIf(cc, instr->environment()); | 3963 DeoptimizeIf(cc, instr->environment()); |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5659 FixedArray::kHeaderSize - kPointerSize)); | 5646 FixedArray::kHeaderSize - kPointerSize)); |
5660 __ bind(&done); | 5647 __ bind(&done); |
5661 } | 5648 } |
5662 | 5649 |
5663 | 5650 |
5664 #undef __ | 5651 #undef __ |
5665 | 5652 |
5666 } } // namespace v8::internal | 5653 } } // namespace v8::internal |
5667 | 5654 |
5668 #endif // V8_TARGET_ARCH_X64 | 5655 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |