Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 void MacroAssembler::CheckFastSmiOnlyElements(Register map, | 399 void MacroAssembler::CheckFastSmiOnlyElements(Register map, |
| 400 Label* fail, | 400 Label* fail, |
| 401 Label::Distance distance) { | 401 Label::Distance distance) { |
| 402 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 402 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
| 403 cmpb(FieldOperand(map, Map::kBitField2Offset), | 403 cmpb(FieldOperand(map, Map::kBitField2Offset), |
| 404 Map::kMaximumBitField2FastSmiOnlyElementValue); | 404 Map::kMaximumBitField2FastSmiOnlyElementValue); |
| 405 j(above, fail, distance); | 405 j(above, fail, distance); |
| 406 } | 406 } |
| 407 | 407 |
| 408 | 408 |
| 409 void MacroAssembler::StoreNumberToDoubleElements( | |
| 410 Register maybe_number, | |
| 411 Register elements, | |
| 412 Register key, | |
| 413 Register scratch1, | |
| 414 XMMRegister scratch2, | |
| 415 Label* fail, | |
| 416 bool specialize_for_processor) { | |
| 417 Label smi_value, done, maybe_nan, not_nan, is_nan, have_double_value; | |
| 418 JumpIfSmi(maybe_number, &smi_value, Label::kNear); | |
| 419 | |
| 420 CheckMap(maybe_number, | |
| 421 isolate()->factory()->heap_number_map(), | |
| 422 fail, | |
| 423 DONT_DO_SMI_CHECK); | |
| 424 | |
| 425 // Double value, canonicalize NaN. | |
| 426 uint32_t offset = HeapNumber::kValueOffset + sizeof(kHoleNanLower32); | |
| 427 cmp(FieldOperand(maybe_number, offset), | |
| 428 Immediate(kNaNOrInfinityLowerBoundUpper32)); | |
| 429 j(greater_equal, &maybe_nan, Label::kNear); | |
| 430 | |
| 431 bind(¬_nan); | |
| 432 ExternalReference canonical_nan_reference = | |
| 433 ExternalReference::address_of_canonical_non_hole_nan(); | |
| 434 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | |
| 435 CpuFeatures::Scope use_sse2(SSE2); | |
| 436 movdbl(scratch2, FieldOperand(maybe_number, HeapNumber::kValueOffset)); | |
| 437 bind(&have_double_value); | |
| 438 movdbl(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize), | |
| 439 scratch2); | |
|
Rico
2011/09/27 12:57:53
indention
danno
2011/09/27 16:14:57
Done.
| |
| 440 } else { | |
| 441 fld_d(FieldOperand(maybe_number, HeapNumber::kValueOffset)); | |
| 442 bind(&have_double_value); | |
| 443 fstp_d(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize)); | |
| 444 } | |
| 445 jmp(&done); | |
| 446 | |
| 447 bind(&maybe_nan); | |
| 448 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise | |
| 449 // it's an Infinity, and the non-NaN code path applies. | |
| 450 j(greater, &is_nan, Label::kNear); | |
| 451 cmp(FieldOperand(maybe_number, HeapNumber::kValueOffset), Immediate(0)); | |
| 452 j(zero, ¬_nan); | |
| 453 bind(&is_nan); | |
| 454 if (CpuFeatures::IsSupported(SSE2) && specialize_for_processor) { | |
| 455 CpuFeatures::Scope use_sse2(SSE2); | |
| 456 movdbl(scratch2, Operand::StaticVariable(canonical_nan_reference)); | |
| 457 } else { | |
| 458 fld_d(Operand::StaticVariable(canonical_nan_reference)); | |
| 459 } | |
| 460 jmp(&have_double_value, Label::kNear); | |
| 461 | |
| 462 bind(&smi_value); | |
| 463 // Value is a smi. convert to a double and store. | |
|
Rico
2011/09/27 12:57:53
Capital c after period
danno
2011/09/27 16:14:57
Done.
| |
| 464 // Preserve original value. | |
| 465 mov(scratch1, maybe_number); | |
| 466 SmiUntag(scratch1); | |
| 467 push(scratch1); | |
| 468 fild_s(Operand(esp, 0)); | |
|
Rico
2011/09/27 12:57:53
Why not also use SSE2 instructions here if availab
danno
2011/09/27 16:14:57
Done.
| |
| 469 pop(scratch1); | |
| 470 fstp_d(FieldOperand(elements, key, times_4, FixedDoubleArray::kHeaderSize)); | |
| 471 bind(&done); | |
| 472 } | |
| 473 | |
| 474 | |
| 409 void MacroAssembler::CheckMap(Register obj, | 475 void MacroAssembler::CheckMap(Register obj, |
| 410 Handle<Map> map, | 476 Handle<Map> map, |
| 411 Label* fail, | 477 Label* fail, |
| 412 SmiCheckType smi_check_type) { | 478 SmiCheckType smi_check_type) { |
| 413 if (smi_check_type == DO_SMI_CHECK) { | 479 if (smi_check_type == DO_SMI_CHECK) { |
| 414 JumpIfSmi(obj, fail); | 480 JumpIfSmi(obj, fail); |
| 415 } | 481 } |
| 416 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); | 482 cmp(FieldOperand(obj, HeapObject::kMapOffset), Immediate(map)); |
| 417 j(not_equal, fail); | 483 j(not_equal, fail); |
| 418 } | 484 } |
| (...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2640 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); | 2706 cmp(length, Operand(bitmap_scratch, MemoryChunk::kSizeOffset)); |
| 2641 Check(less_equal, "Live Bytes Count overflow chunk size"); | 2707 Check(less_equal, "Live Bytes Count overflow chunk size"); |
| 2642 } | 2708 } |
| 2643 | 2709 |
| 2644 bind(&done); | 2710 bind(&done); |
| 2645 } | 2711 } |
| 2646 | 2712 |
| 2647 } } // namespace v8::internal | 2713 } } // namespace v8::internal |
| 2648 | 2714 |
| 2649 #endif // V8_TARGET_ARCH_IA32 | 2715 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |