OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_S390 | 8 #if V8_TARGET_ARCH_S390 |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2394 STATIC_ASSERT(kSmiTag == 0); | 2394 STATIC_ASSERT(kSmiTag == 0); |
2395 TestIfSmi(object); | 2395 TestIfSmi(object); |
2396 Check(ne, kOperandIsASmiAndNotABoundFunction, cr0); | 2396 Check(ne, kOperandIsASmiAndNotABoundFunction, cr0); |
2397 push(object); | 2397 push(object); |
2398 CompareObjectType(object, object, object, JS_BOUND_FUNCTION_TYPE); | 2398 CompareObjectType(object, object, object, JS_BOUND_FUNCTION_TYPE); |
2399 pop(object); | 2399 pop(object); |
2400 Check(eq, kOperandIsNotABoundFunction); | 2400 Check(eq, kOperandIsNotABoundFunction); |
2401 } | 2401 } |
2402 } | 2402 } |
2403 | 2403 |
2404 void MacroAssembler::AssertGeneratorObject(Register object) { | 2404 void MacroAssembler::AssertGeneratorObject(Register object, Register flags) { |
2405 if (emit_debug_code()) { | 2405 // `flags` should be an untagged integer. See `SuspendFlags` in src/globals.h |
2406 STATIC_ASSERT(kSmiTag == 0); | 2406 if (!emit_debug_code()) return; |
2407 TestIfSmi(object); | 2407 TestIfSmi(object); |
2408 Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0); | 2408 Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0); |
2409 push(object); | |
2410 CompareObjectType(object, object, object, JS_GENERATOR_OBJECT_TYPE); | |
2411 pop(object); | |
2412 Check(eq, kOperandIsNotAGeneratorObject); | |
2413 } | |
2414 } | |
2415 | 2409 |
2416 void MacroAssembler::AssertAsyncGeneratorObject(Register object) { | 2410 // Load map |
2417 if (emit_debug_code()) { | 2411 Register map = object; |
2418 STATIC_ASSERT(kSmiTag == 0); | 2412 push(object); |
2419 TestIfSmi(object); | 2413 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
2420 Check(ne, kOperandIsASmiAndNotAGeneratorObject); | 2414 |
2421 push(object); | 2415 Label async, do_check; |
2422 CompareObjectType(object, object, object, JS_ASYNC_GENERATOR_OBJECT_TYPE); | 2416 And(ip, flags, Operand(static_cast<int>(SuspendFlags::kGeneratorTypeMask))); |
2423 pop(object); | 2417 CmpP(ip, Operand(static_cast<int>(SuspendFlags::kGeneratorTypeMask))); |
2424 Check(eq, kOperandIsNotAGeneratorObject); | 2418 bne(&async); |
2425 } | 2419 |
| 2420 // Check if JSGeneratorObject |
| 2421 CompareInstanceType(map, object, JS_GENERATOR_OBJECT_TYPE); |
| 2422 b(&do_check); |
| 2423 |
| 2424 bind(&async); |
| 2425 // Check if JSAsyncGeneratorObject |
| 2426 CompareInstanceType(map, object, JS_ASYNC_GENERATOR_OBJECT_TYPE); |
| 2427 |
| 2428 bind(&do_check); |
| 2429 // Restore generator object to register and perform assertion |
| 2430 pop(object); |
| 2431 Check(eq, kOperandIsNotAGeneratorObject); |
2426 } | 2432 } |
2427 | 2433 |
2428 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, | 2434 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, |
2429 Register scratch) { | 2435 Register scratch) { |
2430 if (emit_debug_code()) { | 2436 if (emit_debug_code()) { |
2431 Label done_checking; | 2437 Label done_checking; |
2432 AssertNotSmi(object); | 2438 AssertNotSmi(object); |
2433 CompareRoot(object, Heap::kUndefinedValueRootIndex); | 2439 CompareRoot(object, Heap::kUndefinedValueRootIndex); |
2434 beq(&done_checking, Label::kNear); | 2440 beq(&done_checking, Label::kNear); |
2435 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2441 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
(...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5372 } | 5378 } |
5373 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5379 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5374 ExtractBit(r0, dividend, 31); | 5380 ExtractBit(r0, dividend, 31); |
5375 AddP(result, r0); | 5381 AddP(result, r0); |
5376 } | 5382 } |
5377 | 5383 |
5378 } // namespace internal | 5384 } // namespace internal |
5379 } // namespace v8 | 5385 } // namespace v8 |
5380 | 5386 |
5381 #endif // V8_TARGET_ARCH_S390 | 5387 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |