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

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

Issue 14022011: Improvements in lithium code generation. Recognizing if some operands are constants, we can often s… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Response to review comments from Danno out of band Created 7 years, 8 months 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 | Annotate | Revision Log
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 3258 matching lines...) Expand 10 before | Expand all | Expand 10 after
3269 LLoadExternalArrayPointer* instr) { 3269 LLoadExternalArrayPointer* instr) {
3270 Register to_reg = ToRegister(instr->result()); 3270 Register to_reg = ToRegister(instr->result());
3271 Register from_reg = ToRegister(instr->object()); 3271 Register from_reg = ToRegister(instr->object());
3272 __ ldr(to_reg, FieldMemOperand(from_reg, 3272 __ ldr(to_reg, FieldMemOperand(from_reg,
3273 ExternalArray::kExternalPointerOffset)); 3273 ExternalArray::kExternalPointerOffset));
3274 } 3274 }
3275 3275
3276 3276
3277 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) { 3277 void LCodeGen::DoAccessArgumentsAt(LAccessArgumentsAt* instr) {
3278 Register arguments = ToRegister(instr->arguments()); 3278 Register arguments = ToRegister(instr->arguments());
3279 Register length = ToRegister(instr->length());
3280 Register index = ToRegister(instr->index());
3281 Register result = ToRegister(instr->result()); 3279 Register result = ToRegister(instr->result());
3282 // There are two words between the frame pointer and the last argument. 3280 if (instr->length()->IsConstantOperand() &&
3283 // Subtracting from length accounts for one of them add one more. 3281 instr->index()->IsConstantOperand()) {
3284 __ sub(length, length, index); 3282 int const_index = ToInteger32(LConstantOperand::cast(instr->index()));
3285 __ add(length, length, Operand(1)); 3283 int const_length = ToInteger32(LConstantOperand::cast(instr->length()));
3286 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2)); 3284 int index = (const_length - const_index) + 1;
3285 __ ldr(result, MemOperand(arguments, index * kPointerSize));
3286 } else {
3287 Register length = ToRegister(instr->length());
3288 Register index = ToRegister(instr->index());
3289 // There are two words between the frame pointer and the last argument.
3290 // Subtracting from length accounts for one of them add one more.
3291 __ sub(length, length, index);
3292 __ add(length, length, Operand(1));
3293 __ ldr(result, MemOperand(arguments, length, LSL, kPointerSizeLog2));
3294 }
3287 } 3295 }
3288 3296
3289 3297
3290 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { 3298 void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
3291 Register external_pointer = ToRegister(instr->elements()); 3299 Register external_pointer = ToRegister(instr->elements());
3292 Register key = no_reg; 3300 Register key = no_reg;
3293 ElementsKind elements_kind = instr->elements_kind(); 3301 ElementsKind elements_kind = instr->elements_kind();
3294 bool key_is_constant = instr->key()->IsConstantOperand(); 3302 bool key_is_constant = instr->key()->IsConstantOperand();
3295 int constant_key = 0; 3303 int constant_key = 0;
3296 if (key_is_constant) { 3304 if (key_is_constant) {
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after
5997 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 6005 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5998 __ ldr(result, FieldMemOperand(scratch, 6006 __ ldr(result, FieldMemOperand(scratch,
5999 FixedArray::kHeaderSize - kPointerSize)); 6007 FixedArray::kHeaderSize - kPointerSize));
6000 __ bind(&done); 6008 __ bind(&done);
6001 } 6009 }
6002 6010
6003 6011
6004 #undef __ 6012 #undef __
6005 6013
6006 } } // namespace v8::internal 6014 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698