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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/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 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 // If the object is not a value type, return the object. 1281 // If the object is not a value type, return the object.
1282 __ CmpObjectType(input, JS_VALUE_TYPE, map); 1282 __ CmpObjectType(input, JS_VALUE_TYPE, map);
1283 __ j(not_equal, &done, Label::kNear); 1283 __ j(not_equal, &done, Label::kNear);
1284 __ mov(result, FieldOperand(input, JSValue::kValueOffset)); 1284 __ mov(result, FieldOperand(input, JSValue::kValueOffset));
1285 1285
1286 __ bind(&done); 1286 __ bind(&done);
1287 } 1287 }
1288 1288
1289 1289
1290 void LCodeGen::DoDateField(LDateField* instr) { 1290 void LCodeGen::DoDateField(LDateField* instr) {
1291 Register input = ToRegister(instr->InputAt(0)); 1291 Register object = ToRegister(instr->InputAt(0));
1292 Register result = ToRegister(instr->result()); 1292 Register result = ToRegister(instr->result());
1293 Register map = ToRegister(instr->TempAt(0)); 1293 Register scratch = ToRegister(instr->TempAt(0));
1294 ASSERT(input.is(result)); 1294 Smi* index = instr->index();
1295 Label runtime, done;
1296 ASSERT(object.is(result));
1297 ASSERT(object.is(eax));
1295 1298
1296 #ifdef DEBUG 1299 #ifdef DEBUG
1297 __ AbortIfSmi(input); 1300 __ AbortIfSmi(object);
1298 __ CmpObjectType(input, JS_DATE_TYPE, map); 1301 __ CmpObjectType(object, JS_DATE_TYPE, scratch);
1299 __ Assert(equal, "Trying to get date field from non-date."); 1302 __ Assert(equal, "Trying to get date field from non-date.");
1300 #endif 1303 #endif
1301 1304
1302 __ mov(result, FieldOperand(input, 1305 if (index->value() == 0) {
1303 JSDate::kValueOffset + kPointerSize * instr->index())); 1306 __ mov(result, FieldOperand(object, JSDate::kValueOffset));
1304 } 1307 } else {
1305 1308 if (index->value() < JSDate::kFirstUncachedField) {
1306 1309 ExternalReference stamp = ExternalReference::date_cache_stamp(isolate());
1307 void LCodeGen::DoSetDateField(LSetDateField* instr) { 1310 __ mov(scratch, Operand::StaticVariable(stamp));
1308 Register date = ToRegister(instr->InputAt(0)); 1311 __ cmp(scratch, FieldOperand(object, JSDate::kCacheStampOffset));
1309 Register value = ToRegister(instr->InputAt(1)); 1312 __ j(not_equal, &runtime, Label::kNear);
1310 Register result = ToRegister(instr->result()); 1313 __ mov(result, FieldOperand(object, JSDate::kValueOffset +
1311 Register temp = ToRegister(instr->TempAt(0)); 1314 kPointerSize * index->value()));
1312 int index = instr->index(); 1315 __ jmp(&done);
1313 1316 }
1314 #ifdef DEBUG 1317 __ bind(&runtime);
1315 __ AbortIfSmi(date); 1318 __ PrepareCallCFunction(2, scratch);
1316 __ CmpObjectType(date, JS_DATE_TYPE, temp); 1319 __ mov(Operand(esp, 0), object);
1317 __ Assert(equal, "Trying to get date field from non-date."); 1320 __ mov(Operand(esp, 1 * kPointerSize), Immediate(index));
1318 #endif 1321 __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2);
1319 1322 __ bind(&done);
1320 __ mov(FieldOperand(date, JSDate::kValueOffset + kPointerSize * index),
1321 value);
1322 // Caches can only be smi or NaN, so we can skip the write barrier for them.
1323 if (index < JSDate::kFirstBarrierFree) {
1324 // Update the write barrier. Save the value as it will be
1325 // overwritten by the write barrier code and is needed afterward.
1326 __ mov(result, value);
1327 __ RecordWriteField(date, JSDate::kValueOffset + kPointerSize * index,
1328 value, temp, kDontSaveFPRegs);
1329 } 1323 }
1330 } 1324 }
1331 1325
1332 1326
1333 void LCodeGen::DoBitNotI(LBitNotI* instr) { 1327 void LCodeGen::DoBitNotI(LBitNotI* instr) {
1334 LOperand* input = instr->InputAt(0); 1328 LOperand* input = instr->InputAt(0);
1335 ASSERT(input->Equals(instr->result())); 1329 ASSERT(input->Equals(instr->result()));
1336 __ not_(ToRegister(input)); 1330 __ not_(ToRegister(input));
1337 } 1331 }
1338 1332
(...skipping 3662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5001 FixedArray::kHeaderSize - kPointerSize)); 4995 FixedArray::kHeaderSize - kPointerSize));
5002 __ bind(&done); 4996 __ bind(&done);
5003 } 4997 }
5004 4998
5005 4999
5006 #undef __ 5000 #undef __
5007 5001
5008 } } // namespace v8::internal 5002 } } // namespace v8::internal
5009 5003
5010 #endif // V8_TARGET_ARCH_IA32 5004 #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