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 #if V8_TARGET_ARCH_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 3372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3383 __ Ldr(x0, MemOperand(x12, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 3383 __ Ldr(x0, MemOperand(x12, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
3384 | 3384 |
3385 __ Bind(&exit); | 3385 __ Bind(&exit); |
3386 context()->Plug(x0); | 3386 context()->Plug(x0); |
3387 } | 3387 } |
3388 | 3388 |
3389 | 3389 |
3390 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { | 3390 void FullCodeGenerator::EmitClassOf(CallRuntime* expr) { |
3391 ASM_LOCATION("FullCodeGenerator::EmitClassOf"); | 3391 ASM_LOCATION("FullCodeGenerator::EmitClassOf"); |
3392 ZoneList<Expression*>* args = expr->arguments(); | 3392 ZoneList<Expression*>* args = expr->arguments(); |
3393 DCHECK(args->length() == 1); | 3393 DCHECK_EQ(1, args->length()); |
3394 Label done, null, function, non_function_constructor; | 3394 Label done, null, function, non_function_constructor; |
3395 | 3395 |
3396 VisitForAccumulatorValue(args->at(0)); | 3396 VisitForAccumulatorValue(args->at(0)); |
3397 | 3397 |
3398 // If the object is a smi, we return null. | 3398 // If the object is a smi, we return null. |
3399 __ JumpIfSmi(x0, &null); | 3399 __ JumpIfSmi(x0, &null); |
3400 | 3400 |
3401 // Check that the object is a JS object but take special care of JS | 3401 // If the object is not a receiver, we return null. |
3402 // functions to make sure they have 'Function' as their class. | 3402 STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE); |
3403 // Assume that there are only two callable types, and one of them is at | 3403 __ CompareObjectType(x0, x10, x11, FIRST_JS_RECEIVER_TYPE); |
3404 // either end of the type range for JS object types. Saves extra comparisons. | |
3405 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); | |
3406 __ CompareObjectType(x0, x10, x11, FIRST_SPEC_OBJECT_TYPE); | |
3407 // x10: object's map. | 3404 // x10: object's map. |
3408 // x11: object's type. | 3405 // x11: object's type. |
3409 __ B(lt, &null); | 3406 __ B(lt, &null); |
3410 STATIC_ASSERT(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE == | |
3411 FIRST_SPEC_OBJECT_TYPE + 1); | |
3412 __ B(eq, &function); | |
3413 | 3407 |
3414 __ Cmp(x11, LAST_SPEC_OBJECT_TYPE); | 3408 // According to ES5 section 15 Standard Built-in ECMAScript Objects, the |
3415 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == | 3409 // [[Class]] of builtin objects is "Function" if a [[Call]] internal |
3416 LAST_SPEC_OBJECT_TYPE - 1); | 3410 // method is present. |
3417 __ B(eq, &function); | 3411 __ Ldrb(x11, FieldMemOperand(x10, Map::kBitFieldOffset)); |
3418 // Assume that there is no larger type. | 3412 __ Tst(x11, 1 << Map::kIsCallable); |
3419 STATIC_ASSERT(LAST_NONCALLABLE_SPEC_OBJECT_TYPE == LAST_TYPE - 1); | 3413 __ B(ne, &function); |
3420 | 3414 |
3421 // Check if the constructor in the map is a JS function. | 3415 // Check if the constructor in the map is a JS function. |
3422 Register instance_type = x14; | 3416 Register instance_type = x14; |
3423 __ GetMapConstructor(x12, x10, x13, instance_type); | 3417 __ GetMapConstructor(x12, x10, x13, instance_type); |
3424 __ Cmp(instance_type, JS_FUNCTION_TYPE); | 3418 __ Cmp(instance_type, JS_FUNCTION_TYPE); |
3425 __ B(ne, &non_function_constructor); | 3419 __ B(ne, &non_function_constructor); |
3426 | 3420 |
3427 // x12 now contains the constructor function. Grab the | 3421 // x12 now contains the constructor function. Grab the |
3428 // instance class name from there. | 3422 // instance class name from there. |
3429 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset)); | 3423 __ Ldr(x13, FieldMemOperand(x12, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 } | 5332 } |
5339 | 5333 |
5340 return INTERRUPT; | 5334 return INTERRUPT; |
5341 } | 5335 } |
5342 | 5336 |
5343 | 5337 |
5344 } // namespace internal | 5338 } // namespace internal |
5345 } // namespace v8 | 5339 } // namespace v8 |
5346 | 5340 |
5347 #endif // V8_TARGET_ARCH_ARM64 | 5341 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |