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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 AssertNotSmi(object); | 885 AssertNotSmi(object); |
886 cmp(object, isolate()->factory()->undefined_value()); | 886 cmp(object, isolate()->factory()->undefined_value()); |
887 j(equal, &done_checking); | 887 j(equal, &done_checking); |
888 cmp(FieldOperand(object, 0), | 888 cmp(FieldOperand(object, 0), |
889 Immediate(isolate()->factory()->allocation_site_map())); | 889 Immediate(isolate()->factory()->allocation_site_map())); |
890 Assert(equal, kExpectedUndefinedOrCell); | 890 Assert(equal, kExpectedUndefinedOrCell); |
891 bind(&done_checking); | 891 bind(&done_checking); |
892 } | 892 } |
893 } | 893 } |
894 | 894 |
| 895 void MacroAssembler::AssertApiCallResult(Register object) { |
| 896 if (emit_debug_code()) { |
| 897 Label done_checking; |
| 898 Push(object); |
| 899 |
| 900 // Check for Smis. |
| 901 JumpIfSmi(object, &done_checking, Label::kNear); |
| 902 |
| 903 // Check for valid Oddballs. |
| 904 JumpIfRoot(object, Heap::kTrueValueRootIndex, &done_checking, Label::kNear); |
| 905 JumpIfRoot(object, Heap::kFalseValueRootIndex, &done_checking, |
| 906 Label::kNear); |
| 907 JumpIfRoot(object, Heap::kNullValueRootIndex, &done_checking, Label::kNear); |
| 908 JumpIfRoot(object, Heap::kUndefinedValueRootIndex, &done_checking, |
| 909 Label::kNear); |
| 910 |
| 911 // Check for other primitives (String, Symbol and HeapNumber). |
| 912 STATIC_ASSERT(LAST_PRIMITIVE_TYPE == ODDBALL_TYPE); |
| 913 CmpObjectType(object, LAST_PRIMITIVE_TYPE, object); |
| 914 j(below, &done_checking, Label::kNear); |
| 915 |
| 916 // Check for JSReceivers. |
| 917 CmpInstanceType(object, FIRST_JS_RECEIVER_TYPE); |
| 918 Check(above_equal, kAPICallReturnedInvalidObject); |
| 919 |
| 920 bind(&done_checking); |
| 921 Pop(object); |
| 922 } |
| 923 } |
895 | 924 |
896 void MacroAssembler::AssertNotSmi(Register object) { | 925 void MacroAssembler::AssertNotSmi(Register object) { |
897 if (emit_debug_code()) { | 926 if (emit_debug_code()) { |
898 test(object, Immediate(kSmiTagMask)); | 927 test(object, Immediate(kSmiTagMask)); |
899 Check(not_equal, kOperandIsASmi); | 928 Check(not_equal, kOperandIsASmi); |
900 } | 929 } |
901 } | 930 } |
902 | 931 |
903 void MacroAssembler::StubPrologue(StackFrame::Type type) { | 932 void MacroAssembler::StubPrologue(StackFrame::Type type) { |
904 push(ebp); // Caller's frame pointer. | 933 push(ebp); // Caller's frame pointer. |
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 mov(eax, dividend); | 2807 mov(eax, dividend); |
2779 shr(eax, 31); | 2808 shr(eax, 31); |
2780 add(edx, eax); | 2809 add(edx, eax); |
2781 } | 2810 } |
2782 | 2811 |
2783 | 2812 |
2784 } // namespace internal | 2813 } // namespace internal |
2785 } // namespace v8 | 2814 } // namespace v8 |
2786 | 2815 |
2787 #endif // V8_TARGET_ARCH_IA32 | 2816 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |