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

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

Issue 6062002: Merge 6006:6095 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 10 years 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/lithium-ia32.h ('k') | src/ia32/macro-assembler-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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 200
201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const { 201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const {
202 stream->Add("if "); 202 stream->Add("if ");
203 input()->PrintTo(stream); 203 input()->PrintTo(stream);
204 stream->Add(is_strict() ? " === null" : " == null"); 204 stream->Add(is_strict() ? " === null" : " == null");
205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
206 } 206 }
207 207
208 208
209 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) const {
210 stream->Add("if is_object(");
211 input()->PrintTo(stream);
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
213 }
214
215
209 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const { 216 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const {
210 stream->Add("if is_smi("); 217 stream->Add("if is_smi(");
211 input()->PrintTo(stream); 218 input()->PrintTo(stream);
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 219 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
213 } 220 }
214 221
215 222
216 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const { 223 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const {
217 stream->Add("if has_instance_type("); 224 stream->Add("if has_instance_type(");
218 input()->PrintTo(stream); 225 input()->PrintTo(stream);
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 874
868 875
869 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) { 876 LOperand* LChunkBuilder::FixedTemp(XMMRegister reg) {
870 LUnallocated* operand = ToUnallocated(reg); 877 LUnallocated* operand = ToUnallocated(reg);
871 allocator_->RecordTemporary(operand); 878 allocator_->RecordTemporary(operand);
872 return operand; 879 return operand;
873 } 880 }
874 881
875 882
876 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { 883 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) {
877 HBasicBlock* deopt_predecessor = instr->block()->deopt_predecessor();
878 if (deopt_predecessor != NULL &&
879 deopt_predecessor->inverted()) {
880 HEnvironment* env = current_block_->last_environment();
881 HValue* value = env->Pop();
882 ASSERT(value->IsConstant());
883 Handle<Object> obj = HConstant::cast(value)->handle();
884 ASSERT(*obj == *Factory::true_value() || *obj == *Factory::false_value());
885 env->Push(*obj == *Factory::true_value()
886 ? current_block_->graph()->GetConstantFalse()
887 : current_block_->graph()->GetConstantTrue());
888 }
889
890 return new LLabel(instr->block()); 884 return new LLabel(instr->block());
891 } 885 }
892 886
893 887
894 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) { 888 LInstruction* LChunkBuilder::DoDeoptimize(HDeoptimize* instr) {
895 return AssignEnvironment(new LDeoptimize); 889 return AssignEnvironment(new LDeoptimize);
896 } 890 }
897 891
898 892
899 LInstruction* LChunkBuilder::DoBit(Token::Value op, 893 LInstruction* LChunkBuilder::DoBit(Token::Value op,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 HIsNull* compare = HIsNull::cast(v); 1238 HIsNull* compare = HIsNull::cast(v);
1245 ASSERT(compare->value()->representation().IsTagged()); 1239 ASSERT(compare->value()->representation().IsTagged());
1246 1240
1247 // We only need a temp register for non-strict compare. 1241 // We only need a temp register for non-strict compare.
1248 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); 1242 LOperand* temp = compare->is_strict() ? NULL : TempRegister();
1249 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), 1243 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()),
1250 compare->is_strict(), 1244 compare->is_strict(),
1251 temp, 1245 temp,
1252 first_id, 1246 first_id,
1253 second_id); 1247 second_id);
1248 } else if (v->IsIsObject()) {
1249 HIsObject* compare = HIsObject::cast(v);
1250 ASSERT(compare->value()->representation().IsTagged());
1251
1252 LOperand* temp1 = TempRegister();
1253 LOperand* temp2 = TempRegister();
1254 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()),
1255 temp1,
1256 temp2,
1257 first_id,
1258 second_id);
1254 } else if (v->IsCompareJSObjectEq()) { 1259 } else if (v->IsCompareJSObjectEq()) {
1255 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); 1260 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
1256 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), 1261 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
1257 UseRegisterAtStart(compare->right()), 1262 UseRegisterAtStart(compare->right()),
1258 first_id, 1263 first_id,
1259 second_id); 1264 second_id);
1260 } else if (v->IsInstanceOf()) { 1265 } else if (v->IsInstanceOf()) {
1261 HInstanceOf* instance_of = HInstanceOf::cast(v); 1266 HInstanceOf* instance_of = HInstanceOf::cast(v);
1262 LInstruction* result = 1267 LInstruction* result =
1263 new LInstanceOfAndBranch(Use(instance_of->left()), 1268 new LInstanceOfAndBranch(UseFixed(instance_of->left(), eax),
1264 Use(instance_of->right()), 1269 UseFixed(instance_of->right(), edx),
1265 first_id, 1270 first_id,
1266 second_id); 1271 second_id);
1267 return MarkAsCall(result, instr); 1272 return MarkAsCall(result, instr);
1268 } else if (v->IsTypeofIs()) { 1273 } else if (v->IsTypeofIs()) {
1269 HTypeofIs* typeof_is = HTypeofIs::cast(v); 1274 HTypeofIs* typeof_is = HTypeofIs::cast(v);
1270 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()), 1275 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()),
1271 first_id, 1276 first_id,
1272 second_id); 1277 second_id);
1273 } else { 1278 } else {
1274 if (v->IsConstant()) { 1279 if (v->IsConstant()) {
(...skipping 29 matching lines...) Expand all
1304 } 1309 }
1305 1310
1306 1311
1307 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1312 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1308 return DefineAsRegister(new LArgumentsElements); 1313 return DefineAsRegister(new LArgumentsElements);
1309 } 1314 }
1310 1315
1311 1316
1312 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1317 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1313 LInstruction* result = 1318 LInstruction* result =
1314 new LInstanceOf(Use(instr->left()), Use(instr->right())); 1319 new LInstanceOf(UseFixed(instr->left(), eax),
1320 UseFixed(instr->right(), edx));
1315 return MarkAsCall(DefineFixed(result, eax), instr); 1321 return MarkAsCall(DefineFixed(result, eax), instr);
1316 } 1322 }
1317 1323
1318 1324
1319 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1325 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1320 LOperand* function = UseFixed(instr->function(), edi); 1326 LOperand* function = UseFixed(instr->function(), edi);
1321 LOperand* receiver = UseFixed(instr->receiver(), eax); 1327 LOperand* receiver = UseFixed(instr->receiver(), eax);
1322 LOperand* length = UseRegisterAtStart(instr->length()); 1328 LOperand* length = UseRegisterAtStart(instr->length());
1323 LOperand* elements = UseRegisterAtStart(instr->elements()); 1329 LOperand* elements = UseRegisterAtStart(instr->elements());
1324 LInstruction* result = new LApplyArguments(function, 1330 LInstruction* result = new LApplyArguments(function,
1325 receiver, 1331 receiver,
1326 length, 1332 length,
1327 elements); 1333 elements);
1328 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY); 1334 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
1329 } 1335 }
1330 1336
1331 1337
1332 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { 1338 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1333 ++argument_count_; 1339 ++argument_count_;
1334 LOperand* argument = Use(instr->argument()); 1340 LOperand* argument = UseOrConstant(instr->argument());
1335 return new LPushArgument(argument); 1341 return new LPushArgument(argument);
1336 } 1342 }
1337 1343
1338 1344
1339 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { 1345 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1340 return DefineAsRegister(new LGlobalObject); 1346 return DefineAsRegister(new LGlobalObject);
1341 } 1347 }
1342 1348
1343 1349
1344 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1350 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1345 return DefineAsRegister(new LGlobalReceiver); 1351 return DefineAsRegister(new LGlobalReceiver);
1346 } 1352 }
1347 1353
1348 1354
1349 LInstruction* LChunkBuilder::DoCallConstantFunction( 1355 LInstruction* LChunkBuilder::DoCallConstantFunction(
1350 HCallConstantFunction* instr) { 1356 HCallConstantFunction* instr) {
1351 argument_count_ -= instr->argument_count(); 1357 argument_count_ -= instr->argument_count();
1352 return MarkAsCall(DefineFixed(new LCallConstantFunction, eax), instr); 1358 return MarkAsCall(DefineFixed(new LCallConstantFunction, eax), instr);
1353 } 1359 }
1354 1360
1355 1361
1356 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1362 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1357 MathFunctionId op = instr->op(); 1363 BuiltinFunctionId op = instr->op();
1358 LOperand* input = UseRegisterAtStart(instr->value()); 1364 if (op == kMathLog || op == kMathSin || op == kMathCos) {
1359 LInstruction* result = new LUnaryMathOperation(input); 1365 LOperand* input = UseFixedDouble(instr->value(), xmm1);
1360 switch (op) { 1366 LInstruction* result = new LUnaryMathOperation(input);
1361 case kMathAbs: 1367 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1368 } else {
1363 case kMathFloor: 1369 LOperand* input = UseRegisterAtStart(instr->value());
1364 return AssignEnvironment(DefineAsRegister(result)); 1370 LInstruction* result = new LUnaryMathOperation(input);
1365 case kMathRound: 1371 switch (op) {
1366 return AssignEnvironment(DefineAsRegister(result)); 1372 case kMathAbs:
1367 case kMathSqrt: 1373 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1368 return DefineSameAsFirst(result); 1374 case kMathFloor:
1369 case kMathPowHalf: 1375 return AssignEnvironment(DefineAsRegister(result));
1370 return AssignEnvironment(DefineSameAsFirst(result)); 1376 case kMathRound:
1371 default: 1377 return AssignEnvironment(DefineAsRegister(result));
1372 UNREACHABLE(); 1378 case kMathSqrt:
1373 return NULL; 1379 return DefineSameAsFirst(result);
1380 case kMathPowHalf:
1381 return AssignEnvironment(DefineSameAsFirst(result));
1382 default:
1383 UNREACHABLE();
1384 return NULL;
1385 }
1374 } 1386 }
1375 } 1387 }
1376 1388
1377 1389
1378 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1390 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1379 ASSERT(instr->key()->representation().IsTagged()); 1391 ASSERT(instr->key()->representation().IsTagged());
1380 argument_count_ -= instr->argument_count(); 1392 argument_count_ -= instr->argument_count();
1381 UseFixed(instr->key(), ecx); 1393 UseFixed(instr->key(), ecx);
1382 return MarkAsCall(DefineFixed(new LCallKeyed, eax), instr); 1394 return MarkAsCall(DefineFixed(new LCallKeyed, eax), instr);
1383 } 1395 }
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 ASSERT(instr->representation().IsDouble()); 1584 ASSERT(instr->representation().IsDouble());
1573 // We call a C function for double power. It can't trigger a GC. 1585 // We call a C function for double power. It can't trigger a GC.
1574 // We need to use fixed result register for the call. 1586 // We need to use fixed result register for the call.
1575 Representation exponent_type = instr->right()->representation(); 1587 Representation exponent_type = instr->right()->representation();
1576 ASSERT(instr->left()->representation().IsDouble()); 1588 ASSERT(instr->left()->representation().IsDouble());
1577 LOperand* left = UseFixedDouble(instr->left(), xmm1); 1589 LOperand* left = UseFixedDouble(instr->left(), xmm1);
1578 LOperand* right = exponent_type.IsDouble() ? 1590 LOperand* right = exponent_type.IsDouble() ?
1579 UseFixedDouble(instr->right(), xmm2) : 1591 UseFixedDouble(instr->right(), xmm2) :
1580 UseFixed(instr->right(), eax); 1592 UseFixed(instr->right(), eax);
1581 LPower* result = new LPower(left, right); 1593 LPower* result = new LPower(left, right);
1582 return MarkAsCall(DefineFixedDouble(result, xmm1), instr, 1594 return MarkAsCall(DefineFixedDouble(result, xmm3), instr,
1583 CAN_DEOPTIMIZE_EAGERLY); 1595 CAN_DEOPTIMIZE_EAGERLY);
1584 } 1596 }
1585 1597
1586 1598
1587 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { 1599 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
1588 Token::Value op = instr->token(); 1600 Token::Value op = instr->token();
1589 if (instr->left()->representation().IsInteger32()) { 1601 if (instr->left()->representation().IsInteger32()) {
1590 ASSERT(instr->right()->representation().IsInteger32()); 1602 ASSERT(instr->right()->representation().IsInteger32());
1591 LOperand* left = UseRegisterAtStart(instr->left()); 1603 LOperand* left = UseRegisterAtStart(instr->left());
1592 LOperand* right = UseOrConstantAtStart(instr->right()); 1604 LOperand* right = UseOrConstantAtStart(instr->right());
(...skipping 24 matching lines...) Expand all
1617 1629
1618 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { 1630 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) {
1619 ASSERT(instr->value()->representation().IsTagged()); 1631 ASSERT(instr->value()->representation().IsTagged());
1620 LOperand* value = UseRegisterAtStart(instr->value()); 1632 LOperand* value = UseRegisterAtStart(instr->value());
1621 1633
1622 return DefineAsRegister(new LIsNull(value, 1634 return DefineAsRegister(new LIsNull(value,
1623 instr->is_strict())); 1635 instr->is_strict()));
1624 } 1636 }
1625 1637
1626 1638
1639 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) {
1640 ASSERT(instr->value()->representation().IsTagged());
1641 LOperand* value = UseRegister(instr->value());
1642
1643 return DefineAsRegister(new LIsObject(value, TempRegister()));
1644 }
1645
1646
1627 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { 1647 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) {
1628 ASSERT(instr->value()->representation().IsTagged()); 1648 ASSERT(instr->value()->representation().IsTagged());
1629 LOperand* value = UseAtStart(instr->value()); 1649 LOperand* value = UseAtStart(instr->value());
1630 1650
1631 return DefineAsRegister(new LIsSmi(value)); 1651 return DefineAsRegister(new LIsSmi(value));
1632 } 1652 }
1633 1653
1634 1654
1635 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { 1655 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) {
1636 ASSERT(instr->value()->representation().IsTagged()); 1656 ASSERT(instr->value()->representation().IsTagged());
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 void LPointerMap::PrintTo(StringStream* stream) const { 2119 void LPointerMap::PrintTo(StringStream* stream) const {
2100 stream->Add("{"); 2120 stream->Add("{");
2101 for (int i = 0; i < pointer_operands_.length(); ++i) { 2121 for (int i = 0; i < pointer_operands_.length(); ++i) {
2102 if (i != 0) stream->Add(";"); 2122 if (i != 0) stream->Add(";");
2103 pointer_operands_[i]->PrintTo(stream); 2123 pointer_operands_[i]->PrintTo(stream);
2104 } 2124 }
2105 stream->Add("} @%d", position()); 2125 stream->Add("} @%d", position());
2106 } 2126 }
2107 2127
2108 } } // namespace v8::internal 2128 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698