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

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

Issue 2840018: [Isolates] Moved more compilation-related globals (builtins, runtime, &c.)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: rebase Created 10 years, 5 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
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } else { 678 } else {
679 __ movq(rax, key_); 679 __ movq(rax, key_);
680 __ movq(rdx, receiver_); 680 __ movq(rdx, receiver_);
681 } 681 }
682 // Calculate the delta from the IC call instruction to the map check 682 // Calculate the delta from the IC call instruction to the map check
683 // movq instruction in the inlined version. This delta is stored in 683 // movq instruction in the inlined version. This delta is stored in
684 // a test(rax, delta) instruction after the call so that we can find 684 // a test(rax, delta) instruction after the call so that we can find
685 // it in the IC initialization code and patch the movq instruction. 685 // it in the IC initialization code and patch the movq instruction.
686 // This means that we cannot allow test instructions after calls to 686 // This means that we cannot allow test instructions after calls to
687 // KeyedLoadIC stubs in other places. 687 // KeyedLoadIC stubs in other places.
688 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 688 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
689 Builtins::KeyedLoadIC_Initialize));
689 __ Call(ic, RelocInfo::CODE_TARGET); 690 __ Call(ic, RelocInfo::CODE_TARGET);
690 // The delta from the start of the map-compare instruction to the 691 // The delta from the start of the map-compare instruction to the
691 // test instruction. We use masm_-> directly here instead of the __ 692 // test instruction. We use masm_-> directly here instead of the __
692 // macro because the macro sometimes uses macro expansion to turn 693 // macro because the macro sometimes uses macro expansion to turn
693 // into something that can't return a value. This is encountered 694 // into something that can't return a value. This is encountered
694 // when doing generated code coverage tests. 695 // when doing generated code coverage tests.
695 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); 696 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site());
696 // Here we use masm_-> instead of the __ macro because this is the 697 // Here we use masm_-> instead of the __ macro because this is the
697 // instruction that gets patched and coverage code gets in the way. 698 // instruction that gets patched and coverage code gets in the way.
698 // TODO(X64): Consider whether it's worth switching the test to a 699 // TODO(X64): Consider whether it's worth switching the test to a
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 __ movq(rcx, key_); 768 __ movq(rcx, key_);
768 } 769 }
769 } else if (key_.is(rcx)) { 770 } else if (key_.is(rcx)) {
770 __ movq(rdx, receiver_); 771 __ movq(rdx, receiver_);
771 } else { 772 } else {
772 __ movq(rcx, key_); 773 __ movq(rcx, key_);
773 __ movq(rdx, receiver_); 774 __ movq(rdx, receiver_);
774 } 775 }
775 776
776 // Call the IC stub. 777 // Call the IC stub.
777 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize)); 778 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
779 Builtins::KeyedStoreIC_Initialize));
778 __ Call(ic, RelocInfo::CODE_TARGET); 780 __ Call(ic, RelocInfo::CODE_TARGET);
779 // The delta from the start of the map-compare instructions (initial movq) 781 // The delta from the start of the map-compare instructions (initial movq)
780 // to the test instruction. We use masm_-> directly here instead of the 782 // to the test instruction. We use masm_-> directly here instead of the
781 // __ macro because the macro sometimes uses macro expansion to turn 783 // __ macro because the macro sometimes uses macro expansion to turn
782 // into something that can't return a value. This is encountered 784 // into something that can't return a value. This is encountered
783 // when doing generated code coverage tests. 785 // when doing generated code coverage tests.
784 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); 786 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site());
785 // Here we use masm_-> instead of the __ macro because this is the 787 // Here we use masm_-> instead of the __ macro because this is the
786 // instruction that gets patched and coverage code gets in the way. 788 // instruction that gets patched and coverage code gets in the way.
787 masm_->testl(rax, Immediate(-delta_to_patch_site)); 789 masm_->testl(rax, Immediate(-delta_to_patch_site));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx); 871 __ CmpObjectType(rax, FIRST_JS_OBJECT_TYPE, rcx);
870 __ j(below, &build_args); 872 __ j(below, &build_args);
871 873
872 // Check that applicand.apply is Function.prototype.apply. 874 // Check that applicand.apply is Function.prototype.apply.
873 __ movq(rax, Operand(rsp, kPointerSize)); 875 __ movq(rax, Operand(rsp, kPointerSize));
874 is_smi = masm_->CheckSmi(rax); 876 is_smi = masm_->CheckSmi(rax);
875 __ j(is_smi, &build_args); 877 __ j(is_smi, &build_args);
876 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx); 878 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rcx);
877 __ j(not_equal, &build_args); 879 __ j(not_equal, &build_args);
878 __ movq(rax, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset)); 880 __ movq(rax, FieldOperand(rax, JSFunction::kSharedFunctionInfoOffset));
879 Handle<Code> apply_code(Builtins::builtin(Builtins::FunctionApply)); 881 Handle<Code> apply_code(Isolate::Current()->builtins()->builtin(
882 Builtins::FunctionApply));
880 __ Cmp(FieldOperand(rax, SharedFunctionInfo::kCodeOffset), apply_code); 883 __ Cmp(FieldOperand(rax, SharedFunctionInfo::kCodeOffset), apply_code);
881 __ j(not_equal, &build_args); 884 __ j(not_equal, &build_args);
882 885
883 // Check that applicand is a function. 886 // Check that applicand is a function.
884 __ movq(rdi, Operand(rsp, 2 * kPointerSize)); 887 __ movq(rdi, Operand(rsp, 2 * kPointerSize));
885 is_smi = masm_->CheckSmi(rdi); 888 is_smi = masm_->CheckSmi(rdi);
886 __ j(is_smi, &build_args); 889 __ j(is_smi, &build_args);
887 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); 890 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx);
888 __ j(not_equal, &build_args); 891 __ j(not_equal, &build_args);
889 892
(...skipping 2291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 } 3184 }
3182 3185
3183 3186
3184 void CodeGenerator::VisitCallRuntime(CallRuntime* node) { 3187 void CodeGenerator::VisitCallRuntime(CallRuntime* node) {
3185 if (CheckForInlineRuntimeCall(node)) { 3188 if (CheckForInlineRuntimeCall(node)) {
3186 return; 3189 return;
3187 } 3190 }
3188 3191
3189 ZoneList<Expression*>* args = node->arguments(); 3192 ZoneList<Expression*>* args = node->arguments();
3190 Comment cmnt(masm_, "[ CallRuntime"); 3193 Comment cmnt(masm_, "[ CallRuntime");
3191 Runtime::Function* function = node->function(); 3194 const Runtime::Function* function = node->function();
3192 3195
3193 if (function == NULL) { 3196 if (function == NULL) {
3194 // Push the builtins object found in the current global object. 3197 // Push the builtins object found in the current global object.
3195 Result temp = allocator()->Allocate(); 3198 Result temp = allocator()->Allocate();
3196 ASSERT(temp.is_valid()); 3199 ASSERT(temp.is_valid());
3197 __ movq(temp.reg(), GlobalObject()); 3200 __ movq(temp.reg(), GlobalObject());
3198 __ movq(temp.reg(), 3201 __ movq(temp.reg(),
3199 FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset)); 3202 FieldOperand(temp.reg(), GlobalObject::kBuiltinsOffset));
3200 frame_->Push(&temp); 3203 frame_->Push(&temp);
3201 } 3204 }
(...skipping 3592 matching lines...) Expand 10 before | Expand all | Expand 10 after
6794 Register receiver_; 6797 Register receiver_;
6795 Handle<String> name_; 6798 Handle<String> name_;
6796 }; 6799 };
6797 6800
6798 6801
6799 void DeferredReferenceGetNamedValue::Generate() { 6802 void DeferredReferenceGetNamedValue::Generate() {
6800 if (!receiver_.is(rax)) { 6803 if (!receiver_.is(rax)) {
6801 __ movq(rax, receiver_); 6804 __ movq(rax, receiver_);
6802 } 6805 }
6803 __ Move(rcx, name_); 6806 __ Move(rcx, name_);
6804 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 6807 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
6808 Builtins::LoadIC_Initialize));
6805 __ Call(ic, RelocInfo::CODE_TARGET); 6809 __ Call(ic, RelocInfo::CODE_TARGET);
6806 // The call must be followed by a test rax instruction to indicate 6810 // The call must be followed by a test rax instruction to indicate
6807 // that the inobject property case was inlined. 6811 // that the inobject property case was inlined.
6808 // 6812 //
6809 // Store the delta to the map check instruction here in the test 6813 // Store the delta to the map check instruction here in the test
6810 // instruction. Use masm_-> instead of the __ macro since the 6814 // instruction. Use masm_-> instead of the __ macro since the
6811 // latter can't return a value. 6815 // latter can't return a value.
6812 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site()); 6816 int delta_to_patch_site = masm_->SizeOfCodeGeneratedSince(patch_site());
6813 // Here we use masm_-> instead of the __ macro because this is the 6817 // Here we use masm_-> instead of the __ macro because this is the
6814 // instruction that gets patched and coverage code gets in the way. 6818 // instruction that gets patched and coverage code gets in the way.
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after
9754 __ InvokeFunction(rdi, actual, JUMP_FUNCTION); 9758 __ InvokeFunction(rdi, actual, JUMP_FUNCTION);
9755 9759
9756 // Slow-case: Non-function called. 9760 // Slow-case: Non-function called.
9757 __ bind(&slow); 9761 __ bind(&slow);
9758 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead 9762 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead
9759 // of the original receiver from the call site). 9763 // of the original receiver from the call site).
9760 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rdi); 9764 __ movq(Operand(rsp, (argc_ + 1) * kPointerSize), rdi);
9761 __ Set(rax, argc_); 9765 __ Set(rax, argc_);
9762 __ Set(rbx, 0); 9766 __ Set(rbx, 0);
9763 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION); 9767 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION);
9764 Handle<Code> adaptor(Builtins::builtin(Builtins::ArgumentsAdaptorTrampoline)); 9768 Handle<Code> adaptor(Isolate::Current()->builtins()->builtin(
9769 Builtins::ArgumentsAdaptorTrampoline));
9765 __ Jump(adaptor, RelocInfo::CODE_TARGET); 9770 __ Jump(adaptor, RelocInfo::CODE_TARGET);
9766 } 9771 }
9767 9772
9768 9773
9769 void CEntryStub::Generate(MacroAssembler* masm) { 9774 void CEntryStub::Generate(MacroAssembler* masm) {
9770 // rax: number of arguments including receiver 9775 // rax: number of arguments including receiver
9771 // rbx: pointer to C function (C callee-saved) 9776 // rbx: pointer to C function (C callee-saved)
9772 // rbp: frame pointer of calling JS frame (restored after C call) 9777 // rbp: frame pointer of calling JS frame (restored after C call)
9773 // rsp: stack pointer (restored after C call) 9778 // rsp: stack pointer (restored after C call)
9774 // rsi: current context (restored) 9779 // rsi: current context (restored)
(...skipping 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
11954 } 11959 }
11955 11960
11956 #endif 11961 #endif
11957 11962
11958 11963
11959 #undef __ 11964 #undef __
11960 11965
11961 } } // namespace v8::internal 11966 } } // namespace v8::internal
11962 11967
11963 #endif // V8_TARGET_ARCH_X64 11968 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime.h ('K') | « src/x64/codegen-x64.h ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698