| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // Handle construction of an empty array. | 332 // Handle construction of an empty array. |
| 333 __ bind(&empty_array); | 333 __ bind(&empty_array); |
| 334 AllocateEmptyJSArray(masm, | 334 AllocateEmptyJSArray(masm, |
| 335 a1, | 335 a1, |
| 336 a2, | 336 a2, |
| 337 a3, | 337 a3, |
| 338 t0, | 338 t0, |
| 339 t1, | 339 t1, |
| 340 call_generic_code); | 340 call_generic_code); |
| 341 __ IncrementCounter(counters->array_function_native(), 1, a3, t0); | 341 __ IncrementCounter(counters->array_function_native(), 1, a3, t0); |
| 342 // Setup return value, remove receiver from stack and return. | 342 // Set up return value, remove receiver from stack and return. |
| 343 __ mov(v0, a2); | 343 __ mov(v0, a2); |
| 344 __ Addu(sp, sp, Operand(kPointerSize)); | 344 __ Addu(sp, sp, Operand(kPointerSize)); |
| 345 __ Ret(); | 345 __ Ret(); |
| 346 | 346 |
| 347 // Check for one argument. Bail out if argument is not smi or if it is | 347 // Check for one argument. Bail out if argument is not smi or if it is |
| 348 // negative. | 348 // negative. |
| 349 __ bind(&argc_one_or_more); | 349 __ bind(&argc_one_or_more); |
| 350 __ Branch(&argc_two_or_more, ne, a0, Operand(1)); | 350 __ Branch(&argc_two_or_more, ne, a0, Operand(1)); |
| 351 | 351 |
| 352 STATIC_ASSERT(kSmiTag == 0); | 352 STATIC_ASSERT(kSmiTag == 0); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 375 a2, | 375 a2, |
| 376 a3, | 376 a3, |
| 377 t0, | 377 t0, |
| 378 t1, | 378 t1, |
| 379 t2, | 379 t2, |
| 380 t3, | 380 t3, |
| 381 true, | 381 true, |
| 382 call_generic_code); | 382 call_generic_code); |
| 383 __ IncrementCounter(counters->array_function_native(), 1, a2, t0); | 383 __ IncrementCounter(counters->array_function_native(), 1, a2, t0); |
| 384 | 384 |
| 385 // Setup return value, remove receiver and argument from stack and return. | 385 // Set up return value, remove receiver and argument from stack and return. |
| 386 __ mov(v0, a3); | 386 __ mov(v0, a3); |
| 387 __ Addu(sp, sp, Operand(2 * kPointerSize)); | 387 __ Addu(sp, sp, Operand(2 * kPointerSize)); |
| 388 __ Ret(); | 388 __ Ret(); |
| 389 | 389 |
| 390 // Handle construction of an array from a list of arguments. | 390 // Handle construction of an array from a list of arguments. |
| 391 __ bind(&argc_two_or_more); | 391 __ bind(&argc_two_or_more); |
| 392 __ sll(a2, a0, kSmiTagSize); // Convert argc to a smi. | 392 __ sll(a2, a0, kSmiTagSize); // Convert argc to a smi. |
| 393 | 393 |
| 394 // a0: argc | 394 // a0: argc |
| 395 // a1: constructor | 395 // a1: constructor |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 | 974 |
| 975 // Reload the number of arguments from the stack. | 975 // Reload the number of arguments from the stack. |
| 976 // a1: constructor function | 976 // a1: constructor function |
| 977 // sp[0]: receiver | 977 // sp[0]: receiver |
| 978 // sp[1]: constructor function | 978 // sp[1]: constructor function |
| 979 // sp[2]: receiver | 979 // sp[2]: receiver |
| 980 // sp[3]: constructor function | 980 // sp[3]: constructor function |
| 981 // sp[4]: number of arguments (smi-tagged) | 981 // sp[4]: number of arguments (smi-tagged) |
| 982 __ lw(a3, MemOperand(sp, 4 * kPointerSize)); | 982 __ lw(a3, MemOperand(sp, 4 * kPointerSize)); |
| 983 | 983 |
| 984 // Setup pointer to last argument. | 984 // Set up pointer to last argument. |
| 985 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); | 985 __ Addu(a2, fp, Operand(StandardFrameConstants::kCallerSPOffset)); |
| 986 | 986 |
| 987 // Setup number of arguments for function call below. | 987 // Set up number of arguments for function call below. |
| 988 __ srl(a0, a3, kSmiTagSize); | 988 __ srl(a0, a3, kSmiTagSize); |
| 989 | 989 |
| 990 // Copy arguments and receiver to the expression stack. | 990 // Copy arguments and receiver to the expression stack. |
| 991 // a0: number of arguments | 991 // a0: number of arguments |
| 992 // a1: constructor function | 992 // a1: constructor function |
| 993 // a2: address of last argument (caller sp) | 993 // a2: address of last argument (caller sp) |
| 994 // a3: number of arguments (smi-tagged) | 994 // a3: number of arguments (smi-tagged) |
| 995 // sp[0]: receiver | 995 // sp[0]: receiver |
| 996 // sp[1]: constructor function | 996 // sp[1]: constructor function |
| 997 // sp[2]: receiver | 997 // sp[2]: receiver |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 // Clear the context before we push it when entering the JS frame. | 1107 // Clear the context before we push it when entering the JS frame. |
| 1108 __ mov(cp, zero_reg); | 1108 __ mov(cp, zero_reg); |
| 1109 | 1109 |
| 1110 // Enter an internal frame. | 1110 // Enter an internal frame. |
| 1111 { | 1111 { |
| 1112 FrameScope scope(masm, StackFrame::INTERNAL); | 1112 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1113 | 1113 |
| 1114 // Set up the context from the function argument. | 1114 // Set up the context from the function argument. |
| 1115 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); | 1115 __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
| 1116 | 1116 |
| 1117 // Set up the roots register. | 1117 __ InitializeRootRegister(); |
| 1118 ExternalReference roots_array_start = | |
| 1119 ExternalReference::roots_array_start(masm->isolate()); | |
| 1120 __ li(s6, Operand(roots_array_start)); | |
| 1121 | 1118 |
| 1122 // Push the function and the receiver onto the stack. | 1119 // Push the function and the receiver onto the stack. |
| 1123 __ Push(a1, a2); | 1120 __ Push(a1, a2); |
| 1124 | 1121 |
| 1125 // Copy arguments to the stack in a loop. | 1122 // Copy arguments to the stack in a loop. |
| 1126 // a3: argc | 1123 // a3: argc |
| 1127 // s0: argv, ie points to first arg | 1124 // s0: argv, ie points to first arg |
| 1128 Label loop, entry; | 1125 Label loop, entry; |
| 1129 __ sll(t0, a3, kPointerSizeLog2); | 1126 __ sll(t0, a3, kPointerSizeLog2); |
| 1130 __ addu(t2, s0, t0); | 1127 __ addu(t2, s0, t0); |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 __ bind(&dont_adapt_arguments); | 1811 __ bind(&dont_adapt_arguments); |
| 1815 __ Jump(a3); | 1812 __ Jump(a3); |
| 1816 } | 1813 } |
| 1817 | 1814 |
| 1818 | 1815 |
| 1819 #undef __ | 1816 #undef __ |
| 1820 | 1817 |
| 1821 } } // namespace v8::internal | 1818 } } // namespace v8::internal |
| 1822 | 1819 |
| 1823 #endif // V8_TARGET_ARCH_MIPS | 1820 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |