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/crankshaft/arm64/lithium-codegen-arm64.h" | 5 #include "src/crankshaft/arm64/lithium-codegen-arm64.h" |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-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 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2252 Handle<String> class_name = instr->hydrogen()->class_name(); | 2252 Handle<String> class_name = instr->hydrogen()->class_name(); |
2253 Label* true_label = instr->TrueLabel(chunk_); | 2253 Label* true_label = instr->TrueLabel(chunk_); |
2254 Label* false_label = instr->FalseLabel(chunk_); | 2254 Label* false_label = instr->FalseLabel(chunk_); |
2255 Register input = ToRegister(instr->value()); | 2255 Register input = ToRegister(instr->value()); |
2256 Register scratch1 = ToRegister(instr->temp1()); | 2256 Register scratch1 = ToRegister(instr->temp1()); |
2257 Register scratch2 = ToRegister(instr->temp2()); | 2257 Register scratch2 = ToRegister(instr->temp2()); |
2258 | 2258 |
2259 __ JumpIfSmi(input, false_label); | 2259 __ JumpIfSmi(input, false_label); |
2260 | 2260 |
2261 Register map = scratch2; | 2261 Register map = scratch2; |
| 2262 __ CompareObjectType(input, map, scratch1, JS_FUNCTION_TYPE); |
2262 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { | 2263 if (String::Equals(isolate()->factory()->Function_string(), class_name)) { |
2263 // Assuming the following assertions, we can use the same compares to test | |
2264 // for both being a function type and being in the object type range. | |
2265 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
2266 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
2267 LAST_JS_RECEIVER_TYPE - 1); | |
2268 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); | |
2269 | |
2270 // We expect CompareObjectType to load the object instance type in scratch1. | |
2271 __ CompareObjectType(input, map, scratch1, FIRST_JS_RECEIVER_TYPE); | |
2272 __ B(lt, false_label); | |
2273 __ Cmp(scratch1, LAST_JS_RECEIVER_TYPE); | |
2274 __ B(eq, true_label); | 2264 __ B(eq, true_label); |
2275 } else { | 2265 } else { |
2276 __ IsObjectJSObjectType(input, map, scratch1, false_label); | 2266 __ B(eq, false_label); |
2277 } | 2267 } |
2278 | 2268 |
2279 // Now we are in the FIRST-LAST_NONCALLABLE_SPEC_OBJECT_TYPE range. | |
2280 // Check if the constructor in the map is a function. | 2269 // Check if the constructor in the map is a function. |
2281 { | 2270 { |
2282 UseScratchRegisterScope temps(masm()); | 2271 UseScratchRegisterScope temps(masm()); |
2283 Register instance_type = temps.AcquireX(); | 2272 Register instance_type = temps.AcquireX(); |
2284 __ GetMapConstructor(scratch1, map, scratch2, instance_type); | 2273 __ GetMapConstructor(scratch1, map, scratch2, instance_type); |
2285 __ Cmp(instance_type, JS_FUNCTION_TYPE); | 2274 __ Cmp(instance_type, JS_FUNCTION_TYPE); |
2286 } | 2275 } |
2287 // Objects with a non-function constructor have class 'Object'. | 2276 // Objects with a non-function constructor have class 'Object'. |
2288 if (String::Equals(class_name, isolate()->factory()->Object_string())) { | 2277 if (String::Equals(class_name, isolate()->factory()->Object_string())) { |
2289 __ B(ne, true_label); | 2278 __ B(ne, true_label); |
(...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5824 Handle<ScopeInfo> scope_info = instr->scope_info(); | 5813 Handle<ScopeInfo> scope_info = instr->scope_info(); |
5825 __ Push(scope_info); | 5814 __ Push(scope_info); |
5826 __ Push(ToRegister(instr->function())); | 5815 __ Push(ToRegister(instr->function())); |
5827 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5816 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5828 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5817 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5829 } | 5818 } |
5830 | 5819 |
5831 | 5820 |
5832 } // namespace internal | 5821 } // namespace internal |
5833 } // namespace v8 | 5822 } // namespace v8 |
OLD | NEW |