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

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

Issue 9572008: Implement date library functions in C++. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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
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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 input = ToRegister(instr->InputAt(0));
1229 Register result = ToRegister(instr->result());
1230 ASSERT(input.is(result));
1231
1232 #ifdef DEBUG
1233 __ AbortIfSmi(input);
1234 __ CmpObjectType(input, JS_DATE_TYPE, kScratchRegister);
1235 __ Assert(equal, "Trying to get date field from non-date.");
1236 #endif
1237
1238 __ movq(result, FieldOperand(input,
1239 JSDate::kValueOffset + kPointerSize * instr->index()));
1240 }
1241
1242
1243 void LCodeGen::DoSetDateField(LSetDateField* instr) {
1244 Register date = ToRegister(instr->InputAt(0));
1245 Register value = ToRegister(instr->InputAt(1));
1246 Register result = ToRegister(instr->result());
1247 int index = instr->index();
1248
1249 #ifdef DEBUG
1250 __ AbortIfSmi(date);
1251 __ CmpObjectType(date, JS_DATE_TYPE, kScratchRegister);
1252 __ Assert(equal, "Trying to get date field from non-date.");
1253 #endif
1254
1255 __ movq(FieldOperand(date, JSDate::kValueOffset + kPointerSize * index),
1256 value);
1257 // Caches can only be smi or NaN, so we can skip the write barrier for them.
1258 if (index < JSDate::kFirstBarrierFree) {
1259 // Update the write barrier. Save the value as it will be
1260 // overwritten by the write barrier code and is needed afterward.
1261 __ movq(result, value);
1262 __ RecordWriteField(date, JSDate::kValueOffset + kPointerSize * index,
1263 value, kScratchRegister, kDontSaveFPRegs);
1264 }
1265 }
1266
1267
1227 void LCodeGen::DoBitNotI(LBitNotI* instr) { 1268 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1228 LOperand* input = instr->InputAt(0); 1269 LOperand* input = instr->InputAt(0);
1229 ASSERT(input->Equals(instr->result())); 1270 ASSERT(input->Equals(instr->result()));
1230 __ not_(ToRegister(input)); 1271 __ not_(ToRegister(input));
1231 } 1272 }
1232 1273
1233 1274
1234 void LCodeGen::DoThrow(LThrow* instr) { 1275 void LCodeGen::DoThrow(LThrow* instr) {
1235 __ push(ToRegister(instr->InputAt(0))); 1276 __ push(ToRegister(instr->InputAt(0)));
1236 CallRuntime(Runtime::kThrow, 1, instr); 1277 CallRuntime(Runtime::kThrow, 1, instr);
(...skipping 3349 matching lines...) Expand 10 before | Expand all | Expand 10 after
4586 FixedArray::kHeaderSize - kPointerSize)); 4627 FixedArray::kHeaderSize - kPointerSize));
4587 __ bind(&done); 4628 __ bind(&done);
4588 } 4629 }
4589 4630
4590 4631
4591 #undef __ 4632 #undef __
4592 4633
4593 } } // namespace v8::internal 4634 } } // namespace v8::internal
4594 4635
4595 #endif // V8_TARGET_ARCH_X64 4636 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698