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 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 Label* fail) { | 1452 Label* fail) { |
1453 DCHECK(kNotStringTag != 0); | 1453 DCHECK(kNotStringTag != 0); |
1454 | 1454 |
1455 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 1455 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
1456 LoadlB(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 1456 LoadlB(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
1457 mov(r0, Operand(kIsNotStringMask)); | 1457 mov(r0, Operand(kIsNotStringMask)); |
1458 AndP(r0, scratch); | 1458 AndP(r0, scratch); |
1459 bne(fail); | 1459 bne(fail); |
1460 } | 1460 } |
1461 | 1461 |
1462 void MacroAssembler::IsObjectNameType(Register object, Register scratch, | |
1463 Label* fail) { | |
1464 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | |
1465 LoadlB(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | |
1466 CmpP(scratch, Operand(LAST_NAME_TYPE)); | |
1467 bgt(fail); | |
1468 } | |
1469 | |
1470 void MacroAssembler::MaybeDropFrames() { | 1462 void MacroAssembler::MaybeDropFrames() { |
1471 // Check whether we need to drop frames to restart a function on the stack. | 1463 // Check whether we need to drop frames to restart a function on the stack. |
1472 ExternalReference restart_fp = | 1464 ExternalReference restart_fp = |
1473 ExternalReference::debug_restart_fp_address(isolate()); | 1465 ExternalReference::debug_restart_fp_address(isolate()); |
1474 mov(r3, Operand(restart_fp)); | 1466 mov(r3, Operand(restart_fp)); |
1475 LoadP(r3, MemOperand(r3)); | 1467 LoadP(r3, MemOperand(r3)); |
1476 CmpP(r3, Operand::Zero()); | 1468 CmpP(r3, Operand::Zero()); |
1477 Jump(isolate()->builtins()->FrameDropperTrampoline(), RelocInfo::CODE_TARGET, | 1469 Jump(isolate()->builtins()->FrameDropperTrampoline(), RelocInfo::CODE_TARGET, |
1478 ne); | 1470 ne); |
1479 } | 1471 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 Heap::RootListIndex index, Label* fail, | 1913 Heap::RootListIndex index, Label* fail, |
1922 SmiCheckType smi_check_type) { | 1914 SmiCheckType smi_check_type) { |
1923 if (smi_check_type == DO_SMI_CHECK) { | 1915 if (smi_check_type == DO_SMI_CHECK) { |
1924 JumpIfSmi(obj, fail); | 1916 JumpIfSmi(obj, fail); |
1925 } | 1917 } |
1926 LoadP(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 1918 LoadP(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
1927 CompareRoot(scratch, index); | 1919 CompareRoot(scratch, index); |
1928 bne(fail); | 1920 bne(fail); |
1929 } | 1921 } |
1930 | 1922 |
1931 void MacroAssembler::DispatchWeakMap(Register obj, Register scratch1, | |
1932 Register scratch2, Handle<WeakCell> cell, | |
1933 Handle<Code> success, | |
1934 SmiCheckType smi_check_type) { | |
1935 Label fail; | |
1936 if (smi_check_type == DO_SMI_CHECK) { | |
1937 JumpIfSmi(obj, &fail); | |
1938 } | |
1939 LoadP(scratch1, FieldMemOperand(obj, HeapObject::kMapOffset)); | |
1940 CmpWeakValue(scratch1, cell, scratch2); | |
1941 Jump(success, RelocInfo::CODE_TARGET, eq); | |
1942 bind(&fail); | |
1943 } | |
1944 | |
1945 void MacroAssembler::CmpWeakValue(Register value, Handle<WeakCell> cell, | |
1946 Register scratch, CRegister) { | |
1947 mov(scratch, Operand(cell)); | |
1948 CmpP(value, FieldMemOperand(scratch, WeakCell::kValueOffset)); | |
1949 } | |
1950 | |
1951 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { | 1923 void MacroAssembler::GetWeakValue(Register value, Handle<WeakCell> cell) { |
1952 mov(value, Operand(cell)); | 1924 mov(value, Operand(cell)); |
1953 LoadP(value, FieldMemOperand(value, WeakCell::kValueOffset)); | 1925 LoadP(value, FieldMemOperand(value, WeakCell::kValueOffset)); |
1954 } | 1926 } |
1955 | 1927 |
1956 void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, | 1928 void MacroAssembler::LoadWeakValue(Register value, Handle<WeakCell> cell, |
1957 Label* miss) { | 1929 Label* miss) { |
1958 GetWeakValue(value, cell); | 1930 GetWeakValue(value, cell); |
1959 JumpIfSmi(value, miss); | 1931 JumpIfSmi(value, miss); |
1960 } | 1932 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 AddP(scratch2, Operand(-value)); | 2194 AddP(scratch2, Operand(-value)); |
2223 StoreW(scratch2, MemOperand(scratch1)); | 2195 StoreW(scratch2, MemOperand(scratch1)); |
2224 } | 2196 } |
2225 } | 2197 } |
2226 | 2198 |
2227 void MacroAssembler::Assert(Condition cond, BailoutReason reason, | 2199 void MacroAssembler::Assert(Condition cond, BailoutReason reason, |
2228 CRegister cr) { | 2200 CRegister cr) { |
2229 if (emit_debug_code()) Check(cond, reason, cr); | 2201 if (emit_debug_code()) Check(cond, reason, cr); |
2230 } | 2202 } |
2231 | 2203 |
2232 void MacroAssembler::AssertFastElements(Register elements) { | |
2233 if (emit_debug_code()) { | |
2234 DCHECK(!elements.is(r0)); | |
2235 Label ok; | |
2236 push(elements); | |
2237 LoadP(elements, FieldMemOperand(elements, HeapObject::kMapOffset)); | |
2238 CompareRoot(elements, Heap::kFixedArrayMapRootIndex); | |
2239 beq(&ok, Label::kNear); | |
2240 CompareRoot(elements, Heap::kFixedDoubleArrayMapRootIndex); | |
2241 beq(&ok, Label::kNear); | |
2242 CompareRoot(elements, Heap::kFixedCOWArrayMapRootIndex); | |
2243 beq(&ok, Label::kNear); | |
2244 Abort(kJSObjectWithFastElementsMapHasSlowElements); | |
2245 bind(&ok); | |
2246 pop(elements); | |
2247 } | |
2248 } | |
2249 | |
2250 void MacroAssembler::Check(Condition cond, BailoutReason reason, CRegister cr) { | 2204 void MacroAssembler::Check(Condition cond, BailoutReason reason, CRegister cr) { |
2251 Label L; | 2205 Label L; |
2252 b(cond, &L); | 2206 b(cond, &L); |
2253 Abort(reason); | 2207 Abort(reason); |
2254 // will not return here | 2208 // will not return here |
2255 bind(&L); | 2209 bind(&L); |
2256 } | 2210 } |
2257 | 2211 |
2258 void MacroAssembler::Abort(BailoutReason reason) { | 2212 void MacroAssembler::Abort(BailoutReason reason) { |
2259 Label abort_start; | 2213 Label abort_start; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 beq(smi_case); | 2341 beq(smi_case); |
2388 } | 2342 } |
2389 | 2343 |
2390 void MacroAssembler::JumpIfEitherSmi(Register reg1, Register reg2, | 2344 void MacroAssembler::JumpIfEitherSmi(Register reg1, Register reg2, |
2391 Label* on_either_smi) { | 2345 Label* on_either_smi) { |
2392 STATIC_ASSERT(kSmiTag == 0); | 2346 STATIC_ASSERT(kSmiTag == 0); |
2393 JumpIfSmi(reg1, on_either_smi); | 2347 JumpIfSmi(reg1, on_either_smi); |
2394 JumpIfSmi(reg2, on_either_smi); | 2348 JumpIfSmi(reg2, on_either_smi); |
2395 } | 2349 } |
2396 | 2350 |
2397 void MacroAssembler::AssertNotNumber(Register object) { | |
2398 if (emit_debug_code()) { | |
2399 STATIC_ASSERT(kSmiTag == 0); | |
2400 TestIfSmi(object); | |
2401 Check(ne, kOperandIsANumber, cr0); | |
2402 push(object); | |
2403 CompareObjectType(object, object, object, HEAP_NUMBER_TYPE); | |
2404 pop(object); | |
2405 Check(ne, kOperandIsANumber); | |
2406 } | |
2407 } | |
2408 | |
2409 void MacroAssembler::AssertNotSmi(Register object) { | 2351 void MacroAssembler::AssertNotSmi(Register object) { |
2410 if (emit_debug_code()) { | 2352 if (emit_debug_code()) { |
2411 STATIC_ASSERT(kSmiTag == 0); | 2353 STATIC_ASSERT(kSmiTag == 0); |
2412 TestIfSmi(object); | 2354 TestIfSmi(object); |
2413 Check(ne, kOperandIsASmi, cr0); | 2355 Check(ne, kOperandIsASmi, cr0); |
2414 } | 2356 } |
2415 } | 2357 } |
2416 | 2358 |
2417 void MacroAssembler::AssertSmi(Register object) { | 2359 void MacroAssembler::AssertSmi(Register object) { |
2418 if (emit_debug_code()) { | 2360 if (emit_debug_code()) { |
2419 STATIC_ASSERT(kSmiTag == 0); | 2361 STATIC_ASSERT(kSmiTag == 0); |
2420 TestIfSmi(object); | 2362 TestIfSmi(object); |
2421 Check(eq, kOperandIsNotSmi, cr0); | 2363 Check(eq, kOperandIsNotSmi, cr0); |
2422 } | 2364 } |
2423 } | 2365 } |
2424 | 2366 |
2425 void MacroAssembler::AssertString(Register object) { | |
2426 if (emit_debug_code()) { | |
2427 STATIC_ASSERT(kSmiTag == 0); | |
2428 TestIfSmi(object); | |
2429 Check(ne, kOperandIsASmiAndNotAString, cr0); | |
2430 push(object); | |
2431 LoadP(object, FieldMemOperand(object, HeapObject::kMapOffset)); | |
2432 CompareInstanceType(object, object, FIRST_NONSTRING_TYPE); | |
2433 pop(object); | |
2434 Check(lt, kOperandIsNotAString); | |
2435 } | |
2436 } | |
2437 | |
2438 void MacroAssembler::AssertName(Register object) { | |
2439 if (emit_debug_code()) { | |
2440 STATIC_ASSERT(kSmiTag == 0); | |
2441 TestIfSmi(object); | |
2442 Check(ne, kOperandIsASmiAndNotAName, cr0); | |
2443 push(object); | |
2444 LoadP(object, FieldMemOperand(object, HeapObject::kMapOffset)); | |
2445 CompareInstanceType(object, object, LAST_NAME_TYPE); | |
2446 pop(object); | |
2447 Check(le, kOperandIsNotAName); | |
2448 } | |
2449 } | |
2450 | |
2451 void MacroAssembler::AssertFunction(Register object) { | 2367 void MacroAssembler::AssertFunction(Register object) { |
2452 if (emit_debug_code()) { | 2368 if (emit_debug_code()) { |
2453 STATIC_ASSERT(kSmiTag == 0); | 2369 STATIC_ASSERT(kSmiTag == 0); |
2454 TestIfSmi(object); | 2370 TestIfSmi(object); |
2455 Check(ne, kOperandIsASmiAndNotAFunction, cr0); | 2371 Check(ne, kOperandIsASmiAndNotAFunction, cr0); |
2456 push(object); | 2372 push(object); |
2457 CompareObjectType(object, object, object, JS_FUNCTION_TYPE); | 2373 CompareObjectType(object, object, object, JS_FUNCTION_TYPE); |
2458 pop(object); | 2374 pop(object); |
2459 Check(eq, kOperandIsNotAFunction); | 2375 Check(eq, kOperandIsNotAFunction); |
2460 } | 2376 } |
(...skipping 16 matching lines...) Expand all Loading... |
2477 STATIC_ASSERT(kSmiTag == 0); | 2393 STATIC_ASSERT(kSmiTag == 0); |
2478 TestIfSmi(object); | 2394 TestIfSmi(object); |
2479 Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0); | 2395 Check(ne, kOperandIsASmiAndNotAGeneratorObject, cr0); |
2480 push(object); | 2396 push(object); |
2481 CompareObjectType(object, object, object, JS_GENERATOR_OBJECT_TYPE); | 2397 CompareObjectType(object, object, object, JS_GENERATOR_OBJECT_TYPE); |
2482 pop(object); | 2398 pop(object); |
2483 Check(eq, kOperandIsNotAGeneratorObject); | 2399 Check(eq, kOperandIsNotAGeneratorObject); |
2484 } | 2400 } |
2485 } | 2401 } |
2486 | 2402 |
2487 void MacroAssembler::AssertReceiver(Register object) { | |
2488 if (emit_debug_code()) { | |
2489 STATIC_ASSERT(kSmiTag == 0); | |
2490 TestIfSmi(object); | |
2491 Check(ne, kOperandIsASmiAndNotAReceiver, cr0); | |
2492 push(object); | |
2493 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE); | |
2494 CompareObjectType(object, object, object, FIRST_JS_RECEIVER_TYPE); | |
2495 pop(object); | |
2496 Check(ge, kOperandIsNotAReceiver); | |
2497 } | |
2498 } | |
2499 | |
2500 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, | 2403 void MacroAssembler::AssertUndefinedOrAllocationSite(Register object, |
2501 Register scratch) { | 2404 Register scratch) { |
2502 if (emit_debug_code()) { | 2405 if (emit_debug_code()) { |
2503 Label done_checking; | 2406 Label done_checking; |
2504 AssertNotSmi(object); | 2407 AssertNotSmi(object); |
2505 CompareRoot(object, Heap::kUndefinedValueRootIndex); | 2408 CompareRoot(object, Heap::kUndefinedValueRootIndex); |
2506 beq(&done_checking, Label::kNear); | 2409 beq(&done_checking, Label::kNear); |
2507 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2410 LoadP(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2508 CompareRoot(scratch, Heap::kAllocationSiteMapRootIndex); | 2411 CompareRoot(scratch, Heap::kAllocationSiteMapRootIndex); |
2509 Assert(eq, kExpectedUndefinedOrCell); | 2412 Assert(eq, kExpectedUndefinedOrCell); |
(...skipping 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5444 } | 5347 } |
5445 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5348 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5446 ExtractBit(r0, dividend, 31); | 5349 ExtractBit(r0, dividend, 31); |
5447 AddP(result, r0); | 5350 AddP(result, r0); |
5448 } | 5351 } |
5449 | 5352 |
5450 } // namespace internal | 5353 } // namespace internal |
5451 } // namespace v8 | 5354 } // namespace v8 |
5452 | 5355 |
5453 #endif // V8_TARGET_ARCH_S390 | 5356 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |