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

Side by Side Diff: src/ia32/lithium-ia32.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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 218 }
219 219
220 220
221 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) { 221 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) {
222 stream->Add("if is_object("); 222 stream->Add("if is_object(");
223 InputAt(0)->PrintTo(stream); 223 InputAt(0)->PrintTo(stream);
224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 224 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
225 } 225 }
226 226
227 227
228 void LIsStringAndBranch::PrintDataTo(StringStream* stream) {
229 stream->Add("if is_string(");
230 InputAt(0)->PrintTo(stream);
231 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
232 }
233
234
228 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) { 235 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) {
229 stream->Add("if is_smi("); 236 stream->Add("if is_smi(");
230 InputAt(0)->PrintTo(stream); 237 InputAt(0)->PrintTo(stream);
231 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
232 } 239 }
233 240
234 241
235 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) { 242 void LIsUndetectableAndBranch::PrintDataTo(StringStream* stream) {
236 stream->Add("if is_undetectable("); 243 stream->Add("if is_undetectable(");
237 InputAt(0)->PrintTo(stream); 244 InputAt(0)->PrintTo(stream);
238 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
239 } 246 }
240 247
241 248
249 void LCompareGenericAndBranch::PrintDataTo(StringStream* stream) {
250 stream->Add("if compare_generic(");
251 InputAt(1)->PrintTo(stream);
252 InputAt(2)->PrintTo(stream);
253 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
254 }
255
256
242 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) { 257 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) {
243 stream->Add("if has_instance_type("); 258 stream->Add("if has_instance_type(");
244 InputAt(0)->PrintTo(stream); 259 InputAt(0)->PrintTo(stream);
245 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 260 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
246 } 261 }
247 262
248 263
249 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) { 264 void LHasCachedArrayIndexAndBranch::PrintDataTo(StringStream* stream) {
250 stream->Add("if has_cached_array_index("); 265 stream->Add("if has_cached_array_index(");
251 InputAt(0)->PrintTo(stream); 266 InputAt(0)->PrintTo(stream);
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 } 1506 }
1492 1507
1493 1508
1494 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1509 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1495 ASSERT(instr->value()->representation().IsTagged()); 1510 ASSERT(instr->value()->representation().IsTagged());
1496 LOperand* temp = TempRegister(); 1511 LOperand* temp = TempRegister();
1497 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp); 1512 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1498 } 1513 }
1499 1514
1500 1515
1516 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1517 ASSERT(instr->value()->representation().IsTagged());
1518 LOperand* temp = TempRegister();
1519 return new LIsStringAndBranch(UseRegister(instr->value()), temp);
1520 }
1521
1522
1501 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1523 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1502 ASSERT(instr->value()->representation().IsTagged()); 1524 ASSERT(instr->value()->representation().IsTagged());
1503 return new(zone()) LIsSmiAndBranch(Use(instr->value())); 1525 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1504 } 1526 }
1505 1527
1506 1528
1507 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1529 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1508 HIsUndetectableAndBranch* instr) { 1530 HIsUndetectableAndBranch* instr) {
1509 ASSERT(instr ->value()->representation().IsTagged()); 1531 ASSERT(instr ->value()->representation().IsTagged());
1510 return new(zone()) LIsUndetectableAndBranch( 1532 return new(zone()) LIsUndetectableAndBranch(
1511 UseRegisterAtStart(instr->value()), TempRegister()); 1533 UseRegisterAtStart(instr->value()), TempRegister());
1512 } 1534 }
1513 1535
1514 1536
1537 LInstruction* LChunkBuilder::DoCompareGenericAndBranch(
1538 HCompareGenericAndBranch* instr) {
1539 ASSERT(instr->left()->representation().IsTagged());
1540 ASSERT(instr->right()->representation().IsTagged());
1541 LOperand* context = UseFixed(instr->context(), esi);
1542 LOperand* left = UseFixed(instr->left(), edx);
1543 LOperand* right = UseFixed(instr->right(), eax);
1544
1545 LCompareGenericAndBranch* result = new
1546 LCompareGenericAndBranch(context, left, right);
1547
1548 return AssignEnvironment(MarkAsCall(result, instr));
fschneider 2011/11/07 08:27:18 This looks fishy. We should not need an environmen
indutny 2011/11/07 11:53:46 You're right. We don't need this anymore
1549 }
1550
1551
1515 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1552 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1516 HHasInstanceTypeAndBranch* instr) { 1553 HHasInstanceTypeAndBranch* instr) {
1517 ASSERT(instr->value()->representation().IsTagged()); 1554 ASSERT(instr->value()->representation().IsTagged());
1518 return new(zone()) LHasInstanceTypeAndBranch( 1555 return new(zone()) LHasInstanceTypeAndBranch(
1519 UseRegisterAtStart(instr->value()), 1556 UseRegisterAtStart(instr->value()),
1520 TempRegister()); 1557 TempRegister());
1521 } 1558 }
1522 1559
1523 1560
1524 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1561 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 LOperand* key = UseOrConstantAtStart(instr->key()); 2356 LOperand* key = UseOrConstantAtStart(instr->key());
2320 LOperand* object = UseOrConstantAtStart(instr->object()); 2357 LOperand* object = UseOrConstantAtStart(instr->object());
2321 LIn* result = new(zone()) LIn(context, key, object); 2358 LIn* result = new(zone()) LIn(context, key, object);
2322 return MarkAsCall(DefineFixed(result, eax), instr); 2359 return MarkAsCall(DefineFixed(result, eax), instr);
2323 } 2360 }
2324 2361
2325 2362
2326 } } // namespace v8::internal 2363 } } // namespace v8::internal
2327 2364
2328 #endif // V8_TARGET_ARCH_IA32 2365 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698