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

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

Issue 8373029: [hydrogen] optimize switch with string clauses (Closed) Base URL: gh:v8/v8@master
Patch Set: use type feedback to bailout switches with known beforehand string(non-symbol) comparison 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 223
224 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { 224 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
225 stream->Add("if is_object("); 225 stream->Add("if is_object(");
226 InputAt(0)->PrintTo(stream); 226 InputAt(0)->PrintTo(stream);
227 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 227 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
228 } 228 }
229 229
230 230
231 void LIsStringAndBranch::PrintDataTo(StringStream* stream) {
232 stream->Add("if is_string(");
233 InputAt(0)->PrintTo(stream);
234 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
235 }
236
237
231 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { 238 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
232 stream->Add("if is_smi("); 239 stream->Add("if is_smi(");
233 InputAt(0)->PrintTo(stream); 240 InputAt(0)->PrintTo(stream);
234 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 241 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
235 } 242 }
236 243
237 244
238 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { 245 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) {
239 stream->Add("if is_undetectable("); 246 stream->Add("if is_undetectable(");
240 InputAt(0)->PrintTo(stream); 247 InputAt(0)->PrintTo(stream);
241 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 248 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
242 } 249 }
243 250
244 251
252 void LCompareGenericAndBranch::PrintDataTo(StringStream* stream) {
253 stream->Add("if compare_generic(");
254 InputAt(0)->PrintTo(stream);
255 InputAt(1)->PrintTo(stream);
256 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
257 }
258
259
245 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { 260 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
246 stream->Add("if has_instance_type("); 261 stream->Add("if has_instance_type(");
247 InputAt(0)->PrintTo(stream); 262 InputAt(0)->PrintTo(stream);
248 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 263 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
249 } 264 }
250 265
251 266
252 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { 267 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
253 stream->Add("if has_cached_array_index("); 268 stream->Add("if has_cached_array_index(");
254 InputAt(0)->PrintTo(stream); 269 InputAt(0)->PrintTo(stream);
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 } 1407 }
1393 1408
1394 1409
1395 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) { 1410 LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
1396 Representation r = instr->GetInputRepresentation(); 1411 Representation r = instr->GetInputRepresentation();
1397 ASSERT(instr->left()->representation().IsTagged()); 1412 ASSERT(instr->left()->representation().IsTagged());
1398 ASSERT(instr->right()->representation().IsTagged()); 1413 ASSERT(instr->right()->representation().IsTagged());
1399 LOperand* left = UseFixed(instr->left(), a1); 1414 LOperand* left = UseFixed(instr->left(), a1);
1400 LOperand* right = UseFixed(instr->right(), a0); 1415 LOperand* right = UseFixed(instr->right(), a0);
1401 LCmpT* result = new LCmpT(left, right); 1416 LCmpT* result = new LCmpT(left, right);
1402 return MarkAsCall(DefineFixed(result, v0), instr); 1417 return AssignEnvironment(MarkAsCall(DefineFixed(result, v0), instr));
1403 } 1418 }
1404 1419
1405 1420
1406 LInstruction* LChunkBuilder::DoCompareIDAndBranch( 1421 LInstruction* LChunkBuilder::DoCompareIDAndBranch(
1407 HCompareIDAndBranch* instr) { 1422 HCompareIDAndBranch* instr) {
1408 Representation r = instr->GetInputRepresentation(); 1423 Representation r = instr->GetInputRepresentation();
1409 if (r.IsInteger32()) { 1424 if (r.IsInteger32()) {
1410 ASSERT(instr->left()->representation().IsInteger32()); 1425 ASSERT(instr->left()->representation().IsInteger32());
1411 ASSERT(instr->right()->representation().IsInteger32()); 1426 ASSERT(instr->right()->representation().IsInteger32());
1412 LOperand* left = UseRegisterOrConstantAtStart(instr->left()); 1427 LOperand* left = UseRegisterOrConstantAtStart(instr->left());
(...skipping 30 matching lines...) Expand all
1443 } 1458 }
1444 1459
1445 1460
1446 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1461 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1447 ASSERT(instr->value()->representation().IsTagged()); 1462 ASSERT(instr->value()->representation().IsTagged());
1448 LOperand* temp = TempRegister(); 1463 LOperand* temp = TempRegister();
1449 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()), temp); 1464 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()), temp);
1450 } 1465 }
1451 1466
1452 1467
1468 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1469 ASSERT(instr->value()->representation().IsTagged());
1470 LOperand* temp = TempRegister();
1471 return new LIsStringAndBranch(UseRegisterAtStart(instr->value()), temp);
1472 }
1473
1474
1453 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1475 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1454 ASSERT(instr->value()->representation().IsTagged()); 1476 ASSERT(instr->value()->representation().IsTagged());
1455 return new LIsSmiAndBranch(Use(instr->value())); 1477 return new LIsSmiAndBranch(Use(instr->value()));
1456 } 1478 }
1457 1479
1458 1480
1459 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1481 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1460 HIsUndetectableAndBranch* instr) { 1482 HIsUndetectableAndBranch* instr) {
1461 ASSERT(instr->value()->representation().IsTagged()); 1483 ASSERT(instr->value()->representation().IsTagged());
1462 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()), 1484 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()),
1463 TempRegister()); 1485 TempRegister());
1464 } 1486 }
1465 1487
1466 1488
1489 LInstruction* LChunkBuilder::DoCompareGenericAndBranch(
1490 HCompareGenericAndBranch* instr) {
1491 Representation r = instr->GetInputRepresentation();
1492 ASSERT(instr->left()->representation().IsTagged());
1493 ASSERT(instr->right()->representation().IsTagged());
1494 LOperand* left = UseFixed(instr->left(), a1);
1495 LOperand* right = UseFixed(instr->right(), a0);
1496 LCompareGenericAndBranch* result = new LCompareGenericAndBranch(left, right);
1497 return AssignEnvironment(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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 2227
2194 LInstruction* LChunkBuilder::DoIn(HIn* instr) { 2228 LInstruction* LChunkBuilder::DoIn(HIn* instr) {
2195 LOperand* key = UseRegisterAtStart(instr->key()); 2229 LOperand* key = UseRegisterAtStart(instr->key());
2196 LOperand* object = UseRegisterAtStart(instr->object()); 2230 LOperand* object = UseRegisterAtStart(instr->object());
2197 LIn* result = new LIn(key, object); 2231 LIn* result = new LIn(key, object);
2198 return MarkAsCall(DefineFixed(result, v0), instr); 2232 return MarkAsCall(DefineFixed(result, v0), instr);
2199 } 2233 }
2200 2234
2201 2235
2202 } } // namespace v8::internal 2236 } } // namespace v8::internal
OLDNEW
« src/ia32/lithium-ia32.cc ('K') | « src/mips/lithium-mips.h ('k') | src/type-info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698