| 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 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2335 | 2348 |
| 2336 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { | 2349 LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { |
| 2337 LParameter* result = new(zone()) LParameter; | 2350 LParameter* result = new(zone()) LParameter; |
| 2338 if (instr->kind() == HParameter::STACK_PARAMETER) { | 2351 if (instr->kind() == HParameter::STACK_PARAMETER) { |
| 2339 int spill_index = chunk()->GetParameterStackSlot(instr->index()); | 2352 int spill_index = chunk()->GetParameterStackSlot(instr->index()); |
| 2340 return DefineAsSpilled(result, spill_index); | 2353 return DefineAsSpilled(result, spill_index); |
| 2341 } else { | 2354 } else { |
| 2342 ASSERT(info()->IsStub()); | 2355 ASSERT(info()->IsStub()); |
| 2343 CodeStubInterfaceDescriptor* descriptor = | 2356 CodeStubInterfaceDescriptor* descriptor = |
| 2344 info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); | 2357 info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); |
| 2345 Register reg = descriptor->register_params_[instr->index()]; | 2358 Register reg; |
| 2359 if (static_cast<int>(instr->index()) == descriptor->register_param_count_) { |
| 2360 reg = *(descriptor->stack_parameter_count_); |
| 2361 } else { |
| 2362 reg = descriptor->register_params_[instr->index()]; |
| 2363 } |
| 2346 return DefineFixed(result, reg); | 2364 return DefineFixed(result, reg); |
| 2347 } | 2365 } |
| 2348 } | 2366 } |
| 2349 | 2367 |
| 2350 | 2368 |
| 2351 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { | 2369 LInstruction* LChunkBuilder::DoUnknownOSRValue(HUnknownOSRValue* instr) { |
| 2352 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. | 2370 int spill_index = chunk()->GetNextSpillIndex(false); // Not double-width. |
| 2353 if (spill_index > LUnallocated::kMaxFixedIndex) { | 2371 if (spill_index > LUnallocated::kMaxFixedIndex) { |
| 2354 Abort("Too many spill slots needed for OSR"); | 2372 Abort("Too many spill slots needed for OSR"); |
| 2355 spill_index = 0; | 2373 spill_index = 0; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2368 // There are no real uses of the arguments object. | 2386 // There are no real uses of the arguments object. |
| 2369 // arguments.length and element access are supported directly on | 2387 // arguments.length and element access are supported directly on |
| 2370 // stack arguments, and any real arguments object use causes a bailout. | 2388 // stack arguments, and any real arguments object use causes a bailout. |
| 2371 // So this value is never used. | 2389 // So this value is never used. |
| 2372 return NULL; | 2390 return NULL; |
| 2373 } | 2391 } |
| 2374 | 2392 |
| 2375 | 2393 |
| 2376 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { | 2394 LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { |
| 2377 LOperand* args = UseRegister(instr->arguments()); | 2395 LOperand* args = UseRegister(instr->arguments()); |
| 2378 LOperand* length = UseTempRegister(instr->length()); | 2396 LOperand* length; |
| 2379 LOperand* index = Use(instr->index()); | 2397 LOperand* index; |
| 2398 if (instr->length()->IsConstant() && instr->index()->IsConstant()) { |
| 2399 length = UseRegisterOrConstant(instr->length()); |
| 2400 index = UseOrConstant(instr->index()); |
| 2401 } else { |
| 2402 length = UseTempRegister(instr->length()); |
| 2403 index = Use(instr->index()); |
| 2404 } |
| 2380 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); | 2405 return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); |
| 2381 } | 2406 } |
| 2382 | 2407 |
| 2383 | 2408 |
| 2384 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { | 2409 LInstruction* LChunkBuilder::DoToFastProperties(HToFastProperties* instr) { |
| 2385 LOperand* object = UseFixed(instr->value(), rax); | 2410 LOperand* object = UseFixed(instr->value(), rax); |
| 2386 LToFastProperties* result = new(zone()) LToFastProperties(object); | 2411 LToFastProperties* result = new(zone()) LToFastProperties(object); |
| 2387 return MarkAsCall(DefineFixed(result, rax), instr); | 2412 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2388 } | 2413 } |
| 2389 | 2414 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2520 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2545 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2521 LOperand* object = UseRegister(instr->object()); | 2546 LOperand* object = UseRegister(instr->object()); |
| 2522 LOperand* index = UseTempRegister(instr->index()); | 2547 LOperand* index = UseTempRegister(instr->index()); |
| 2523 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2548 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2524 } | 2549 } |
| 2525 | 2550 |
| 2526 | 2551 |
| 2527 } } // namespace v8::internal | 2552 } } // namespace v8::internal |
| 2528 | 2553 |
| 2529 #endif // V8_TARGET_ARCH_X64 | 2554 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |