OLD | NEW |
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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 __ CompareObjectType(input, map, map, JS_VALUE_TYPE); | 1432 __ CompareObjectType(input, map, map, JS_VALUE_TYPE); |
1433 __ Move(result, input, ne); | 1433 __ Move(result, input, ne); |
1434 __ b(ne, &done); | 1434 __ b(ne, &done); |
1435 __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset)); | 1435 __ ldr(result, FieldMemOperand(input, JSValue::kValueOffset)); |
1436 | 1436 |
1437 __ bind(&done); | 1437 __ bind(&done); |
1438 } | 1438 } |
1439 | 1439 |
1440 | 1440 |
1441 void LCodeGen::DoDateField(LDateField* instr) { | 1441 void LCodeGen::DoDateField(LDateField* instr) { |
1442 Register input = ToRegister(instr->InputAt(0)); | 1442 Register object = ToRegister(instr->InputAt(0)); |
1443 Register result = ToRegister(instr->result()); | 1443 Register result = ToRegister(instr->result()); |
1444 Register map = ToRegister(instr->TempAt(0)); | 1444 Register scratch = ToRegister(instr->TempAt(0)); |
| 1445 Smi* index = instr->index(); |
| 1446 Label runtime, done; |
| 1447 ASSERT(object.is(result)); |
| 1448 ASSERT(object.is(r0)); |
| 1449 ASSERT(!scratch.is(scratch0())); |
| 1450 ASSERT(!scratch.is(object)); |
1445 | 1451 |
1446 #ifdef DEBUG | 1452 #ifdef DEBUG |
1447 __ AbortIfSmi(input); | 1453 __ AbortIfSmi(object); |
1448 __ CompareObjectType(input, map, map, JS_DATE_TYPE); | 1454 __ CompareObjectType(object, scratch, scratch, JS_DATE_TYPE); |
1449 __ Assert(eq, "Trying to get date field from non-date."); | 1455 __ Assert(eq, "Trying to get date field from non-date."); |
1450 #endif | 1456 #endif |
1451 | 1457 |
1452 __ ldr(result, FieldMemOperand(input, | 1458 if (index->value() == 0) { |
1453 JSDate::kValueOffset + kPointerSize * instr->index())); | 1459 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); |
1454 } | 1460 } else { |
1455 | 1461 if (index->value() < JSDate::kFirstUncachedField) { |
1456 | 1462 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
1457 void LCodeGen::DoSetDateField(LSetDateField* instr) { | 1463 __ mov(scratch, Operand(stamp)); |
1458 Register date = ToRegister(instr->InputAt(0)); | 1464 __ ldr(scratch, MemOperand(scratch)); |
1459 Register value = ToRegister(instr->InputAt(1)); | 1465 __ ldr(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset)); |
1460 Register result = ToRegister(instr->result()); | 1466 __ cmp(scratch, scratch0()); |
1461 Register temp = ToRegister(instr->TempAt(0)); | 1467 __ b(ne, &runtime); |
1462 int index = instr->index(); | 1468 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + |
1463 | 1469 kPointerSize * index->value())); |
1464 #ifdef DEBUG | 1470 __ jmp(&done); |
1465 __ AbortIfSmi(date); | 1471 } |
1466 __ CompareObjectType(date, temp, temp, JS_DATE_TYPE); | 1472 __ bind(&runtime); |
1467 __ Assert(eq, "Trying to get date field from non-date."); | 1473 __ PrepareCallCFunction(2, scratch); |
1468 #endif | 1474 __ mov(r1, Operand(index)); |
1469 | 1475 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
1470 __ str(value, | 1476 __ bind(&done); |
1471 FieldMemOperand(date, JSDate::kValueOffset + kPointerSize * index)); | |
1472 // Caches can only be smi or NaN, so we can skip the write barrier for them. | |
1473 if (index < JSDate::kFirstBarrierFree) { | |
1474 // Update the write barrier. Save the value as it will be | |
1475 // overwritten by the write barrier code and is needed afterward. | |
1476 __ mov(result, value); | |
1477 __ RecordWriteField( | |
1478 date, JSDate::kValueOffset + kPointerSize * index, | |
1479 value, temp, kLRHasBeenSaved, kDontSaveFPRegs); | |
1480 } | 1477 } |
1481 } | 1478 } |
1482 | 1479 |
1483 | 1480 |
1484 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 1481 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
1485 Register input = ToRegister(instr->InputAt(0)); | 1482 Register input = ToRegister(instr->InputAt(0)); |
1486 Register result = ToRegister(instr->result()); | 1483 Register result = ToRegister(instr->result()); |
1487 __ mvn(result, Operand(input)); | 1484 __ mvn(result, Operand(input)); |
1488 } | 1485 } |
1489 | 1486 |
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5109 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5106 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5110 __ ldr(result, FieldMemOperand(scratch, | 5107 __ ldr(result, FieldMemOperand(scratch, |
5111 FixedArray::kHeaderSize - kPointerSize)); | 5108 FixedArray::kHeaderSize - kPointerSize)); |
5112 __ bind(&done); | 5109 __ bind(&done); |
5113 } | 5110 } |
5114 | 5111 |
5115 | 5112 |
5116 #undef __ | 5113 #undef __ |
5117 | 5114 |
5118 } } // namespace v8::internal | 5115 } } // namespace v8::internal |
OLD | NEW |