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

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: fix lint errors, improved test 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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/mips/lithium-codegen-mips.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 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 LStringCompareAndBranch::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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 } 1507 }
1493 1508
1494 1509
1495 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1510 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1496 ASSERT(instr->value()->representation().IsTagged()); 1511 ASSERT(instr->value()->representation().IsTagged());
1497 LOperand* temp = TempRegister(); 1512 LOperand* temp = TempRegister();
1498 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp); 1513 return new(zone()) LIsObjectAndBranch(UseRegister(instr->value()), temp);
1499 } 1514 }
1500 1515
1501 1516
1517 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1518 ASSERT(instr->value()->representation().IsTagged());
1519 LOperand* temp = TempRegister();
1520 return new LIsStringAndBranch(UseRegister(instr->value()), temp);
1521 }
1522
1523
1502 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1524 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1503 ASSERT(instr->value()->representation().IsTagged()); 1525 ASSERT(instr->value()->representation().IsTagged());
1504 return new(zone()) LIsSmiAndBranch(Use(instr->value())); 1526 return new(zone()) LIsSmiAndBranch(Use(instr->value()));
1505 } 1527 }
1506 1528
1507 1529
1508 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1530 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1509 HIsUndetectableAndBranch* instr) { 1531 HIsUndetectableAndBranch* instr) {
1510 ASSERT(instr ->value()->representation().IsTagged()); 1532 ASSERT(instr ->value()->representation().IsTagged());
1511 return new(zone()) LIsUndetectableAndBranch( 1533 return new(zone()) LIsUndetectableAndBranch(
1512 UseRegisterAtStart(instr->value()), TempRegister()); 1534 UseRegisterAtStart(instr->value()), TempRegister());
1513 } 1535 }
1514 1536
1515 1537
1538 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1539 HStringCompareAndBranch* instr) {
1540 ASSERT(instr->left()->representation().IsTagged());
1541 ASSERT(instr->right()->representation().IsTagged());
1542 LOperand* context = UseFixed(instr->context(), esi);
1543 LOperand* left = UseFixed(instr->left(), edx);
1544 LOperand* right = UseFixed(instr->right(), eax);
1545
1546 LStringCompareAndBranch* result = new
1547 LStringCompareAndBranch(context, left, right);
1548
1549 return MarkAsCall(result, instr);
1550 }
1551
1552
1516 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1553 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1517 HHasInstanceTypeAndBranch* instr) { 1554 HHasInstanceTypeAndBranch* instr) {
1518 ASSERT(instr->value()->representation().IsTagged()); 1555 ASSERT(instr->value()->representation().IsTagged());
1519 return new(zone()) LHasInstanceTypeAndBranch( 1556 return new(zone()) LHasInstanceTypeAndBranch(
1520 UseRegisterAtStart(instr->value()), 1557 UseRegisterAtStart(instr->value()),
1521 TempRegister()); 1558 TempRegister());
1522 } 1559 }
1523 1560
1524 1561
1525 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1562 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 LOperand* key = UseOrConstantAtStart(instr->key()); 2357 LOperand* key = UseOrConstantAtStart(instr->key());
2321 LOperand* object = UseOrConstantAtStart(instr->object()); 2358 LOperand* object = UseOrConstantAtStart(instr->object());
2322 LIn* result = new(zone()) LIn(context, key, object); 2359 LIn* result = new(zone()) LIn(context, key, object);
2323 return MarkAsCall(DefineFixed(result, eax), instr); 2360 return MarkAsCall(DefineFixed(result, eax), instr);
2324 } 2361 }
2325 2362
2326 2363
2327 } } // namespace v8::internal 2364 } } // namespace v8::internal
2328 2365
2329 #endif // V8_TARGET_ARCH_IA32 2366 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/mips/lithium-codegen-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698