Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: src/x64/codegen-x64.cc

Issue 3120006: Put direct code pointers into JSFunction objects. This is a first step... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1); 2623 STATIC_ASSERT(JS_FUNCTION_TYPE == LAST_JS_OBJECT_TYPE + 1);
2624 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); 2624 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx);
2625 __ j(below, &build_args); 2625 __ j(below, &build_args);
2626 2626
2627 // Check that applicand.apply is Function.prototype.apply. 2627 // Check that applicand.apply is Function.prototype.apply.
2628 __ movq(rax, Operand(rsp, kPointerSize)); 2628 __ movq(rax, Operand(rsp, kPointerSize));
2629 is_smi = masm_->CheckSmi(rax); 2629 is_smi = masm_->CheckSmi(rax);
2630 __ j(is_smi, &build_args); 2630 __ j(is_smi, &build_args);
2631 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); 2631 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx);
2632 __ j(not_equal, &build_args); 2632 __ j(not_equal, &build_args);
2633 __ movq(rax, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset));
2634 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); 2633 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply));
2635 __ Cmp(FieldOperand(rax, SharedFunctionInfo::kCodeOffset), apply_code); 2634 __ Cmp(FieldOperand(rax, JSFunction::kCodeOffset), apply_code);
2636 __ j(not_equal, &build_args); 2635 __ j(not_equal, &build_args);
2637 2636
2638 // Check that applicand is a function. 2637 // Check that applicand is a function.
2639 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); 2638 __ movq(rdi, Operand(rsp, 2 * kPointerSize));
2640 is_smi = masm_->CheckSmi(rdi); 2639 is_smi = masm_->CheckSmi(rdi);
2641 __ j(is_smi, &build_args); 2640 __ j(is_smi, &build_args);
2642 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 2641 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
2643 __ j(not_equal, &build_args); 2642 __ j(not_equal, &build_args);
2644 2643
2645 // Copy the arguments to this function possibly from the 2644 // Copy the arguments to this function possibly from the
(...skipping 5982 matching lines...) Expand 10 before | Expand all | Expand 10 after
8628 // write barrier because the allocated object is in new space. 8627 // write barrier because the allocated object is in new space.
8629 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex); 8628 __ LoadRoot(rbx, Heap::kEmptyFixedArrayRootIndex);
8630 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex); 8629 __ LoadRoot(rcx, Heap::kTheHoleValueRootIndex);
8631 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx); 8630 __ movq(FieldOperand(rax, JSObject::kPropertiesOffset), rbx);
8632 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx); 8631 __ movq(FieldOperand(rax, JSObject::kElementsOffset), rbx);
8633 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx); 8632 __ movq(FieldOperand(rax, JSFunction::kPrototypeOrInitialMapOffset), rcx);
8634 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx); 8633 __ movq(FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset), rdx);
8635 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi); 8634 __ movq(FieldOperand(rax, JSFunction::kContextOffset), rsi);
8636 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx); 8635 __ movq(FieldOperand(rax, JSFunction::kLiteralsOffset), rbx);
8637 8636
8637 // Initialize the code pointer in the function to be the one
8638 // found in the shared function info object.
8639 __ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset));
8640 __ movq(FieldOperand(rax, JSFunction::kCodeOffset), rdx);
8641
8642
8638 // Return and remove the on-stack parameter. 8643 // Return and remove the on-stack parameter.
8639 __ ret(1 * kPointerSize); 8644 __ ret(1 * kPointerSize);
8640 8645
8641 // Create a new closure through the slower runtime call. 8646 // Create a new closure through the slower runtime call.
8642 __ bind(&gc); 8647 __ bind(&gc);
8643 __ pop(rcx); // Temporarily remove return address. 8648 __ pop(rcx); // Temporarily remove return address.
8644 __ pop(rdx); 8649 __ pop(rdx);
8645 __ push(rsi); 8650 __ push(rsi);
8646 __ push(rdx); 8651 __ push(rdx);
8647 __ push(rcx); // Restore return address. 8652 __ push(rcx); // Restore return address.
(...skipping 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after
12616 #undef __ 12621 #undef __
12617 12622
12618 void RecordWriteStub::Generate(MacroAssembler* masm) { 12623 void RecordWriteStub::Generate(MacroAssembler* masm) {
12619 masm->RecordWriteHelper(object_, addr_, scratch_); 12624 masm->RecordWriteHelper(object_, addr_, scratch_);
12620 masm->ret(0); 12625 masm->ret(0);
12621 } 12626 }
12622 12627
12623 } } // namespace v8::internal 12628 } } // namespace v8::internal
12624 12629
12625 #endif // V8_TARGET_ARCH_X64 12630 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698