| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 | 2370 |
| 2371 return new(zone()) LTypeofIsAndBranch( | 2371 return new(zone()) LTypeofIsAndBranch( |
| 2372 UseRegister(instr->value()), temp1, temp2); | 2372 UseRegister(instr->value()), temp1, temp2); |
| 2373 } | 2373 } |
| 2374 | 2374 |
| 2375 | 2375 |
| 2376 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { | 2376 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { |
| 2377 switch (instr->op()) { | 2377 switch (instr->op()) { |
| 2378 case kMathAbs: { | 2378 case kMathAbs: { |
| 2379 Representation r = instr->representation(); | 2379 Representation r = instr->representation(); |
| 2380 // TODO(jbramley): Support smis in LMathAbs and use that. | 2380 if (r.IsTagged()) { |
| 2381 if (r.IsTagged() || r.IsSmi()) { | |
| 2382 // The tagged case might need to allocate a HeapNumber for the result, | 2381 // The tagged case might need to allocate a HeapNumber for the result, |
| 2383 // so it is handled by a separate LInstruction. | 2382 // so it is handled by a separate LInstruction. |
| 2384 LOperand* input = UseRegister(instr->value()); | 2383 LOperand* input = UseRegister(instr->value()); |
| 2385 LOperand* temp1 = TempRegister(); | 2384 LOperand* temp1 = TempRegister(); |
| 2386 LOperand* temp2 = TempRegister(); | 2385 LOperand* temp2 = TempRegister(); |
| 2387 LOperand* temp3 = TempRegister(); | 2386 LOperand* temp3 = TempRegister(); |
| 2388 LMathAbsTagged* result = | 2387 LMathAbsTagged* result = |
| 2389 new(zone()) LMathAbsTagged(input, temp1, temp2, temp3); | 2388 new(zone()) LMathAbsTagged(input, temp1, temp2, temp3); |
| 2390 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 2389 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 2391 } else { | 2390 } else { |
| 2392 LOperand* input = UseRegisterAtStart(instr->value()); | 2391 LOperand* input = UseRegisterAtStart(instr->value()); |
| 2393 LMathAbs* result = new(zone()) LMathAbs(input); | 2392 LMathAbs* result = new(zone()) LMathAbs(input); |
| 2394 if (r.IsDouble()) { | 2393 if (r.IsDouble()) { |
| 2395 // The Double case can never fail so it doesn't need an environment. | 2394 // The Double case can never fail so it doesn't need an environment. |
| 2396 return DefineAsRegister(result); | 2395 return DefineAsRegister(result); |
| 2397 } else { | 2396 } else { |
| 2398 ASSERT(r.IsInteger32()); | 2397 ASSERT(r.IsInteger32() || r.IsSmi()); |
| 2399 // The Integer32 case needs an environment because it can deoptimize | 2398 // The Integer32 and Smi cases need an environment because they can |
| 2400 // on INT_MIN. | 2399 // deoptimize on minimum representable number. |
| 2401 return AssignEnvironment(DefineAsRegister(result)); | 2400 return AssignEnvironment(DefineAsRegister(result)); |
| 2402 } | 2401 } |
| 2403 } | 2402 } |
| 2404 } | 2403 } |
| 2405 case kMathCos: { | 2404 case kMathCos: { |
| 2406 ASSERT(instr->representation().IsDouble()); | 2405 ASSERT(instr->representation().IsDouble()); |
| 2407 ASSERT(instr->value()->representation().IsDouble()); | 2406 ASSERT(instr->value()->representation().IsDouble()); |
| 2408 LOperand* input = UseFixedDouble(instr->value(), d0); | 2407 LOperand* input = UseFixedDouble(instr->value(), d0); |
| 2409 LMathCos* result = new(zone()) LMathCos(input); | 2408 LMathCos* result = new(zone()) LMathCos(input); |
| 2410 return MarkAsCall(DefineFixedDouble(result, d0), instr); | 2409 return MarkAsCall(DefineFixedDouble(result, d0), instr); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2545 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2544 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2546 LOperand* receiver = UseRegister(instr->receiver()); | 2545 LOperand* receiver = UseRegister(instr->receiver()); |
| 2547 LOperand* function = UseRegisterAtStart(instr->function()); | 2546 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2548 LOperand* temp = TempRegister(); | 2547 LOperand* temp = TempRegister(); |
| 2549 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2548 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2550 return AssignEnvironment(DefineAsRegister(result)); | 2549 return AssignEnvironment(DefineAsRegister(result)); |
| 2551 } | 2550 } |
| 2552 | 2551 |
| 2553 | 2552 |
| 2554 } } // namespace v8::internal | 2553 } } // namespace v8::internal |
| OLD | NEW |