| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { | 612 void Builtins::Generate_JSConstructCall(MacroAssembler* masm) { |
| 613 // ----------- S t a t e ------------- | 613 // ----------- S t a t e ------------- |
| 614 // -- r0 : number of arguments | 614 // -- r0 : number of arguments |
| 615 // -- r1 : constructor function | 615 // -- r1 : constructor function |
| 616 // -- lr : return address | 616 // -- lr : return address |
| 617 // -- sp[...]: constructor arguments | 617 // -- sp[...]: constructor arguments |
| 618 // ----------------------------------- | 618 // ----------------------------------- |
| 619 | 619 |
| 620 Label non_function_call; | 620 Label non_function_call; |
| 621 // Check that the function is not a smi. | 621 // Check that the function is not a smi. |
| 622 __ tst(r1, Operand(kSmiTagMask)); | 622 __ JumpIfSmi(r1, &non_function_call); |
| 623 __ b(eq, &non_function_call); | |
| 624 // Check that the function is a JSFunction. | 623 // Check that the function is a JSFunction. |
| 625 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 624 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 626 __ b(ne, &non_function_call); | 625 __ b(ne, &non_function_call); |
| 627 | 626 |
| 628 // Jump to the function-specific construct stub. | 627 // Jump to the function-specific construct stub. |
| 629 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 628 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 630 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset)); | 629 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kConstructStubOffset)); |
| 631 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); | 630 __ add(pc, r2, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 632 | 631 |
| 633 // r0: number of arguments | 632 // r0: number of arguments |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 ExternalReference::debug_step_in_fp_address(isolate); | 667 ExternalReference::debug_step_in_fp_address(isolate); |
| 669 __ mov(r2, Operand(debug_step_in_fp)); | 668 __ mov(r2, Operand(debug_step_in_fp)); |
| 670 __ ldr(r2, MemOperand(r2)); | 669 __ ldr(r2, MemOperand(r2)); |
| 671 __ tst(r2, r2); | 670 __ tst(r2, r2); |
| 672 __ b(ne, &rt_call); | 671 __ b(ne, &rt_call); |
| 673 #endif | 672 #endif |
| 674 | 673 |
| 675 // Load the initial map and verify that it is in fact a map. | 674 // Load the initial map and verify that it is in fact a map. |
| 676 // r1: constructor function | 675 // r1: constructor function |
| 677 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 676 __ ldr(r2, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
| 678 __ tst(r2, Operand(kSmiTagMask)); | 677 __ JumpIfSmi(r2, &rt_call); |
| 679 __ b(eq, &rt_call); | |
| 680 __ CompareObjectType(r2, r3, r4, MAP_TYPE); | 678 __ CompareObjectType(r2, r3, r4, MAP_TYPE); |
| 681 __ b(ne, &rt_call); | 679 __ b(ne, &rt_call); |
| 682 | 680 |
| 683 // Check that the constructor is not constructing a JSFunction (see comments | 681 // Check that the constructor is not constructing a JSFunction (see comments |
| 684 // in Runtime_NewObject in runtime.cc). In which case the initial map's | 682 // in Runtime_NewObject in runtime.cc). In which case the initial map's |
| 685 // instance type would be JS_FUNCTION_TYPE. | 683 // instance type would be JS_FUNCTION_TYPE. |
| 686 // r1: constructor function | 684 // r1: constructor function |
| 687 // r2: initial map | 685 // r2: initial map |
| 688 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE); | 686 __ CompareInstanceType(r2, r3, JS_FUNCTION_TYPE); |
| 689 __ b(eq, &rt_call); | 687 __ b(eq, &rt_call); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 | 906 |
| 909 // Call the function. | 907 // Call the function. |
| 910 // r0: number of arguments | 908 // r0: number of arguments |
| 911 // r1: constructor function | 909 // r1: constructor function |
| 912 if (is_api_function) { | 910 if (is_api_function) { |
| 913 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 911 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 914 Handle<Code> code = | 912 Handle<Code> code = |
| 915 masm->isolate()->builtins()->HandleApiCallConstruct(); | 913 masm->isolate()->builtins()->HandleApiCallConstruct(); |
| 916 ParameterCount expected(0); | 914 ParameterCount expected(0); |
| 917 __ InvokeCode(code, expected, expected, | 915 __ InvokeCode(code, expected, expected, |
| 918 RelocInfo::CODE_TARGET, CALL_FUNCTION); | 916 RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD); |
| 919 } else { | 917 } else { |
| 920 ParameterCount actual(r0); | 918 ParameterCount actual(r0); |
| 921 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 919 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 920 NullCallWrapper(), CALL_AS_METHOD); |
| 922 } | 921 } |
| 923 | 922 |
| 924 // Pop the function from the stack. | 923 // Pop the function from the stack. |
| 925 // sp[0]: constructor function | 924 // sp[0]: constructor function |
| 926 // sp[2]: receiver | 925 // sp[2]: receiver |
| 927 // sp[3]: constructor function | 926 // sp[3]: constructor function |
| 928 // sp[4]: number of arguments (smi-tagged) | 927 // sp[4]: number of arguments (smi-tagged) |
| 929 __ pop(); | 928 __ pop(); |
| 930 | 929 |
| 931 // Restore context from the frame. | 930 // Restore context from the frame. |
| 932 // r0: result | 931 // r0: result |
| 933 // sp[0]: receiver | 932 // sp[0]: receiver |
| 934 // sp[1]: constructor function | 933 // sp[1]: constructor function |
| 935 // sp[2]: number of arguments (smi-tagged) | 934 // sp[2]: number of arguments (smi-tagged) |
| 936 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 935 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 937 | 936 |
| 938 // If the result is an object (in the ECMA sense), we should get rid | 937 // If the result is an object (in the ECMA sense), we should get rid |
| 939 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 | 938 // of the receiver and use the result; see ECMA-262 section 13.2.2-7 |
| 940 // on page 74. | 939 // on page 74. |
| 941 Label use_receiver, exit; | 940 Label use_receiver, exit; |
| 942 | 941 |
| 943 // If the result is a smi, it is *not* an object in the ECMA sense. | 942 // If the result is a smi, it is *not* an object in the ECMA sense. |
| 944 // r0: result | 943 // r0: result |
| 945 // sp[0]: receiver (newly allocated object) | 944 // sp[0]: receiver (newly allocated object) |
| 946 // sp[1]: constructor function | 945 // sp[1]: constructor function |
| 947 // sp[2]: number of arguments (smi-tagged) | 946 // sp[2]: number of arguments (smi-tagged) |
| 948 __ tst(r0, Operand(kSmiTagMask)); | 947 __ JumpIfSmi(r0, &use_receiver); |
| 949 __ b(eq, &use_receiver); | |
| 950 | 948 |
| 951 // If the type of the result (stored in its map) is less than | 949 // If the type of the result (stored in its map) is less than |
| 952 // FIRST_JS_OBJECT_TYPE, it is not an object in the ECMA sense. | 950 // FIRST_SPEC_OBJECT_TYPE, it is not an object in the ECMA sense. |
| 953 __ CompareObjectType(r0, r3, r3, FIRST_JS_OBJECT_TYPE); | 951 __ CompareObjectType(r0, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 954 __ b(ge, &exit); | 952 __ b(ge, &exit); |
| 955 | 953 |
| 956 // Throw away the result of the constructor invocation and use the | 954 // Throw away the result of the constructor invocation and use the |
| 957 // on-stack receiver as the result. | 955 // on-stack receiver as the result. |
| 958 __ bind(&use_receiver); | 956 __ bind(&use_receiver); |
| 959 __ ldr(r0, MemOperand(sp)); | 957 __ ldr(r0, MemOperand(sp)); |
| 960 | 958 |
| 961 // Remove receiver from the stack, remove caller arguments, and | 959 // Remove receiver from the stack, remove caller arguments, and |
| 962 // return. | 960 // return. |
| 963 __ bind(&exit); | 961 __ bind(&exit); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 __ mov(r5, Operand(r4)); | 1037 __ mov(r5, Operand(r4)); |
| 1040 __ mov(r6, Operand(r4)); | 1038 __ mov(r6, Operand(r4)); |
| 1041 __ mov(r7, Operand(r4)); | 1039 __ mov(r7, Operand(r4)); |
| 1042 if (kR9Available == 1) { | 1040 if (kR9Available == 1) { |
| 1043 __ mov(r9, Operand(r4)); | 1041 __ mov(r9, Operand(r4)); |
| 1044 } | 1042 } |
| 1045 | 1043 |
| 1046 // Invoke the code and pass argc as r0. | 1044 // Invoke the code and pass argc as r0. |
| 1047 __ mov(r0, Operand(r3)); | 1045 __ mov(r0, Operand(r3)); |
| 1048 if (is_construct) { | 1046 if (is_construct) { |
| 1049 __ Call(masm->isolate()->builtins()->JSConstructCall(), | 1047 __ Call(masm->isolate()->builtins()->JSConstructCall()); |
| 1050 RelocInfo::CODE_TARGET); | |
| 1051 } else { | 1048 } else { |
| 1052 ParameterCount actual(r0); | 1049 ParameterCount actual(r0); |
| 1053 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 1050 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 1051 NullCallWrapper(), CALL_AS_METHOD); |
| 1054 } | 1052 } |
| 1055 | 1053 |
| 1056 // Exit the JS frame and remove the parameters (except function), and return. | 1054 // Exit the JS frame and remove the parameters (except function), and return. |
| 1057 // Respect ABI stack constraint. | 1055 // Respect ABI stack constraint. |
| 1058 __ LeaveInternalFrame(); | 1056 __ LeaveInternalFrame(); |
| 1059 __ Jump(lr); | 1057 __ Jump(lr); |
| 1060 | 1058 |
| 1061 // r0: result | 1059 // r0: result |
| 1062 } | 1060 } |
| 1063 | 1061 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 __ push(r2); | 1225 __ push(r2); |
| 1228 __ add(r0, r0, Operand(1)); | 1226 __ add(r0, r0, Operand(1)); |
| 1229 __ bind(&done); | 1227 __ bind(&done); |
| 1230 } | 1228 } |
| 1231 | 1229 |
| 1232 // 2. Get the function to call (passed as receiver) from the stack, check | 1230 // 2. Get the function to call (passed as receiver) from the stack, check |
| 1233 // if it is a function. | 1231 // if it is a function. |
| 1234 // r0: actual number of arguments | 1232 // r0: actual number of arguments |
| 1235 Label non_function; | 1233 Label non_function; |
| 1236 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1234 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1237 __ tst(r1, Operand(kSmiTagMask)); | 1235 __ JumpIfSmi(r1, &non_function); |
| 1238 __ b(eq, &non_function); | |
| 1239 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 1236 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 1240 __ b(ne, &non_function); | 1237 __ b(ne, &non_function); |
| 1241 | 1238 |
| 1242 // 3a. Patch the first argument if necessary when calling a function. | 1239 // 3a. Patch the first argument if necessary when calling a function. |
| 1243 // r0: actual number of arguments | 1240 // r0: actual number of arguments |
| 1244 // r1: function | 1241 // r1: function |
| 1245 Label shift_arguments; | 1242 Label shift_arguments; |
| 1246 { Label convert_to_object, use_global_receiver, patch_receiver; | 1243 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1247 // Change context eagerly in case we need the global receiver. | 1244 // Change context eagerly in case we need the global receiver. |
| 1248 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1245 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1249 | 1246 |
| 1250 // Do not transform the receiver for strict mode functions. | 1247 // Do not transform the receiver for strict mode functions. |
| 1251 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1248 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1252 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); | 1249 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1253 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1250 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1254 kSmiTagSize))); | 1251 kSmiTagSize))); |
| 1255 __ b(ne, &shift_arguments); | 1252 __ b(ne, &shift_arguments); |
| 1256 | 1253 |
| 1257 // Do not transform the receiver for native (Compilerhints already in r3). | 1254 // Do not transform the receiver for native (Compilerhints already in r3). |
| 1258 __ tst(r3, Operand(1 << (SharedFunctionInfo::kES5Native + | 1255 __ tst(r3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
| 1259 kSmiTagSize))); | |
| 1260 __ b(ne, &shift_arguments); | 1256 __ b(ne, &shift_arguments); |
| 1261 | 1257 |
| 1262 // Compute the receiver in non-strict mode. | 1258 // Compute the receiver in non-strict mode. |
| 1263 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1259 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1264 __ ldr(r2, MemOperand(r2, -kPointerSize)); | 1260 __ ldr(r2, MemOperand(r2, -kPointerSize)); |
| 1265 // r0: actual number of arguments | 1261 // r0: actual number of arguments |
| 1266 // r1: function | 1262 // r1: function |
| 1267 // r2: first argument | 1263 // r2: first argument |
| 1268 __ tst(r2, Operand(kSmiTagMask)); | 1264 __ JumpIfSmi(r2, &convert_to_object); |
| 1269 __ b(eq, &convert_to_object); | |
| 1270 | 1265 |
| 1271 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | 1266 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
| 1272 __ cmp(r2, r3); | 1267 __ cmp(r2, r3); |
| 1273 __ b(eq, &use_global_receiver); | 1268 __ b(eq, &use_global_receiver); |
| 1274 __ LoadRoot(r3, Heap::kNullValueRootIndex); | 1269 __ LoadRoot(r3, Heap::kNullValueRootIndex); |
| 1275 __ cmp(r2, r3); | 1270 __ cmp(r2, r3); |
| 1276 __ b(eq, &use_global_receiver); | 1271 __ b(eq, &use_global_receiver); |
| 1277 | 1272 |
| 1278 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1273 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1279 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1274 __ CompareObjectType(r2, r3, r3, FIRST_SPEC_OBJECT_TYPE); |
| 1280 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); | |
| 1281 __ b(ge, &shift_arguments); | 1275 __ b(ge, &shift_arguments); |
| 1282 | 1276 |
| 1283 __ bind(&convert_to_object); | 1277 __ bind(&convert_to_object); |
| 1284 __ EnterInternalFrame(); // In order to preserve argument count. | 1278 __ EnterInternalFrame(); // In order to preserve argument count. |
| 1285 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. | 1279 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. |
| 1286 __ push(r0); | 1280 __ push(r0); |
| 1287 | 1281 |
| 1288 __ push(r2); | 1282 __ push(r2); |
| 1289 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1283 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1290 __ mov(r2, r0); | 1284 __ mov(r2, r0); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1372 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); | 1366 FieldMemOperand(r3, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 1373 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); | 1367 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); |
| 1374 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1368 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
| 1375 __ SetCallKind(r5, CALL_AS_METHOD); | 1369 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1376 __ cmp(r2, r0); // Check formal and actual parameter counts. | 1370 __ cmp(r2, r0); // Check formal and actual parameter counts. |
| 1377 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1371 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1378 RelocInfo::CODE_TARGET, | 1372 RelocInfo::CODE_TARGET, |
| 1379 ne); | 1373 ne); |
| 1380 | 1374 |
| 1381 ParameterCount expected(0); | 1375 ParameterCount expected(0); |
| 1382 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION); | 1376 __ InvokeCode(r3, expected, expected, JUMP_FUNCTION, |
| 1377 NullCallWrapper(), CALL_AS_METHOD); |
| 1383 } | 1378 } |
| 1384 | 1379 |
| 1385 | 1380 |
| 1386 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { | 1381 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { |
| 1387 const int kIndexOffset = -5 * kPointerSize; | 1382 const int kIndexOffset = -5 * kPointerSize; |
| 1388 const int kLimitOffset = -4 * kPointerSize; | 1383 const int kLimitOffset = -4 * kPointerSize; |
| 1389 const int kArgsOffset = 2 * kPointerSize; | 1384 const int kArgsOffset = 2 * kPointerSize; |
| 1390 const int kRecvOffset = 3 * kPointerSize; | 1385 const int kRecvOffset = 3 * kPointerSize; |
| 1391 const int kFunctionOffset = 4 * kPointerSize; | 1386 const int kFunctionOffset = 4 * kPointerSize; |
| 1392 | 1387 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 Label call_to_object, use_global_receiver, push_receiver; | 1428 Label call_to_object, use_global_receiver, push_receiver; |
| 1434 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 1429 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
| 1435 | 1430 |
| 1436 // Do not transform the receiver for strict mode functions. | 1431 // Do not transform the receiver for strict mode functions. |
| 1437 __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); | 1432 __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1438 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1433 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1439 kSmiTagSize))); | 1434 kSmiTagSize))); |
| 1440 __ b(ne, &push_receiver); | 1435 __ b(ne, &push_receiver); |
| 1441 | 1436 |
| 1442 // Do not transform the receiver for strict mode functions. | 1437 // Do not transform the receiver for strict mode functions. |
| 1443 __ tst(r2, Operand(1 << (SharedFunctionInfo::kES5Native + | 1438 __ tst(r2, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); |
| 1444 kSmiTagSize))); | |
| 1445 __ b(ne, &push_receiver); | 1439 __ b(ne, &push_receiver); |
| 1446 | 1440 |
| 1447 // Compute the receiver in non-strict mode. | 1441 // Compute the receiver in non-strict mode. |
| 1448 __ tst(r0, Operand(kSmiTagMask)); | 1442 __ JumpIfSmi(r0, &call_to_object); |
| 1449 __ b(eq, &call_to_object); | |
| 1450 __ LoadRoot(r1, Heap::kNullValueRootIndex); | 1443 __ LoadRoot(r1, Heap::kNullValueRootIndex); |
| 1451 __ cmp(r0, r1); | 1444 __ cmp(r0, r1); |
| 1452 __ b(eq, &use_global_receiver); | 1445 __ b(eq, &use_global_receiver); |
| 1453 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 1446 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 1454 __ cmp(r0, r1); | 1447 __ cmp(r0, r1); |
| 1455 __ b(eq, &use_global_receiver); | 1448 __ b(eq, &use_global_receiver); |
| 1456 | 1449 |
| 1457 // Check if the receiver is already a JavaScript object. | 1450 // Check if the receiver is already a JavaScript object. |
| 1458 // r0: receiver | 1451 // r0: receiver |
| 1459 STATIC_ASSERT(LAST_JS_OBJECT_TYPE + 1 == LAST_TYPE); | 1452 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1460 STATIC_ASSERT(LAST_TYPE == JS_FUNCTION_TYPE); | 1453 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); |
| 1461 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | |
| 1462 __ b(ge, &push_receiver); | 1454 __ b(ge, &push_receiver); |
| 1463 | 1455 |
| 1464 // Convert the receiver to a regular object. | 1456 // Convert the receiver to a regular object. |
| 1465 // r0: receiver | 1457 // r0: receiver |
| 1466 __ bind(&call_to_object); | 1458 __ bind(&call_to_object); |
| 1467 __ push(r0); | 1459 __ push(r0); |
| 1468 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1460 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1469 __ b(&push_receiver); | 1461 __ b(&push_receiver); |
| 1470 | 1462 |
| 1471 // Use the current global receiver object as the receiver. | 1463 // Use the current global receiver object as the receiver. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 // arguments object. | 1500 // arguments object. |
| 1509 __ bind(&entry); | 1501 __ bind(&entry); |
| 1510 __ ldr(r1, MemOperand(fp, kLimitOffset)); | 1502 __ ldr(r1, MemOperand(fp, kLimitOffset)); |
| 1511 __ cmp(r0, r1); | 1503 __ cmp(r0, r1); |
| 1512 __ b(ne, &loop); | 1504 __ b(ne, &loop); |
| 1513 | 1505 |
| 1514 // Invoke the function. | 1506 // Invoke the function. |
| 1515 ParameterCount actual(r0); | 1507 ParameterCount actual(r0); |
| 1516 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); | 1508 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
| 1517 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1509 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
| 1518 __ InvokeFunction(r1, actual, CALL_FUNCTION); | 1510 __ InvokeFunction(r1, actual, CALL_FUNCTION, |
| 1511 NullCallWrapper(), CALL_AS_METHOD); |
| 1519 | 1512 |
| 1520 // Tear down the internal frame and remove function, receiver and args. | 1513 // Tear down the internal frame and remove function, receiver and args. |
| 1521 __ LeaveInternalFrame(); | 1514 __ LeaveInternalFrame(); |
| 1522 __ add(sp, sp, Operand(3 * kPointerSize)); | 1515 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1523 __ Jump(lr); | 1516 __ Jump(lr); |
| 1524 } | 1517 } |
| 1525 | 1518 |
| 1526 | 1519 |
| 1527 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1520 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
| 1528 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); | 1521 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 __ bind(&dont_adapt_arguments); | 1642 __ bind(&dont_adapt_arguments); |
| 1650 __ Jump(r3); | 1643 __ Jump(r3); |
| 1651 } | 1644 } |
| 1652 | 1645 |
| 1653 | 1646 |
| 1654 #undef __ | 1647 #undef __ |
| 1655 | 1648 |
| 1656 } } // namespace v8::internal | 1649 } } // namespace v8::internal |
| 1657 | 1650 |
| 1658 #endif // V8_TARGET_ARCH_ARM | 1651 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |