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 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 DCHECK(!input.is(temp)); | 2446 DCHECK(!input.is(temp)); |
2447 DCHECK(!input.is(temp2)); | 2447 DCHECK(!input.is(temp2)); |
2448 DCHECK(!temp.is(temp2)); | 2448 DCHECK(!temp.is(temp2)); |
2449 | 2449 |
2450 __ JumpIfSmi(input, is_false); | 2450 __ JumpIfSmi(input, is_false); |
2451 | 2451 |
2452 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2452 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2453 // Assuming the following assertions, we can use the same compares to test | 2453 // Assuming the following assertions, we can use the same compares to test |
2454 // for both being a function type and being in the object type range. | 2454 // for both being a function type and being in the object type range. |
2455 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | 2455 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); |
2456 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2457 FIRST_JS_RECEIVER_TYPE + 1); | |
2458 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 2456 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == |
2459 LAST_JS_RECEIVER_TYPE - 1); | 2457 LAST_JS_RECEIVER_TYPE - 1); |
2460 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | 2458 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
2461 | 2459 |
2462 __ GetObjectType(input, temp, temp2); | 2460 __ GetObjectType(input, temp, temp2); |
2463 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | 2461 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
2464 __ Branch(is_true, eq, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2465 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); | 2462 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); |
2466 } else { | 2463 } else { |
2467 // Faster code path to avoid two compares: subtract lower bound from the | 2464 // Faster code path to avoid two compares: subtract lower bound from the |
2468 // actual type and do a signed compare with the width of the type range. | 2465 // actual type and do a signed compare with the width of the type range. |
2469 __ GetObjectType(input, temp, temp2); | 2466 __ GetObjectType(input, temp, temp2); |
2470 __ Subu(temp2, temp2, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2467 __ Subu(temp2, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); |
2471 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | 2468 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - |
2472 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 2469 FIRST_JS_RECEIVER_TYPE)); |
2473 } | 2470 } |
2474 | 2471 |
2475 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2472 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. |
2476 // Check if the constructor in the map is a function. | 2473 // Check if the constructor in the map is a function. |
2477 Register instance_type = scratch1(); | 2474 Register instance_type = scratch1(); |
2478 DCHECK(!instance_type.is(temp)); | 2475 DCHECK(!instance_type.is(temp)); |
2479 __ GetMapConstructor(temp, temp, temp2, instance_type); | 2476 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2480 | 2477 |
2481 // Objects with a non-function constructor have class 'Object'. | 2478 // Objects with a non-function constructor have class 'Object'. |
2482 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2479 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
(...skipping 3185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5668 __ Push(at, ToRegister(instr->function())); | 5665 __ Push(at, ToRegister(instr->function())); |
5669 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5666 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5670 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5667 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5671 } | 5668 } |
5672 | 5669 |
5673 | 5670 |
5674 #undef __ | 5671 #undef __ |
5675 | 5672 |
5676 } // namespace internal | 5673 } // namespace internal |
5677 } // namespace v8 | 5674 } // namespace v8 |
OLD | NEW |