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 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | 2494 __ movq(result, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
2495 __ SmiToInteger32(result, | 2495 __ SmiToInteger32(result, |
2496 Operand(result, | 2496 Operand(result, |
2497 ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2497 ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2498 | 2498 |
2499 // Argument length is in result register. | 2499 // Argument length is in result register. |
2500 __ bind(&done); | 2500 __ bind(&done); |
2501 } | 2501 } |
2502 | 2502 |
2503 | 2503 |
2504 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2504 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { |
2505 Register receiver = ToRegister(instr->receiver()); | 2505 Register receiver = ToRegister(instr->receiver()); |
2506 Register function = ToRegister(instr->function()); | 2506 Register function = ToRegister(instr->function()); |
2507 Register length = ToRegister(instr->length()); | |
2508 Register elements = ToRegister(instr->elements()); | |
2509 ASSERT(receiver.is(rax)); // Used for parameter count. | |
2510 ASSERT(function.is(rdi)); // Required by InvokeFunction. | |
2511 ASSERT(ToRegister(instr->result()).is(rax)); | |
2512 | 2507 |
2513 // If the receiver is null or undefined, we have to pass the global | 2508 // If the receiver is null or undefined, we have to pass the global |
2514 // object as a receiver to normal functions. Values have to be | 2509 // object as a receiver to normal functions. Values have to be |
2515 // passed unchanged to builtins and strict-mode functions. | 2510 // passed unchanged to builtins and strict-mode functions. |
2516 Label global_object, receiver_ok; | 2511 Label global_object, receiver_ok; |
2517 | 2512 |
2518 // Do not transform the receiver to object for strict mode | 2513 // Do not transform the receiver to object for strict mode |
2519 // functions. | 2514 // functions. |
2520 __ movq(kScratchRegister, | 2515 __ movq(kScratchRegister, |
2521 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 2516 FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 22 matching lines...) Expand all Loading... |
2544 __ jmp(&receiver_ok, Label::kNear); | 2539 __ jmp(&receiver_ok, Label::kNear); |
2545 | 2540 |
2546 __ bind(&global_object); | 2541 __ bind(&global_object); |
2547 // TODO(kmillikin): We have a hydrogen value for the global object. See | 2542 // TODO(kmillikin): We have a hydrogen value for the global object. See |
2548 // if it's better to use it than to explicitly fetch it from the context | 2543 // if it's better to use it than to explicitly fetch it from the context |
2549 // here. | 2544 // here. |
2550 __ movq(receiver, ContextOperand(rsi, Context::GLOBAL_INDEX)); | 2545 __ movq(receiver, ContextOperand(rsi, Context::GLOBAL_INDEX)); |
2551 __ movq(receiver, | 2546 __ movq(receiver, |
2552 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 2547 FieldOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
2553 __ bind(&receiver_ok); | 2548 __ bind(&receiver_ok); |
| 2549 } |
| 2550 |
| 2551 |
| 2552 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 2553 Register receiver = ToRegister(instr->receiver()); |
| 2554 Register function = ToRegister(instr->function()); |
| 2555 Register length = ToRegister(instr->length()); |
| 2556 Register elements = ToRegister(instr->elements()); |
| 2557 ASSERT(receiver.is(rax)); // Used for parameter count. |
| 2558 ASSERT(function.is(rdi)); // Required by InvokeFunction. |
| 2559 ASSERT(ToRegister(instr->result()).is(rax)); |
2554 | 2560 |
2555 // Copy the arguments to this function possibly from the | 2561 // Copy the arguments to this function possibly from the |
2556 // adaptor frame below it. | 2562 // adaptor frame below it. |
2557 const uint32_t kArgumentsLimit = 1 * KB; | 2563 const uint32_t kArgumentsLimit = 1 * KB; |
2558 __ cmpq(length, Immediate(kArgumentsLimit)); | 2564 __ cmpq(length, Immediate(kArgumentsLimit)); |
2559 DeoptimizeIf(above, instr->environment()); | 2565 DeoptimizeIf(above, instr->environment()); |
2560 | 2566 |
2561 __ push(receiver); | 2567 __ push(receiver); |
2562 __ movq(receiver, length); | 2568 __ movq(receiver, length); |
2563 | 2569 |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4694 FixedArray::kHeaderSize - kPointerSize)); | 4700 FixedArray::kHeaderSize - kPointerSize)); |
4695 __ bind(&done); | 4701 __ bind(&done); |
4696 } | 4702 } |
4697 | 4703 |
4698 | 4704 |
4699 #undef __ | 4705 #undef __ |
4700 | 4706 |
4701 } } // namespace v8::internal | 4707 } } // namespace v8::internal |
4702 | 4708 |
4703 #endif // V8_TARGET_ARCH_X64 | 4709 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |