OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 5278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5289 Result y = frame_->Pop(); | 5289 Result y = frame_->Pop(); |
5290 Result x= frame_->Pop(); | 5290 Result x= frame_->Pop(); |
5291 if (p.is_valid() && p.reg().is(eax)) { | 5291 if (p.is_valid() && p.reg().is(eax)) { |
5292 x.ToRegister(); | 5292 x.ToRegister(); |
5293 y.ToRegister(); | 5293 y.ToRegister(); |
5294 frame_->Spill(x.reg()); | 5294 frame_->Spill(x.reg()); |
5295 frame_->Spill(y.reg()); | 5295 frame_->Spill(y.reg()); |
5296 ASSERT(x.is_valid()); | 5296 ASSERT(x.is_valid()); |
5297 ASSERT(y.is_valid()); | 5297 ASSERT(y.is_valid()); |
5298 | 5298 |
| 5299 // Save 1 in xmm3 - we need this several times later on |
| 5300 __ mov(p.reg(), Immediate(1)); |
| 5301 __ cvtsi2sd(xmm3, Operand(p.reg())); |
| 5302 |
5299 Label y_nonsmi; | 5303 Label y_nonsmi; |
5300 Label x_is_double; | 5304 Label x_is_double; |
5301 // If y is a heap number go to that specific case. | 5305 // If y is a heap number go to that specific case. |
5302 __ test(y.reg(), Immediate(kSmiTagMask)); | 5306 __ test(y.reg(), Immediate(kSmiTagMask)); |
5303 __ j(not_zero, &y_nonsmi); | 5307 __ j(not_zero, &y_nonsmi); |
5304 __ test(x.reg(), Immediate(kSmiTagMask)); | 5308 __ test(x.reg(), Immediate(kSmiTagMask)); |
5305 __ j(not_zero, &x_is_double); | 5309 __ j(not_zero, &x_is_double); |
5306 | 5310 |
5307 // Bot numbers are smis. | 5311 // Bot numbers are smis. |
5308 Label powi; | 5312 Label powi; |
5309 __ SmiUntag(x.reg()); | 5313 __ SmiUntag(x.reg()); |
5310 __ cvtsi2sd(xmm0, Operand(x.reg())); | 5314 __ cvtsi2sd(xmm0, Operand(x.reg())); |
5311 __ jmp(&powi); | 5315 __ jmp(&powi); |
5312 // Y is smi and x is a double. | 5316 // Y is smi and x is a double. |
5313 __ bind(&x_is_double); | 5317 __ bind(&x_is_double); |
5314 __ cmp(FieldOperand(x.reg(), HeapObject::kMapOffset), | 5318 __ cmp(FieldOperand(x.reg(), HeapObject::kMapOffset), |
5315 Factory::heap_number_map()); | 5319 Factory::heap_number_map()); |
5316 __ j(not_equal, &go_runtime); | 5320 __ j(not_equal, &go_runtime); |
5317 __ movdbl(xmm0, FieldOperand(x.reg(), HeapNumber::kValueOffset)); | 5321 __ movdbl(xmm0, FieldOperand(x.reg(), HeapNumber::kValueOffset)); |
5318 | 5322 |
5319 __ bind(&powi); | 5323 __ bind(&powi); |
5320 __ SmiUntag(y.reg()); | 5324 __ SmiUntag(y.reg()); |
5321 | 5325 |
5322 // Save y in x as we need to check if y is negative later. | 5326 // Save y in x as we need to check if y is negative later. |
5323 __ mov(x.reg(), y.reg()); | 5327 __ mov(x.reg(), y.reg()); |
5324 // Save 1 in xmm3 - we need this several times later on | 5328 |
5325 __ mov(p.reg(), Immediate(1)); | |
5326 __ cvtsi2sd(xmm3, Operand(p.reg())); | |
5327 | 5329 |
5328 // Get absolute value of y. | 5330 // Get absolute value of y. |
5329 Label no_neg; | 5331 Label no_neg; |
5330 __ cmp(y.reg(), 0); | 5332 __ cmp(y.reg(), 0); |
5331 __ j(greater_equal, &no_neg); | 5333 __ j(greater_equal, &no_neg); |
5332 __ neg(y.reg()); | 5334 __ neg(y.reg()); |
5333 __ bind(&no_neg); | 5335 __ bind(&no_neg); |
5334 | 5336 |
5335 // Optimized version of pow if y is an integer. | 5337 // Optimized version of pow if y is an integer. |
5336 // Load xmm1 with 1. | 5338 // Load xmm1 with 1. |
(...skipping 5893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11230 | 11232 |
11231 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 11233 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
11232 // tagged as a small integer. | 11234 // tagged as a small integer. |
11233 __ bind(&runtime); | 11235 __ bind(&runtime); |
11234 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 11236 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
11235 } | 11237 } |
11236 | 11238 |
11237 #undef __ | 11239 #undef __ |
11238 | 11240 |
11239 } } // namespace v8::internal | 11241 } } // namespace v8::internal |
OLD | NEW |