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

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

Issue 7608020: Use immediates when possible for HBoundsCheck and HLoadKeyedFastElement (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after
2299 DeoptimizeIf(below_equal, instr->environment()); 2299 DeoptimizeIf(below_equal, instr->environment());
2300 2300
2301 // There are two words between the frame pointer and the last argument. 2301 // There are two words between the frame pointer and the last argument.
2302 // Subtracting from length accounts for one of them add one more. 2302 // Subtracting from length accounts for one of them add one more.
2303 __ movq(result, Operand(arguments, length, times_pointer_size, kPointerSize)); 2303 __ movq(result, Operand(arguments, length, times_pointer_size, kPointerSize));
2304 } 2304 }
2305 2305
2306 2306
2307 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) { 2307 void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
2308 Register elements = ToRegister(instr->elements()); 2308 Register elements = ToRegister(instr->elements());
2309 Register key = ToRegister(instr->key());
2310 Register result = ToRegister(instr->result()); 2309 Register result = ToRegister(instr->result());
2311 ASSERT(result.is(elements));
2312 2310
2313 // Load the result. 2311 // Load the result.
2314 __ movq(result, FieldOperand(elements, 2312 if (instr->key()->IsConstantOperand()) {
2315 key, 2313 int key = ToInteger32(LConstantOperand::cast(instr->key()));
danno 2011/08/10 11:03:46 Move into a "GetOperanXXXX" function. Or can you e
Jakob Kummerow 2011/08/10 12:22:48 Done.
2316 times_pointer_size, 2314 __ movq(result, FieldOperand(
2317 FixedArray::kHeaderSize)); 2315 elements, (key << times_pointer_size) + FixedArray::kHeaderSize));
2316 } else {
2317 __ movq(result, FieldOperand(elements,
2318 ToRegister(instr->key()),
2319 times_pointer_size,
2320 FixedArray::kHeaderSize));
2321 }
2318 2322
2319 // Check for the hole value. 2323 // Check for the hole value.
2320 if (instr->hydrogen()->RequiresHoleCheck()) { 2324 if (instr->hydrogen()->RequiresHoleCheck()) {
2321 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); 2325 __ CompareRoot(result, Heap::kTheHoleValueRootIndex);
2322 DeoptimizeIf(equal, instr->environment()); 2326 DeoptimizeIf(equal, instr->environment());
2323 } 2327 }
2324 } 2328 }
2325 2329
2326 2330
2327 void LCodeGen::DoLoadKeyedFastDoubleElement( 2331 void LCodeGen::DoLoadKeyedFastDoubleElement(
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
3130 case JSObject::DICTIONARY_ELEMENTS: 3134 case JSObject::DICTIONARY_ELEMENTS:
3131 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS: 3135 case JSObject::NON_STRICT_ARGUMENTS_ELEMENTS:
3132 UNREACHABLE(); 3136 UNREACHABLE();
3133 break; 3137 break;
3134 } 3138 }
3135 } 3139 }
3136 } 3140 }
3137 3141
3138 3142
3139 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3143 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3140 if (instr->length()->IsRegister()) { 3144 if (instr->index()->IsConstantOperand()) {
3141 __ cmpq(ToRegister(instr->index()), ToRegister(instr->length())); 3145 if (instr->length()->IsRegister()) {
3146 __ cmpq(ToRegister(instr->length()),
3147 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3148 } else {
3149 __ cmpq(ToOperand(instr->length()),
3150 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3151 }
3142 } else { 3152 } else {
3143 __ cmpq(ToRegister(instr->index()), ToOperand(instr->length())); 3153 if (instr->length()->IsRegister()) {
3154 __ cmpq(ToRegister(instr->length()), ToRegister(instr->index()));
3155 } else {
3156 __ cmpq(ToOperand(instr->length()), ToRegister(instr->index()));
3157 }
3144 } 3158 }
3145 DeoptimizeIf(above_equal, instr->environment()); 3159 DeoptimizeIf(below_equal, instr->environment());
3146 } 3160 }
3147 3161
3148 3162
3149 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) { 3163 void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
3150 Register value = ToRegister(instr->value()); 3164 Register value = ToRegister(instr->value());
3151 Register elements = ToRegister(instr->object()); 3165 Register elements = ToRegister(instr->object());
3152 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg; 3166 Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
3153 3167
3154 // Do the store. 3168 // Do the store.
3155 if (instr->key()->IsConstantOperand()) { 3169 if (instr->key()->IsConstantOperand()) {
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
4184 RegisterEnvironmentForDeoptimization(environment); 4198 RegisterEnvironmentForDeoptimization(environment);
4185 ASSERT(osr_pc_offset_ == -1); 4199 ASSERT(osr_pc_offset_ == -1);
4186 osr_pc_offset_ = masm()->pc_offset(); 4200 osr_pc_offset_ = masm()->pc_offset();
4187 } 4201 }
4188 4202
4189 #undef __ 4203 #undef __
4190 4204
4191 } } // namespace v8::internal 4205 } } // namespace v8::internal
4192 4206
4193 #endif // V8_TARGET_ARCH_X64 4207 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698