| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 __ LeaveConstructFrame(); | 176 __ LeaveConstructFrame(); |
| 177 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); | 177 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
| 178 __ add(sp, sp, Operand(kPointerSize)); | 178 __ add(sp, sp, Operand(kPointerSize)); |
| 179 __ Jump(lr); | 179 __ Jump(lr); |
| 180 | 180 |
| 181 // r0: number of arguments | 181 // r0: number of arguments |
| 182 // r1: called object | 182 // r1: called object |
| 183 __ bind(&non_function_call); | 183 __ bind(&non_function_call); |
| 184 | 184 |
| 185 // Set expected number of arguments to zero (not changing r0). | 185 // Set expected number of arguments to zero (not changing r0). |
| 186 __ mov(r2, Operand(0)); | 186 __ mov(r2, Operand(0, RelocInfo::NONE)); |
| 187 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 187 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); |
| 188 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), | 188 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), |
| 189 RelocInfo::CODE_TARGET); | 189 RelocInfo::CODE_TARGET); |
| 190 } | 190 } |
| 191 | 191 |
| 192 | 192 |
| 193 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 193 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
| 194 bool is_construct) { | 194 bool is_construct) { |
| 195 // Called from Generate_JS_Entry | 195 // Called from Generate_JS_Entry |
| 196 // r0: code entry | 196 // r0: code entry |
| 197 // r1: function | 197 // r1: function |
| 198 // r2: receiver | 198 // r2: receiver |
| 199 // r3: argc | 199 // r3: argc |
| 200 // r4: argv | 200 // r4: argv |
| 201 // r5-r7, cp may be clobbered | 201 // r5-r7, cp may be clobbered |
| 202 | 202 |
| 203 // Clear the context before we push it when entering the JS frame. | 203 // Clear the context before we push it when entering the JS frame. |
| 204 __ mov(cp, Operand(0)); | 204 __ mov(cp, Operand(0, RelocInfo::NONE)); |
| 205 | 205 |
| 206 // Enter an internal frame. | 206 // Enter an internal frame. |
| 207 __ EnterInternalFrame(); | 207 __ EnterInternalFrame(); |
| 208 | 208 |
| 209 // Setup the context from the function argument. | 209 // Setup the context from the function argument. |
| 210 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 210 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 211 | 211 |
| 212 // Push the function and the receiver onto the stack. | 212 // Push the function and the receiver onto the stack. |
| 213 __ push(r1); | 213 __ push(r1); |
| 214 __ push(r2); | 214 __ push(r2); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // r0: actual number of argument | 284 // r0: actual number of argument |
| 285 { Label done, non_function, function; | 285 { Label done, non_function, function; |
| 286 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 286 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
| 287 __ tst(r1, Operand(kSmiTagMask)); | 287 __ tst(r1, Operand(kSmiTagMask)); |
| 288 __ b(eq, &non_function); | 288 __ b(eq, &non_function); |
| 289 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); | 289 __ CompareObjectType(r1, r2, r2, JS_FUNCTION_TYPE); |
| 290 __ b(eq, &function); | 290 __ b(eq, &function); |
| 291 | 291 |
| 292 // Non-function called: Clear the function to force exception. | 292 // Non-function called: Clear the function to force exception. |
| 293 __ bind(&non_function); | 293 __ bind(&non_function); |
| 294 __ mov(r1, Operand(0)); | 294 __ mov(r1, Operand(0, RelocInfo::NONE)); |
| 295 __ b(&done); | 295 __ b(&done); |
| 296 | 296 |
| 297 // Change the context eagerly because it will be used below to get the | 297 // Change the context eagerly because it will be used below to get the |
| 298 // right global object. | 298 // right global object. |
| 299 __ bind(&function); | 299 __ bind(&function); |
| 300 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 300 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 301 | 301 |
| 302 __ bind(&done); | 302 __ bind(&done); |
| 303 } | 303 } |
| 304 | 304 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 __ add(sp, sp, Operand(kPointerSize)); | 384 __ add(sp, sp, Operand(kPointerSize)); |
| 385 | 385 |
| 386 // 6. Get the code for the function or the non-function builtin. | 386 // 6. Get the code for the function or the non-function builtin. |
| 387 // If number of expected arguments matches, then call. Otherwise restart | 387 // If number of expected arguments matches, then call. Otherwise restart |
| 388 // the arguments adaptor stub. | 388 // the arguments adaptor stub. |
| 389 // r0: actual number of arguments | 389 // r0: actual number of arguments |
| 390 // r1: function | 390 // r1: function |
| 391 { Label invoke; | 391 { Label invoke; |
| 392 __ tst(r1, r1); | 392 __ tst(r1, r1); |
| 393 __ b(ne, &invoke); | 393 __ b(ne, &invoke); |
| 394 __ mov(r2, Operand(0)); // expected arguments is 0 for CALL_NON_FUNCTION | 394 // expected arguments is 0 for CALL_NON_FUNCTION |
| 395 __ mov(r2, Operand(0, RelocInfo::NONE)); |
| 395 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); | 396 __ GetBuiltinEntry(r3, Builtins::CALL_NON_FUNCTION); |
| 396 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), | 397 __ Jump(Handle<Code>(builtin(ArgumentsAdaptorTrampoline)), |
| 397 RelocInfo::CODE_TARGET); | 398 RelocInfo::CODE_TARGET); |
| 398 | 399 |
| 399 __ bind(&invoke); | 400 __ bind(&invoke); |
| 400 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 401 __ ldr(r3, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 401 __ ldr(r2, | 402 __ ldr(r2, |
| 402 FieldMemOperand(r3, | 403 FieldMemOperand(r3, |
| 403 SharedFunctionInfo::kFormalParameterCountOffset)); | 404 SharedFunctionInfo::kFormalParameterCountOffset)); |
| 404 __ ldr(r3, | 405 __ ldr(r3, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 466 |
| 466 // Out of stack space. | 467 // Out of stack space. |
| 467 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 468 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
| 468 __ push(r1); | 469 __ push(r1); |
| 469 __ push(r0); | 470 __ push(r0); |
| 470 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_JS); | 471 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_JS); |
| 471 | 472 |
| 472 // Push current limit and index. | 473 // Push current limit and index. |
| 473 __ bind(&okay); | 474 __ bind(&okay); |
| 474 __ push(r0); // limit | 475 __ push(r0); // limit |
| 475 __ mov(r1, Operand(0)); // initial index | 476 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index |
| 476 __ push(r1); | 477 __ push(r1); |
| 477 | 478 |
| 478 // Change context eagerly to get the right global object if necessary. | 479 // Change context eagerly to get the right global object if necessary. |
| 479 __ ldr(r0, MemOperand(fp, kFunctionOffset)); | 480 __ ldr(r0, MemOperand(fp, kFunctionOffset)); |
| 480 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); | 481 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); |
| 481 | 482 |
| 482 // Compute the receiver. | 483 // Compute the receiver. |
| 483 Label call_to_object, use_global_receiver, push_receiver; | 484 Label call_to_object, use_global_receiver, push_receiver; |
| 484 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 485 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
| 485 __ tst(r0, Operand(kSmiTagMask)); | 486 __ tst(r0, Operand(kSmiTagMask)); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // Dont adapt arguments. | 682 // Dont adapt arguments. |
| 682 // ------------------------------------------- | 683 // ------------------------------------------- |
| 683 __ bind(&dont_adapt_arguments); | 684 __ bind(&dont_adapt_arguments); |
| 684 __ Jump(r3); | 685 __ Jump(r3); |
| 685 } | 686 } |
| 686 | 687 |
| 687 | 688 |
| 688 #undef __ | 689 #undef __ |
| 689 | 690 |
| 690 } } // namespace v8::internal | 691 } } // namespace v8::internal |
| OLD | NEW |