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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 // If the object is not a value type, return the object. | 1431 // If the object is not a value type, return the object. |
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) { |
| 1442 Register object = ToRegister(instr->InputAt(0)); |
| 1443 Register result = ToRegister(instr->result()); |
| 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)); |
| 1451 |
| 1452 #ifdef DEBUG |
| 1453 __ AbortIfSmi(object); |
| 1454 __ CompareObjectType(object, scratch, scratch, JS_DATE_TYPE); |
| 1455 __ Assert(eq, "Trying to get date field from non-date."); |
| 1456 #endif |
| 1457 |
| 1458 if (index->value() == 0) { |
| 1459 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset)); |
| 1460 } else { |
| 1461 if (index->value() < JSDate::kFirstUncachedField) { |
| 1462 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 1463 __ mov(scratch, Operand(stamp)); |
| 1464 __ ldr(scratch, MemOperand(scratch)); |
| 1465 __ ldr(scratch0(), FieldMemOperand(object, JSDate::kCacheStampOffset)); |
| 1466 __ cmp(scratch, scratch0()); |
| 1467 __ b(ne, &runtime); |
| 1468 __ ldr(result, FieldMemOperand(object, JSDate::kValueOffset + |
| 1469 kPointerSize * index->value())); |
| 1470 __ jmp(&done); |
| 1471 } |
| 1472 __ bind(&runtime); |
| 1473 __ PrepareCallCFunction(2, scratch); |
| 1474 __ mov(r1, Operand(index)); |
| 1475 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 1476 __ bind(&done); |
| 1477 } |
| 1478 } |
| 1479 |
| 1480 |
1441 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 1481 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
1442 Register input = ToRegister(instr->InputAt(0)); | 1482 Register input = ToRegister(instr->InputAt(0)); |
1443 Register result = ToRegister(instr->result()); | 1483 Register result = ToRegister(instr->result()); |
1444 __ mvn(result, Operand(input)); | 1484 __ mvn(result, Operand(input)); |
1445 } | 1485 } |
1446 | 1486 |
1447 | 1487 |
1448 void LCodeGen::DoThrow(LThrow* instr) { | 1488 void LCodeGen::DoThrow(LThrow* instr) { |
1449 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); | 1489 Register input_reg = EmitLoadRegister(instr->InputAt(0), ip); |
1450 __ push(input_reg); | 1490 __ push(input_reg); |
(...skipping 3525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4976 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5016 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
4977 __ ldr(result, FieldMemOperand(scratch, | 5017 __ ldr(result, FieldMemOperand(scratch, |
4978 FixedArray::kHeaderSize - kPointerSize)); | 5018 FixedArray::kHeaderSize - kPointerSize)); |
4979 __ bind(&done); | 5019 __ bind(&done); |
4980 } | 5020 } |
4981 | 5021 |
4982 | 5022 |
4983 #undef __ | 5023 #undef __ |
4984 | 5024 |
4985 } } // namespace v8::internal | 5025 } } // namespace v8::internal |
OLD | NEW |