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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
9 #include "src/base/utils/random-number-generator.h" | 9 #include "src/base/utils/random-number-generator.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3761 Label done_checking; | 3761 Label done_checking; |
3762 AssertNotSmi(object); | 3762 AssertNotSmi(object); |
3763 Cmp(object, isolate()->factory()->undefined_value()); | 3763 Cmp(object, isolate()->factory()->undefined_value()); |
3764 j(equal, &done_checking); | 3764 j(equal, &done_checking); |
3765 Cmp(FieldOperand(object, 0), isolate()->factory()->allocation_site_map()); | 3765 Cmp(FieldOperand(object, 0), isolate()->factory()->allocation_site_map()); |
3766 Assert(equal, kExpectedUndefinedOrCell); | 3766 Assert(equal, kExpectedUndefinedOrCell); |
3767 bind(&done_checking); | 3767 bind(&done_checking); |
3768 } | 3768 } |
3769 } | 3769 } |
3770 | 3770 |
| 3771 void MacroAssembler::AssertApiCallResult(Register object) { |
| 3772 if (emit_debug_code()) { |
| 3773 Label done_checking; |
| 3774 Push(object); |
| 3775 |
| 3776 // Check for Smis. |
| 3777 JumpIfSmi(object, &done_checking, Label::kNear); |
| 3778 |
| 3779 // Check for valid Oddballs. |
| 3780 JumpIfRoot(object, Heap::kTrueValueRootIndex, &done_checking, Label::kNear); |
| 3781 JumpIfRoot(object, Heap::kFalseValueRootIndex, &done_checking, |
| 3782 Label::kNear); |
| 3783 JumpIfRoot(object, Heap::kNullValueRootIndex, &done_checking, Label::kNear); |
| 3784 JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking, |
| 3785 Label::kNear); |
| 3786 |
| 3787 // Check for other primitives (String, Symbol and HeapNumber). |
| 3788 STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE); |
| 3789 CmpObjectType(object, LAST_PRIMITIVE_TYPE, object); |
| 3790 j(below, &done_checking, Label::kNear); |
| 3791 |
| 3792 // Check for JSReceivers. |
| 3793 CmpInstanceType(object, FIRST_JS_RECEIVER_TYPE); |
| 3794 Check(above_equal, kAPICallReturnedInvalidObject); |
| 3795 |
| 3796 bind(&done_checking); |
| 3797 Pop(object); |
| 3798 } |
| 3799 } |
3771 | 3800 |
3772 Condition MacroAssembler::IsObjectStringType(Register heap_object, | 3801 Condition MacroAssembler::IsObjectStringType(Register heap_object, |
3773 Register map, | 3802 Register map, |
3774 Register instance_type) { | 3803 Register instance_type) { |
3775 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset)); | 3804 movp(map, FieldOperand(heap_object, HeapObject::kMapOffset)); |
3776 movzxbl(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); | 3805 movzxbl(instance_type, FieldOperand(map, Map::kInstanceTypeOffset)); |
3777 STATIC_ASSERT(kNotStringTag != 0); | 3806 STATIC_ASSERT(kNotStringTag != 0); |
3778 testb(instance_type, Immediate(kIsNotStringMask)); | 3807 testb(instance_type, Immediate(kIsNotStringMask)); |
3779 return zero; | 3808 return zero; |
3780 } | 3809 } |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5039 movl(rax, dividend); | 5068 movl(rax, dividend); |
5040 shrl(rax, Immediate(31)); | 5069 shrl(rax, Immediate(31)); |
5041 addl(rdx, rax); | 5070 addl(rdx, rax); |
5042 } | 5071 } |
5043 | 5072 |
5044 | 5073 |
5045 } // namespace internal | 5074 } // namespace internal |
5046 } // namespace v8 | 5075 } // namespace v8 |
5047 | 5076 |
5048 #endif // V8_TARGET_ARCH_X64 | 5077 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |