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

Side by Side Diff: src/x64/lithium-x64.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
« src/ia32/lithium-ia32.cc ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | 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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 2126
2127 if (instr->value()->representation().IsDouble()) { 2127 if (instr->value()->representation().IsDouble()) {
2128 object = UseRegisterAtStart(instr->elements()); 2128 object = UseRegisterAtStart(instr->elements());
2129 val = UseTempRegister(instr->value()); 2129 val = UseTempRegister(instr->value());
2130 key = clobbers_key ? UseTempRegister(instr->key()) 2130 key = clobbers_key ? UseTempRegister(instr->key())
2131 : UseRegisterOrConstantAtStart(instr->key()); 2131 : UseRegisterOrConstantAtStart(instr->key());
2132 } else { 2132 } else {
2133 ASSERT(instr->value()->representation().IsTagged()); 2133 ASSERT(instr->value()->representation().IsTagged());
2134 object = UseTempRegister(instr->elements()); 2134 object = UseTempRegister(instr->elements());
2135 val = needs_write_barrier ? UseTempRegister(instr->value()) 2135 val = needs_write_barrier ? UseTempRegister(instr->value())
2136 : UseRegisterAtStart(instr->value()); 2136 : UseRegisterOrConstantAtStart(instr->value());
2137 key = (clobbers_key || needs_write_barrier) 2137 key = (clobbers_key || needs_write_barrier)
2138 ? UseTempRegister(instr->key()) 2138 ? UseTempRegister(instr->key())
2139 : UseRegisterOrConstantAtStart(instr->key()); 2139 : UseRegisterOrConstantAtStart(instr->key());
2140 } 2140 }
2141 2141
2142 return new(zone()) LStoreKeyed(object, key, val); 2142 return new(zone()) LStoreKeyed(object, key, val);
2143 } 2143 }
2144 2144
2145 ASSERT( 2145 ASSERT(
2146 (instr->value()->representation().IsInteger32() && 2146 (instr->value()->representation().IsInteger32() &&
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 if (needs_write_barrier) { 2223 if (needs_write_barrier) {
2224 obj = instr->is_in_object() 2224 obj = instr->is_in_object()
2225 ? UseRegister(instr->object()) 2225 ? UseRegister(instr->object())
2226 : UseTempRegister(instr->object()); 2226 : UseTempRegister(instr->object());
2227 } else { 2227 } else {
2228 obj = needs_write_barrier_for_map 2228 obj = needs_write_barrier_for_map
2229 ? UseRegister(instr->object()) 2229 ? UseRegister(instr->object())
2230 : UseRegisterAtStart(instr->object()); 2230 : UseRegisterAtStart(instr->object());
2231 } 2231 }
2232 2232
2233 LOperand* val = needs_write_barrier 2233 LOperand* val = NULL;
2234 ? UseTempRegister(instr->value()) 2234 if (needs_write_barrier) {
2235 : UseRegister(instr->value()); 2235 val = UseTempRegister(instr->value());
2236 } else if (instr->value()->IsConstant()) {
2237 // If it's tagged, it might still be in new space
2238 HConstant* constant_value = HConstant::cast(instr->value());
2239 if (constant_value->HasInteger32Value() ||
2240 constant_value->HasDoubleValue() ||
2241 constant_value->ImmortalImmovable()) {
2242 val = UseRegisterOrConstant(instr->value());
2243 }
2244 }
2245
2246 if (val == NULL) {
2247 val = UseRegister(instr->value());
2248 }
2236 2249
2237 // We only need a scratch register if we have a write barrier or we 2250 // We only need a scratch register if we have a write barrier or we
2238 // have a store into the properties array (not in-object-property). 2251 // have a store into the properties array (not in-object-property).
2239 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || 2252 LOperand* temp = (!instr->is_in_object() || needs_write_barrier ||
2240 needs_write_barrier_for_map) ? TempRegister() : NULL; 2253 needs_write_barrier_for_map) ? TempRegister() : NULL;
2241 2254
2242 return new(zone()) LStoreNamedField(obj, val, temp); 2255 return new(zone()) LStoreNamedField(obj, val, temp);
2243 } 2256 }
2244 2257
2245 2258
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2368 // There are no real uses of the arguments object. 2381 // There are no real uses of the arguments object.
2369 // arguments.length and element access are supported directly on 2382 // arguments.length and element access are supported directly on
2370 // stack arguments, and any real arguments object use causes a bailout. 2383 // stack arguments, and any real arguments object use causes a bailout.
2371 // So this value is never used. 2384 // So this value is never used.
2372 return NULL; 2385 return NULL;
2373 } 2386 }
2374 2387
2375 2388
2376 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { 2389 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2377 LOperand* args = UseRegister(instr->arguments()); 2390 LOperand* args = UseRegister(instr->arguments());
2378 LOperand* length = UseTempRegister(instr->length()); 2391 LOperand* length;
2379 LOperand* index = Use(instr->index()); 2392 LOperand* index;
2393 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2394 length = UseRegisterOrConstant(instr->length());
2395 index = UseOrConstant(instr->index());
2396 } else {
2397 length = UseTempRegister(instr->length());
2398 index = Use(instr->index());
2399 }
2380 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); 2400 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index));
2381 } 2401 }
2382 2402
2383 2403
2384 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { 2404 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2385 LOperand* object = UseFixed(instr->value(), rax); 2405 LOperand* object = UseFixed(instr->value(), rax);
2386 LToFastProperties* result = new(zone()) LToFastProperties(object); 2406 LToFastProperties* result = new(zone()) LToFastProperties(object);
2387 return MarkAsCall(DefineFixed(result, rax), instr); 2407 return MarkAsCall(DefineFixed(result, rax), instr);
2388 } 2408 }
2389 2409
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2540 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2521 LOperand* object = UseRegister(instr->object()); 2541 LOperand* object = UseRegister(instr->object());
2522 LOperand* index = UseTempRegister(instr->index()); 2542 LOperand* index = UseTempRegister(instr->index());
2523 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2543 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2524 } 2544 }
2525 2545
2526 2546
2527 } } // namespace v8::internal 2547 } } // namespace v8::internal
2528 2548
2529 #endif // V8_TARGET_ARCH_X64 2549 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/lithium-ia32.cc ('K') | « src/x64/lithium-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698