OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 942 |
943 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { | 943 LInstruction* LChunkBuilder::DoBlockEntry(HBlockEntry* instr) { |
944 // V8 expects a label to be generated for each basic block. | 944 // V8 expects a label to be generated for each basic block. |
945 // This is used in some places like LAllocator::IsBlockBoundary | 945 // This is used in some places like LAllocator::IsBlockBoundary |
946 // in lithium-allocator.cc | 946 // in lithium-allocator.cc |
947 return new(zone()) LLabel(instr->block()); | 947 return new(zone()) LLabel(instr->block()); |
948 } | 948 } |
949 | 949 |
950 | 950 |
951 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { | 951 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { |
952 LOperand* value = UseRegisterOrConstantAtStart(instr->index()); | 952 if (!FLAG_debug_code && instr->skip_check()) return NULL; |
953 LOperand* length = UseRegister(instr->length()); | 953 LOperand* index = UseRegisterOrConstantAtStart(instr->index()); |
954 return AssignEnvironment(new(zone()) LBoundsCheck(value, length)); | 954 LOperand* length = !index->IsConstantOperand() |
| 955 ? UseRegisterOrConstantAtStart(instr->length()) |
| 956 : UseRegisterAtStart(instr->length()); |
| 957 LInstruction* result = new(zone()) LBoundsCheck(index, length); |
| 958 if (!FLAG_debug_code || !instr->skip_check()) { |
| 959 result = AssignEnvironment(result); |
| 960 } |
| 961 return result; |
955 } | 962 } |
956 | 963 |
957 | 964 |
958 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { | 965 LInstruction* LChunkBuilder::DoBranch(HBranch* instr) { |
959 LInstruction* goto_instr = CheckElideControlInstruction(instr); | 966 LInstruction* goto_instr = CheckElideControlInstruction(instr); |
960 if (goto_instr != NULL) return goto_instr; | 967 if (goto_instr != NULL) return goto_instr; |
961 | 968 |
962 HValue* value = instr->value(); | 969 HValue* value = instr->value(); |
963 Representation r = value->representation(); | 970 Representation r = value->representation(); |
964 HType type = value->type(); | 971 HType type = value->type(); |
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 | 2570 |
2564 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2571 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
2565 LOperand* receiver = UseRegister(instr->receiver()); | 2572 LOperand* receiver = UseRegister(instr->receiver()); |
2566 LOperand* function = UseRegister(instr->function()); | 2573 LOperand* function = UseRegister(instr->function()); |
2567 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); | 2574 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function); |
2568 return AssignEnvironment(DefineAsRegister(result)); | 2575 return AssignEnvironment(DefineAsRegister(result)); |
2569 } | 2576 } |
2570 | 2577 |
2571 | 2578 |
2572 } } // namespace v8::internal | 2579 } } // namespace v8::internal |
OLD | NEW |