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/crankshaft/mips64/lithium-codegen-mips64.h" | 5 #include "src/crankshaft/mips64/lithium-codegen-mips64.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/crankshaft/hydrogen-osr.h" | 9 #include "src/crankshaft/hydrogen-osr.h" |
10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" | 10 #include "src/crankshaft/mips64/lithium-gap-resolver-mips64.h" |
(...skipping 2236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2247 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); | 2247 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); |
2248 __ And(at, at, Operand(1 << Map::kIsUndetectable)); | 2248 __ And(at, at, Operand(1 << Map::kIsUndetectable)); |
2249 __ Branch(instr->FalseLabel(chunk_), ne, at, Operand(zero_reg)); | 2249 __ Branch(instr->FalseLabel(chunk_), ne, at, Operand(zero_reg)); |
2250 } | 2250 } |
2251 } | 2251 } |
2252 | 2252 |
2253 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { | 2253 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { |
2254 // spec object -> true. | 2254 // spec object -> true. |
2255 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2255 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2256 __ Branch(instr->TrueLabel(chunk_), | 2256 __ Branch(instr->TrueLabel(chunk_), |
2257 ge, at, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2257 ge, at, Operand(FIRST_JS_RECEIVER_TYPE)); |
2258 } | 2258 } |
2259 | 2259 |
2260 if (expected.Contains(ToBooleanStub::STRING)) { | 2260 if (expected.Contains(ToBooleanStub::STRING)) { |
2261 // String value -> false iff empty. | 2261 // String value -> false iff empty. |
2262 Label not_string; | 2262 Label not_string; |
2263 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2263 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2264 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); | 2264 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); |
2265 __ ld(at, FieldMemOperand(reg, String::kLengthOffset)); | 2265 __ ld(at, FieldMemOperand(reg, String::kLengthOffset)); |
2266 __ Branch(instr->TrueLabel(chunk_), ne, at, Operand(zero_reg)); | 2266 __ Branch(instr->TrueLabel(chunk_), ne, at, Operand(zero_reg)); |
2267 __ Branch(instr->FalseLabel(chunk_)); | 2267 __ Branch(instr->FalseLabel(chunk_)); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2622 DCHECK(!input.is(temp2)); | 2622 DCHECK(!input.is(temp2)); |
2623 DCHECK(!temp.is(temp2)); | 2623 DCHECK(!temp.is(temp2)); |
2624 | 2624 |
2625 __ JumpIfSmi(input, is_false); | 2625 __ JumpIfSmi(input, is_false); |
2626 | 2626 |
2627 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2627 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2628 // Assuming the following assertions, we can use the same compares to test | 2628 // Assuming the following assertions, we can use the same compares to test |
2629 // for both being a function type and being in the object type range. | 2629 // for both being a function type and being in the object type range. |
2630 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2630 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2631 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2631 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2632 FIRST_SPEC_OBJECT_TYPE + 1); | 2632 FIRST_JS_RECEIVER_TYPE + 1); |
2633 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2633 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2634 LAST_SPEC_OBJECT_TYPE - 1); | 2634 LAST_JS_RECEIVER_TYPE - 1); |
2635 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2635 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
2636 | 2636 |
2637 __ GetObjectType(input, temp, temp2); | 2637 __ GetObjectType(input, temp, temp2); |
2638 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2638 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
2639 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2639 __ Branch(is_true, eq, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
2640 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); | 2640 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); |
2641 } else { | 2641 } else { |
2642 // Faster code path to avoid two compares: subtract lower bound from the | 2642 // Faster code path to avoid two compares: subtract lower bound from the |
2643 // actual type and do a signed compare with the width of the type range. | 2643 // actual type and do a signed compare with the width of the type range. |
2644 __ GetObjectType(input, temp, temp2); | 2644 __ GetObjectType(input, temp, temp2); |
2645 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2645 __ Dsubu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2646 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2646 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2647 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2647 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
2648 } | 2648 } |
2649 | 2649 |
2650 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2650 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3398 __ Branch(&global_object, eq, receiver, Operand(scratch)); | 3398 __ Branch(&global_object, eq, receiver, Operand(scratch)); |
3399 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 3399 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
3400 __ Branch(&global_object, eq, receiver, Operand(scratch)); | 3400 __ Branch(&global_object, eq, receiver, Operand(scratch)); |
3401 | 3401 |
3402 // Deoptimize if the receiver is not a JS object. | 3402 // Deoptimize if the receiver is not a JS object. |
3403 __ SmiTst(receiver, scratch); | 3403 __ SmiTst(receiver, scratch); |
3404 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); | 3404 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); |
3405 | 3405 |
3406 __ GetObjectType(receiver, scratch, scratch); | 3406 __ GetObjectType(receiver, scratch, scratch); |
3407 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, | 3407 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, |
3408 Operand(FIRST_SPEC_OBJECT_TYPE)); | 3408 Operand(FIRST_JS_RECEIVER_TYPE)); |
3409 __ Branch(&result_in_receiver); | 3409 __ Branch(&result_in_receiver); |
3410 | 3410 |
3411 __ bind(&global_object); | 3411 __ bind(&global_object); |
3412 __ ld(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3412 __ ld(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
3413 __ ld(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); | 3413 __ ld(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); |
3414 __ ld(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); | 3414 __ ld(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); |
3415 | 3415 |
3416 if (result.is(receiver)) { | 3416 if (result.is(receiver)) { |
3417 __ bind(&result_in_receiver); | 3417 __ bind(&result_in_receiver); |
3418 } else { | 3418 } else { |
(...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5608 __ And(scratch, scratch, | 5608 __ And(scratch, scratch, |
5609 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 5609 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
5610 *cmp1 = scratch; | 5610 *cmp1 = scratch; |
5611 *cmp2 = Operand(1 << Map::kIsCallable); | 5611 *cmp2 = Operand(1 << Map::kIsCallable); |
5612 final_branch_condition = eq; | 5612 final_branch_condition = eq; |
5613 | 5613 |
5614 } else if (String::Equals(type_name, factory->object_string())) { | 5614 } else if (String::Equals(type_name, factory->object_string())) { |
5615 __ JumpIfSmi(input, false_label); | 5615 __ JumpIfSmi(input, false_label); |
5616 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5616 __ LoadRoot(at, Heap::kNullValueRootIndex); |
5617 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5617 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
5618 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 5618 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
5619 __ GetObjectType(input, scratch, scratch1()); | 5619 __ GetObjectType(input, scratch, scratch1()); |
5620 __ Branch(false_label, lt, scratch1(), Operand(FIRST_SPEC_OBJECT_TYPE)); | 5620 __ Branch(false_label, lt, scratch1(), Operand(FIRST_JS_RECEIVER_TYPE)); |
5621 // Check for callable or undetectable objects => false. | 5621 // Check for callable or undetectable objects => false. |
5622 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | 5622 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); |
5623 __ And(at, scratch, | 5623 __ And(at, scratch, |
5624 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 5624 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
5625 *cmp1 = at; | 5625 *cmp1 = at; |
5626 *cmp2 = Operand(zero_reg); | 5626 *cmp2 = Operand(zero_reg); |
5627 final_branch_condition = eq; | 5627 final_branch_condition = eq; |
5628 | 5628 |
5629 // clang-format off | 5629 // clang-format off |
5630 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ | 5630 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5802 } | 5802 } |
5803 | 5803 |
5804 | 5804 |
5805 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5805 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
5806 Register result = ToRegister(instr->result()); | 5806 Register result = ToRegister(instr->result()); |
5807 Register object = ToRegister(instr->object()); | 5807 Register object = ToRegister(instr->object()); |
5808 | 5808 |
5809 __ And(at, object, kSmiTagMask); | 5809 __ And(at, object, kSmiTagMask); |
5810 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg)); | 5810 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg)); |
5811 | 5811 |
5812 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 5812 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
5813 __ GetObjectType(object, a1, a1); | 5813 __ GetObjectType(object, a1, a1); |
5814 DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1, | 5814 DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1, |
5815 Operand(LAST_JS_PROXY_TYPE)); | 5815 Operand(LAST_JS_PROXY_TYPE)); |
5816 | 5816 |
5817 Label use_cache, call_runtime; | 5817 Label use_cache, call_runtime; |
5818 DCHECK(object.is(a0)); | 5818 DCHECK(object.is(a0)); |
5819 Register null_value = a5; | 5819 Register null_value = a5; |
5820 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 5820 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
5821 __ CheckEnumCache(null_value, &call_runtime); | 5821 __ CheckEnumCache(null_value, &call_runtime); |
5822 | 5822 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5950 __ Push(at, ToRegister(instr->function())); | 5950 __ Push(at, ToRegister(instr->function())); |
5951 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5951 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5952 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5952 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5953 } | 5953 } |
5954 | 5954 |
5955 | 5955 |
5956 #undef __ | 5956 #undef __ |
5957 | 5957 |
5958 } // namespace internal | 5958 } // namespace internal |
5959 } // namespace v8 | 5959 } // namespace v8 |
OLD | NEW |