| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 __ add(r0, r0, Operand(Smi::FromInt(1))); | 1300 __ add(r0, r0, Operand(Smi::FromInt(1))); |
| 1301 } | 1301 } |
| 1302 } else { | 1302 } else { |
| 1303 __ sub(r0, r0, Operand(Smi::FromInt(min_index))); | 1303 __ sub(r0, r0, Operand(Smi::FromInt(min_index))); |
| 1304 } | 1304 } |
| 1305 } | 1305 } |
| 1306 __ tst(r0, Operand(0x80000000 | kSmiTagMask)); | 1306 __ tst(r0, Operand(0x80000000 | kSmiTagMask)); |
| 1307 fail_label->Branch(ne); | 1307 fail_label->Branch(ne); |
| 1308 __ cmp(r0, Operand(Smi::FromInt(range))); | 1308 __ cmp(r0, Operand(Smi::FromInt(range))); |
| 1309 fail_label->Branch(ge); | 1309 fail_label->Branch(ge); |
| 1310 __ add(pc, pc, Operand(r0, LSL, 2 - kSmiTagSize)); | 1310 __ SmiJumpTable(r0, case_targets); |
| 1311 // One extra instruction offsets the table, so the table's start address is | |
| 1312 // the pc-register at the above add. | |
| 1313 __ stop("Unreachable: Switch table alignment"); | |
| 1314 | 1311 |
| 1315 JumpTarget table_start(this); | 1312 JumpTarget table_start(this); |
| 1316 table_start.Bind(); | 1313 table_start.Bind(); |
| 1317 // Table containing branch operations. | 1314 // Table containing branch operations. |
| 1318 for (int i = 0; i < range; i++) { | 1315 for (int i = 0; i < range; i++) { |
| 1319 case_targets[i]->Jump(); | 1316 case_targets[i]->Jump(); |
| 1320 frame_ = new VirtualFrame(table_start.expected_frame()); | 1317 frame_ = new VirtualFrame(table_start.expected_frame()); |
| 1321 } | 1318 } |
| 1322 | |
| 1323 GenerateFastCaseSwitchCases(node, case_labels, &table_start); | 1319 GenerateFastCaseSwitchCases(node, case_labels, &table_start); |
| 1324 } | 1320 } |
| 1325 | 1321 |
| 1326 | 1322 |
| 1327 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { | 1323 void CodeGenerator::VisitSwitchStatement(SwitchStatement* node) { |
| 1328 Comment cmnt(masm_, "[ SwitchStatement"); | 1324 Comment cmnt(masm_, "[ SwitchStatement"); |
| 1329 if (FLAG_debug_info) RecordStatementPosition(node); | 1325 if (FLAG_debug_info) RecordStatementPosition(node); |
| 1330 node->set_break_stack_height(break_stack_height_); | 1326 node->set_break_stack_height(break_stack_height_); |
| 1331 node->break_target()->set_code_generator(this); | 1327 node->break_target()->set_code_generator(this); |
| 1332 | 1328 |
| (...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4497 __ mov(r2, Operand(0)); | 4493 __ mov(r2, Operand(0)); |
| 4498 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 4494 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
| 4499 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), | 4495 __ Jump(Handle<Code>(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)), |
| 4500 RelocInfo::CODE_TARGET); | 4496 RelocInfo::CODE_TARGET); |
| 4501 } | 4497 } |
| 4502 | 4498 |
| 4503 | 4499 |
| 4504 #undef __ | 4500 #undef __ |
| 4505 | 4501 |
| 4506 } } // namespace v8::internal | 4502 } } // namespace v8::internal |
| OLD | NEW |