Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 9117034: New class for Date objects: caches individual date components. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add constant for index of first barrier-free slot. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 __ and_(result, Map::kElementsKindMask); 1259 __ and_(result, Map::kElementsKindMask);
1260 __ shr(result, Map::kElementsKindShift); 1260 __ shr(result, Map::kElementsKindShift);
1261 } 1261 }
1262 1262
1263 1263
1264 void LCodeGen::DoValueOf(LValueOf* instr) { 1264 void LCodeGen::DoValueOf(LValueOf* instr) {
1265 Register input = ToRegister(instr->InputAt(0)); 1265 Register input = ToRegister(instr->InputAt(0));
1266 Register result = ToRegister(instr->result()); 1266 Register result = ToRegister(instr->result());
1267 Register map = ToRegister(instr->TempAt(0)); 1267 Register map = ToRegister(instr->TempAt(0));
1268 ASSERT(input.is(result)); 1268 ASSERT(input.is(result));
1269
1269 Label done; 1270 Label done;
1270 // If the object is a smi return the object. 1271 // If the object is a smi return the object.
1271 __ JumpIfSmi(input, &done, Label::kNear); 1272 __ JumpIfSmi(input, &done, Label::kNear);
1272 1273
1273 // If the object is not a value type, return the object. 1274 // If the object is not a value type, return the object.
1274 __ CmpObjectType(input, JS_VALUE_TYPE, map); 1275 __ CmpObjectType(input, JS_VALUE_TYPE, map);
1275 __ j(not_equal, &done, Label::kNear); 1276 __ j(not_equal, &done, Label::kNear);
1276 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); 1277 __ mov(result, FieldOperand(input, JSValue::kValueOffset));
1277 1278
1278 __ bind(&done); 1279 __ bind(&done);
1279 } 1280 }
1280 1281
1281 1282
1283 void LCodeGen::DoDateField(LDateField* instr) {
1284 Register input = ToRegister(instr->InputAt(0));
1285 Register result = ToRegister(instr->result());
1286 Register map = ToRegister(instr->TempAt(0));
1287 ASSERT(input.is(result));
1288
1289 #ifdef DEBUG
1290 __ AbortIfSmi(input);
1291 __ CmpObjectType(input, JS_DATE_TYPE, map);
1292 __ Assert(equal, "Trying to get date field from non-date.");
1293 #endif
1294
1295 __ mov(result, FieldOperand(input,
1296 JSDate::kValueOffset + kPointerSize * instr->index()));
1297 }
1298
1299
1300 void LCodeGen::DoSetDateField(LSetDateField* instr) {
1301 Register date = ToRegister(instr->InputAt(0));
1302 Register value = ToRegister(instr->InputAt(1));
1303 Register result = ToRegister(instr->result());
1304 Register temp = ToRegister(instr->TempAt(0));
1305 int index = instr->index();
1306
1307 #ifdef DEBUG
1308 __ AbortIfSmi(date);
1309 __ CmpObjectType(date, JS_DATE_TYPE, temp);
1310 __ Assert(equal, "Trying to get date field from non-date.");
1311 #endif
1312
1313 __ mov(FieldOperand(date, JSDate::kValueOffset + kPointerSize * index),
1314 value);
1315 // Caches can only be smi or NaN, so we can skip the write barrier for them.
1316 if (index < JSDate::kFirstBarrierFree) {
1317 // Update the write barrier. Save the value as it will be
1318 // overwritten by the write barrier code and is needed afterward.
1319 __ mov(result, value);
1320 __ RecordWriteField(date, JSDate::kValueOffset + kPointerSize * index,
1321 value, temp, kDontSaveFPRegs);
1322 }
1323 }
1324
1325
1282 void LCodeGen::DoBitNotI(LBitNotI* instr) { 1326 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1283 LOperand* input = instr->InputAt(0); 1327 LOperand* input = instr->InputAt(0);
1284 ASSERT(input->Equals(instr->result())); 1328 ASSERT(input->Equals(instr->result()));
1285 __ not_(ToRegister(input)); 1329 __ not_(ToRegister(input));
1286 } 1330 }
1287 1331
1288 1332
1289 void LCodeGen::DoThrow(LThrow* instr) { 1333 void LCodeGen::DoThrow(LThrow* instr) {
1290 __ push(ToOperand(instr->value())); 1334 __ push(ToOperand(instr->value()));
1291 ASSERT(ToRegister(instr->context()).is(esi)); 1335 ASSERT(ToRegister(instr->context()).is(esi));
(...skipping 3389 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 this, pointers, Safepoint::kLazyDeopt); 4725 this, pointers, Safepoint::kLazyDeopt);
4682 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4726 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4683 } 4727 }
4684 4728
4685 4729
4686 #undef __ 4730 #undef __
4687 4731
4688 } } // namespace v8::internal 4732 } } // namespace v8::internal
4689 4733
4690 #endif // V8_TARGET_ARCH_IA32 4734 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698