OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 constructor()->PrintTo(stream); | 99 constructor()->PrintTo(stream); |
100 stream->Add(" #%d / ", arity()); | 100 stream->Add(" #%d / ", arity()); |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 void LCallNewArray::PrintDataTo(StringStream* stream) { | 104 void LCallNewArray::PrintDataTo(StringStream* stream) { |
105 stream->Add("= "); | 105 stream->Add("= "); |
106 constructor()->PrintTo(stream); | 106 constructor()->PrintTo(stream); |
107 stream->Add(" #%d / ", arity()); | 107 stream->Add(" #%d / ", arity()); |
108 ASSERT(hydrogen()->property_cell()->value()->IsSmi()); | 108 ASSERT(hydrogen()->property_cell()->value()->IsSmi()); |
109 ElementsKind kind = static_cast<ElementsKind>( | 109 ElementsKind kind = hydrogen()->elements_kind(); |
110 Smi::cast(hydrogen()->property_cell()->value())->value()); | |
111 stream->Add(" (%s) ", ElementsKindToString(kind)); | 110 stream->Add(" (%s) ", ElementsKindToString(kind)); |
112 } | 111 } |
113 | 112 |
114 | 113 |
115 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { | 114 void LClassOfTestAndBranch::PrintDataTo(StringStream* stream) { |
116 stream->Add("if class_of_test("); | 115 stream->Add("if class_of_test("); |
117 value()->PrintTo(stream); | 116 value()->PrintTo(stream); |
118 stream->Add(", \"%o\") then B%d else B%d", | 117 stream->Add(", \"%o\") then B%d else B%d", |
119 *hydrogen()->class_name(), | 118 *hydrogen()->class_name(), |
120 true_block_id(), | 119 true_block_id(), |
121 false_block_id()); | 120 false_block_id()); |
122 } | 121 } |
123 | 122 |
124 | 123 |
125 void LCmpIDAndBranch::PrintDataTo(StringStream* stream) { | 124 void LCompareNumericAndBranch::PrintDataTo(StringStream* stream) { |
126 stream->Add("if "); | 125 stream->Add("if "); |
127 left()->PrintTo(stream); | 126 left()->PrintTo(stream); |
128 stream->Add(" %s ", Token::String(op())); | 127 stream->Add(" %s ", Token::String(op())); |
129 right()->PrintTo(stream); | 128 right()->PrintTo(stream); |
130 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); | 129 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); |
131 } | 130 } |
132 | 131 |
133 | 132 |
134 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { | 133 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { |
135 stream->Add("if has_cached_array_index("); | 134 stream->Add("if has_cached_array_index("); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 | 1228 |
1230 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { | 1229 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |
1231 // TODO(jbramley): The scratch registers are not needed if | 1230 // TODO(jbramley): The scratch registers are not needed if |
1232 // instr->CanOmitPrototypeChecks(). Can we safely test that here? | 1231 // instr->CanOmitPrototypeChecks(). Can we safely test that here? |
1233 LOperand* temp1 = TempRegister(); | 1232 LOperand* temp1 = TempRegister(); |
1234 LOperand* temp2 = TempRegister(); | 1233 LOperand* temp2 = TempRegister(); |
1235 return AssignEnvironment(new(zone()) LCheckPrototypeMaps(temp1, temp2)); | 1234 return AssignEnvironment(new(zone()) LCheckPrototypeMaps(temp1, temp2)); |
1236 } | 1235 } |
1237 | 1236 |
1238 | 1237 |
| 1238 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |
| 1239 LOperand* value = UseRegisterAtStart(instr->value()); |
| 1240 return AssignEnvironment(new(zone()) LCheckSmi(value)); |
| 1241 } |
| 1242 |
| 1243 |
1239 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { | 1244 LInstruction* LChunkBuilder::DoClampToUint8(HClampToUint8* instr) { |
1240 HValue* value = instr->value(); | 1245 HValue* value = instr->value(); |
1241 Representation input_rep = value->representation(); | 1246 Representation input_rep = value->representation(); |
1242 LOperand* reg = UseRegister(value); | 1247 LOperand* reg = UseRegister(value); |
1243 if (input_rep.IsDouble()) { | 1248 if (input_rep.IsDouble()) { |
1244 return DefineAsRegister(new(zone()) LClampDToUint8(reg)); | 1249 return DefineAsRegister(new(zone()) LClampDToUint8(reg)); |
1245 } else if (input_rep.IsInteger32()) { | 1250 } else if (input_rep.IsInteger32()) { |
1246 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); | 1251 return DefineAsRegister(new(zone()) LClampIToUint8(reg)); |
1247 } else { | 1252 } else { |
1248 ASSERT(input_rep.IsSmiOrTagged()); | 1253 ASSERT(input_rep.IsSmiOrTagged()); |
1249 return AssignEnvironment( | 1254 return AssignEnvironment( |
1250 DefineAsRegister(new(zone()) LClampTToUint8(reg, | 1255 DefineAsRegister(new(zone()) LClampTToUint8(reg, |
1251 TempRegister(), | 1256 TempRegister(), |
1252 FixedTemp(d24)))); | 1257 FixedTemp(d24)))); |
1253 } | 1258 } |
1254 } | 1259 } |
1255 | 1260 |
1256 | 1261 |
1257 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( | 1262 LInstruction* LChunkBuilder::DoClassOfTestAndBranch( |
1258 HClassOfTestAndBranch* instr) { | 1263 HClassOfTestAndBranch* instr) { |
1259 ASSERT(instr->value()->representation().IsTagged()); | 1264 ASSERT(instr->value()->representation().IsTagged()); |
1260 LOperand* value = UseRegisterAtStart(instr->value()); | 1265 LOperand* value = UseRegisterAtStart(instr->value()); |
1261 return new(zone()) LClassOfTestAndBranch(value, | 1266 return new(zone()) LClassOfTestAndBranch(value, |
1262 TempRegister(), | 1267 TempRegister(), |
1263 TempRegister()); | 1268 TempRegister()); |
1264 } | 1269 } |
1265 | 1270 |
1266 | 1271 |
1267 LInstruction* LChunkBuilder::DoCompareIDAndBranch(HCompareIDAndBranch* instr) { | 1272 LInstruction* LChunkBuilder::DoCompareNumericAndBranch( |
| 1273 HCompareNumericAndBranch* instr) { |
1268 Representation r = instr->representation(); | 1274 Representation r = instr->representation(); |
1269 | 1275 |
1270 // TODO(all): This instruction has been replaced by HCompareNumericAndBranch | 1276 // TODO(all): This instruction has been replaced by HCompareNumericAndBranch |
1271 // on bleeding_edge. We should update when we'll do the rebase. | 1277 // on bleeding_edge. We should update when we'll do the rebase. |
1272 if (r.IsSmiOrInteger32()) { | 1278 if (r.IsSmiOrInteger32()) { |
1273 ASSERT(instr->left()->representation().Equals(r)); | 1279 ASSERT(instr->left()->representation().Equals(r)); |
1274 ASSERT(instr->right()->representation().Equals(r)); | 1280 ASSERT(instr->right()->representation().Equals(r)); |
1275 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1281 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
1276 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1282 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
1277 return new(zone()) LCmpIDAndBranch(left, right); | 1283 return new(zone()) LCompareNumericAndBranch(left, right); |
1278 } else { | 1284 } else { |
1279 ASSERT(r.IsDouble()); | 1285 ASSERT(r.IsDouble()); |
1280 ASSERT(instr->left()->representation().IsDouble()); | 1286 ASSERT(instr->left()->representation().IsDouble()); |
1281 ASSERT(instr->right()->representation().IsDouble()); | 1287 ASSERT(instr->right()->representation().IsDouble()); |
1282 // TODO(all): In fact the only case that we can handle more efficiently is | 1288 // TODO(all): In fact the only case that we can handle more efficiently is |
1283 // when one of the operand is the constant 0. Currently the MacroAssembler | 1289 // when one of the operand is the constant 0. Currently the MacroAssembler |
1284 // will be able to cope with any constant by loading it into an internal | 1290 // will be able to cope with any constant by loading it into an internal |
1285 // scratch register. This means that if the constant is used more that once, | 1291 // scratch register. This means that if the constant is used more that once, |
1286 // it will be loaded multiple times. Unfortunatly crankshaft already | 1292 // it will be loaded multiple times. Unfortunatly crankshaft already |
1287 // duplicates constant loads, but we should modify the code below once this | 1293 // duplicates constant loads, but we should modify the code below once this |
1288 // issue has been addressed in crankshaft. | 1294 // issue has been addressed in crankshaft. |
1289 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); | 1295 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); |
1290 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); | 1296 LOperand* right = UseRegisterOrConstantAtStart(instr->right()); |
1291 return new(zone()) LCmpIDAndBranch(left, right); | 1297 return new(zone()) LCompareNumericAndBranch(left, right); |
1292 } | 1298 } |
1293 } | 1299 } |
1294 | 1300 |
1295 | 1301 |
1296 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { | 1302 LInstruction* LChunkBuilder::DoRandom(HRandom* instr) { |
1297 ASSERT(instr->representation().IsDouble()); | 1303 ASSERT(instr->representation().IsDouble()); |
1298 ASSERT(instr->global_object()->representation().IsTagged()); | 1304 ASSERT(instr->global_object()->representation().IsTagged()); |
1299 LOperand* global_object = UseFixed(instr->global_object(), x0); | 1305 LOperand* global_object = UseFixed(instr->global_object(), x0); |
1300 LRandom* result = new(zone()) LRandom(global_object); | 1306 LRandom* result = new(zone()) LRandom(global_object); |
1301 return MarkAsCall(DefineFixedDouble(result, d7), instr); | 1307 return MarkAsCall(DefineFixedDouble(result, d7), instr); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 return NULL; | 1452 return NULL; |
1447 } | 1453 } |
1448 | 1454 |
1449 | 1455 |
1450 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) { | 1456 LInstruction* LChunkBuilder::DoEnvironmentMarker(HEnvironmentMarker* instr) { |
1451 UNREACHABLE(); | 1457 UNREACHABLE(); |
1452 return NULL; | 1458 return NULL; |
1453 } | 1459 } |
1454 | 1460 |
1455 | 1461 |
1456 LInstruction* LChunkBuilder::DoFixedArrayBaseLength( | |
1457 HFixedArrayBaseLength* instr) { | |
1458 LOperand* array = UseRegisterAtStart(instr->value()); | |
1459 return DefineAsRegister(new(zone()) LFixedArrayBaseLength(array)); | |
1460 } | |
1461 | |
1462 | |
1463 LInstruction* LChunkBuilder::DoForceRepresentation( | 1462 LInstruction* LChunkBuilder::DoForceRepresentation( |
1464 HForceRepresentation* instr) { | 1463 HForceRepresentation* instr) { |
1465 UNIMPLEMENTED_INSTRUCTION(); | 1464 UNIMPLEMENTED_INSTRUCTION(); |
1466 } | 1465 } |
1467 | 1466 |
1468 | 1467 |
1469 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { | 1468 LInstruction* LChunkBuilder::DoFunctionLiteral(HFunctionLiteral* instr) { |
1470 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, x0), instr); | 1469 return MarkAsCall(DefineFixed(new(zone()) LFunctionLiteral, x0), instr); |
1471 } | 1470 } |
1472 | 1471 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); | 1562 return MarkAsCall(DefineFixed(result, x0), instr, CANNOT_DEOPTIMIZE_EAGERLY); |
1564 } | 1563 } |
1565 | 1564 |
1566 | 1565 |
1567 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( | 1566 LInstruction* LChunkBuilder::DoIsConstructCallAndBranch( |
1568 HIsConstructCallAndBranch* instr) { | 1567 HIsConstructCallAndBranch* instr) { |
1569 return new(zone()) LIsConstructCallAndBranch(TempRegister(), TempRegister()); | 1568 return new(zone()) LIsConstructCallAndBranch(TempRegister(), TempRegister()); |
1570 } | 1569 } |
1571 | 1570 |
1572 | 1571 |
| 1572 LInstruction* LChunkBuilder::DoIsNumberAndBranch(HIsNumberAndBranch* instr) { |
| 1573 return new(zone()) |
| 1574 LIsNumberAndBranch(UseRegisterOrConstantAtStart(instr->value())); |
| 1575 } |
| 1576 |
| 1577 |
1573 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { | 1578 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { |
1574 ASSERT(instr->value()->representation().IsTagged()); | 1579 ASSERT(instr->value()->representation().IsTagged()); |
1575 LOperand* value = UseRegisterAtStart(instr->value()); | 1580 LOperand* value = UseRegisterAtStart(instr->value()); |
1576 LOperand* temp1 = TempRegister(); | 1581 LOperand* temp1 = TempRegister(); |
1577 LOperand* temp2 = TempRegister(); | 1582 LOperand* temp2 = TempRegister(); |
1578 return new(zone()) LIsObjectAndBranch(value, temp1, temp2); | 1583 return new(zone()) LIsObjectAndBranch(value, temp1, temp2); |
1579 } | 1584 } |
1580 | 1585 |
1581 | 1586 |
1582 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { | 1587 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) { |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2522 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2527 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2523 LOperand* receiver = UseRegister(instr->receiver()); | 2528 LOperand* receiver = UseRegister(instr->receiver()); |
2524 LOperand* function = UseRegisterAtStart(instr->function()); | 2529 LOperand* function = UseRegisterAtStart(instr->function()); |
2525 LOperand* temp = TempRegister(); | 2530 LOperand* temp = TempRegister(); |
2526 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2531 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
2527 return AssignEnvironment(DefineAsRegister(result)); | 2532 return AssignEnvironment(DefineAsRegister(result)); |
2528 } | 2533 } |
2529 | 2534 |
2530 | 2535 |
2531 } } // namespace v8::internal | 2536 } } // namespace v8::internal |
OLD | NEW |