| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2146 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); | 2146 __ lbu(at, FieldMemOperand(map, Map::kBitFieldOffset)); |
| 2147 __ And(at, at, Operand(1 << Map::kIsUndetectable)); | 2147 __ And(at, at, Operand(1 << Map::kIsUndetectable)); |
| 2148 __ Branch(instr->FalseLabel(chunk_), ne, at, Operand(zero_reg)); | 2148 __ Branch(instr->FalseLabel(chunk_), ne, at, Operand(zero_reg)); |
| 2149 } | 2149 } |
| 2150 } | 2150 } |
| 2151 | 2151 |
| 2152 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { | 2152 if (expected.Contains(ToBooleanStub::SPEC_OBJECT)) { |
| 2153 // spec object -> true. | 2153 // spec object -> true. |
| 2154 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2154 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
| 2155 __ Branch(instr->TrueLabel(chunk_), | 2155 __ Branch(instr->TrueLabel(chunk_), |
| 2156 ge, at, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2156 ge, at, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 if (expected.Contains(ToBooleanStub::STRING)) { | 2159 if (expected.Contains(ToBooleanStub::STRING)) { |
| 2160 // String value -> false iff empty. | 2160 // String value -> false iff empty. |
| 2161 Label not_string; | 2161 Label not_string; |
| 2162 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2162 __ lbu(at, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
| 2163 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); | 2163 __ Branch(¬_string, ge , at, Operand(FIRST_NONSTRING_TYPE)); |
| 2164 __ lw(at, FieldMemOperand(reg, String::kLengthOffset)); | 2164 __ lw(at, FieldMemOperand(reg, String::kLengthOffset)); |
| 2165 __ Branch(instr->TrueLabel(chunk_), ne, at, Operand(zero_reg)); | 2165 __ Branch(instr->TrueLabel(chunk_), ne, at, Operand(zero_reg)); |
| 2166 __ Branch(instr->FalseLabel(chunk_)); | 2166 __ Branch(instr->FalseLabel(chunk_)); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2518 DCHECK(!input.is(temp2)); | 2518 DCHECK(!input.is(temp2)); |
| 2519 DCHECK(!temp.is(temp2)); | 2519 DCHECK(!temp.is(temp2)); |
| 2520 | 2520 |
| 2521 __ JumpIfSmi(input, is_false); | 2521 __ JumpIfSmi(input, is_false); |
| 2522 | 2522 |
| 2523 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2523 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
| 2524 // Assuming the following assertions, we can use the same compares to test | 2524 // Assuming the following assertions, we can use the same compares to test |
| 2525 // for both being a function type and being in the object type range. | 2525 // for both being a function type and being in the object type range. |
| 2526 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2526 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
| 2527 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2527 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2528 FIRST_SPEC_OBJECT_TYPE + 1); | 2528 FIRST_JS_RECEIVER_TYPE + 1); |
| 2529 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2529 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
| 2530 LAST_SPEC_OBJECT_TYPE - 1); | 2530 LAST_JS_RECEIVER_TYPE - 1); |
| 2531 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 2531 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 2532 | 2532 |
| 2533 __ GetObjectType(input, temp, temp2); | 2533 __ GetObjectType(input, temp, temp2); |
| 2534 __ Branch(is_false, lt, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2534 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 2535 __ Branch(is_true, eq, temp2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2535 __ Branch(is_true, eq, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
| 2536 __ Branch(is_true, eq, temp2, Operand(LAST_SPEC_OBJECT_TYPE)); | 2536 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); |
| 2537 } else { | 2537 } else { |
| 2538 // Faster code path to avoid two compares: subtract lower bound from the | 2538 // Faster code path to avoid two compares: subtract lower bound from the |
| 2539 // actual type and do a signed compare with the width of the type range. | 2539 // actual type and do a signed compare with the width of the type range. |
| 2540 __ GetObjectType(input, temp, temp2); | 2540 __ GetObjectType(input, temp, temp2); |
| 2541 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2541 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2542 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2542 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
| 2543 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2543 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
| 2544 } | 2544 } |
| 2545 | 2545 |
| 2546 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2546 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 __ Branch(&global_object, eq, receiver, Operand(scratch)); | 3229 __ Branch(&global_object, eq, receiver, Operand(scratch)); |
| 3230 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); | 3230 __ LoadRoot(scratch, Heap::kUndefinedValueRootIndex); |
| 3231 __ Branch(&global_object, eq, receiver, Operand(scratch)); | 3231 __ Branch(&global_object, eq, receiver, Operand(scratch)); |
| 3232 | 3232 |
| 3233 // Deoptimize if the receiver is not a JS object. | 3233 // Deoptimize if the receiver is not a JS object. |
| 3234 __ SmiTst(receiver, scratch); | 3234 __ SmiTst(receiver, scratch); |
| 3235 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); | 3235 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, scratch, Operand(zero_reg)); |
| 3236 | 3236 |
| 3237 __ GetObjectType(receiver, scratch, scratch); | 3237 __ GetObjectType(receiver, scratch, scratch); |
| 3238 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, | 3238 DeoptimizeIf(lt, instr, Deoptimizer::kNotAJavaScriptObject, scratch, |
| 3239 Operand(FIRST_SPEC_OBJECT_TYPE)); | 3239 Operand(FIRST_JS_RECEIVER_TYPE)); |
| 3240 | 3240 |
| 3241 __ Branch(&result_in_receiver); | 3241 __ Branch(&result_in_receiver); |
| 3242 __ bind(&global_object); | 3242 __ bind(&global_object); |
| 3243 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset)); | 3243 __ lw(result, FieldMemOperand(function, JSFunction::kContextOffset)); |
| 3244 __ lw(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); | 3244 __ lw(result, ContextMemOperand(result, Context::NATIVE_CONTEXT_INDEX)); |
| 3245 __ lw(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); | 3245 __ lw(result, ContextMemOperand(result, Context::GLOBAL_PROXY_INDEX)); |
| 3246 | 3246 |
| 3247 if (result.is(receiver)) { | 3247 if (result.is(receiver)) { |
| 3248 __ bind(&result_in_receiver); | 3248 __ bind(&result_in_receiver); |
| 3249 } else { | 3249 } else { |
| (...skipping 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5423 __ And(scratch, scratch, | 5423 __ And(scratch, scratch, |
| 5424 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 5424 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
| 5425 *cmp1 = scratch; | 5425 *cmp1 = scratch; |
| 5426 *cmp2 = Operand(1 << Map::kIsCallable); | 5426 *cmp2 = Operand(1 << Map::kIsCallable); |
| 5427 final_branch_condition = eq; | 5427 final_branch_condition = eq; |
| 5428 | 5428 |
| 5429 } else if (String::Equals(type_name, factory->object_string())) { | 5429 } else if (String::Equals(type_name, factory->object_string())) { |
| 5430 __ JumpIfSmi(input, false_label); | 5430 __ JumpIfSmi(input, false_label); |
| 5431 __ LoadRoot(at, Heap::kNullValueRootIndex); | 5431 __ LoadRoot(at, Heap::kNullValueRootIndex); |
| 5432 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); | 5432 __ Branch(USE_DELAY_SLOT, true_label, eq, at, Operand(input)); |
| 5433 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 5433 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 5434 __ GetObjectType(input, scratch, scratch1()); | 5434 __ GetObjectType(input, scratch, scratch1()); |
| 5435 __ Branch(false_label, lt, scratch1(), Operand(FIRST_SPEC_OBJECT_TYPE)); | 5435 __ Branch(false_label, lt, scratch1(), Operand(FIRST_JS_RECEIVER_TYPE)); |
| 5436 // Check for callable or undetectable objects => false. | 5436 // Check for callable or undetectable objects => false. |
| 5437 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); | 5437 __ lbu(scratch, FieldMemOperand(scratch, Map::kBitFieldOffset)); |
| 5438 __ And(at, scratch, | 5438 __ And(at, scratch, |
| 5439 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); | 5439 Operand((1 << Map::kIsCallable) | (1 << Map::kIsUndetectable))); |
| 5440 *cmp1 = at; | 5440 *cmp1 = at; |
| 5441 *cmp2 = Operand(zero_reg); | 5441 *cmp2 = Operand(zero_reg); |
| 5442 final_branch_condition = eq; | 5442 final_branch_condition = eq; |
| 5443 | 5443 |
| 5444 // clang-format off | 5444 // clang-format off |
| 5445 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ | 5445 #define SIMD128_TYPE(TYPE, Type, type, lane_count, lane_type) \ |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5615 GenerateOsrPrologue(); | 5615 GenerateOsrPrologue(); |
| 5616 } | 5616 } |
| 5617 | 5617 |
| 5618 | 5618 |
| 5619 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { | 5619 void LCodeGen::DoForInPrepareMap(LForInPrepareMap* instr) { |
| 5620 Register result = ToRegister(instr->result()); | 5620 Register result = ToRegister(instr->result()); |
| 5621 Register object = ToRegister(instr->object()); | 5621 Register object = ToRegister(instr->object()); |
| 5622 __ And(at, object, kSmiTagMask); | 5622 __ And(at, object, kSmiTagMask); |
| 5623 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg)); | 5623 DeoptimizeIf(eq, instr, Deoptimizer::kSmi, at, Operand(zero_reg)); |
| 5624 | 5624 |
| 5625 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 5625 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_JS_RECEIVER_TYPE); |
| 5626 __ GetObjectType(object, a1, a1); | 5626 __ GetObjectType(object, a1, a1); |
| 5627 DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1, | 5627 DeoptimizeIf(le, instr, Deoptimizer::kNotAJavaScriptObject, a1, |
| 5628 Operand(LAST_JS_PROXY_TYPE)); | 5628 Operand(LAST_JS_PROXY_TYPE)); |
| 5629 | 5629 |
| 5630 Label use_cache, call_runtime; | 5630 Label use_cache, call_runtime; |
| 5631 DCHECK(object.is(a0)); | 5631 DCHECK(object.is(a0)); |
| 5632 Register null_value = t1; | 5632 Register null_value = t1; |
| 5633 __ LoadRoot(null_value, Heap::kNullValueRootIndex); | 5633 __ LoadRoot(null_value, Heap::kNullValueRootIndex); |
| 5634 __ CheckEnumCache(null_value, &call_runtime); | 5634 __ CheckEnumCache(null_value, &call_runtime); |
| 5635 | 5635 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5765 __ Push(at, ToRegister(instr->function())); | 5765 __ Push(at, ToRegister(instr->function())); |
| 5766 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5766 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5767 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5767 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5768 } | 5768 } |
| 5769 | 5769 |
| 5770 | 5770 |
| 5771 #undef __ | 5771 #undef __ |
| 5772 | 5772 |
| 5773 } // namespace internal | 5773 } // namespace internal |
| 5774 } // namespace v8 | 5774 } // namespace v8 |
| OLD | NEW |