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

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: Rebase 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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.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 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) { 1227 void LCodeGen::DoDateField(LDateField* instr) {
1228 Register input = ToRegister(instr->InputAt(0)); 1228 Register object = ToRegister(instr->InputAt(0));
1229 Register result = ToRegister(instr->result()); 1229 Register result = ToRegister(instr->result());
1230 ASSERT(input.is(result)); 1230 Smi* index = instr->index();
1231 Label runtime, done;
1232 ASSERT(object.is(result));
1233 ASSERT(object.is(rax));
1231 1234
1232 #ifdef DEBUG 1235 #ifdef DEBUG
1233 __ AbortIfSmi(input); 1236 __ AbortIfSmi(object);
1234 __ CmpObjectType(input, JS_DATE_TYPE, kScratchRegister); 1237 __ CmpObjectType(object, JS_DATE_TYPE, kScratchRegister);
1235 __ Assert(equal, "Trying to get date field from non-date."); 1238 __ Assert(equal, "Trying to get date field from non-date.");
1236 #endif 1239 #endif
1237 1240
1238 __ movq(result, FieldOperand(input, 1241 if (index->value() == 0) {
1239 JSDate::kValueOffset + kPointerSize * instr->index())); 1242 __ movq(result, FieldOperand(object, JSDate::kValueOffset));
1240 } 1243 } else {
1241 1244 if (index->value() < JSDate::kFirstUncachedField) {
1242 1245 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1243 void LCodeGen::DoSetDateField(LSetDateField* instr) { 1246 __ movq(kScratchRegister, stamp);
1244 Register date = ToRegister(instr->InputAt(0)); 1247 __ cmpq(kScratchRegister, FieldOperand(object,
1245 Register value = ToRegister(instr->InputAt(1)); 1248 JSDate::kCacheStampOffset));
1246 Register result = ToRegister(instr->result()); 1249 __ j(not_equal, &runtime, Label::kNear);
1247 int index = instr->index(); 1250 __ movq(result, FieldOperand(object, JSDate::kValueOffset +
1248 1251 kPointerSize * index->value()));
1249 #ifdef DEBUG 1252 __ jmp(&done);
1250 __ AbortIfSmi(date); 1253 }
1251 __ CmpObjectType(date, JS_DATE_TYPE, kScratchRegister); 1254 __ bind(&runtime);
1252 __ Assert(equal, "Trying to get date field from non-date."); 1255 __ PrepareCallCFunction(2);
1256 #ifdef _WIN64
1257 __ movq(rcx, object);
1258 __ movq(rdx, index, RelocInfo::NONE);
1259 #else
1260 __ movq(rdi, object);
1261 __ movq(rsi, index, RelocInfo::NONE);
1253 #endif 1262 #endif
1254 1263 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1255 __ movq(FieldOperand(date, JSDate::kValueOffset + kPointerSize * index), 1264 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
1256 value); 1265 __ bind(&done);
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 } 1266 }
1265 } 1267 }
1266 1268
1267 1269
1268 void LCodeGen::DoBitNotI(LBitNotI* instr) { 1270 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1269 LOperand* input = instr->InputAt(0); 1271 LOperand* input = instr->InputAt(0);
1270 ASSERT(input->Equals(instr->result())); 1272 ASSERT(input->Equals(instr->result()));
1271 __ not_(ToRegister(input)); 1273 __ not_(ToRegister(input));
1272 } 1274 }
1273 1275
(...skipping 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after
4735 FixedArray::kHeaderSize - kPointerSize)); 4737 FixedArray::kHeaderSize - kPointerSize));
4736 __ bind(&done); 4738 __ bind(&done);
4737 } 4739 }
4738 4740
4739 4741
4740 #undef __ 4742 #undef __
4741 4743
4742 } } // namespace v8::internal 4744 } } // namespace v8::internal
4743 4745
4744 #endif // V8_TARGET_ARCH_X64 4746 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698