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

Side by Side Diff: src/ia32/lithium-ia32.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: Review updates 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
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.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 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2288 2288
2289 if (instr->value()->representation().IsDouble()) { 2289 if (instr->value()->representation().IsDouble()) {
2290 LOperand* object = UseRegisterAtStart(instr->elements()); 2290 LOperand* object = UseRegisterAtStart(instr->elements());
2291 LOperand* val = NULL; 2291 LOperand* val = NULL;
2292 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { 2292 if (CpuFeatures::IsSafeForSnapshot(SSE2)) {
2293 val = UseRegisterAtStart(instr->value()); 2293 val = UseRegisterAtStart(instr->value());
2294 } else if (!instr->IsConstantHoleStore()) { 2294 } else if (!instr->IsConstantHoleStore()) {
2295 val = UseX87TopOfStack(instr->value()); 2295 val = UseX87TopOfStack(instr->value());
2296 } 2296 }
2297 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2297 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2298
2299 return new(zone()) LStoreKeyed(object, key, val); 2298 return new(zone()) LStoreKeyed(object, key, val);
2300 } else { 2299 } else {
2301 ASSERT(instr->value()->representation().IsTagged()); 2300 ASSERT(instr->value()->representation().IsTagged());
2302 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2301 bool needs_write_barrier = instr->NeedsWriteBarrier();
2303 2302
2304 LOperand* obj = UseRegister(instr->elements()); 2303 LOperand* obj = UseRegister(instr->elements());
2305 LOperand* val = needs_write_barrier 2304 LOperand* val;
2306 ? UseTempRegister(instr->value()) 2305 LOperand* key;
2307 : UseRegisterAtStart(instr->value()); 2306 if (needs_write_barrier) {
2308 LOperand* key = needs_write_barrier 2307 val = UseTempRegister(instr->value());
2309 ? UseTempRegister(instr->key()) 2308 key = UseTempRegister(instr->key());
2310 : UseRegisterOrConstantAtStart(instr->key()); 2309 } else {
2310 val = UseRegisterOrConstantAtStart(instr->value());
2311 key = UseRegisterOrConstantAtStart(instr->key());
2312 }
2311 return new(zone()) LStoreKeyed(obj, key, val); 2313 return new(zone()) LStoreKeyed(obj, key, val);
2312 } 2314 }
2313 } 2315 }
2314 2316
2315 ElementsKind elements_kind = instr->elements_kind(); 2317 ElementsKind elements_kind = instr->elements_kind();
2316 ASSERT( 2318 ASSERT(
2317 (instr->value()->representation().IsInteger32() && 2319 (instr->value()->representation().IsInteger32() &&
2318 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2320 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
2319 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2321 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
2320 (instr->value()->representation().IsDouble() && 2322 (instr->value()->representation().IsDouble() &&
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2400 if (needs_write_barrier) { 2402 if (needs_write_barrier) {
2401 obj = instr->is_in_object() 2403 obj = instr->is_in_object()
2402 ? UseRegister(instr->object()) 2404 ? UseRegister(instr->object())
2403 : UseTempRegister(instr->object()); 2405 : UseTempRegister(instr->object());
2404 } else { 2406 } else {
2405 obj = needs_write_barrier_for_map 2407 obj = needs_write_barrier_for_map
2406 ? UseRegister(instr->object()) 2408 ? UseRegister(instr->object())
2407 : UseRegisterAtStart(instr->object()); 2409 : UseRegisterAtStart(instr->object());
2408 } 2410 }
2409 2411
2410 LOperand* val = needs_write_barrier 2412 bool register_or_constant = false;
2411 ? UseTempRegister(instr->value()) 2413 if (instr->value()->IsConstant()) {
2412 : UseRegister(instr->value()); 2414 HConstant* constant_value = HConstant::cast(instr->value());
2415 register_or_constant = constant_value->HasInteger32Value()
2416 || constant_value->HasDoubleValue()
2417 || constant_value->ImmortalImmovable();
2418 }
2419
2420 LOperand* val;
2421 if (needs_write_barrier) {
2422 val = UseTempRegister(instr->value());
2423 } else if (register_or_constant) {
2424 val = UseRegisterOrConstant(instr->value());
2425 } else {
2426 val = UseRegister(instr->value());
2427 }
2413 2428
2414 // We only need a scratch register if we have a write barrier or we 2429 // We only need a scratch register if we have a write barrier or we
2415 // have a store into the properties array (not in-object-property). 2430 // have a store into the properties array (not in-object-property).
2416 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || 2431 LOperand* temp = (!instr->is_in_object() || needs_write_barrier ||
2417 needs_write_barrier_for_map) ? TempRegister() : NULL; 2432 needs_write_barrier_for_map) ? TempRegister() : NULL;
2418 2433
2419 // We need a temporary register for write barrier of the map field. 2434 // We need a temporary register for write barrier of the map field.
2420 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL; 2435 LOperand* temp_map = needs_write_barrier_for_map ? TempRegister() : NULL;
2421 2436
2422 return new(zone()) LStoreNamedField(obj, val, temp, temp_map); 2437 return new(zone()) LStoreNamedField(obj, val, temp, temp_map);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 // There are no real uses of the arguments object. 2584 // There are no real uses of the arguments object.
2570 // arguments.length and element access are supported directly on 2585 // arguments.length and element access are supported directly on
2571 // stack arguments, and any real arguments object use causes a bailout. 2586 // stack arguments, and any real arguments object use causes a bailout.
2572 // So this value is never used. 2587 // So this value is never used.
2573 return NULL; 2588 return NULL;
2574 } 2589 }
2575 2590
2576 2591
2577 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { 2592 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) {
2578 LOperand* args = UseRegister(instr->arguments()); 2593 LOperand* args = UseRegister(instr->arguments());
2579 LOperand* length = UseTempRegister(instr->length()); 2594 LOperand* length;
2580 LOperand* index = Use(instr->index()); 2595 LOperand* index;
2596 if (instr->length()->IsConstant() && instr->index()->IsConstant()) {
2597 length = UseRegisterOrConstant(instr->length());
2598 index = UseOrConstant(instr->index());
2599 } else {
2600 length = UseTempRegister(instr->length());
2601 index = Use(instr->index());
2602 }
2581 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); 2603 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index));
2582 } 2604 }
2583 2605
2584 2606
2585 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { 2607 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) {
2586 LOperand* object = UseFixed(instr->value(), eax); 2608 LOperand* object = UseFixed(instr->value(), eax);
2587 LToFastProperties* result = new(zone()) LToFastProperties(object); 2609 LToFastProperties* result = new(zone()) LToFastProperties(object);
2588 return MarkAsCall(DefineFixed(result, eax), instr); 2610 return MarkAsCall(DefineFixed(result, eax), instr);
2589 } 2611 }
2590 2612
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2750 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2729 LOperand* object = UseRegister(instr->object()); 2751 LOperand* object = UseRegister(instr->object());
2730 LOperand* index = UseTempRegister(instr->index()); 2752 LOperand* index = UseTempRegister(instr->index());
2731 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2753 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2732 } 2754 }
2733 2755
2734 2756
2735 } } // namespace v8::internal 2757 } } // namespace v8::internal
2736 2758
2737 #endif // V8_TARGET_ARCH_IA32 2759 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698