OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/arm64/frames-arm64.h" | 5 #include "src/arm64/frames-arm64.h" |
6 #include "src/arm64/lithium-codegen-arm64.h" | 6 #include "src/arm64/lithium-codegen-arm64.h" |
7 #include "src/arm64/lithium-gap-resolver-arm64.h" | 7 #include "src/arm64/lithium-gap-resolver-arm64.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 Handle<String> class_name = instr->hydrogen()->class_name(); | 2348 Handle<String> class_name = instr->hydrogen()->class_name(); |
2349 Label* true_label = instr->TrueLabel(chunk_); | 2349 Label* true_label = instr->TrueLabel(chunk_); |
2350 Label* false_label = instr->FalseLabel(chunk_); | 2350 Label* false_label = instr->FalseLabel(chunk_); |
2351 Register input = ToRegister(instr->value()); | 2351 Register input = ToRegister(instr->value()); |
2352 Register scratch1 = ToRegister(instr->temp1()); | 2352 Register scratch1 = ToRegister(instr->temp1()); |
2353 Register scratch2 = ToRegister(instr->temp2()); | 2353 Register scratch2 = ToRegister(instr->temp2()); |
2354 | 2354 |
2355 __ JumpIfSmi(input, false_label); | 2355 __ JumpIfSmi(input, false_label); |
2356 | 2356 |
2357 Register map = scratch2; | 2357 Register map = scratch2; |
| 2358 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
| 2359 __ CompareObjectType(input, map, scratch1, FIRST_JS_RECEIVER_TYPE); |
| 2360 __ B(lt, false_label); |
| 2361 |
| 2362 // Objects with [[Call]] have class 'Function'. |
| 2363 Register bit_field = scratch1; |
| 2364 __ Ldrb(bit_field, FieldMemOperand(map, Map::kBitFieldOffset)); |
| 2365 __ Tst(bit_field, 1 << Map::kIsCallable); |
2358 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2366 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2359 // Assuming the following assertions, we can use the same compares to test | 2367 __ B(ne, true_label); |
2360 // for both being a function type and being in the object type range. | |
2361 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
2362 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2363 FIRST_SPEC_OBJECT_TYPE + 1); | |
2364 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2365 LAST_SPEC_OBJECT_TYPE - 1); | |
2366 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | |
2367 | |
2368 // We expect CompareObjectType to load the object instance type in scratch1. | |
2369 __ CompareObjectType(input, map, scratch1, FIRST_SPEC_OBJECT_TYPE); | |
2370 __ B(lt, false_label); | |
2371 __ B(eq, true_label); | |
2372 __ Cmp(scratch1, LAST_SPEC_OBJECT_TYPE); | |
2373 __ B(eq, true_label); | |
2374 } else { | 2368 } else { |
2375 __ IsObjectJSObjectType(input, map, scratch1, false_label); | 2369 __ B(ne, false_label); |
2376 } | 2370 } |
2377 | 2371 |
2378 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | 2372 // Now we are in the FIRST-LAST_JS_RECEIVER_TYPE range. |
2379 // Check if the constructor in the map is a function. | 2373 // Check if the constructor in the map is a function. |
2380 { | 2374 { |
2381 UseScratchRegisterScope temps(masm()); | 2375 UseScratchRegisterScope temps(masm()); |
2382 Register instance_type = temps.AcquireX(); | 2376 Register instance_type = temps.AcquireX(); |
2383 __ GetMapConstructor(scratch1, map, scratch2, instance_type); | 2377 __ GetMapConstructor(scratch1, map, scratch2, instance_type); |
2384 __ Cmp(instance_type, JS_FUNCTION_TYPE); | 2378 __ Cmp(instance_type, JS_FUNCTION_TYPE); |
2385 } | 2379 } |
2386 // Objects with a non-function constructor have class 'Object'. | 2380 // Objects with a non-function constructor have class 'Object'. |
2387 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2381 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
2388 __ B(ne, true_label); | 2382 __ B(ne, true_label); |
(...skipping 3659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6048 Handle<ScopeInfo> scope_info = instr->scope_info(); | 6042 Handle<ScopeInfo> scope_info = instr->scope_info(); |
6049 __ Push(scope_info); | 6043 __ Push(scope_info); |
6050 __ Push(ToRegister(instr->function())); | 6044 __ Push(ToRegister(instr->function())); |
6051 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6045 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6052 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6046 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6053 } | 6047 } |
6054 | 6048 |
6055 | 6049 |
6056 } // namespace internal | 6050 } // namespace internal |
6057 } // namespace v8 | 6051 } // namespace v8 |
OLD | NEW |