OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); | 2609 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); |
2610 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); | 2610 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); |
2611 __ j(below, &build_args); | 2611 __ j(below, &build_args); |
2612 | 2612 |
2613 // Check that applicand.apply is Function.prototype.apply. | 2613 // Check that applicand.apply is Function.prototype.apply. |
2614 __ movq(rax, Operand(rsp, kPointerSize)); | 2614 __ movq(rax, Operand(rsp, kPointerSize)); |
2615 is_smi = masm_->CheckSmi(rax); | 2615 is_smi = masm_->CheckSmi(rax); |
2616 __ j(is_smi, &build_args); | 2616 __ j(is_smi, &build_args); |
2617 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); | 2617 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); |
2618 __ j(not_equal, &build_args); | 2618 __ j(not_equal, &build_args); |
| 2619 __ movq(rcx, FieldOperand(rax, JSFunction::kCodeEntryOffset)); |
| 2620 __ subq(rcx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
2619 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); | 2621 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); |
2620 __ Cmp(FieldOperand(rax, JSFunction::kCodeOffset), apply_code); | 2622 __ Cmp(FieldOperand(rcx, SharedFunctionInfo::kCodeOffset), apply_code); |
2621 __ j(not_equal, &build_args); | 2623 __ j(not_equal, &build_args); |
2622 | 2624 |
2623 // Check that applicand is a function. | 2625 // Check that applicand is a function. |
2624 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); | 2626 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); |
2625 is_smi = masm_->CheckSmi(rdi); | 2627 is_smi = masm_->CheckSmi(rdi); |
2626 __ j(is_smi, &build_args); | 2628 __ j(is_smi, &build_args); |
2627 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 2629 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
2628 __ j(not_equal, &build_args); | 2630 __ j(not_equal, &build_args); |
2629 | 2631 |
2630 // Copy the arguments to this function possibly from the | 2632 // Copy the arguments to this function possibly from the |
(...skipping 6120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8751 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); | 8753 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); |
8752 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx); | 8754 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx); |
8753 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx); | 8755 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx); |
8754 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx); | 8756 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx); |
8755 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi); | 8757 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi); |
8756 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx); | 8758 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx); |
8757 | 8759 |
8758 // Initialize the code pointer in the function to be the one | 8760 // Initialize the code pointer in the function to be the one |
8759 // found in the shared function info object. | 8761 // found in the shared function info object. |
8760 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); | 8762 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
8761 __ movq(FieldOperand(rax, JSFunction::kCodeOffset), rdx); | 8763 __ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
| 8764 __ movq(FieldOperand(rax, JSFunction::kCodeEntryOffset), rdx); |
8762 | 8765 |
8763 | 8766 |
8764 // Return and remove the on-stack parameter. | 8767 // Return and remove the on-stack parameter. |
8765 __ ret(1 * kPointerSize); | 8768 __ ret(1 * kPointerSize); |
8766 | 8769 |
8767 // Create a new closure through the slower runtime call. | 8770 // Create a new closure through the slower runtime call. |
8768 __ bind(&gc); | 8771 __ bind(&gc); |
8769 __ pop(rcx); // Temporarily remove return address. | 8772 __ pop(rcx); // Temporarily remove return address. |
8770 __ pop(rdx); | 8773 __ pop(rdx); |
8771 __ push(rsi); | 8774 __ push(rsi); |
(...skipping 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12761 #undef __ | 12764 #undef __ |
12762 | 12765 |
12763 void RecordWriteStub::Generate(MacroAssembler* masm) { | 12766 void RecordWriteStub::Generate(MacroAssembler* masm) { |
12764 masm->RecordWriteHelper(object_, addr_, scratch_); | 12767 masm->RecordWriteHelper(object_, addr_, scratch_); |
12765 masm->ret(0); | 12768 masm->ret(0); |
12766 } | 12769 } |
12767 | 12770 |
12768 } } // namespace v8::internal | 12771 } } // namespace v8::internal |
12769 | 12772 |
12770 #endif // V8_TARGET_ARCH_X64 | 12773 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |