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

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 79143007: MIPS: Optimize AccessArgumentsAt. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 7 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 | « no previous file | src/mips/lithium-mips.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 Register to_reg = ToRegister(instr->result()); 3030 Register to_reg = ToRegister(instr->result());
3031 Register from_reg = ToRegister(instr->object()); 3031 Register from_reg = ToRegister(instr->object());
3032 __ lw(to_reg, FieldMemOperand(from_reg, 3032 __ lw(to_reg, FieldMemOperand(from_reg,
3033 ExternalArray::kExternalPointerOffset)); 3033 ExternalArray::kExternalPointerOffset));
3034 } 3034 }
3035 3035
3036 3036
3037 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 3037 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
3038 Register arguments = ToRegister(instr->arguments()); 3038 Register arguments = ToRegister(instr->arguments());
3039 Register result = ToRegister(instr->result()); 3039 Register result = ToRegister(instr->result());
3040 if (instr->length()->IsConstantOperand() && 3040 // There are two words between the frame pointer and the last argument.
3041 instr->index()->IsConstantOperand()) { 3041 // Subtracting from length accounts for one of them add one more.
3042 if (instr->length()->IsConstantOperand()) {
3043 int const_length = ToInteger32(LConstantOperand::cast(instr->length()));
3044 if (instr->index()->IsConstantOperand()) {
3045 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3046 int index = (const_length - const_index) + 1;
3047 __ lw(result, MemOperand(arguments, index * kPointerSize));
3048 } else {
3049 Register index = ToRegister(instr->index());
3050 __ li(at, Operand(const_length + 1));
3051 __ Subu(result, at, index);
3052 __ sll(at, result, kPointerSizeLog2);
3053 __ Addu(at, arguments, at);
3054 __ lw(result, MemOperand(at));
3055 }
3056 } else if (instr->index()->IsConstantOperand()) {
3057 Register length = ToRegister(instr->length());
3042 int const_index = ToInteger32(LConstantOperand::cast(instr->index())); 3058 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3043 int const_length = ToInteger32(LConstantOperand::cast(instr->length())); 3059 int loc = const_index - 1;
3044 int index = (const_length - const_index) + 1; 3060 if (loc != 0) {
3045 __ lw(result, MemOperand(arguments, index * kPointerSize)); 3061 __ Subu(result, length, Operand(loc));
3062 __ sll(at, result, kPointerSizeLog2);
3063 __ Addu(at, arguments, at);
3064 __ lw(result, MemOperand(at));
3065 } else {
3066 __ sll(at, length, kPointerSizeLog2);
3067 __ Addu(at, arguments, at);
3068 __ lw(result, MemOperand(at));
3069 }
3046 } else { 3070 } else {
3047 Register length = ToRegister(instr->length()); 3071 Register length = ToRegister(instr->length());
3048 Register index = ToRegister(instr->index()); 3072 Register index = ToRegister(instr->index());
3049 // There are two words between the frame pointer and the last argument. 3073 __ Subu(result, length, index);
3050 // Subtracting from length accounts for one of them, add one more. 3074 __ Addu(result, result, 1);
3051 __ subu(length, length, index); 3075 __ sll(at, result, kPointerSizeLog2);
3052 __ Addu(length, length, Operand(1)); 3076 __ Addu(at, arguments, at);
3053 __ sll(length, length, kPointerSizeLog2); 3077 __ lw(result, MemOperand(at));
3054 __ Addu(at, arguments, Operand(length));
3055 __ lw(result, MemOperand(at, 0));
3056 } 3078 }
3057 } 3079 }
3058 3080
3059 3081
3060 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { 3082 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3061 Register external_pointer = ToRegister(instr->elements()); 3083 Register external_pointer = ToRegister(instr->elements());
3062 Register key = no_reg; 3084 Register key = no_reg;
3063 ElementsKind elements_kind = instr->elements_kind(); 3085 ElementsKind elements_kind = instr->elements_kind();
3064 bool key_is_constant = instr->key()->IsConstantOperand(); 3086 bool key_is_constant = instr->key()->IsConstantOperand();
3065 int constant_key = 0; 3087 int constant_key = 0;
(...skipping 2757 matching lines...) Expand 10 before | Expand all | Expand 10 after
5823 __ Subu(scratch, result, scratch); 5845 __ Subu(scratch, result, scratch);
5824 __ lw(result, FieldMemOperand(scratch, 5846 __ lw(result, FieldMemOperand(scratch,
5825 FixedArray::kHeaderSize - kPointerSize)); 5847 FixedArray::kHeaderSize - kPointerSize));
5826 __ bind(&done); 5848 __ bind(&done);
5827 } 5849 }
5828 5850
5829 5851
5830 #undef __ 5852 #undef __
5831 5853
5832 } } // namespace v8::internal 5854 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698