| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 __ cmp(ecx, eax); | 466 __ cmp(ecx, eax); |
| 467 __ j(not_equal, &loop); | 467 __ j(not_equal, &loop); |
| 468 | 468 |
| 469 // Get the function from the stack and call it. | 469 // Get the function from the stack and call it. |
| 470 // kPointerSize for the receiver. | 470 // kPointerSize for the receiver. |
| 471 __ mov(edi, Operand(esp, eax, times_4, kPointerSize)); | 471 __ mov(edi, Operand(esp, eax, times_4, kPointerSize)); |
| 472 | 472 |
| 473 // Invoke the code. | 473 // Invoke the code. |
| 474 if (is_construct) { | 474 if (is_construct) { |
| 475 // No type feedback cell is available | 475 // No type feedback cell is available |
| 476 Handle<Object> undefined_sentinel( | 476 Handle<Object> megamorphic_sentinel = |
| 477 masm->isolate()->heap()->undefined_value(), masm->isolate()); | 477 TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()); |
| 478 __ mov(ebx, Immediate(undefined_sentinel)); | 478 __ mov(ebx, Immediate(megamorphic_sentinel)); |
| 479 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 479 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| 480 __ CallStub(&stub); | 480 __ CallStub(&stub); |
| 481 } else { | 481 } else { |
| 482 ParameterCount actual(eax); | 482 ParameterCount actual(eax); |
| 483 __ InvokeFunction(edi, actual, CALL_FUNCTION, | 483 __ InvokeFunction(edi, actual, CALL_FUNCTION, |
| 484 NullCallWrapper()); | 484 NullCallWrapper()); |
| 485 } | 485 } |
| 486 | 486 |
| 487 // Exit the internal frame. Notice that this also removes the empty. | 487 // Exit the internal frame. Notice that this also removes the empty. |
| 488 // context and the function left on the stack by the code | 488 // context and the function left on the stack by the code |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); | 730 __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset)); |
| 731 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset), | 731 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kStrictModeByteOffset), |
| 732 1 << SharedFunctionInfo::kStrictModeBitWithinByte); | 732 1 << SharedFunctionInfo::kStrictModeBitWithinByte); |
| 733 __ j(not_equal, &shift_arguments); | 733 __ j(not_equal, &shift_arguments); |
| 734 | 734 |
| 735 // Do not transform the receiver for natives (shared already in ebx). | 735 // Do not transform the receiver for natives (shared already in ebx). |
| 736 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kNativeByteOffset), | 736 __ test_b(FieldOperand(ebx, SharedFunctionInfo::kNativeByteOffset), |
| 737 1 << SharedFunctionInfo::kNativeBitWithinByte); | 737 1 << SharedFunctionInfo::kNativeBitWithinByte); |
| 738 __ j(not_equal, &shift_arguments); | 738 __ j(not_equal, &shift_arguments); |
| 739 | 739 |
| 740 // Compute the receiver in non-strict mode. | 740 // Compute the receiver in sloppy mode. |
| 741 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. | 741 __ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument. |
| 742 | 742 |
| 743 // Call ToObject on the receiver if it is not an object, or use the | 743 // Call ToObject on the receiver if it is not an object, or use the |
| 744 // global object if it is null or undefined. | 744 // global object if it is null or undefined. |
| 745 __ JumpIfSmi(ebx, &convert_to_object); | 745 __ JumpIfSmi(ebx, &convert_to_object); |
| 746 __ cmp(ebx, factory->null_value()); | 746 __ cmp(ebx, factory->null_value()); |
| 747 __ j(equal, &use_global_receiver); | 747 __ j(equal, &use_global_receiver); |
| 748 __ cmp(ebx, factory->undefined_value()); | 748 __ cmp(ebx, factory->undefined_value()); |
| 749 __ j(equal, &use_global_receiver); | 749 __ j(equal, &use_global_receiver); |
| 750 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 750 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 1 << SharedFunctionInfo::kStrictModeBitWithinByte); | 916 1 << SharedFunctionInfo::kStrictModeBitWithinByte); |
| 917 __ j(not_equal, &push_receiver); | 917 __ j(not_equal, &push_receiver); |
| 918 | 918 |
| 919 Factory* factory = masm->isolate()->factory(); | 919 Factory* factory = masm->isolate()->factory(); |
| 920 | 920 |
| 921 // Do not transform the receiver for natives (shared already in ecx). | 921 // Do not transform the receiver for natives (shared already in ecx). |
| 922 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kNativeByteOffset), | 922 __ test_b(FieldOperand(ecx, SharedFunctionInfo::kNativeByteOffset), |
| 923 1 << SharedFunctionInfo::kNativeBitWithinByte); | 923 1 << SharedFunctionInfo::kNativeBitWithinByte); |
| 924 __ j(not_equal, &push_receiver); | 924 __ j(not_equal, &push_receiver); |
| 925 | 925 |
| 926 // Compute the receiver in non-strict mode. | 926 // Compute the receiver in sloppy mode. |
| 927 // Call ToObject on the receiver if it is not an object, or use the | 927 // Call ToObject on the receiver if it is not an object, or use the |
| 928 // global object if it is null or undefined. | 928 // global object if it is null or undefined. |
| 929 __ JumpIfSmi(ebx, &call_to_object); | 929 __ JumpIfSmi(ebx, &call_to_object); |
| 930 __ cmp(ebx, factory->null_value()); | 930 __ cmp(ebx, factory->null_value()); |
| 931 __ j(equal, &use_global_receiver); | 931 __ j(equal, &use_global_receiver); |
| 932 __ cmp(ebx, factory->undefined_value()); | 932 __ cmp(ebx, factory->undefined_value()); |
| 933 __ j(equal, &use_global_receiver); | 933 __ j(equal, &use_global_receiver); |
| 934 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 934 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 935 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); | 935 __ CmpObjectType(ebx, FIRST_SPEC_OBJECT_TYPE, ecx); |
| 936 __ j(above_equal, &push_receiver); | 936 __ j(above_equal, &push_receiver); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); | 1050 __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset)); |
| 1051 // Will both indicate a NULL and a Smi. | 1051 // Will both indicate a NULL and a Smi. |
| 1052 __ test(ebx, Immediate(kSmiTagMask)); | 1052 __ test(ebx, Immediate(kSmiTagMask)); |
| 1053 __ Assert(not_zero, kUnexpectedInitialMapForArrayFunction); | 1053 __ Assert(not_zero, kUnexpectedInitialMapForArrayFunction); |
| 1054 __ CmpObjectType(ebx, MAP_TYPE, ecx); | 1054 __ CmpObjectType(ebx, MAP_TYPE, ecx); |
| 1055 __ Assert(equal, kUnexpectedInitialMapForArrayFunction); | 1055 __ Assert(equal, kUnexpectedInitialMapForArrayFunction); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 // Run the native code for the Array function called as a normal function. | 1058 // Run the native code for the Array function called as a normal function. |
| 1059 // tail call a stub | 1059 // tail call a stub |
| 1060 Handle<Object> undefined_sentinel( | 1060 Handle<Object> megamorphic_sentinel = |
| 1061 masm->isolate()->heap()->undefined_value(), | 1061 TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()); |
| 1062 masm->isolate()); | 1062 __ mov(ebx, Immediate(megamorphic_sentinel)); |
| 1063 __ mov(ebx, Immediate(undefined_sentinel)); | |
| 1064 ArrayConstructorStub stub(masm->isolate()); | 1063 ArrayConstructorStub stub(masm->isolate()); |
| 1065 __ TailCallStub(&stub); | 1064 __ TailCallStub(&stub); |
| 1066 } | 1065 } |
| 1067 | 1066 |
| 1068 | 1067 |
| 1069 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 1068 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 1070 // ----------- S t a t e ------------- | 1069 // ----------- S t a t e ------------- |
| 1071 // -- eax : number of arguments | 1070 // -- eax : number of arguments |
| 1072 // -- edi : constructor function | 1071 // -- edi : constructor function |
| 1073 // -- esp[0] : return address | 1072 // -- esp[0] : return address |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1364 |
| 1366 __ bind(&ok); | 1365 __ bind(&ok); |
| 1367 __ ret(0); | 1366 __ ret(0); |
| 1368 } | 1367 } |
| 1369 | 1368 |
| 1370 #undef __ | 1369 #undef __ |
| 1371 } | 1370 } |
| 1372 } // namespace v8::internal | 1371 } // namespace v8::internal |
| 1373 | 1372 |
| 1374 #endif // V8_TARGET_ARCH_IA32 | 1373 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |