OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 Register result = ToRegister(instr->result()); | 1196 Register result = ToRegister(instr->result()); |
1197 Register array = ToRegister(instr->InputAt(0)); | 1197 Register array = ToRegister(instr->InputAt(0)); |
1198 __ movl(result, FieldOperand(array, ExternalPixelArray::kLengthOffset)); | 1198 __ movl(result, FieldOperand(array, ExternalPixelArray::kLengthOffset)); |
1199 } | 1199 } |
1200 | 1200 |
1201 | 1201 |
1202 void LCodeGen::DoValueOf(LValueOf* instr) { | 1202 void LCodeGen::DoValueOf(LValueOf* instr) { |
1203 Register input = ToRegister(instr->InputAt(0)); | 1203 Register input = ToRegister(instr->InputAt(0)); |
1204 Register result = ToRegister(instr->result()); | 1204 Register result = ToRegister(instr->result()); |
1205 ASSERT(input.is(result)); | 1205 ASSERT(input.is(result)); |
1206 NearLabel done; | 1206 Label done; |
1207 // If the object is a smi return the object. | 1207 // If the object is a smi return the object. |
1208 __ JumpIfSmi(input, &done); | 1208 __ JumpIfSmi(input, &done, Label::kNear); |
1209 | 1209 |
1210 // If the object is not a value type, return the object. | 1210 // If the object is not a value type, return the object. |
1211 __ CmpObjectType(input, JS_VALUE_TYPE, kScratchRegister); | 1211 __ CmpObjectType(input, JS_VALUE_TYPE, kScratchRegister); |
1212 __ j(not_equal, &done); | 1212 __ j(not_equal, &done, Label::kNear); |
1213 __ movq(result, FieldOperand(input, JSValue::kValueOffset)); | 1213 __ movq(result, FieldOperand(input, JSValue::kValueOffset)); |
1214 | 1214 |
1215 __ bind(&done); | 1215 __ bind(&done); |
1216 } | 1216 } |
1217 | 1217 |
1218 | 1218 |
1219 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 1219 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
1220 LOperand* input = instr->InputAt(0); | 1220 LOperand* input = instr->InputAt(0); |
1221 ASSERT(input->Equals(instr->result())); | 1221 ASSERT(input->Equals(instr->result())); |
1222 __ not_(ToRegister(input)); | 1222 __ not_(ToRegister(input)); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 __ CompareRoot(reg, Heap::kNullValueRootIndex); | 1567 __ CompareRoot(reg, Heap::kNullValueRootIndex); |
1568 if (instr->is_strict()) { | 1568 if (instr->is_strict()) { |
1569 ASSERT(Heap::kTrueValueRootIndex >= 0); | 1569 ASSERT(Heap::kTrueValueRootIndex >= 0); |
1570 __ movl(result, Immediate(Heap::kTrueValueRootIndex)); | 1570 __ movl(result, Immediate(Heap::kTrueValueRootIndex)); |
1571 Label load; | 1571 Label load; |
1572 __ j(equal, &load, Label::kNear); | 1572 __ j(equal, &load, Label::kNear); |
1573 __ Set(result, Heap::kFalseValueRootIndex); | 1573 __ Set(result, Heap::kFalseValueRootIndex); |
1574 __ bind(&load); | 1574 __ bind(&load); |
1575 __ LoadRootIndexed(result, result, 0); | 1575 __ LoadRootIndexed(result, result, 0); |
1576 } else { | 1576 } else { |
1577 NearLabel false_value; | 1577 Label false_value, true_value, done; |
1578 Label true_value, done; | |
1579 __ j(equal, &true_value, Label::kNear); | 1578 __ j(equal, &true_value, Label::kNear); |
1580 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); | 1579 __ CompareRoot(reg, Heap::kUndefinedValueRootIndex); |
1581 __ j(equal, &true_value, Label::kNear); | 1580 __ j(equal, &true_value, Label::kNear); |
1582 __ JumpIfSmi(reg, &false_value); | 1581 __ JumpIfSmi(reg, &false_value, Label::kNear); |
1583 // Check for undetectable objects by looking in the bit field in | 1582 // Check for undetectable objects by looking in the bit field in |
1584 // the map. The object has already been smi checked. | 1583 // the map. The object has already been smi checked. |
1585 Register scratch = result; | 1584 Register scratch = result; |
1586 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | 1585 __ movq(scratch, FieldOperand(reg, HeapObject::kMapOffset)); |
1587 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), | 1586 __ testb(FieldOperand(scratch, Map::kBitFieldOffset), |
1588 Immediate(1 << Map::kIsUndetectable)); | 1587 Immediate(1 << Map::kIsUndetectable)); |
1589 __ j(not_zero, &true_value, Label::kNear); | 1588 __ j(not_zero, &true_value, Label::kNear); |
1590 __ bind(&false_value); | 1589 __ bind(&false_value); |
1591 __ LoadRoot(result, Heap::kFalseValueRootIndex); | 1590 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
1592 __ jmp(&done, Label::kNear); | 1591 __ jmp(&done, Label::kNear); |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 Condition is_smi = __ CheckSmi(input); | 3487 Condition is_smi = __ CheckSmi(input); |
3489 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); | 3488 DeoptimizeIf(NegateCondition(is_smi), instr->environment()); |
3490 } | 3489 } |
3491 __ SmiToInteger32(input, input); | 3490 __ SmiToInteger32(input, input); |
3492 } | 3491 } |
3493 | 3492 |
3494 | 3493 |
3495 void LCodeGen::EmitNumberUntagD(Register input_reg, | 3494 void LCodeGen::EmitNumberUntagD(Register input_reg, |
3496 XMMRegister result_reg, | 3495 XMMRegister result_reg, |
3497 LEnvironment* env) { | 3496 LEnvironment* env) { |
3498 NearLabel load_smi; | 3497 Label load_smi, heap_number, done; |
3499 Label heap_number, done; | |
3500 | 3498 |
3501 // Smi check. | 3499 // Smi check. |
3502 __ JumpIfSmi(input_reg, &load_smi); | 3500 __ JumpIfSmi(input_reg, &load_smi, Label::kNear); |
3503 | 3501 |
3504 // Heap number map check. | 3502 // Heap number map check. |
3505 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 3503 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
3506 Heap::kHeapNumberMapRootIndex); | 3504 Heap::kHeapNumberMapRootIndex); |
3507 __ j(equal, &heap_number, Label::kNear); | 3505 __ j(equal, &heap_number, Label::kNear); |
3508 | 3506 |
3509 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 3507 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
3510 DeoptimizeIf(not_equal, env); | 3508 DeoptimizeIf(not_equal, env); |
3511 | 3509 |
3512 // Convert undefined to NaN. Compute NaN as 0/0. | 3510 // Convert undefined to NaN. Compute NaN as 0/0. |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4138 RegisterEnvironmentForDeoptimization(environment); | 4136 RegisterEnvironmentForDeoptimization(environment); |
4139 ASSERT(osr_pc_offset_ == -1); | 4137 ASSERT(osr_pc_offset_ == -1); |
4140 osr_pc_offset_ = masm()->pc_offset(); | 4138 osr_pc_offset_ = masm()->pc_offset(); |
4141 } | 4139 } |
4142 | 4140 |
4143 #undef __ | 4141 #undef __ |
4144 | 4142 |
4145 } } // namespace v8::internal | 4143 } } // namespace v8::internal |
4146 | 4144 |
4147 #endif // V8_TARGET_ARCH_X64 | 4145 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |