OLD | NEW |
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 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 | 2130 |
2131 if (instr->value()->representation().IsDouble()) { | 2131 if (instr->value()->representation().IsDouble()) { |
2132 object = UseRegisterAtStart(instr->elements()); | 2132 object = UseRegisterAtStart(instr->elements()); |
2133 val = UseTempRegister(instr->value()); | 2133 val = UseTempRegister(instr->value()); |
2134 key = clobbers_key ? UseTempRegister(instr->key()) | 2134 key = clobbers_key ? UseTempRegister(instr->key()) |
2135 : UseRegisterOrConstantAtStart(instr->key()); | 2135 : UseRegisterOrConstantAtStart(instr->key()); |
2136 } else { | 2136 } else { |
2137 ASSERT(instr->value()->representation().IsTagged()); | 2137 ASSERT(instr->value()->representation().IsTagged()); |
2138 object = UseTempRegister(instr->elements()); | 2138 object = UseTempRegister(instr->elements()); |
2139 val = needs_write_barrier ? UseTempRegister(instr->value()) | 2139 val = needs_write_barrier ? UseTempRegister(instr->value()) |
2140 : UseRegisterAtStart(instr->value()); | 2140 : UseRegisterOrConstantAtStart(instr->value()); |
2141 key = (clobbers_key || needs_write_barrier) | 2141 key = (clobbers_key || needs_write_barrier) |
2142 ? UseTempRegister(instr->key()) | 2142 ? UseTempRegister(instr->key()) |
2143 : UseRegisterOrConstantAtStart(instr->key()); | 2143 : UseRegisterOrConstantAtStart(instr->key()); |
2144 } | 2144 } |
2145 | 2145 |
2146 return new(zone()) LStoreKeyed(object, key, val); | 2146 return new(zone()) LStoreKeyed(object, key, val); |
2147 } | 2147 } |
2148 | 2148 |
2149 ASSERT( | 2149 ASSERT( |
2150 (instr->value()->representation().IsInteger32() && | 2150 (instr->value()->representation().IsInteger32() && |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2227 if (needs_write_barrier) { | 2227 if (needs_write_barrier) { |
2228 obj = instr->is_in_object() | 2228 obj = instr->is_in_object() |
2229 ? UseRegister(instr->object()) | 2229 ? UseRegister(instr->object()) |
2230 : UseTempRegister(instr->object()); | 2230 : UseTempRegister(instr->object()); |
2231 } else { | 2231 } else { |
2232 obj = needs_write_barrier_for_map | 2232 obj = needs_write_barrier_for_map |
2233 ? UseRegister(instr->object()) | 2233 ? UseRegister(instr->object()) |
2234 : UseRegisterAtStart(instr->object()); | 2234 : UseRegisterAtStart(instr->object()); |
2235 } | 2235 } |
2236 | 2236 |
2237 LOperand* val = needs_write_barrier | 2237 bool register_or_constant = false; |
2238 ? UseTempRegister(instr->value()) | 2238 if (instr->value()->IsConstant()) { |
2239 : UseRegister(instr->value()); | 2239 HConstant* constant_value = HConstant::cast(instr->value()); |
| 2240 register_or_constant = constant_value->HasInteger32Value() |
| 2241 || constant_value->HasDoubleValue() |
| 2242 || constant_value->ImmortalImmovable(); |
| 2243 } |
| 2244 |
| 2245 LOperand* val; |
| 2246 if (needs_write_barrier) { |
| 2247 val = UseTempRegister(instr->value()); |
| 2248 } else if (register_or_constant) { |
| 2249 val = UseRegisterOrConstant(instr->value()); |
| 2250 } else { |
| 2251 val = UseRegister(instr->value()); |
| 2252 } |
2240 | 2253 |
2241 // We only need a scratch register if we have a write barrier or we | 2254 // We only need a scratch register if we have a write barrier or we |
2242 // have a store into the properties array (not in-object-property). | 2255 // have a store into the properties array (not in-object-property). |
2243 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || | 2256 LOperand* temp = (!instr->is_in_object() || needs_write_barrier || |
2244 needs_write_barrier_for_map) ? TempRegister() : NULL; | 2257 needs_write_barrier_for_map) ? TempRegister() : NULL; |
2245 | 2258 |
2246 return new(zone()) LStoreNamedField(obj, val, temp); | 2259 return new(zone()) LStoreNamedField(obj, val, temp); |
2247 } | 2260 } |
2248 | 2261 |
2249 | 2262 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2372 // There are no real uses of the arguments object. | 2385 // There are no real uses of the arguments object. |
2373 // arguments.length and element access are supported directly on | 2386 // arguments.length and element access are supported directly on |
2374 // stack arguments, and any real arguments object use causes a bailout. | 2387 // stack arguments, and any real arguments object use causes a bailout. |
2375 // So this value is never used. | 2388 // So this value is never used. |
2376 return NULL; | 2389 return NULL; |
2377 } | 2390 } |
2378 | 2391 |
2379 | 2392 |
2380 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2393 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
2381 LOperand* args = UseRegister(instr->arguments()); | 2394 LOperand* args = UseRegister(instr->arguments()); |
2382 LOperand* length = UseTempRegister(instr->length()); | 2395 LOperand* length; |
2383 LOperand* index = Use(instr->index()); | 2396 LOperand* index; |
| 2397 if (instr->length()->IsConstant() && instr->index()->IsConstant()) { |
| 2398 length = UseRegisterOrConstant(instr->length()); |
| 2399 index = UseOrConstant(instr->index()); |
| 2400 } else { |
| 2401 length = UseTempRegister(instr->length()); |
| 2402 index = Use(instr->index()); |
| 2403 } |
2384 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); | 2404 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
2385 } | 2405 } |
2386 | 2406 |
2387 | 2407 |
2388 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2408 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
2389 LOperand* object = UseFixed(instr->value(), rax); | 2409 LOperand* object = UseFixed(instr->value(), rax); |
2390 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2410 LToFastProperties* result = new(zone()) LToFastProperties(object); |
2391 return MarkAsCall(DefineFixed(result, rax), instr); | 2411 return MarkAsCall(DefineFixed(result, rax), instr); |
2392 } | 2412 } |
2393 | 2413 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2544 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2525 LOperand* object = UseRegister(instr->object()); | 2545 LOperand* object = UseRegister(instr->object()); |
2526 LOperand* index = UseTempRegister(instr->index()); | 2546 LOperand* index = UseTempRegister(instr->index()); |
2527 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2547 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2528 } | 2548 } |
2529 | 2549 |
2530 | 2550 |
2531 } } // namespace v8::internal | 2551 } } // namespace v8::internal |
2532 | 2552 |
2533 #endif // V8_TARGET_ARCH_X64 | 2553 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |