OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 Register map = ToRegister(instr->value()); | 2054 Register map = ToRegister(instr->value()); |
2055 __ EnumLength(result, map); | 2055 __ EnumLength(result, map); |
2056 } | 2056 } |
2057 | 2057 |
2058 | 2058 |
2059 void LCodeGen::DoDateField(LDateField* instr) { | 2059 void LCodeGen::DoDateField(LDateField* instr) { |
2060 Register object = ToRegister(instr->date()); | 2060 Register object = ToRegister(instr->date()); |
2061 Register result = ToRegister(instr->result()); | 2061 Register result = ToRegister(instr->result()); |
2062 Register scratch = ToRegister(instr->temp()); | 2062 Register scratch = ToRegister(instr->temp()); |
2063 Smi* index = instr->index(); | 2063 Smi* index = instr->index(); |
2064 Label runtime, done; | |
2065 DCHECK(object.is(result)); | 2064 DCHECK(object.is(result)); |
2066 DCHECK(object.is(eax)); | 2065 DCHECK(object.is(eax)); |
2067 | 2066 |
2068 __ test(object, Immediate(kSmiTagMask)); | |
2069 DeoptimizeIf(zero, instr, Deoptimizer::kSmi); | |
2070 __ CmpObjectType(object, JS_DATE_TYPE, scratch); | |
2071 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotADateObject); | |
2072 | |
2073 if (index->value() == 0) { | 2067 if (index->value() == 0) { |
2074 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); | 2068 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
2075 } else { | 2069 } else { |
| 2070 Label runtime, done; |
2076 if (index->value() < JSDate::kFirstUncachedField) { | 2071 if (index->value() < JSDate::kFirstUncachedField) { |
2077 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); | 2072 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
2078 __ mov(scratch, Operand::StaticVariable(stamp)); | 2073 __ mov(scratch, Operand::StaticVariable(stamp)); |
2079 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); | 2074 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
2080 __ j(not_equal, &runtime, Label::kNear); | 2075 __ j(not_equal, &runtime, Label::kNear); |
2081 __ mov(result, FieldOperand(object, JSDate::kValueOffset + | 2076 __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
2082 kPointerSize * index->value())); | 2077 kPointerSize * index->value())); |
2083 __ jmp(&done, Label::kNear); | 2078 __ jmp(&done, Label::kNear); |
2084 } | 2079 } |
2085 __ bind(&runtime); | 2080 __ bind(&runtime); |
(...skipping 4358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6444 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6439 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6445 } | 6440 } |
6446 | 6441 |
6447 | 6442 |
6448 #undef __ | 6443 #undef __ |
6449 | 6444 |
6450 } // namespace internal | 6445 } // namespace internal |
6451 } // namespace v8 | 6446 } // namespace v8 |
6452 | 6447 |
6453 #endif // V8_TARGET_ARCH_X87 | 6448 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |