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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 __ and_(result, Map::kElementsKindMask); | 1266 __ and_(result, Map::kElementsKindMask); |
1267 __ shr(result, Map::kElementsKindShift); | 1267 __ shr(result, Map::kElementsKindShift); |
1268 } | 1268 } |
1269 | 1269 |
1270 | 1270 |
1271 void LCodeGen::DoValueOf(LValueOf* instr) { | 1271 void LCodeGen::DoValueOf(LValueOf* instr) { |
1272 Register input = ToRegister(instr->InputAt(0)); | 1272 Register input = ToRegister(instr->InputAt(0)); |
1273 Register result = ToRegister(instr->result()); | 1273 Register result = ToRegister(instr->result()); |
1274 Register map = ToRegister(instr->TempAt(0)); | 1274 Register map = ToRegister(instr->TempAt(0)); |
1275 ASSERT(input.is(result)); | 1275 ASSERT(input.is(result)); |
| 1276 |
1276 Label done; | 1277 Label done; |
1277 // If the object is a smi return the object. | 1278 // If the object is a smi return the object. |
1278 __ JumpIfSmi(input, &done, Label::kNear); | 1279 __ JumpIfSmi(input, &done, Label::kNear); |
1279 | 1280 |
1280 // If the object is not a value type, return the object. | 1281 // If the object is not a value type, return the object. |
1281 __ CmpObjectType(input, JS_VALUE_TYPE, map); | 1282 __ CmpObjectType(input, JS_VALUE_TYPE, map); |
1282 __ j(not_equal, &done, Label::kNear); | 1283 __ j(not_equal, &done, Label::kNear); |
1283 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); | 1284 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); |
1284 | 1285 |
1285 __ bind(&done); | 1286 __ bind(&done); |
1286 } | 1287 } |
1287 | 1288 |
1288 | 1289 |
| 1290 void LCodeGen::DoDateField(LDateField* instr) { |
| 1291 Register object = ToRegister(instr->InputAt(0)); |
| 1292 Register result = ToRegister(instr->result()); |
| 1293 Register scratch = ToRegister(instr->TempAt(0)); |
| 1294 Smi* index = instr->index(); |
| 1295 Label runtime, done; |
| 1296 ASSERT(object.is(result)); |
| 1297 ASSERT(object.is(eax)); |
| 1298 if (index->value() == 0) { |
| 1299 __ mov(result, FieldOperand(object, JSDate::kValueOffset)); |
| 1300 } else { |
| 1301 if (index->value() < JSDate::kFirstUncachedField) { |
| 1302 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); |
| 1303 __ mov(scratch, Operand::StaticVariable(stamp)); |
| 1304 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset)); |
| 1305 __ j(not_equal, &runtime, Label::kNear); |
| 1306 __ mov(result, FieldOperand(object, JSDate::kValueOffset + |
| 1307 kPointerSize * index->value())); |
| 1308 __ jmp(&done); |
| 1309 } |
| 1310 __ bind(&runtime); |
| 1311 __ PrepareCallCFunction(2, scratch); |
| 1312 __ mov(Operand(esp, 0), object); |
| 1313 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index)); |
| 1314 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); |
| 1315 __ bind(&done); |
| 1316 } |
| 1317 } |
| 1318 |
| 1319 |
1289 void LCodeGen::DoBitNotI(LBitNotI* instr) { | 1320 void LCodeGen::DoBitNotI(LBitNotI* instr) { |
1290 LOperand* input = instr->InputAt(0); | 1321 LOperand* input = instr->InputAt(0); |
1291 ASSERT(input->Equals(instr->result())); | 1322 ASSERT(input->Equals(instr->result())); |
1292 __ not_(ToRegister(input)); | 1323 __ not_(ToRegister(input)); |
1293 } | 1324 } |
1294 | 1325 |
1295 | 1326 |
1296 void LCodeGen::DoThrow(LThrow* instr) { | 1327 void LCodeGen::DoThrow(LThrow* instr) { |
1297 __ push(ToOperand(instr->value())); | 1328 __ push(ToOperand(instr->value())); |
1298 ASSERT(ToRegister(instr->context()).is(esi)); | 1329 ASSERT(ToRegister(instr->context()).is(esi)); |
(...skipping 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4850 FixedArray::kHeaderSize - kPointerSize)); | 4881 FixedArray::kHeaderSize - kPointerSize)); |
4851 __ bind(&done); | 4882 __ bind(&done); |
4852 } | 4883 } |
4853 | 4884 |
4854 | 4885 |
4855 #undef __ | 4886 #undef __ |
4856 | 4887 |
4857 } } // namespace v8::internal | 4888 } } // namespace v8::internal |
4858 | 4889 |
4859 #endif // V8_TARGET_ARCH_IA32 | 4890 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |