| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 | 76 |
| 77 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 77 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
| 78 // ----------- S t a t e ------------- | 78 // ----------- S t a t e ------------- |
| 79 // -- eax: number of arguments | 79 // -- eax: number of arguments |
| 80 // -- edi: constructor function | 80 // -- edi: constructor function |
| 81 // ----------------------------------- | 81 // ----------------------------------- |
| 82 | 82 |
| 83 Label non_function_call; | 83 Label non_function_call; |
| 84 // Check that function is not a smi. | 84 // Check that function is not a smi. |
| 85 __ test(edi, Immediate(kSmiTagMask)); | 85 __ JumpIfSmi(edi, &non_function_call); |
| 86 __ j(zero, &non_function_call); | |
| 87 // Check that function is a JSFunction. | 86 // Check that function is a JSFunction. |
| 88 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 87 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 89 __ j(not_equal, &non_function_call); | 88 __ j(not_equal, &non_function_call); |
| 90 | 89 |
| 91 // Jump to the function-specific construct stub. | 90 // Jump to the function-specific construct stub. |
| 92 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 91 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 93 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kConstructStubOffset)); | 92 __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kConstructStubOffset)); |
| 94 __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize)); | 93 __ lea(ebx, FieldOperand(ebx, Code::kHeaderSize)); |
| 95 __ jmp(Operand(ebx)); | 94 __ jmp(Operand(ebx)); |
| 96 | 95 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 ExternalReference::debug_step_in_fp_address(masm->isolate()); | 132 ExternalReference::debug_step_in_fp_address(masm->isolate()); |
| 134 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); | 133 __ cmp(Operand::StaticVariable(debug_step_in_fp), Immediate(0)); |
| 135 __ j(not_equal, &rt_call); | 134 __ j(not_equal, &rt_call); |
| 136 #endif | 135 #endif |
| 137 | 136 |
| 138 // Verified that the constructor is a JSFunction. | 137 // Verified that the constructor is a JSFunction. |
| 139 // Load the initial map and verify that it is in fact a map. | 138 // Load the initial map and verify that it is in fact a map. |
| 140 // edi: constructor | 139 // edi: constructor |
| 141 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 140 __ mov(eax, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 142 // Will both indicate a NULL and a Smi | 141 // Will both indicate a NULL and a Smi |
| 143 __ test(eax, Immediate(kSmiTagMask)); | 142 __ JumpIfSmi(eax, &rt_call); |
| 144 __ j(zero, &rt_call); | |
| 145 // edi: constructor | 143 // edi: constructor |
| 146 // eax: initial map (if proven valid below) | 144 // eax: initial map (if proven valid below) |
| 147 __ CmpObjectType(eax, MAP_TYPE, ebx); | 145 __ CmpObjectType(eax, MAP_TYPE, ebx); |
| 148 __ j(not_equal, &rt_call); | 146 __ j(not_equal, &rt_call); |
| 149 | 147 |
| 150 // Check that the constructor is not constructing a JSFunction (see comments | 148 // Check that the constructor is not constructing a JSFunction (see comments |
| 151 // in Runtime_NewObject in runtime.cc). In which case the initial map's | 149 // in Runtime_NewObject in runtime.cc). In which case the initial map's |
| 152 // instance type would be JS_FUNCTION_TYPE. | 150 // instance type would be JS_FUNCTION_TYPE. |
| 153 // edi: constructor | 151 // edi: constructor |
| 154 // eax: initial map | 152 // eax: initial map |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 __ bind(&entry); | 331 __ bind(&entry); |
| 334 __ dec(ecx); | 332 __ dec(ecx); |
| 335 __ j(greater_equal, &loop); | 333 __ j(greater_equal, &loop); |
| 336 | 334 |
| 337 // Call the function. | 335 // Call the function. |
| 338 if (is_api_function) { | 336 if (is_api_function) { |
| 339 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 337 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 340 Handle<Code> code = | 338 Handle<Code> code = |
| 341 masm->isolate()->builtins()->HandleApiCallConstruct(); | 339 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 342 ParameterCount expected(0); | 340 ParameterCount expected(0); |
| 343 __ InvokeCode(code, expected, expected, | 341 __ InvokeCode(code, expected, expected, RelocInfo::CODE_TARGET, |
| 344 RelocInfo::CODE_TARGET, CALL_FUNCTION); | 342 CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD); |
| 345 } else { | 343 } else { |
| 346 ParameterCount actual(eax); | 344 ParameterCount actual(eax); |
| 347 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 345 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 346 NullCallWrapper(), CALL_AS_METHOD); |
| 348 } | 347 } |
| 349 | 348 |
| 350 // Restore context from the frame. | 349 // Restore context from the frame. |
| 351 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 350 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 352 | 351 |
| 353 // If the result is an object (in the ECMA sense), we should get rid | 352 // If the result is an object (in the ECMA sense), we should get rid |
| 354 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 353 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 355 // on page 74. | 354 // on page 74. |
| 356 Label use_receiver, exit; | 355 Label use_receiver, exit; |
| 357 | 356 |
| 358 // If the result is a smi, it is *not* an object in the ECMA sense. | 357 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 359 __ test(eax, Immediate(kSmiTagMask)); | 358 __ JumpIfSmi(eax, &use_receiver); |
| 360 __ j(zero, &use_receiver); | |
| 361 | 359 |
| 362 // If the type of the result (stored in its map) is less than | 360 // If the type of the result (stored in its map) is less than |
| 363 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 361 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
| 364 __ CmpObjectType(eax, FIRST_JS_OBJECT_TYPE, ecx); | 362 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 365 __ j(above_equal, &exit); | 363 __ j(above_equal, &exit); |
| 366 | 364 |
| 367 // Throw away the result of the constructor invocation and use the | 365 // Throw away the result of the constructor invocation and use the |
| 368 // on-stack receiver as the result. | 366 // on-stack receiver as the result. |
| 369 __ bind(&use_receiver); | 367 __ bind(&use_receiver); |
| 370 __ mov(eax, Operand(esp, 0)); | 368 __ mov(eax, Operand(esp, 0)); |
| 371 | 369 |
| 372 // Restore the arguments count and leave the construct frame. | 370 // Restore the arguments count and leave the construct frame. |
| 373 __ bind(&exit); | 371 __ bind(&exit); |
| 374 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count | 372 __ mov(ebx, Operand(esp, kPointerSize)); // get arguments count |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 434 |
| 437 // Get the function from the stack and call it. | 435 // Get the function from the stack and call it. |
| 438 __ mov(edi, Operand(esp, eax, times_4, +1 * kPointerSize)); // +1 ~ receiver | 436 __ mov(edi, Operand(esp, eax, times_4, +1 * kPointerSize)); // +1 ~ receiver |
| 439 | 437 |
| 440 // Invoke the code. | 438 // Invoke the code. |
| 441 if (is_construct) { | 439 if (is_construct) { |
| 442 __ call(masm->isolate()->builtins()->JSConstructCall(), | 440 __ call(masm->isolate()->builtins()->JSConstructCall(), |
| 443 RelocInfo::CODE_TARGET); | 441 RelocInfo::CODE_TARGET); |
| 444 } else { | 442 } else { |
| 445 ParameterCount actual(eax); | 443 ParameterCount actual(eax); |
| 446 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 444 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 445 NullCallWrapper(), CALL_AS_METHOD); |
| 447 } | 446 } |
| 448 | 447 |
| 449 // Exit the JS frame. Notice that this also removes the empty | 448 // Exit the JS frame. Notice that this also removes the empty |
| 450 // context and the function left on the stack by the code | 449 // context and the function left on the stack by the code |
| 451 // invocation. | 450 // invocation. |
| 452 __ LeaveInternalFrame(); | 451 __ LeaveInternalFrame(); |
| 453 __ ret(1 * kPointerSize); // remove receiver | 452 __ ret(1 * kPointerSize); // remove receiver |
| 454 } | 453 } |
| 455 | 454 |
| 456 | 455 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 __ push(ebx); | 586 __ push(ebx); |
| 588 __ inc(eax); | 587 __ inc(eax); |
| 589 __ bind(&done); | 588 __ bind(&done); |
| 590 } | 589 } |
| 591 | 590 |
| 592 // 2. Get the function to call (passed as receiver) from the stack, check | 591 // 2. Get the function to call (passed as receiver) from the stack, check |
| 593 // if it is a function. | 592 // if it is a function. |
| 594 Label non_function; | 593 Label non_function; |
| 595 // 1 ~ return address. | 594 // 1 ~ return address. |
| 596 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); | 595 __ mov(edi, Operand(esp, eax, times_4, 1 * kPointerSize)); |
| 597 __ test(edi, Immediate(kSmiTagMask)); | 596 __ JumpIfSmi(edi, &non_function); |
| 598 __ j(zero, &non_function); | |
| 599 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 597 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
| 600 __ j(not_equal, &non_function); | 598 __ j(not_equal, &non_function); |
| 601 | 599 |
| 602 | 600 |
| 603 // 3a. Patch the first argument if necessary when calling a function. | 601 // 3a. Patch the first argument if necessary when calling a function. |
| 604 Label shift_arguments; | 602 Label shift_arguments; |
| 605 { Label convert_to_object, use_global_receiver, patch_receiver; | 603 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 606 // Change context eagerly in case we need the global receiver. | 604 // Change context eagerly in case we need the global receiver. |
| 607 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 605 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 608 | 606 |
| 609 // Do not transform the receiver for strict mode functions. | 607 // Do not transform the receiver for strict mode functions. |
| 610 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 608 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 611 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset), | 609 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset), |
| 612 1 << SharedFunctionInfo::kStrictModeBitWithinByte); | 610 1 << SharedFunctionInfo::kStrictModeBitWithinByte); |
| 613 __ j(not_equal, &shift_arguments); | 611 __ j(not_equal, &shift_arguments); |
| 614 | 612 |
| 615 // Do not transform the receiver for natives (shared already in ebx). | 613 // Do not transform the receiver for natives (shared already in ebx). |
| 616 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kES5NativeByteOffset), | 614 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kNativeByteOffset), |
| 617 1 << SharedFunctionInfo::kES5NativeBitWithinByte); | 615 1 << SharedFunctionInfo::kNativeBitWithinByte); |
| 618 __ j(not_equal, &shift_arguments); | 616 __ j(not_equal, &shift_arguments); |
| 619 | 617 |
| 620 // Compute the receiver in non-strict mode. | 618 // Compute the receiver in non-strict mode. |
| 621 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. | 619 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. |
| 622 | 620 |
| 623 // Call ToObject on the receiver if it is not an object, or use the | 621 // Call ToObject on the receiver if it is not an object, or use the |
| 624 // global object if it is null or undefined. | 622 // global object if it is null or undefined. |
| 625 __ test(ebx, Immediate(kSmiTagMask)); | 623 __ JumpIfSmi(ebx, &convert_to_object); |
| 626 __ j(zero, &convert_to_object); | |
| 627 __ cmp(ebx, factory->null_value()); | 624 __ cmp(ebx, factory->null_value()); |
| 628 __ j(equal, &use_global_receiver); | 625 __ j(equal, &use_global_receiver); |
| 629 __ cmp(ebx, factory->undefined_value()); | 626 __ cmp(ebx, factory->undefined_value()); |
| 630 __ j(equal, &use_global_receiver); | 627 __ j(equal, &use_global_receiver); |
| 631 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 628 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 632 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 629 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 633 __ CmpObjectType(ebx, FIRST_JS_OBJECT_TYPE, ecx); | |
| 634 __ j(above_equal, &shift_arguments); | 630 __ j(above_equal, &shift_arguments); |
| 635 | 631 |
| 636 __ bind(&convert_to_object); | 632 __ bind(&convert_to_object); |
| 637 __ EnterInternalFrame(); // In order to preserve argument count. | 633 __ EnterInternalFrame(); // In order to preserve argument count. |
| 638 __ SmiTag(eax); | 634 __ SmiTag(eax); |
| 639 __ push(eax); | 635 __ push(eax); |
| 640 | 636 |
| 641 __ push(ebx); | 637 __ push(ebx); |
| 642 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 638 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 643 __ mov(ebx, eax); | 639 __ mov(ebx, eax); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 __ mov(ebx, | 704 __ mov(ebx, |
| 709 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); | 705 FieldOperand(edx, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 710 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); | 706 __ mov(edx, FieldOperand(edi, JSFunction::kCodeEntryOffset)); |
| 711 __ SmiUntag(ebx); | 707 __ SmiUntag(ebx); |
| 712 __ SetCallKind(ecx, CALL_AS_METHOD); | 708 __ SetCallKind(ecx, CALL_AS_METHOD); |
| 713 __ cmp(eax, Operand(ebx)); | 709 __ cmp(eax, Operand(ebx)); |
| 714 __ j(not_equal, | 710 __ j(not_equal, |
| 715 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); | 711 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline()); |
| 716 | 712 |
| 717 ParameterCount expected(0); | 713 ParameterCount expected(0); |
| 718 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION); | 714 __ InvokeCode(Operand(edx), expected, expected, JUMP_FUNCTION, |
| 715 NullCallWrapper(), CALL_AS_METHOD); |
| 719 } | 716 } |
| 720 | 717 |
| 721 | 718 |
| 722 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 719 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 723 __ EnterInternalFrame(); | 720 __ EnterInternalFrame(); |
| 724 | 721 |
| 725 __ push(Operand(ebp, 4 * kPointerSize)); // push this | 722 __ push(Operand(ebp, 4 * kPointerSize)); // push this |
| 726 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments | 723 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments |
| 727 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); | 724 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); |
| 728 | 725 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 | 767 |
| 771 // Do not transform the receiver for strict mode functions. | 768 // Do not transform the receiver for strict mode functions. |
| 772 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 769 __ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 773 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset), | 770 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrictModeByteOffset), |
| 774 1 << SharedFunctionInfo::kStrictModeBitWithinByte); | 771 1 << SharedFunctionInfo::kStrictModeBitWithinByte); |
| 775 __ j(not_equal, &push_receiver); | 772 __ j(not_equal, &push_receiver); |
| 776 | 773 |
| 777 Factory* factory = masm->isolate()->factory(); | 774 Factory* factory = masm->isolate()->factory(); |
| 778 | 775 |
| 779 // Do not transform the receiver for natives (shared already in ecx). | 776 // Do not transform the receiver for natives (shared already in ecx). |
| 780 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kES5NativeByteOffset), | 777 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kNativeByteOffset), |
| 781 1 << SharedFunctionInfo::kES5NativeBitWithinByte); | 778 1 << SharedFunctionInfo::kNativeBitWithinByte); |
| 782 __ j(not_equal, &push_receiver); | 779 __ j(not_equal, &push_receiver); |
| 783 | 780 |
| 784 // Compute the receiver in non-strict mode. | 781 // Compute the receiver in non-strict mode. |
| 785 // Call ToObject on the receiver if it is not an object, or use the | 782 // Call ToObject on the receiver if it is not an object, or use the |
| 786 // global object if it is null or undefined. | 783 // global object if it is null or undefined. |
| 787 __ test(ebx, Immediate(kSmiTagMask)); | 784 __ JumpIfSmi(ebx, &call_to_object); |
| 788 __ j(zero, &call_to_object); | |
| 789 __ cmp(ebx, factory->null_value()); | 785 __ cmp(ebx, factory->null_value()); |
| 790 __ j(equal, &use_global_receiver); | 786 __ j(equal, &use_global_receiver); |
| 791 __ cmp(ebx, factory->undefined_value()); | 787 __ cmp(ebx, factory->undefined_value()); |
| 792 __ j(equal, &use_global_receiver); | 788 __ j(equal, &use_global_receiver); |
| 793 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 789 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 794 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 790 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 795 __ CmpObjectType(ebx, FIRST_JS_OBJECT_TYPE, ecx); | |
| 796 __ j(above_equal, &push_receiver); | 791 __ j(above_equal, &push_receiver); |
| 797 | 792 |
| 798 __ bind(&call_to_object); | 793 __ bind(&call_to_object); |
| 799 __ push(ebx); | 794 __ push(ebx); |
| 800 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 795 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 801 __ mov(ebx, Operand(eax)); | 796 __ mov(ebx, Operand(eax)); |
| 802 __ jmp(&push_receiver); | 797 __ jmp(&push_receiver); |
| 803 | 798 |
| 804 // Use the current global receiver object as the receiver. | 799 // Use the current global receiver object as the receiver. |
| 805 __ bind(&use_global_receiver); | 800 __ bind(&use_global_receiver); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 __ mov(Operand(ebp, kIndexOffset), eax); | 833 __ mov(Operand(ebp, kIndexOffset), eax); |
| 839 | 834 |
| 840 __ bind(&entry); | 835 __ bind(&entry); |
| 841 __ cmp(eax, Operand(ebp, kLimitOffset)); | 836 __ cmp(eax, Operand(ebp, kLimitOffset)); |
| 842 __ j(not_equal, &loop); | 837 __ j(not_equal, &loop); |
| 843 | 838 |
| 844 // Invoke the function. | 839 // Invoke the function. |
| 845 ParameterCount actual(eax); | 840 ParameterCount actual(eax); |
| 846 __ SmiUntag(eax); | 841 __ SmiUntag(eax); |
| 847 __ mov(edi, Operand(ebp, 4 * kPointerSize)); | 842 __ mov(edi, Operand(ebp, 4 * kPointerSize)); |
| 848 __ InvokeFunction(edi, actual, CALL_FUNCTION); | 843 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 844 NullCallWrapper(), CALL_AS_METHOD); |
| 849 | 845 |
| 850 __ LeaveInternalFrame(); | 846 __ LeaveInternalFrame(); |
| 851 __ ret(3 * kPointerSize); // remove this, receiver, and arguments | 847 __ ret(3 * kPointerSize); // remove this, receiver, and arguments |
| 852 } | 848 } |
| 853 | 849 |
| 854 | 850 |
| 855 // Number of empty elements to allocate for an empty array. | 851 // Number of empty elements to allocate for an empty array. |
| 856 static const int kPreallocatedArrayElements = 4; | 852 static const int kPreallocatedArrayElements = 4; |
| 857 | 853 |
| 858 | 854 |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 1377 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 1382 | 1378 |
| 1383 // We're done. Return. | 1379 // We're done. Return. |
| 1384 __ ret(0); | 1380 __ ret(0); |
| 1385 | 1381 |
| 1386 // The argument was not found in the number to string cache. Check | 1382 // The argument was not found in the number to string cache. Check |
| 1387 // if it's a string already before calling the conversion builtin. | 1383 // if it's a string already before calling the conversion builtin. |
| 1388 Label convert_argument; | 1384 Label convert_argument; |
| 1389 __ bind(¬_cached); | 1385 __ bind(¬_cached); |
| 1390 STATIC_ASSERT(kSmiTag == 0); | 1386 STATIC_ASSERT(kSmiTag == 0); |
| 1391 __ test(eax, Immediate(kSmiTagMask)); | 1387 __ JumpIfSmi(eax, &convert_argument); |
| 1392 __ j(zero, &convert_argument); | |
| 1393 Condition is_string = masm->IsObjectStringType(eax, ebx, ecx); | 1388 Condition is_string = masm->IsObjectStringType(eax, ebx, ecx); |
| 1394 __ j(NegateCondition(is_string), &convert_argument); | 1389 __ j(NegateCondition(is_string), &convert_argument); |
| 1395 __ mov(ebx, eax); | 1390 __ mov(ebx, eax); |
| 1396 __ IncrementCounter(counters->string_ctor_string_value(), 1); | 1391 __ IncrementCounter(counters->string_ctor_string_value(), 1); |
| 1397 __ jmp(&argument_is_string); | 1392 __ jmp(&argument_is_string); |
| 1398 | 1393 |
| 1399 // Invoke the conversion builtin and put the result into ebx. | 1394 // Invoke the conversion builtin and put the result into ebx. |
| 1400 __ bind(&convert_argument); | 1395 __ bind(&convert_argument); |
| 1401 __ IncrementCounter(counters->string_ctor_conversions(), 1); | 1396 __ IncrementCounter(counters->string_ctor_conversions(), 1); |
| 1402 __ EnterInternalFrame(); | 1397 __ EnterInternalFrame(); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1607 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1613 generator.Generate(); | 1608 generator.Generate(); |
| 1614 } | 1609 } |
| 1615 | 1610 |
| 1616 | 1611 |
| 1617 #undef __ | 1612 #undef __ |
| 1618 } | 1613 } |
| 1619 } // namespace v8::internal | 1614 } // namespace v8::internal |
| 1620 | 1615 |
| 1621 #endif // V8_TARGET_ARCH_IA32 | 1616 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |