Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: src/crankshaft/ia32/lithium-codegen-ia32.cc

Issue 1535523003: [runtime] Drop FIRST/LAST_NONCALLABLE_SPEC_OBJECT instance type range. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 Label* is_false, 2434 Label* is_false,
2435 Handle<String>class_name, 2435 Handle<String>class_name,
2436 Register input, 2436 Register input,
2437 Register temp, 2437 Register temp,
2438 Register temp2) { 2438 Register temp2) {
2439 DCHECK(!input.is(temp)); 2439 DCHECK(!input.is(temp));
2440 DCHECK(!input.is(temp2)); 2440 DCHECK(!input.is(temp2));
2441 DCHECK(!temp.is(temp2)); 2441 DCHECK(!temp.is(temp2));
2442 __ JumpIfSmi(input, is_false); 2442 __ JumpIfSmi(input, is_false);
2443 2443
2444 __ CmpObjectType(input, JS_FUNCTION_TYPE, temp);
2444 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { 2445 if (String::Equals(isolate()->factory()->Function_string(), class_name)) {
2445 // Assuming the following assertions, we can use the same compares to test
2446 // for both being a function type and being in the object type range.
2447 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
2448 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE ==
2449 LAST_JS_RECEIVER_TYPE - 1);
2450 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
2451 __ CmpObjectType(input, FIRST_JS_RECEIVER_TYPE, temp);
2452 __ j(below, is_false);
2453 __ CmpInstanceType(temp, LAST_JS_RECEIVER_TYPE);
2454 __ j(equal, is_true); 2446 __ j(equal, is_true);
2455 } else { 2447 } else {
2456 // Faster code path to avoid two compares: subtract lower bound from the 2448 __ j(equal, is_false);
2457 // actual type and do a signed compare with the width of the type range.
2458 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset));
2459 __ movzx_b(temp2, FieldOperand(temp, Map::kInstanceTypeOffset));
2460 __ sub(Operand(temp2), Immediate(FIRST_JS_RECEIVER_TYPE));
2461 __ cmp(Operand(temp2), Immediate(LAST_NONCALLABLE_SPEC_OBJECT_TYPE -
2462 FIRST_JS_RECEIVER_TYPE));
2463 __ j(above, is_false);
2464 } 2449 }
2465 2450
2466 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. 2451 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range.
2467 // Check if the constructor in the map is a function. 2452 // Check if the constructor in the map is a function.
2468 __ GetMapConstructor(temp, temp, temp2); 2453 __ GetMapConstructor(temp, temp, temp2);
2469 // Objects with a non-function constructor have class 'Object'. 2454 // Objects with a non-function constructor have class 'Object'.
2470 __ CmpInstanceType(temp2, JS_FUNCTION_TYPE); 2455 __ CmpInstanceType(temp2, JS_FUNCTION_TYPE);
2471 if (String::Equals(class_name, isolate()->factory()->Object_string())) { 2456 if (String::Equals(class_name, isolate()->factory()->Object_string())) {
2472 __ j(not_equal, is_true); 2457 __ j(not_equal, is_true);
2473 } else { 2458 } else {
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after
5514 RecordSafepoint(Safepoint::kNoLazyDeopt); 5499 RecordSafepoint(Safepoint::kNoLazyDeopt);
5515 } 5500 }
5516 5501
5517 5502
5518 #undef __ 5503 #undef __
5519 5504
5520 } // namespace internal 5505 } // namespace internal
5521 } // namespace v8 5506 } // namespace v8
5522 5507
5523 #endif // V8_TARGET_ARCH_IA32 5508 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/crankshaft/arm64/lithium-codegen-arm64.cc ('k') | src/crankshaft/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698