| 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 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3088 } | 3088 } |
| 3089 | 3089 |
| 3090 | 3090 |
| 3091 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { | 3091 void LCodeGen::DoInteger32ToDouble(LInteger32ToDouble* instr) { |
| 3092 Register value = ToRegister32(instr->value()); | 3092 Register value = ToRegister32(instr->value()); |
| 3093 DoubleRegister result = ToDoubleRegister(instr->result()); | 3093 DoubleRegister result = ToDoubleRegister(instr->result()); |
| 3094 __ Scvtf(result, value); | 3094 __ Scvtf(result, value); |
| 3095 } | 3095 } |
| 3096 | 3096 |
| 3097 | 3097 |
| 3098 void LCodeGen::DoInteger32ToSmi(LInteger32ToSmi* instr) { | |
| 3099 // A64 smis can represent all Integer32 values, so this cannot deoptimize. | |
| 3100 ASSERT(!instr->hydrogen()->value()->HasRange() || | |
| 3101 instr->hydrogen()->value()->range()->IsInSmiRange()); | |
| 3102 | |
| 3103 Register value = ToRegister32(instr->value()); | |
| 3104 Register result = ToRegister(instr->result()); | |
| 3105 __ SmiTag(result, value.X()); | |
| 3106 } | |
| 3107 | |
| 3108 | |
| 3109 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { | 3098 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) { |
| 3110 ASSERT(ToRegister(instr->context()).is(cp)); | 3099 ASSERT(ToRegister(instr->context()).is(cp)); |
| 3111 // The function is required to be in x1. | 3100 // The function is required to be in x1. |
| 3112 ASSERT(ToRegister(instr->function()).is(x1)); | 3101 ASSERT(ToRegister(instr->function()).is(x1)); |
| 3113 ASSERT(instr->HasPointerMap()); | 3102 ASSERT(instr->HasPointerMap()); |
| 3114 | 3103 |
| 3115 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); | 3104 Handle<JSFunction> known_function = instr->hydrogen()->known_function(); |
| 3116 if (known_function.is_null()) { | 3105 if (known_function.is_null()) { |
| 3117 LPointerMap* pointers = instr->pointer_map(); | 3106 LPointerMap* pointers = instr->pointer_map(); |
| 3118 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); | 3107 SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt); |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4697 BuildSeqStringOperand(string, temp, instr->index(), encoding); | 4686 BuildSeqStringOperand(string, temp, instr->index(), encoding); |
| 4698 if (encoding == String::ONE_BYTE_ENCODING) { | 4687 if (encoding == String::ONE_BYTE_ENCODING) { |
| 4699 __ Strb(value, operand); | 4688 __ Strb(value, operand); |
| 4700 } else { | 4689 } else { |
| 4701 __ Strh(value, operand); | 4690 __ Strh(value, operand); |
| 4702 } | 4691 } |
| 4703 } | 4692 } |
| 4704 | 4693 |
| 4705 | 4694 |
| 4706 void LCodeGen::DoSmiTag(LSmiTag* instr) { | 4695 void LCodeGen::DoSmiTag(LSmiTag* instr) { |
| 4707 ASSERT(!instr->hydrogen_value()->CheckFlag(HValue::kCanOverflow)); | 4696 HChange* hchange = instr->hydrogen(); |
| 4708 __ SmiTag(ToRegister(instr->result()), ToRegister(instr->value())); | 4697 Register input = ToRegister(instr->value()); |
| 4698 Register output = ToRegister(instr->result()); |
| 4699 if (hchange->CheckFlag(HValue::kCanOverflow) && |
| 4700 hchange->value()->CheckFlag(HValue::kUint32)) { |
| 4701 DeoptimizeIfNegative(input.W(), instr->environment()); |
| 4702 } |
| 4703 __ SmiTag(output, input); |
| 4709 } | 4704 } |
| 4710 | 4705 |
| 4711 | 4706 |
| 4712 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { | 4707 void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
| 4713 Register input = ToRegister(instr->value()); | 4708 Register input = ToRegister(instr->value()); |
| 4714 Register result = ToRegister(instr->result()); | 4709 Register result = ToRegister(instr->result()); |
| 4715 Label done, untag; | 4710 Label done, untag; |
| 4716 | 4711 |
| 4717 if (instr->needs_check()) { | 4712 if (instr->needs_check()) { |
| 4718 DeoptimizeIfNotSmi(input, instr->environment()); | 4713 DeoptimizeIfNotSmi(input, instr->environment()); |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5730 __ B(false_label); | 5725 __ B(false_label); |
| 5731 } | 5726 } |
| 5732 } | 5727 } |
| 5733 | 5728 |
| 5734 | 5729 |
| 5735 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { | 5730 void LCodeGen::DoUint32ToDouble(LUint32ToDouble* instr) { |
| 5736 __ Ucvtf(ToDoubleRegister(instr->result()), ToRegister32(instr->value())); | 5731 __ Ucvtf(ToDoubleRegister(instr->result()), ToRegister32(instr->value())); |
| 5737 } | 5732 } |
| 5738 | 5733 |
| 5739 | 5734 |
| 5740 void LCodeGen::DoUint32ToSmi(LUint32ToSmi* instr) { | |
| 5741 Register value = ToRegister(instr->value()); | |
| 5742 Register result = ToRegister(instr->result()); | |
| 5743 | |
| 5744 if (!instr->hydrogen()->value()->HasRange() || | |
| 5745 !instr->hydrogen()->value()->range()->IsInSmiRange() || | |
| 5746 instr->hydrogen()->value()->range()->upper() == kMaxInt) { | |
| 5747 // The Range class can't express upper bounds in the (kMaxInt, kMaxUint32] | |
| 5748 // interval, so we treat kMaxInt as a sentinel for this entire interval. | |
| 5749 DeoptimizeIfNegative(value.W(), instr->environment()); | |
| 5750 } | |
| 5751 __ SmiTag(result, value); | |
| 5752 } | |
| 5753 | |
| 5754 | |
| 5755 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { | 5735 void LCodeGen::DoCheckMapValue(LCheckMapValue* instr) { |
| 5756 Register object = ToRegister(instr->value()); | 5736 Register object = ToRegister(instr->value()); |
| 5757 Register map = ToRegister(instr->map()); | 5737 Register map = ToRegister(instr->map()); |
| 5758 Register temp = ToRegister(instr->temp()); | 5738 Register temp = ToRegister(instr->temp()); |
| 5759 __ Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset)); | 5739 __ Ldr(temp, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 5760 __ Cmp(map, temp); | 5740 __ Cmp(map, temp); |
| 5761 DeoptimizeIf(ne, instr->environment()); | 5741 DeoptimizeIf(ne, instr->environment()); |
| 5762 } | 5742 } |
| 5763 | 5743 |
| 5764 | 5744 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 __ Bind(&out_of_object); | 5810 __ Bind(&out_of_object); |
| 5831 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); | 5811 __ Ldr(result, FieldMemOperand(object, JSObject::kPropertiesOffset)); |
| 5832 // Index is equal to negated out of object property index plus 1. | 5812 // Index is equal to negated out of object property index plus 1. |
| 5833 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 5813 __ Sub(result, result, Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 5834 __ Ldr(result, FieldMemOperand(result, | 5814 __ Ldr(result, FieldMemOperand(result, |
| 5835 FixedArray::kHeaderSize - kPointerSize)); | 5815 FixedArray::kHeaderSize - kPointerSize)); |
| 5836 __ Bind(&done); | 5816 __ Bind(&done); |
| 5837 } | 5817 } |
| 5838 | 5818 |
| 5839 } } // namespace v8::internal | 5819 } } // namespace v8::internal |
| OLD | NEW |