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 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 Label* is_false, | 2441 Label* is_false, |
2442 Handle<String>class_name, | 2442 Handle<String>class_name, |
2443 Register input, | 2443 Register input, |
2444 Register temp, | 2444 Register temp, |
2445 Register temp2) { | 2445 Register temp2) { |
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 __ GetObjectType(input, temp, temp2); |
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 __ Branch(is_true, eq, temp2, Operand(JS_FUNCTION_TYPE)); |
2454 // for both being a function type and being in the object type range. | |
2455 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
2456 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2457 LAST_JS_RECEIVER_TYPE - 1); | |
2458 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
2459 | |
2460 __ GetObjectType(input, temp, temp2); | |
2461 __ Branch(is_false, lt, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2462 __ Branch(is_true, eq, temp2, Operand(LAST_JS_RECEIVER_TYPE)); | |
2463 } else { | 2454 } else { |
2464 // Faster code path to avoid two compares: subtract lower bound from the | 2455 __ Branch(is_false, eq, temp2, Operand(JS_FUNCTION_TYPE)); |
2465 // actual type and do a signed compare with the width of the type range. | |
2466 __ GetObjectType(input, temp, temp2); | |
2467 __ Subu(temp2, temp2, Operand(FIRST_JS_RECEIVER_TYPE)); | |
2468 __ Branch(is_false, gt, temp2, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE - | |
2469 FIRST_JS_RECEIVER_TYPE)); | |
2470 } | 2456 } |
2471 | 2457 |
2472 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | |
2473 // Check if the constructor in the map is a function. | 2458 // Check if the constructor in the map is a function. |
2474 Register instance_type = scratch1(); | 2459 Register instance_type = scratch1(); |
2475 DCHECK(!instance_type.is(temp)); | 2460 DCHECK(!instance_type.is(temp)); |
2476 __ GetMapConstructor(temp, temp, temp2, instance_type); | 2461 __ GetMapConstructor(temp, temp, temp2, instance_type); |
2477 | 2462 |
2478 // Objects with a non-function constructor have class 'Object'. | 2463 // Objects with a non-function constructor have class 'Object'. |
2479 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2464 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
2480 __ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE)); | 2465 __ Branch(is_true, ne, instance_type, Operand(JS_FUNCTION_TYPE)); |
2481 } else { | 2466 } else { |
2482 __ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE)); | 2467 __ Branch(is_false, ne, instance_type, Operand(JS_FUNCTION_TYPE)); |
(...skipping 3193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5676 __ Push(at, ToRegister(instr->function())); | 5661 __ Push(at, ToRegister(instr->function())); |
5677 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5662 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5678 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5663 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5679 } | 5664 } |
5680 | 5665 |
5681 | 5666 |
5682 #undef __ | 5667 #undef __ |
5683 | 5668 |
5684 } // namespace internal | 5669 } // namespace internal |
5685 } // namespace v8 | 5670 } // namespace v8 |
OLD | NEW |