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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 int CodeGenerator::FastCaseSwitchMaxOverheadFactor() { | 1592 int CodeGenerator::FastCaseSwitchMaxOverheadFactor() { |
1593 return kFastSwitchMaxOverheadFactor; | 1593 return kFastSwitchMaxOverheadFactor; |
1594 } | 1594 } |
1595 | 1595 |
1596 int CodeGenerator::FastCaseSwitchMinCaseCount() { | 1596 int CodeGenerator::FastCaseSwitchMinCaseCount() { |
1597 return kFastSwitchMinCaseCount; | 1597 return kFastSwitchMinCaseCount; |
1598 } | 1598 } |
1599 | 1599 |
1600 // Generate a computed jump to a switch case. | 1600 // Generate a computed jump to a switch case. |
1601 void CodeGenerator::GenerateFastCaseSwitchJumpTable( | 1601 void CodeGenerator::GenerateFastCaseSwitchJumpTable( |
1602 SwitchStatement* node, int min_index, int range, Label *fail_label, | 1602 SwitchStatement* node, |
1603 SmartPointer<Label*> &case_targets, SmartPointer<Label> &case_labels) { | 1603 int min_index, |
| 1604 int range, |
| 1605 Label* fail_label, |
| 1606 Vector<Label*> case_targets, |
| 1607 Vector<Label> case_labels) { |
1604 // Notice: Internal references, used by both the jmp instruction and | 1608 // Notice: Internal references, used by both the jmp instruction and |
1605 // the table entries, need to be relocated if the buffer grows. This | 1609 // the table entries, need to be relocated if the buffer grows. This |
1606 // prevents the forward use of Labels, since a displacement cannot | 1610 // prevents the forward use of Labels, since a displacement cannot |
1607 // survive relocation, and it also cannot safely be distinguished | 1611 // survive relocation, and it also cannot safely be distinguished |
1608 // from a real address. Instead we put in zero-values as | 1612 // from a real address. Instead we put in zero-values as |
1609 // placeholders, and fill in the addresses after the labels have been | 1613 // placeholders, and fill in the addresses after the labels have been |
1610 // bound. | 1614 // bound. |
1611 | 1615 |
1612 frame_->Pop(eax); // supposed smi | 1616 frame_->Pop(eax); // supposed smi |
1613 // check range of value, if outside [0..length-1] jump to default/end label. | 1617 // check range of value, if outside [0..length-1] jump to default/end label. |
(...skipping 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5097 | 5101 |
5098 // Slow-case: Go through the JavaScript implementation. | 5102 // Slow-case: Go through the JavaScript implementation. |
5099 __ bind(&slow); | 5103 __ bind(&slow); |
5100 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); | 5104 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); |
5101 } | 5105 } |
5102 | 5106 |
5103 | 5107 |
5104 #undef __ | 5108 #undef __ |
5105 | 5109 |
5106 } } // namespace v8::internal | 5110 } } // namespace v8::internal |
OLD | NEW |