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

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

Issue 8373029: [hydrogen] optimize switch with string clauses (Closed) Base URL: gh:v8/v8@master
Patch Set: remove second pass Created 9 years, 1 month 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 225
226 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { 226 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
227 stream->Add("if is_object("); 227 stream->Add("if is_object(");
228 InputAt(0)->PrintTo(stream); 228 InputAt(0)->PrintTo(stream);
229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 229 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
230 } 230 }
231 231
232 232
233 void LIsStringAndBranch::PrintDataTo(StringStream* stream) {
234 stream->Add("if is_string(");
235 InputAt(0)->PrintTo(stream);
236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
237 }
238
239
233 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { 240 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
234 stream->Add("if is_smi("); 241 stream->Add("if is_smi(");
235 InputAt(0)->PrintTo(stream); 242 InputAt(0)->PrintTo(stream);
236 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
237 } 244 }
238 245
239 246
240 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { 247 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) {
241 stream->Add("if is_undetectable("); 248 stream->Add("if is_undetectable(");
242 InputAt(0)->PrintTo(stream); 249 InputAt(0)->PrintTo(stream);
243 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 250 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
244 } 251 }
245 252
246 253
254 void LStringCompareAndBranch::PrintDataTo(StringStream* stream) {
255 stream->Add("if compare_generic(");
256 InputAt(0)->PrintTo(stream);
257 InputAt(1)->PrintTo(stream);
258 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
259 }
260
261
247 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { 262 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
248 stream->Add("if has_instance_type("); 263 stream->Add("if has_instance_type(");
249 InputAt(0)->PrintTo(stream); 264 InputAt(0)->PrintTo(stream);
250 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 265 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
251 } 266 }
252 267
253 268
254 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { 269 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
255 stream->Add("if has_cached_array_index("); 270 stream->Add("if has_cached_array_index(");
256 InputAt(0)->PrintTo(stream); 271 InputAt(0)->PrintTo(stream);
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 CAN_DEOPTIMIZE_EAGERLY); 1400 CAN_DEOPTIMIZE_EAGERLY);
1386 } 1401 }
1387 1402
1388 1403
1389 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1404 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1390 ASSERT(instr->left()->representation().IsTagged()); 1405 ASSERT(instr->left()->representation().IsTagged());
1391 ASSERT(instr->right()->representation().IsTagged()); 1406 ASSERT(instr->right()->representation().IsTagged());
1392 LOperand* left = UseFixed(instr->left(), rdx); 1407 LOperand* left = UseFixed(instr->left(), rdx);
1393 LOperand* right = UseFixed(instr->right(), rax); 1408 LOperand* right = UseFixed(instr->right(), rax);
1394 LCmpT* result = new LCmpT(left, right); 1409 LCmpT* result = new LCmpT(left, right);
1395 return MarkAsCall(DefineFixed(result, rax), instr); 1410 return AssignEnvironment(MarkAsCall(DefineFixed(result, rax), instr));
fschneider 2011/11/08 10:14:37 Remove this call to AssignEnvironment.
1396 } 1411 }
1397 1412
1398 1413
1399 LInstruction* LChunkBuilder::DoCompareIDAndBranch( 1414 LInstruction* LChunkBuilder::DoCompareIDAndBranch(
1400 HCompareIDAndBranch* instr) { 1415 HCompareIDAndBranch* instr) {
1401 Representation r = instr->GetInputRepresentation(); 1416 Representation r = instr->GetInputRepresentation();
1402 if (r.IsInteger32()) { 1417 if (r.IsInteger32()) {
1403 ASSERT(instr->left()->representation().IsInteger32()); 1418 ASSERT(instr->left()->representation().IsInteger32());
1404 ASSERT(instr->right()->representation().IsInteger32()); 1419 ASSERT(instr->right()->representation().IsInteger32());
1405 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1420 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp); 1458 return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp);
1444 } 1459 }
1445 1460
1446 1461
1447 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1462 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1448 ASSERT(instr->value()->representation().IsTagged()); 1463 ASSERT(instr->value()->representation().IsTagged());
1449 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value())); 1464 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()));
1450 } 1465 }
1451 1466
1452 1467
1468 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1469 ASSERT(instr->value()->representation().IsTagged());
fschneider 2011/11/08 10:14:37 You need to allocate a temp register using TempReg
1470 return new LIsStringAndBranch(UseRegisterAtStart(instr->value()));
1471 }
1472
1473
1453 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1474 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1454 ASSERT(instr->value()->representation().IsTagged()); 1475 ASSERT(instr->value()->representation().IsTagged());
1455 return new LIsSmiAndBranch(Use(instr->value())); 1476 return new LIsSmiAndBranch(Use(instr->value()));
1456 } 1477 }
1457 1478
1458 1479
1459 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1480 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1460 HIsUndetectableAndBranch* instr) { 1481 HIsUndetectableAndBranch* instr) {
1461 ASSERT(instr->value()->representation().IsTagged()); 1482 ASSERT(instr->value()->representation().IsTagged());
1462 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()), 1483 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()),
1463 TempRegister()); 1484 TempRegister());
1464 } 1485 }
1465 1486
1466 1487
1488 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1489 HStringCompareAndBranch* instr) {
1490
1491 ASSERT(instr->left()->representation().IsTagged());
1492 ASSERT(instr->right()->representation().IsTagged());
1493 LOperand* left = UseFixed(instr->left(), rdx);
1494 LOperand* right = UseFixed(instr->right(), rax);
1495 LStringCompareAndBranch* result = new LStringCompareAndBranch(left, right);
1496
1497 return MarkAsCall(result, instr);
1498 }
1499
1500
1467 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1501 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1468 HHasInstanceTypeAndBranch* instr) { 1502 HHasInstanceTypeAndBranch* instr) {
1469 ASSERT(instr->value()->representation().IsTagged()); 1503 ASSERT(instr->value()->representation().IsTagged());
1470 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value())); 1504 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value()));
1471 } 1505 }
1472 1506
1473 1507
1474 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1508 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
1475 HGetCachedArrayIndex* instr) { 1509 HGetCachedArrayIndex* instr) {
1476 ASSERT(instr->value()->representation().IsTagged()); 1510 ASSERT(instr->value()->representation().IsTagged());
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 LOperand* key = UseOrConstantAtStart(instr->key()); 2228 LOperand* key = UseOrConstantAtStart(instr->key());
2195 LOperand* object = UseOrConstantAtStart(instr->object()); 2229 LOperand* object = UseOrConstantAtStart(instr->object());
2196 LIn* result = new LIn(key, object); 2230 LIn* result = new LIn(key, object);
2197 return MarkAsCall(DefineFixed(result, rax), instr); 2231 return MarkAsCall(DefineFixed(result, rax), instr);
2198 } 2232 }
2199 2233
2200 2234
2201 } } // namespace v8::internal 2235 } } // namespace v8::internal
2202 2236
2203 #endif // V8_TARGET_ARCH_X64 2237 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698