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