| 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 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 500 } |
| 501 | 501 |
| 502 | 502 |
| 503 void MacroAssembler::StoreNumberToDoubleElements( | 503 void MacroAssembler::StoreNumberToDoubleElements( |
| 504 Register maybe_number, | 504 Register maybe_number, |
| 505 Register elements, | 505 Register elements, |
| 506 Register key, | 506 Register key, |
| 507 Register scratch1, | 507 Register scratch1, |
| 508 XMMRegister scratch2, | 508 XMMRegister scratch2, |
| 509 Label* fail, | 509 Label* fail, |
| 510 bool specialize_for_processor) { | 510 bool specialize_for_processor, |
| 511 int elements_offset) { |
| 511 Label smi_value, done, maybe_nan, not_nan, is_nan, have_double_value; | 512 Label smi_value, done, maybe_nan, not_nan, is_nan, have_double_value; |
| 512 JumpIfSmi(maybe_number, &smi_value, Label::kNear); | 513 JumpIfSmi(maybe_number, &smi_value, Label::kNear); |
| 513 | 514 |
| 514 CheckMap(maybe_number, | 515 CheckMap(maybe_number, |
| 515 isolate()->factory()->heap_number_map(), | 516 isolate()->factory()->heap_number_map(), |
| 516 fail, | 517 fail, |
| 517 DONT_DO_SMI_CHECK); | 518 DONT_DO_SMI_CHECK); |
| 518 | 519 |
| 519 // Double value, canonicalize NaN. | 520 // Double value, canonicalize NaN. |
| 520 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | 521 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); |
| 521 cmp(FieldOperand(maybe_number, offset), | 522 cmp(FieldOperand(maybe_number, offset), |
| 522 Immediate(kNaNOrInfinityLowerBoundUpper32)); | 523 Immediate(kNaNOrInfinityLowerBoundUpper32)); |
| 523 j(greater_equal, &maybe_nan, Label::kNear); | 524 j(greater_equal, &maybe_nan, Label::kNear); |
| 524 | 525 |
| 525 bind(¬_nan); | 526 bind(¬_nan); |
| 526 ExternalReference canonical_nan_reference = | 527 ExternalReference canonical_nan_reference = |
| 527 ExternalReference::address_of_canonical_non_hole_nan(); | 528 ExternalReference::address_of_canonical_non_hole_nan(); |
| 528 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | 529 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { |
| 529 CpuFeatures::Scope use_sse2(SSE2); | 530 CpuFeatures::Scope use_sse2(SSE2); |
| 530 movdbl(scratch2, FieldOperand(maybe_number, HeapNumber::kValueOffset)); | 531 movdbl(scratch2, FieldOperand(maybe_number, HeapNumber::kValueOffset)); |
| 531 bind(&have_double_value); | 532 bind(&have_double_value); |
| 532 movdbl(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize), | 533 movdbl(FieldOperand(elements, key, times_4, |
| 534 FixedDoubleArray::kHeaderSize - elements_offset), |
| 533 scratch2); | 535 scratch2); |
| 534 } else { | 536 } else { |
| 535 fld_d(FieldOperand(maybe_number, HeapNumber::kValueOffset)); | 537 fld_d(FieldOperand(maybe_number, HeapNumber::kValueOffset)); |
| 536 bind(&have_double_value); | 538 bind(&have_double_value); |
| 537 fstp_d(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize)); | 539 fstp_d(FieldOperand(elements, key, times_4, |
| 540 FixedDoubleArray::kHeaderSize - elements_offset)); |
| 538 } | 541 } |
| 539 jmp(&done); | 542 jmp(&done); |
| 540 | 543 |
| 541 bind(&maybe_nan); | 544 bind(&maybe_nan); |
| 542 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise | 545 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise |
| 543 // it's an Infinity, and the non-NaN code path applies. | 546 // it's an Infinity, and the non-NaN code path applies. |
| 544 j(greater, &is_nan, Label::kNear); | 547 j(greater, &is_nan, Label::kNear); |
| 545 cmp(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); | 548 cmp(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); |
| 546 j(zero, ¬_nan); | 549 j(zero, ¬_nan); |
| 547 bind(&is_nan); | 550 bind(&is_nan); |
| 548 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | 551 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { |
| 549 CpuFeatures::Scope use_sse2(SSE2); | 552 CpuFeatures::Scope use_sse2(SSE2); |
| 550 movdbl(scratch2, Operand::StaticVariable(canonical_nan_reference)); | 553 movdbl(scratch2, Operand::StaticVariable(canonical_nan_reference)); |
| 551 } else { | 554 } else { |
| 552 fld_d(Operand::StaticVariable(canonical_nan_reference)); | 555 fld_d(Operand::StaticVariable(canonical_nan_reference)); |
| 553 } | 556 } |
| 554 jmp(&have_double_value, Label::kNear); | 557 jmp(&have_double_value, Label::kNear); |
| 555 | 558 |
| 556 bind(&smi_value); | 559 bind(&smi_value); |
| 557 // Value is a smi. Convert to a double and store. | 560 // Value is a smi. Convert to a double and store. |
| 558 // Preserve original value. | 561 // Preserve original value. |
| 559 mov(scratch1, maybe_number); | 562 mov(scratch1, maybe_number); |
| 560 SmiUntag(scratch1); | 563 SmiUntag(scratch1); |
| 561 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | 564 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { |
| 562 CpuFeatures::Scope fscope(SSE2); | 565 CpuFeatures::Scope fscope(SSE2); |
| 563 cvtsi2sd(scratch2, scratch1); | 566 cvtsi2sd(scratch2, scratch1); |
| 564 movdbl(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize), | 567 movdbl(FieldOperand(elements, key, times_4, |
| 568 FixedDoubleArray::kHeaderSize - elements_offset), |
| 565 scratch2); | 569 scratch2); |
| 566 } else { | 570 } else { |
| 567 push(scratch1); | 571 push(scratch1); |
| 568 fild_s(Operand(esp, 0)); | 572 fild_s(Operand(esp, 0)); |
| 569 pop(scratch1); | 573 pop(scratch1); |
| 570 fstp_d(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize)); | 574 fstp_d(FieldOperand(elements, key, times_4, |
| 575 FixedDoubleArray::kHeaderSize - elements_offset)); |
| 571 } | 576 } |
| 572 bind(&done); | 577 bind(&done); |
| 573 } | 578 } |
| 574 | 579 |
| 575 | 580 |
| 576 void MacroAssembler::CompareMap(Register obj, | 581 void MacroAssembler::CompareMap(Register obj, |
| 577 Handle<Map> map, | 582 Handle<Map> map, |
| 578 Label* early_success, | 583 Label* early_success, |
| 579 CompareMapMode mode) { | 584 CompareMapMode mode) { |
| 580 cmp(FieldOperand(obj, HeapObject::kMapOffset), map); | 585 cmp(FieldOperand(obj, HeapObject::kMapOffset), map); |
| (...skipping 2396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2977 j(not_equal, call_runtime); | 2982 j(not_equal, call_runtime); |
| 2978 | 2983 |
| 2979 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); | 2984 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); |
| 2980 cmp(ecx, isolate()->factory()->null_value()); | 2985 cmp(ecx, isolate()->factory()->null_value()); |
| 2981 j(not_equal, &next); | 2986 j(not_equal, &next); |
| 2982 } | 2987 } |
| 2983 | 2988 |
| 2984 } } // namespace v8::internal | 2989 } } // namespace v8::internal |
| 2985 | 2990 |
| 2986 #endif // V8_TARGET_ARCH_IA32 | 2991 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |