| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 // Allocated the JSArray. Now initialize the fields except for the elements | 134 // Allocated the JSArray. Now initialize the fields except for the elements |
| 135 // array. | 135 // array. |
| 136 // result: JSObject | 136 // result: JSObject |
| 137 // scratch1: initial map | 137 // scratch1: initial map |
| 138 // scratch2: start of next object | 138 // scratch2: start of next object |
| 139 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); | 139 __ str(scratch1, FieldMemOperand(result, JSObject::kMapOffset)); |
| 140 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); | 140 __ LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); |
| 141 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); | 141 __ str(scratch1, FieldMemOperand(result, JSArray::kPropertiesOffset)); |
| 142 // Field JSArray::kElementsOffset is initialized later. | 142 // Field JSArray::kElementsOffset is initialized later. |
| 143 __ mov(scratch3, Operand(0, RelocInfo::NONE)); | 143 __ mov(scratch3, Operand::Zero()); |
| 144 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); | 144 __ str(scratch3, FieldMemOperand(result, JSArray::kLengthOffset)); |
| 145 | 145 |
| 146 if (initial_capacity == 0) { | 146 if (initial_capacity == 0) { |
| 147 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); | 147 __ str(scratch1, FieldMemOperand(result, JSArray::kElementsOffset)); |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 | 150 |
| 151 // Calculate the location of the elements array and set elements array member | 151 // Calculate the location of the elements array and set elements array member |
| 152 // of the JSArray. | 152 // of the JSArray. |
| 153 // result: JSObject | 153 // result: JSObject |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // entering the generic code. In both cases argc in r0 needs to be preserved. | 312 // entering the generic code. In both cases argc in r0 needs to be preserved. |
| 313 // Both registers are preserved by this code so no need to differentiate between | 313 // Both registers are preserved by this code so no need to differentiate between |
| 314 // construct call and normal call. | 314 // construct call and normal call. |
| 315 static void ArrayNativeCode(MacroAssembler* masm, | 315 static void ArrayNativeCode(MacroAssembler* masm, |
| 316 Label* call_generic_code) { | 316 Label* call_generic_code) { |
| 317 Counters* counters = masm->isolate()->counters(); | 317 Counters* counters = masm->isolate()->counters(); |
| 318 Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array, | 318 Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array, |
| 319 has_non_smi_element, finish, cant_transition_map, not_double; | 319 has_non_smi_element, finish, cant_transition_map, not_double; |
| 320 | 320 |
| 321 // Check for array construction with zero arguments or one. | 321 // Check for array construction with zero arguments or one. |
| 322 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 322 __ cmp(r0, Operand::Zero()); |
| 323 __ b(ne, &argc_one_or_more); | 323 __ b(ne, &argc_one_or_more); |
| 324 | 324 |
| 325 // Handle construction of an empty array. | 325 // Handle construction of an empty array. |
| 326 __ bind(&empty_array); | 326 __ bind(&empty_array); |
| 327 AllocateEmptyJSArray(masm, | 327 AllocateEmptyJSArray(masm, |
| 328 r1, | 328 r1, |
| 329 r2, | 329 r2, |
| 330 r3, | 330 r3, |
| 331 r4, | 331 r4, |
| 332 r5, | 332 r5, |
| 333 call_generic_code); | 333 call_generic_code); |
| 334 __ IncrementCounter(counters->array_function_native(), 1, r3, r4); | 334 __ IncrementCounter(counters->array_function_native(), 1, r3, r4); |
| 335 // Set up return value, remove receiver from stack and return. | 335 // Set up return value, remove receiver from stack and return. |
| 336 __ mov(r0, r2); | 336 __ mov(r0, r2); |
| 337 __ add(sp, sp, Operand(kPointerSize)); | 337 __ add(sp, sp, Operand(kPointerSize)); |
| 338 __ Jump(lr); | 338 __ Jump(lr); |
| 339 | 339 |
| 340 // Check for one argument. Bail out if argument is not smi or if it is | 340 // Check for one argument. Bail out if argument is not smi or if it is |
| 341 // negative. | 341 // negative. |
| 342 __ bind(&argc_one_or_more); | 342 __ bind(&argc_one_or_more); |
| 343 __ cmp(r0, Operand(1)); | 343 __ cmp(r0, Operand(1)); |
| 344 __ b(ne, &argc_two_or_more); | 344 __ b(ne, &argc_two_or_more); |
| 345 STATIC_ASSERT(kSmiTag == 0); | 345 STATIC_ASSERT(kSmiTag == 0); |
| 346 __ ldr(r2, MemOperand(sp)); // Get the argument from the stack. | 346 __ ldr(r2, MemOperand(sp)); // Get the argument from the stack. |
| 347 __ tst(r2, r2); | 347 __ tst(r2, r2); |
| 348 __ b(ne, ¬_empty_array); | 348 __ b(ne, ¬_empty_array); |
| 349 __ Drop(1); // Adjust stack. | 349 __ Drop(1); // Adjust stack. |
| 350 __ mov(r0, Operand(0)); // Treat this as a call with argc of zero. | 350 __ mov(r0, Operand::Zero()); // Treat this as a call with argc of zero. |
| 351 __ b(&empty_array); | 351 __ b(&empty_array); |
| 352 | 352 |
| 353 __ bind(¬_empty_array); | 353 __ bind(¬_empty_array); |
| 354 __ and_(r3, r2, Operand(kIntptrSignBit | kSmiTagMask), SetCC); | 354 __ and_(r3, r2, Operand(kIntptrSignBit | kSmiTagMask), SetCC); |
| 355 __ b(ne, call_generic_code); | 355 __ b(ne, call_generic_code); |
| 356 | 356 |
| 357 // Handle construction of an empty array of a certain size. Bail out if size | 357 // Handle construction of an empty array of a certain size. Bail out if size |
| 358 // is too large to actually allocate an elements array. | 358 // is too large to actually allocate an elements array. |
| 359 STATIC_ASSERT(kSmiTag == 0); | 359 STATIC_ASSERT(kSmiTag == 0); |
| 360 __ cmp(r2, Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize)); | 360 __ cmp(r2, Operand(JSObject::kInitialMaxFastElementArray << kSmiTagSize)); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 | 583 |
| 584 Register function = r1; | 584 Register function = r1; |
| 585 if (FLAG_debug_code) { | 585 if (FLAG_debug_code) { |
| 586 __ LoadGlobalFunction(Context::STRING_FUNCTION_INDEX, r2); | 586 __ LoadGlobalFunction(Context::STRING_FUNCTION_INDEX, r2); |
| 587 __ cmp(function, Operand(r2)); | 587 __ cmp(function, Operand(r2)); |
| 588 __ Assert(eq, "Unexpected String function"); | 588 __ Assert(eq, "Unexpected String function"); |
| 589 } | 589 } |
| 590 | 590 |
| 591 // Load the first arguments in r0 and get rid of the rest. | 591 // Load the first arguments in r0 and get rid of the rest. |
| 592 Label no_arguments; | 592 Label no_arguments; |
| 593 __ cmp(r0, Operand(0, RelocInfo::NONE)); | 593 __ cmp(r0, Operand::Zero()); |
| 594 __ b(eq, &no_arguments); | 594 __ b(eq, &no_arguments); |
| 595 // First args = sp[(argc - 1) * 4]. | 595 // First args = sp[(argc - 1) * 4]. |
| 596 __ sub(r0, r0, Operand(1)); | 596 __ sub(r0, r0, Operand(1)); |
| 597 __ ldr(r0, MemOperand(sp, r0, LSL, kPointerSizeLog2, PreIndex)); | 597 __ ldr(r0, MemOperand(sp, r0, LSL, kPointerSizeLog2, PreIndex)); |
| 598 // sp now point to args[0], drop args[0] + receiver. | 598 // sp now point to args[0], drop args[0] + receiver. |
| 599 __ Drop(2); | 599 __ Drop(2); |
| 600 | 600 |
| 601 Register argument = r2; | 601 Register argument = r2; |
| 602 Label not_cached, argument_is_string; | 602 Label not_cached, argument_is_string; |
| 603 NumberToStringStub::GenerateLookupNumberStringCache( | 603 NumberToStringStub::GenerateLookupNumberStringCache( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 627 TAG_OBJECT); | 627 TAG_OBJECT); |
| 628 | 628 |
| 629 // Initialising the String Object. | 629 // Initialising the String Object. |
| 630 Register map = r3; | 630 Register map = r3; |
| 631 __ LoadGlobalFunctionInitialMap(function, map, r4); | 631 __ LoadGlobalFunctionInitialMap(function, map, r4); |
| 632 if (FLAG_debug_code) { | 632 if (FLAG_debug_code) { |
| 633 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); | 633 __ ldrb(r4, FieldMemOperand(map, Map::kInstanceSizeOffset)); |
| 634 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); | 634 __ cmp(r4, Operand(JSValue::kSize >> kPointerSizeLog2)); |
| 635 __ Assert(eq, "Unexpected string wrapper instance size"); | 635 __ Assert(eq, "Unexpected string wrapper instance size"); |
| 636 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); | 636 __ ldrb(r4, FieldMemOperand(map, Map::kUnusedPropertyFieldsOffset)); |
| 637 __ cmp(r4, Operand(0, RelocInfo::NONE)); | 637 __ cmp(r4, Operand::Zero()); |
| 638 __ Assert(eq, "Unexpected unused properties of string wrapper"); | 638 __ Assert(eq, "Unexpected unused properties of string wrapper"); |
| 639 } | 639 } |
| 640 __ str(map, FieldMemOperand(r0, HeapObject::kMapOffset)); | 640 __ str(map, FieldMemOperand(r0, HeapObject::kMapOffset)); |
| 641 | 641 |
| 642 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); | 642 __ LoadRoot(r3, Heap::kEmptyFixedArrayRootIndex); |
| 643 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); | 643 __ str(r3, FieldMemOperand(r0, JSObject::kPropertiesOffset)); |
| 644 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); | 644 __ str(r3, FieldMemOperand(r0, JSObject::kElementsOffset)); |
| 645 | 645 |
| 646 __ str(argument, FieldMemOperand(r0, JSValue::kValueOffset)); | 646 __ str(argument, FieldMemOperand(r0, JSValue::kValueOffset)); |
| 647 | 647 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 bool is_construct) { | 1090 bool is_construct) { |
| 1091 // Called from Generate_JS_Entry | 1091 // Called from Generate_JS_Entry |
| 1092 // r0: code entry | 1092 // r0: code entry |
| 1093 // r1: function | 1093 // r1: function |
| 1094 // r2: receiver | 1094 // r2: receiver |
| 1095 // r3: argc | 1095 // r3: argc |
| 1096 // r4: argv | 1096 // r4: argv |
| 1097 // r5-r7, cp may be clobbered | 1097 // r5-r7, cp may be clobbered |
| 1098 | 1098 |
| 1099 // Clear the context before we push it when entering the internal frame. | 1099 // Clear the context before we push it when entering the internal frame. |
| 1100 __ mov(cp, Operand(0, RelocInfo::NONE)); | 1100 __ mov(cp, Operand::Zero()); |
| 1101 | 1101 |
| 1102 // Enter an internal frame. | 1102 // Enter an internal frame. |
| 1103 { | 1103 { |
| 1104 FrameScope scope(masm, StackFrame::INTERNAL); | 1104 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1105 | 1105 |
| 1106 // Set up the context from the function argument. | 1106 // Set up the context from the function argument. |
| 1107 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1107 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1108 | 1108 |
| 1109 __ InitializeRootRegister(); | 1109 __ InitializeRootRegister(); |
| 1110 | 1110 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 // the deoptimizer infrastructure. | 1315 // the deoptimizer infrastructure. |
| 1316 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1316 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1317 generator.Generate(); | 1317 generator.Generate(); |
| 1318 } | 1318 } |
| 1319 | 1319 |
| 1320 | 1320 |
| 1321 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 1321 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 1322 // 1. Make sure we have at least one argument. | 1322 // 1. Make sure we have at least one argument. |
| 1323 // r0: actual number of arguments | 1323 // r0: actual number of arguments |
| 1324 { Label done; | 1324 { Label done; |
| 1325 __ cmp(r0, Operand(0)); | 1325 __ cmp(r0, Operand::Zero()); |
| 1326 __ b(ne, &done); | 1326 __ b(ne, &done); |
| 1327 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 1327 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 1328 __ push(r2); | 1328 __ push(r2); |
| 1329 __ add(r0, r0, Operand(1)); | 1329 __ add(r0, r0, Operand(1)); |
| 1330 __ bind(&done); | 1330 __ bind(&done); |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 // 2. Get the function to call (passed as receiver) from the stack, check | 1333 // 2. Get the function to call (passed as receiver) from the stack, check |
| 1334 // if it is a function. | 1334 // if it is a function. |
| 1335 // r0: actual number of arguments | 1335 // r0: actual number of arguments |
| 1336 Label slow, non_function; | 1336 Label slow, non_function; |
| 1337 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1337 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1338 __ JumpIfSmi(r1, &non_function); | 1338 __ JumpIfSmi(r1, &non_function); |
| 1339 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 1339 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 1340 __ b(ne, &slow); | 1340 __ b(ne, &slow); |
| 1341 | 1341 |
| 1342 // 3a. Patch the first argument if necessary when calling a function. | 1342 // 3a. Patch the first argument if necessary when calling a function. |
| 1343 // r0: actual number of arguments | 1343 // r0: actual number of arguments |
| 1344 // r1: function | 1344 // r1: function |
| 1345 Label shift_arguments; | 1345 Label shift_arguments; |
| 1346 __ mov(r4, Operand(0, RelocInfo::NONE)); // indicate regular JS_FUNCTION | 1346 __ mov(r4, Operand::Zero()); // indicate regular JS_FUNCTION |
| 1347 { Label convert_to_object, use_global_receiver, patch_receiver; | 1347 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1348 // Change context eagerly in case we need the global receiver. | 1348 // Change context eagerly in case we need the global receiver. |
| 1349 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1349 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1350 | 1350 |
| 1351 // Do not transform the receiver for strict mode functions. | 1351 // Do not transform the receiver for strict mode functions. |
| 1352 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1352 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1353 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); | 1353 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1354 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1354 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1355 kSmiTagSize))); | 1355 kSmiTagSize))); |
| 1356 __ b(ne, &shift_arguments); | 1356 __ b(ne, &shift_arguments); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 __ mov(r2, r0); | 1391 __ mov(r2, r0); |
| 1392 | 1392 |
| 1393 __ pop(r0); | 1393 __ pop(r0); |
| 1394 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); | 1394 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
| 1395 | 1395 |
| 1396 // Exit the internal frame. | 1396 // Exit the internal frame. |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 // Restore the function to r1, and the flag to r4. | 1399 // Restore the function to r1, and the flag to r4. |
| 1400 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1400 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 1401 __ mov(r4, Operand(0, RelocInfo::NONE)); | 1401 __ mov(r4, Operand::Zero()); |
| 1402 __ jmp(&patch_receiver); | 1402 __ jmp(&patch_receiver); |
| 1403 | 1403 |
| 1404 // Use the global receiver object from the called function as the | 1404 // Use the global receiver object from the called function as the |
| 1405 // receiver. | 1405 // receiver. |
| 1406 __ bind(&use_global_receiver); | 1406 __ bind(&use_global_receiver); |
| 1407 const int kGlobalIndex = | 1407 const int kGlobalIndex = |
| 1408 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; | 1408 Context::kHeaderSize + Context::GLOBAL_OBJECT_INDEX * kPointerSize; |
| 1409 __ ldr(r2, FieldMemOperand(cp, kGlobalIndex)); | 1409 __ ldr(r2, FieldMemOperand(cp, kGlobalIndex)); |
| 1410 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset)); | 1410 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kNativeContextOffset)); |
| 1411 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex)); | 1411 __ ldr(r2, FieldMemOperand(r2, kGlobalIndex)); |
| 1412 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); | 1412 __ ldr(r2, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset)); |
| 1413 | 1413 |
| 1414 __ bind(&patch_receiver); | 1414 __ bind(&patch_receiver); |
| 1415 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1415 __ add(r3, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1416 __ str(r2, MemOperand(r3, -kPointerSize)); | 1416 __ str(r2, MemOperand(r3, -kPointerSize)); |
| 1417 | 1417 |
| 1418 __ jmp(&shift_arguments); | 1418 __ jmp(&shift_arguments); |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 // 3b. Check for function proxy. | 1421 // 3b. Check for function proxy. |
| 1422 __ bind(&slow); | 1422 __ bind(&slow); |
| 1423 __ mov(r4, Operand(1, RelocInfo::NONE)); // indicate function proxy | 1423 __ mov(r4, Operand(1)); // indicate function proxy |
| 1424 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE)); | 1424 __ cmp(r2, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 1425 __ b(eq, &shift_arguments); | 1425 __ b(eq, &shift_arguments); |
| 1426 __ bind(&non_function); | 1426 __ bind(&non_function); |
| 1427 __ mov(r4, Operand(2, RelocInfo::NONE)); // indicate non-function | 1427 __ mov(r4, Operand(2)); // indicate non-function |
| 1428 | 1428 |
| 1429 // 3c. Patch the first argument when calling a non-function. The | 1429 // 3c. Patch the first argument when calling a non-function. The |
| 1430 // CALL_NON_FUNCTION builtin expects the non-function callee as | 1430 // CALL_NON_FUNCTION builtin expects the non-function callee as |
| 1431 // receiver, so overwrite the first argument which will ultimately | 1431 // receiver, so overwrite the first argument which will ultimately |
| 1432 // become the receiver. | 1432 // become the receiver. |
| 1433 // r0: actual number of arguments | 1433 // r0: actual number of arguments |
| 1434 // r1: function | 1434 // r1: function |
| 1435 // r4: call type (0: JS function, 1: function proxy, 2: non-function) | 1435 // r4: call type (0: JS function, 1: function proxy, 2: non-function) |
| 1436 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1436 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1437 __ str(r1, MemOperand(r2, -kPointerSize)); | 1437 __ str(r1, MemOperand(r2, -kPointerSize)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1461 | 1461 |
| 1462 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, | 1462 // 5a. Call non-function via tail call to CALL_NON_FUNCTION builtin, |
| 1463 // or a function proxy via CALL_FUNCTION_PROXY. | 1463 // or a function proxy via CALL_FUNCTION_PROXY. |
| 1464 // r0: actual number of arguments | 1464 // r0: actual number of arguments |
| 1465 // r1: function | 1465 // r1: function |
| 1466 // r4: call type (0: JS function, 1: function proxy, 2: non-function) | 1466 // r4: call type (0: JS function, 1: function proxy, 2: non-function) |
| 1467 { Label function, non_proxy; | 1467 { Label function, non_proxy; |
| 1468 __ tst(r4, r4); | 1468 __ tst(r4, r4); |
| 1469 __ b(eq, &function); | 1469 __ b(eq, &function); |
| 1470 // Expected number of arguments is 0 for CALL_NON_FUNCTION. | 1470 // Expected number of arguments is 0 for CALL_NON_FUNCTION. |
| 1471 __ mov(r2, Operand(0, RelocInfo::NONE)); | 1471 __ mov(r2, Operand::Zero()); |
| 1472 __ SetCallKind(r5, CALL_AS_METHOD); | 1472 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1473 __ cmp(r4, Operand(1)); | 1473 __ cmp(r4, Operand(1)); |
| 1474 __ b(ne, &non_proxy); | 1474 __ b(ne, &non_proxy); |
| 1475 | 1475 |
| 1476 __ push(r1); // re-add proxy object as additional argument | 1476 __ push(r1); // re-add proxy object as additional argument |
| 1477 __ add(r0, r0, Operand(1)); | 1477 __ add(r0, r0, Operand(1)); |
| 1478 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1478 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
| 1479 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1479 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1480 RelocInfo::CODE_TARGET); | 1480 RelocInfo::CODE_TARGET); |
| 1481 | 1481 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 // Out of stack space. | 1539 // Out of stack space. |
| 1540 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1540 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
| 1541 __ push(r1); | 1541 __ push(r1); |
| 1542 __ push(r0); | 1542 __ push(r0); |
| 1543 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); | 1543 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); |
| 1544 // End of stack check. | 1544 // End of stack check. |
| 1545 | 1545 |
| 1546 // Push current limit and index. | 1546 // Push current limit and index. |
| 1547 __ bind(&okay); | 1547 __ bind(&okay); |
| 1548 __ push(r0); // limit | 1548 __ push(r0); // limit |
| 1549 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index | 1549 __ mov(r1, Operand::Zero()); // initial index |
| 1550 __ push(r1); | 1550 __ push(r1); |
| 1551 | 1551 |
| 1552 // Get the receiver. | 1552 // Get the receiver. |
| 1553 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 1553 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
| 1554 | 1554 |
| 1555 // Check that the function is a JS function (otherwise it must be a proxy). | 1555 // Check that the function is a JS function (otherwise it must be a proxy). |
| 1556 Label push_receiver; | 1556 Label push_receiver; |
| 1557 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1557 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
| 1558 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 1558 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 1559 __ b(ne, &push_receiver); | 1559 __ b(ne, &push_receiver); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1651 NullCallWrapper(), CALL_AS_METHOD); | 1651 NullCallWrapper(), CALL_AS_METHOD); |
| 1652 | 1652 |
| 1653 frame_scope.GenerateLeaveFrame(); | 1653 frame_scope.GenerateLeaveFrame(); |
| 1654 __ add(sp, sp, Operand(3 * kPointerSize)); | 1654 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1655 __ Jump(lr); | 1655 __ Jump(lr); |
| 1656 | 1656 |
| 1657 // Invoke the function proxy. | 1657 // Invoke the function proxy. |
| 1658 __ bind(&call_proxy); | 1658 __ bind(&call_proxy); |
| 1659 __ push(r1); // add function proxy as last argument | 1659 __ push(r1); // add function proxy as last argument |
| 1660 __ add(r0, r0, Operand(1)); | 1660 __ add(r0, r0, Operand(1)); |
| 1661 __ mov(r2, Operand(0, RelocInfo::NONE)); | 1661 __ mov(r2, Operand::Zero()); |
| 1662 __ SetCallKind(r5, CALL_AS_METHOD); | 1662 __ SetCallKind(r5, CALL_AS_METHOD); |
| 1663 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); | 1663 __ GetBuiltinEntry(r3, Builtins::CALL_FUNCTION_PROXY); |
| 1664 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1664 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 1665 RelocInfo::CODE_TARGET); | 1665 RelocInfo::CODE_TARGET); |
| 1666 | 1666 |
| 1667 // Tear down the internal frame and remove function, receiver and args. | 1667 // Tear down the internal frame and remove function, receiver and args. |
| 1668 } | 1668 } |
| 1669 __ add(sp, sp, Operand(3 * kPointerSize)); | 1669 __ add(sp, sp, Operand(3 * kPointerSize)); |
| 1670 __ Jump(lr); | 1670 __ Jump(lr); |
| 1671 } | 1671 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1799 __ bind(&dont_adapt_arguments); | 1799 __ bind(&dont_adapt_arguments); |
| 1800 __ Jump(r3); | 1800 __ Jump(r3); |
| 1801 } | 1801 } |
| 1802 | 1802 |
| 1803 | 1803 |
| 1804 #undef __ | 1804 #undef __ |
| 1805 | 1805 |
| 1806 } } // namespace v8::internal | 1806 } } // namespace v8::internal |
| 1807 | 1807 |
| 1808 #endif // V8_TARGET_ARCH_ARM | 1808 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |