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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3558 Condition MacroAssembler::IsObjectNameType(Register heap_object, | 3558 Condition MacroAssembler::IsObjectNameType(Register heap_object, |
3559 Register map, | 3559 Register map, |
3560 Register instance_type) { | 3560 Register instance_type) { |
3561 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 3561 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
3562 movzxbl(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); | 3562 movzxbl(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); |
3563 cmpb(instance_type, Immediate(static_cast<uint8_t>(LAST_NAME_TYPE))); | 3563 cmpb(instance_type, Immediate(static_cast<uint8_t>(LAST_NAME_TYPE))); |
3564 return below_equal; | 3564 return below_equal; |
3565 } | 3565 } |
3566 | 3566 |
3567 | 3567 |
| 3568 void MacroAssembler::GetMapConstructor(Register result, Register map, |
| 3569 Register temp) { |
| 3570 Label done, loop; |
| 3571 movp(result, FieldOperand(map, Map::kConstructorOrBackPointerOffset)); |
| 3572 bind(&loop); |
| 3573 JumpIfSmi(result, &done); |
| 3574 CmpObjectType(result, MAP_TYPE, temp); |
| 3575 j(not_equal, &done); |
| 3576 movp(result, FieldOperand(result, Map::kConstructorOrBackPointerOffset)); |
| 3577 jmp(&loop); |
| 3578 bind(&done); |
| 3579 } |
| 3580 |
| 3581 |
3568 void MacroAssembler::TryGetFunctionPrototype(Register function, | 3582 void MacroAssembler::TryGetFunctionPrototype(Register function, |
3569 Register result, | 3583 Register result, |
3570 Label* miss, | 3584 Label* miss, |
3571 bool miss_on_bound_function) { | 3585 bool miss_on_bound_function) { |
3572 Label non_instance; | 3586 Label non_instance; |
3573 if (miss_on_bound_function) { | 3587 if (miss_on_bound_function) { |
3574 // Check that the receiver isn't a smi. | 3588 // Check that the receiver isn't a smi. |
3575 testl(function, Immediate(kSmiTagMask)); | 3589 testl(function, Immediate(kSmiTagMask)); |
3576 j(zero, miss); | 3590 j(zero, miss); |
3577 | 3591 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 | 3625 |
3612 // Get the prototype from the initial map. | 3626 // Get the prototype from the initial map. |
3613 movp(result, FieldOperand(result, Map::kPrototypeOffset)); | 3627 movp(result, FieldOperand(result, Map::kPrototypeOffset)); |
3614 | 3628 |
3615 if (miss_on_bound_function) { | 3629 if (miss_on_bound_function) { |
3616 jmp(&done, Label::kNear); | 3630 jmp(&done, Label::kNear); |
3617 | 3631 |
3618 // Non-instance prototype: Fetch prototype from constructor field | 3632 // Non-instance prototype: Fetch prototype from constructor field |
3619 // in initial map. | 3633 // in initial map. |
3620 bind(&non_instance); | 3634 bind(&non_instance); |
3621 movp(result, FieldOperand(result, Map::kConstructorOffset)); | 3635 GetMapConstructor(result, result, kScratchRegister); |
3622 } | 3636 } |
3623 | 3637 |
3624 // All done. | 3638 // All done. |
3625 bind(&done); | 3639 bind(&done); |
3626 } | 3640 } |
3627 | 3641 |
3628 | 3642 |
3629 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 3643 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
3630 if (FLAG_native_code_counters && counter->Enabled()) { | 3644 if (FLAG_native_code_counters && counter->Enabled()) { |
3631 Operand counter_operand = ExternalOperand(ExternalReference(counter)); | 3645 Operand counter_operand = ExternalOperand(ExternalReference(counter)); |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5196 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5210 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5197 movl(rax, dividend); | 5211 movl(rax, dividend); |
5198 shrl(rax, Immediate(31)); | 5212 shrl(rax, Immediate(31)); |
5199 addl(rdx, rax); | 5213 addl(rdx, rax); |
5200 } | 5214 } |
5201 | 5215 |
5202 | 5216 |
5203 } } // namespace v8::internal | 5217 } } // namespace v8::internal |
5204 | 5218 |
5205 #endif // V8_TARGET_ARCH_X64 | 5219 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |