OLD | NEW |
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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 __ b(&done); | 2373 __ b(&done); |
2374 | 2374 |
2375 __ bind(¬_array_function); | 2375 __ bind(¬_array_function); |
2376 CreateWeakCellStub weak_cell_stub(masm->isolate()); | 2376 CreateWeakCellStub weak_cell_stub(masm->isolate()); |
2377 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); | 2377 CallStubInRecordCallTarget(masm, &weak_cell_stub, is_super); |
2378 __ bind(&done); | 2378 __ bind(&done); |
2379 } | 2379 } |
2380 | 2380 |
2381 | 2381 |
2382 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { | 2382 static void EmitContinueIfStrictOrNative(MacroAssembler* masm, Label* cont) { |
| 2383 // ----------- S t a t e ------------- |
| 2384 // -- r1 : the function to call |
| 2385 // -- r3 : the function's shared function info |
| 2386 // ----------------------------------- |
2383 // Do not transform the receiver for strict mode functions. | 2387 // Do not transform the receiver for strict mode functions. |
2384 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | |
2385 __ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset)); | 2388 __ ldr(r4, FieldMemOperand(r3, SharedFunctionInfo::kCompilerHintsOffset)); |
2386 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 2389 __ tst(r4, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
2387 kSmiTagSize))); | 2390 kSmiTagSize))); |
2388 __ b(ne, cont); | 2391 __ b(ne, cont); |
2389 | 2392 |
2390 // Do not transform the receiver for native (Compilerhints already in r3). | 2393 // Do not transform the receiver for native (Compilerhints already in r3). |
2391 __ tst(r4, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); | 2394 __ tst(r4, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
2392 __ b(ne, cont); | 2395 __ b(ne, cont); |
2393 } | 2396 } |
2394 | 2397 |
(...skipping 11 matching lines...) Expand all Loading... |
2406 __ mov(r0, r3); | 2409 __ mov(r0, r3); |
2407 ToObjectStub stub(masm->isolate()); | 2410 ToObjectStub stub(masm->isolate()); |
2408 __ CallStub(&stub); | 2411 __ CallStub(&stub); |
2409 __ pop(r1); | 2412 __ pop(r1); |
2410 } | 2413 } |
2411 __ str(r0, MemOperand(sp, argc * kPointerSize)); | 2414 __ str(r0, MemOperand(sp, argc * kPointerSize)); |
2412 __ jmp(cont); | 2415 __ jmp(cont); |
2413 } | 2416 } |
2414 | 2417 |
2415 | 2418 |
| 2419 static void EmitClassConstructorCallCheck(MacroAssembler* masm) { |
| 2420 // ----------- S t a t e ------------- |
| 2421 // -- r1 : the function to call |
| 2422 // -- r3 : the function's shared function info |
| 2423 // ----------------------------------- |
| 2424 // ClassConstructor Check: ES6 section 9.2.1 [[Call]] |
| 2425 Label non_class_constructor; |
| 2426 // Check whether the current function is a classConstructor. |
| 2427 __ ldrb(r4, FieldMemOperand(r3, SharedFunctionInfo::kFunctionKindByteOffset)); |
| 2428 __ tst(r4, Operand(SharedFunctionInfo::kClassConstructorBitsWithinByte)); |
| 2429 __ b(eq, &non_class_constructor); |
| 2430 // If we call a classConstructor Function throw a TypeError |
| 2431 // indirectly via the CallFunction builtin. |
| 2432 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
| 2433 __ bind(&non_class_constructor); |
| 2434 } |
| 2435 |
| 2436 |
2416 static void CallFunctionNoFeedback(MacroAssembler* masm, | 2437 static void CallFunctionNoFeedback(MacroAssembler* masm, |
2417 int argc, bool needs_checks, | 2438 int argc, bool needs_checks, |
2418 bool call_as_method) { | 2439 bool call_as_method) { |
2419 // r1 : the function to call | 2440 // r1 : the function to call |
2420 Label slow, wrap, cont; | 2441 Label slow, wrap, cont; |
2421 | 2442 |
2422 if (needs_checks) { | 2443 if (needs_checks) { |
2423 // Check that the function is really a JavaScript function. | 2444 // Check that the function is really a JavaScript function. |
2424 // r1: pushed function (to be verified) | 2445 // r1: pushed function (to be verified) |
2425 __ JumpIfSmi(r1, &slow); | 2446 __ JumpIfSmi(r1, &slow); |
2426 | 2447 |
2427 // Goto slow case if we do not have a function. | 2448 // Goto slow case if we do not have a function. |
2428 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); | 2449 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); |
2429 __ b(ne, &slow); | 2450 __ b(ne, &slow); |
2430 } | 2451 } |
2431 | 2452 |
| 2453 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 2454 EmitClassConstructorCallCheck(masm); |
| 2455 |
2432 // Fast-case: Invoke the function now. | 2456 // Fast-case: Invoke the function now. |
2433 // r1: pushed function | 2457 // r1: pushed function |
2434 ParameterCount actual(argc); | 2458 ParameterCount actual(argc); |
2435 | 2459 |
2436 if (call_as_method) { | 2460 if (call_as_method) { |
2437 if (needs_checks) { | 2461 if (needs_checks) { |
2438 EmitContinueIfStrictOrNative(masm, &cont); | 2462 EmitContinueIfStrictOrNative(masm, &cont); |
2439 } | 2463 } |
2440 | 2464 |
2441 // Compute the receiver in sloppy mode. | 2465 // Compute the receiver in sloppy mode. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 __ JumpIfSmi(r1, &extra_checks_or_miss); | 2611 __ JumpIfSmi(r1, &extra_checks_or_miss); |
2588 | 2612 |
2589 // Increment the call count for monomorphic function calls. | 2613 // Increment the call count for monomorphic function calls. |
2590 __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2614 __ add(r2, r2, Operand::PointerOffsetFromSmiKey(r3)); |
2591 __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize)); | 2615 __ add(r2, r2, Operand(FixedArray::kHeaderSize + kPointerSize)); |
2592 __ ldr(r3, FieldMemOperand(r2, 0)); | 2616 __ ldr(r3, FieldMemOperand(r2, 0)); |
2593 __ add(r3, r3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 2617 __ add(r3, r3, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
2594 __ str(r3, FieldMemOperand(r2, 0)); | 2618 __ str(r3, FieldMemOperand(r2, 0)); |
2595 | 2619 |
2596 __ bind(&have_js_function); | 2620 __ bind(&have_js_function); |
| 2621 |
| 2622 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 2623 EmitClassConstructorCallCheck(masm); |
| 2624 |
2597 if (CallAsMethod()) { | 2625 if (CallAsMethod()) { |
2598 EmitContinueIfStrictOrNative(masm, &cont); | 2626 EmitContinueIfStrictOrNative(masm, &cont); |
2599 // Compute the receiver in sloppy mode. | 2627 // Compute the receiver in sloppy mode. |
2600 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); | 2628 __ ldr(r3, MemOperand(sp, argc * kPointerSize)); |
2601 | 2629 |
2602 __ JumpIfSmi(r3, &wrap); | 2630 __ JumpIfSmi(r3, &wrap); |
2603 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); | 2631 __ CompareObjectType(r3, r4, r4, FIRST_SPEC_OBJECT_TYPE); |
2604 __ b(lt, &wrap); | 2632 __ b(lt, &wrap); |
2605 | 2633 |
2606 __ bind(&cont); | 2634 __ bind(&cont); |
(...skipping 2955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5562 MemOperand(fp, 6 * kPointerSize), NULL); | 5590 MemOperand(fp, 6 * kPointerSize), NULL); |
5563 } | 5591 } |
5564 | 5592 |
5565 | 5593 |
5566 #undef __ | 5594 #undef __ |
5567 | 5595 |
5568 } // namespace internal | 5596 } // namespace internal |
5569 } // namespace v8 | 5597 } // namespace v8 |
5570 | 5598 |
5571 #endif // V8_TARGET_ARCH_ARM | 5599 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |