OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 FixedArray::kHeaderSize - kHeapObjectTag)); | 420 FixedArray::kHeaderSize - kHeapObjectTag)); |
421 | 421 |
422 RecordWrite(object, dst, value, save_fp, remembered_set_action, | 422 RecordWrite(object, dst, value, save_fp, remembered_set_action, |
423 OMIT_SMI_CHECK, pointers_to_here_check_for_value); | 423 OMIT_SMI_CHECK, pointers_to_here_check_for_value); |
424 | 424 |
425 bind(&done); | 425 bind(&done); |
426 | 426 |
427 // Clobber clobbered input registers when running with the debug-code flag | 427 // Clobber clobbered input registers when running with the debug-code flag |
428 // turned on to provoke errors. | 428 // turned on to provoke errors. |
429 if (emit_debug_code()) { | 429 if (emit_debug_code()) { |
430 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 430 mov(value, Immediate(bit_cast<int32_t>(kZapValue))); |
431 mov(index, Immediate(BitCast<int32_t>(kZapValue))); | 431 mov(index, Immediate(bit_cast<int32_t>(kZapValue))); |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 | 435 |
436 void MacroAssembler::RecordWriteField( | 436 void MacroAssembler::RecordWriteField( |
437 Register object, | 437 Register object, |
438 int offset, | 438 int offset, |
439 Register value, | 439 Register value, |
440 Register dst, | 440 Register dst, |
441 SaveFPRegsMode save_fp, | 441 SaveFPRegsMode save_fp, |
(...skipping 23 matching lines...) Expand all Loading... |
465 } | 465 } |
466 | 466 |
467 RecordWrite(object, dst, value, save_fp, remembered_set_action, | 467 RecordWrite(object, dst, value, save_fp, remembered_set_action, |
468 OMIT_SMI_CHECK, pointers_to_here_check_for_value); | 468 OMIT_SMI_CHECK, pointers_to_here_check_for_value); |
469 | 469 |
470 bind(&done); | 470 bind(&done); |
471 | 471 |
472 // Clobber clobbered input registers when running with the debug-code flag | 472 // Clobber clobbered input registers when running with the debug-code flag |
473 // turned on to provoke errors. | 473 // turned on to provoke errors. |
474 if (emit_debug_code()) { | 474 if (emit_debug_code()) { |
475 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 475 mov(value, Immediate(bit_cast<int32_t>(kZapValue))); |
476 mov(dst, Immediate(BitCast<int32_t>(kZapValue))); | 476 mov(dst, Immediate(bit_cast<int32_t>(kZapValue))); |
477 } | 477 } |
478 } | 478 } |
479 | 479 |
480 | 480 |
481 void MacroAssembler::RecordWriteForMap( | 481 void MacroAssembler::RecordWriteForMap( |
482 Register object, | 482 Register object, |
483 Handle<Map> map, | 483 Handle<Map> map, |
484 Register scratch1, | 484 Register scratch1, |
485 Register scratch2, | 485 Register scratch2, |
486 SaveFPRegsMode save_fp) { | 486 SaveFPRegsMode save_fp) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 | 526 |
527 bind(&done); | 527 bind(&done); |
528 | 528 |
529 // Count number of write barriers in generated code. | 529 // Count number of write barriers in generated code. |
530 isolate()->counters()->write_barriers_static()->Increment(); | 530 isolate()->counters()->write_barriers_static()->Increment(); |
531 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | 531 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
532 | 532 |
533 // Clobber clobbered input registers when running with the debug-code flag | 533 // Clobber clobbered input registers when running with the debug-code flag |
534 // turned on to provoke errors. | 534 // turned on to provoke errors. |
535 if (emit_debug_code()) { | 535 if (emit_debug_code()) { |
536 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 536 mov(value, Immediate(bit_cast<int32_t>(kZapValue))); |
537 mov(scratch1, Immediate(BitCast<int32_t>(kZapValue))); | 537 mov(scratch1, Immediate(bit_cast<int32_t>(kZapValue))); |
538 mov(scratch2, Immediate(BitCast<int32_t>(kZapValue))); | 538 mov(scratch2, Immediate(bit_cast<int32_t>(kZapValue))); |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 | 542 |
543 void MacroAssembler::RecordWrite( | 543 void MacroAssembler::RecordWrite( |
544 Register object, | 544 Register object, |
545 Register address, | 545 Register address, |
546 Register value, | 546 Register value, |
547 SaveFPRegsMode fp_mode, | 547 SaveFPRegsMode fp_mode, |
548 RememberedSetAction remembered_set_action, | 548 RememberedSetAction remembered_set_action, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 596 |
597 bind(&done); | 597 bind(&done); |
598 | 598 |
599 // Count number of write barriers in generated code. | 599 // Count number of write barriers in generated code. |
600 isolate()->counters()->write_barriers_static()->Increment(); | 600 isolate()->counters()->write_barriers_static()->Increment(); |
601 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); | 601 IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1); |
602 | 602 |
603 // Clobber clobbered registers when running with the debug-code flag | 603 // Clobber clobbered registers when running with the debug-code flag |
604 // turned on to provoke errors. | 604 // turned on to provoke errors. |
605 if (emit_debug_code()) { | 605 if (emit_debug_code()) { |
606 mov(address, Immediate(BitCast<int32_t>(kZapValue))); | 606 mov(address, Immediate(bit_cast<int32_t>(kZapValue))); |
607 mov(value, Immediate(BitCast<int32_t>(kZapValue))); | 607 mov(value, Immediate(bit_cast<int32_t>(kZapValue))); |
608 } | 608 } |
609 } | 609 } |
610 | 610 |
611 | 611 |
612 void MacroAssembler::DebugBreak() { | 612 void MacroAssembler::DebugBreak() { |
613 Move(eax, Immediate(0)); | 613 Move(eax, Immediate(0)); |
614 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); | 614 mov(ebx, Immediate(ExternalReference(Runtime::kDebugBreak, isolate()))); |
615 CEntryStub ces(isolate(), 1); | 615 CEntryStub ces(isolate(), 1); |
616 call(ces.GetCode(), RelocInfo::DEBUG_BREAK); | 616 call(ces.GetCode(), RelocInfo::DEBUG_BREAK); |
617 } | 617 } |
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 | 2117 |
2118 | 2118 |
2119 Operand ApiParameterOperand(int index) { | 2119 Operand ApiParameterOperand(int index) { |
2120 return Operand(esp, index * kPointerSize); | 2120 return Operand(esp, index * kPointerSize); |
2121 } | 2121 } |
2122 | 2122 |
2123 | 2123 |
2124 void MacroAssembler::PrepareCallApiFunction(int argc) { | 2124 void MacroAssembler::PrepareCallApiFunction(int argc) { |
2125 EnterApiExitFrame(argc); | 2125 EnterApiExitFrame(argc); |
2126 if (emit_debug_code()) { | 2126 if (emit_debug_code()) { |
2127 mov(esi, Immediate(BitCast<int32_t>(kZapValue))); | 2127 mov(esi, Immediate(bit_cast<int32_t>(kZapValue))); |
2128 } | 2128 } |
2129 } | 2129 } |
2130 | 2130 |
2131 | 2131 |
2132 void MacroAssembler::CallApiFunctionAndReturn( | 2132 void MacroAssembler::CallApiFunctionAndReturn( |
2133 Register function_address, | 2133 Register function_address, |
2134 ExternalReference thunk_ref, | 2134 ExternalReference thunk_ref, |
2135 Operand thunk_last_arg, | 2135 Operand thunk_last_arg, |
2136 int stack_space, | 2136 int stack_space, |
2137 Operand return_value_operand, | 2137 Operand return_value_operand, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 } | 2652 } |
2653 | 2653 |
2654 | 2654 |
2655 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { | 2655 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { |
2656 mov(dst, x); | 2656 mov(dst, x); |
2657 } | 2657 } |
2658 | 2658 |
2659 | 2659 |
2660 void MacroAssembler::Move(XMMRegister dst, double val) { | 2660 void MacroAssembler::Move(XMMRegister dst, double val) { |
2661 // TODO(titzer): recognize double constants with ExternalReferences. | 2661 // TODO(titzer): recognize double constants with ExternalReferences. |
2662 uint64_t int_val = BitCast<uint64_t, double>(val); | 2662 uint64_t int_val = bit_cast<uint64_t, double>(val); |
2663 if (int_val == 0) { | 2663 if (int_val == 0) { |
2664 xorps(dst, dst); | 2664 xorps(dst, dst); |
2665 } else { | 2665 } else { |
2666 int32_t lower = static_cast<int32_t>(int_val); | 2666 int32_t lower = static_cast<int32_t>(int_val); |
2667 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); | 2667 int32_t upper = static_cast<int32_t>(int_val >> kBitsPerInt); |
2668 push(Immediate(upper)); | 2668 push(Immediate(upper)); |
2669 push(Immediate(lower)); | 2669 push(Immediate(lower)); |
2670 movsd(dst, Operand(esp, 0)); | 2670 movsd(dst, Operand(esp, 0)); |
2671 add(esp, Immediate(kDoubleSize)); | 2671 add(esp, Immediate(kDoubleSize)); |
2672 } | 2672 } |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3434 if (mag.shift > 0) sar(edx, mag.shift); | 3434 if (mag.shift > 0) sar(edx, mag.shift); |
3435 mov(eax, dividend); | 3435 mov(eax, dividend); |
3436 shr(eax, 31); | 3436 shr(eax, 31); |
3437 add(edx, eax); | 3437 add(edx, eax); |
3438 } | 3438 } |
3439 | 3439 |
3440 | 3440 |
3441 } } // namespace v8::internal | 3441 } } // namespace v8::internal |
3442 | 3442 |
3443 #endif // V8_TARGET_ARCH_IA32 | 3443 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |