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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 | 1217 |
1218 // If the object is not a value type, return the object. | 1218 // If the object is not a value type, return the object. |
1219 __ CmpObjectType(input, JS_VALUE_TYPE, kScratchRegister); | 1219 __ CmpObjectType(input, JS_VALUE_TYPE, kScratchRegister); |
1220 __ j(not_equal, &done, Label::kNear); | 1220 __ j(not_equal, &done, Label::kNear); |
1221 __ movq(result, FieldOperand(input, JSValue::kValueOffset)); | 1221 __ movq(result, FieldOperand(input, JSValue::kValueOffset)); |
1222 | 1222 |
1223 __ bind(&done); | 1223 __ bind(&done); |
1224 } | 1224 } |
1225 | 1225 |
1226 | 1226 |
| 1227 void LCodeGen::DoDateField(LDateField* instr) { |
| 1228 Register object = ToRegister(instr->InputAt(0)); |
| 1229 Register result = ToRegister(instr->result()); |
| 1230 Smi* index = instr->index(); |
| 1231 Label runtime, done; |
| 1232 ASSERT(object.is(result)); |
| 1233 ASSERT(object.is(rax)); |
| 1234 #ifdef DEBUG |
| 1235 __ AbortIfSmi(object); |
| 1236 __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister); |
| 1237 __ Assert(equal, "Trying to get date field from non-date."); |
| 1238 #endif |
| 1239 |
| 1240 if (index->value() == 0) { |
| 1241 __ movq(result, FieldOperand(object, JSDate::kValueOffset)); |
| 1242 } else { |
| 1243 if (index->value() < JSDate::kFirstUncachedField) { |
| 1244 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 1245 __ movq(kScratchRegister, stamp); |
| 1246 __ cmpq(kScratchRegister, FieldOperand(object, |
| 1247 JSDate::kCacheStampOffset)); |
| 1248 __ j(not_equal, &runtime, Label::kNear); |
| 1249 __ movq(result, FieldOperand(object, JSDate::kValueOffset + |
| 1250 kPointerSize * index->value())); |
| 1251 __ jmp(&done); |
| 1252 } |
| 1253 __ bind(&runtime); |
| 1254 __ PrepareCallCFunction(2); |
| 1255 #ifdef _WIN64 |
| 1256 __ movq(rcx, object); |
| 1257 __ movq(rdx, index, RelocInfo::NONE); |
| 1258 #else |
| 1259 __ movq(rdi, object); |
| 1260 __ movq(rsi, index, RelocInfo::NONE); |
| 1261 #endif |
| 1262 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 1263 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 1264 __ bind(&done); |
| 1265 } |
| 1266 } |
| 1267 |
| 1268 |
1227 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 1269 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
1228 LOperand* input = instr->InputAt(0); | 1270 LOperand* input = instr->InputAt(0); |
1229 ASSERT(input->Equals(instr->result())); | 1271 ASSERT(input->Equals(instr->result())); |
1230 __ not_(ToRegister(input)); | 1272 __ not_(ToRegister(input)); |
1231 } | 1273 } |
1232 | 1274 |
1233 | 1275 |
1234 void LCodeGen::DoThrow(LThrow* instr) { | 1276 void LCodeGen::DoThrow(LThrow* instr) { |
1235 __ push(ToRegister(instr->InputAt(0))); | 1277 __ push(ToRegister(instr->InputAt(0))); |
1236 CallRuntime(Runtime::kThrow, 1, instr); | 1278 CallRuntime(Runtime::kThrow, 1, instr); |
(...skipping 3349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 FixedArray::kHeaderSize - kPointerSize)); | 4628 FixedArray::kHeaderSize - kPointerSize)); |
4587 __ bind(&done); | 4629 __ bind(&done); |
4588 } | 4630 } |
4589 | 4631 |
4590 | 4632 |
4591 #undef __ | 4633 #undef __ |
4592 | 4634 |
4593 } } // namespace v8::internal | 4635 } } // namespace v8::internal |
4594 | 4636 |
4595 #endif // V8_TARGET_ARCH_X64 | 4637 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |