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

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: 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/x64/lithium-x64.h ('k') | test/mjsunit/switch.js » ('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 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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp); 1459 return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp);
1445 } 1460 }
1446 1461
1447 1462
1448 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) { 1463 LInstruction* LChunkBuilder::DoIsObjectAndBranch(HIsObjectAndBranch* instr) {
1449 ASSERT(instr->value()->representation().IsTagged()); 1464 ASSERT(instr->value()->representation().IsTagged());
1450 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value())); 1465 return new LIsObjectAndBranch(UseRegisterAtStart(instr->value()));
1451 } 1466 }
1452 1467
1453 1468
1469 LInstruction* LChunkBuilder::DoIsStringAndBranch(HIsStringAndBranch* instr) {
1470 ASSERT(instr->value()->representation().IsTagged());
1471 LOperand* temp = TempRegister();
1472 return new LIsStringAndBranch(UseRegisterAtStart(instr->value()), temp);
1473 }
1474
1475
1454 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) { 1476 LInstruction* LChunkBuilder::DoIsSmiAndBranch(HIsSmiAndBranch* instr) {
1455 ASSERT(instr->value()->representation().IsTagged()); 1477 ASSERT(instr->value()->representation().IsTagged());
1456 return new LIsSmiAndBranch(Use(instr->value())); 1478 return new LIsSmiAndBranch(Use(instr->value()));
1457 } 1479 }
1458 1480
1459 1481
1460 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch( 1482 LInstruction* LChunkBuilder::DoIsUndetectableAndBranch(
1461 HIsUndetectableAndBranch* instr) { 1483 HIsUndetectableAndBranch* instr) {
1462 ASSERT(instr->value()->representation().IsTagged()); 1484 ASSERT(instr->value()->representation().IsTagged());
1463 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()), 1485 return new LIsUndetectableAndBranch(UseRegisterAtStart(instr->value()),
1464 TempRegister()); 1486 TempRegister());
1465 } 1487 }
1466 1488
1467 1489
1490 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
1491 HStringCompareAndBranch* instr) {
1492
1493 ASSERT(instr->left()->representation().IsTagged());
1494 ASSERT(instr->right()->representation().IsTagged());
1495 LOperand* left = UseFixed(instr->left(), rdx);
1496 LOperand* right = UseFixed(instr->right(), rax);
1497 LStringCompareAndBranch* result = new LStringCompareAndBranch(left, right);
1498
1499 return MarkAsCall(result, instr);
1500 }
1501
1502
1468 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch( 1503 LInstruction* LChunkBuilder::DoHasInstanceTypeAndBranch(
1469 HHasInstanceTypeAndBranch* instr) { 1504 HHasInstanceTypeAndBranch* instr) {
1470 ASSERT(instr->value()->representation().IsTagged()); 1505 ASSERT(instr->value()->representation().IsTagged());
1471 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value())); 1506 return new LHasInstanceTypeAndBranch(UseRegisterAtStart(instr->value()));
1472 } 1507 }
1473 1508
1474 1509
1475 LInstruction* LChunkBuilder::DoGetCachedArrayIndex( 1510 LInstruction* LChunkBuilder::DoGetCachedArrayIndex(
1476 HGetCachedArrayIndex* instr) { 1511 HGetCachedArrayIndex* instr) {
1477 ASSERT(instr->value()->representation().IsTagged()); 1512 ASSERT(instr->value()->representation().IsTagged());
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 LOperand* key = UseOrConstantAtStart(instr->key()); 2230 LOperand* key = UseOrConstantAtStart(instr->key());
2196 LOperand* object = UseOrConstantAtStart(instr->object()); 2231 LOperand* object = UseOrConstantAtStart(instr->object());
2197 LIn* result = new LIn(key, object); 2232 LIn* result = new LIn(key, object);
2198 return MarkAsCall(DefineFixed(result, rax), instr); 2233 return MarkAsCall(DefineFixed(result, rax), instr);
2199 } 2234 }
2200 2235
2201 2236
2202 } } // namespace v8::internal 2237 } } // namespace v8::internal
2203 2238
2204 #endif // V8_TARGET_ARCH_X64 2239 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | test/mjsunit/switch.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698