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

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

Issue 569008: Remember to update the write barrier when storing into... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // Copy any necessary parameters into the context. 89 // Copy any necessary parameters into the context.
90 int num_parameters = fun->scope()->num_parameters(); 90 int num_parameters = fun->scope()->num_parameters();
91 for (int i = 0; i < num_parameters; i++) { 91 for (int i = 0; i < num_parameters; i++) {
92 Slot* slot = fun->scope()->parameter(i)->slot(); 92 Slot* slot = fun->scope()->parameter(i)->slot();
93 if (slot != NULL && slot->type() == Slot::CONTEXT) { 93 if (slot != NULL && slot->type() == Slot::CONTEXT) {
94 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 94 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
95 (num_parameters - 1 - i) * kPointerSize; 95 (num_parameters - 1 - i) * kPointerSize;
96 // Load parameter from stack. 96 // Load parameter from stack.
97 __ movq(rax, Operand(rbp, parameter_offset)); 97 __ movq(rax, Operand(rbp, parameter_offset));
98 // Store it in the context 98 // Store it in the context.
99 __ movq(Operand(rsi, Context::SlotOffset(slot->index())), rax); 99 int context_offset = Context::SlotOffset(slot->index());
100 __ movq(Operand(rsi, context_offset), rax);
101 // Update the write barrier. This clobbers all involved
102 // registers, so we have use a third register to avoid
103 // clobbering rsi.
104 __ movq(rcx, rsi);
105 __ RecordWrite(rcx, context_offset, rax, rbx);
100 } 106 }
101 } 107 }
102 } 108 }
103 109
104 // Possibly allocate an arguments object. 110 // Possibly allocate an arguments object.
105 Variable* arguments = fun->scope()->arguments()->AsVariable(); 111 Variable* arguments = fun->scope()->arguments()->AsVariable();
106 if (arguments != NULL) { 112 if (arguments != NULL) {
107 // Arguments object must be allocated after the context object, in 113 // Arguments object must be allocated after the context object, in
108 // case the "arguments" or ".arguments" variables are in the context. 114 // case the "arguments" or ".arguments" variables are in the context.
109 Comment cmnt(masm_, "[ Allocate arguments object"); 115 Comment cmnt(masm_, "[ Allocate arguments object");
110 if (function_in_register) { 116 if (function_in_register) {
111 __ push(rdi); 117 __ push(rdi);
112 } else { 118 } else {
113 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 119 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
114 } 120 }
115 // The receiver is just before the parameters on the caller's stack. 121 // The receiver is just before the parameters on the caller's stack.
116 __ lea(rdx, Operand(rbp, StandardFrameConstants::kCallerSPOffset + 122 __ lea(rdx, Operand(rbp, StandardFrameConstants::kCallerSPOffset +
117 fun->num_parameters() * kPointerSize)); 123 fun->num_parameters() * kPointerSize));
118 __ push(rdx); 124 __ push(rdx);
119 __ Push(Smi::FromInt(fun->num_parameters())); 125 __ Push(Smi::FromInt(fun->num_parameters()));
120 // Arguments to ArgumentsAccessStub: 126 // Arguments to ArgumentsAccessStub:
121 // function, receiver address, parameter count. 127 // function, receiver address, parameter count.
122 // The stub will rewrite receiver and parameter count if the previous 128 // The stub will rewrite receiver and parameter count if the previous
123 // stack frame was an arguments adapter frame. 129 // stack frame was an arguments adapter frame.
124 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 130 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
125 __ CallStub(&stub); 131 __ CallStub(&stub);
126 // Store new arguments object in both "arguments" and ".arguments" slots. 132 // Store new arguments object in both "arguments" and ".arguments" slots.
127 __ movq(rcx, rax); 133 __ movq(rcx, rax);
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 __ movq(Operand(rsp, 0), rdx); 1893 __ movq(Operand(rsp, 0), rdx);
1888 // And return. 1894 // And return.
1889 __ ret(0); 1895 __ ret(0);
1890 } 1896 }
1891 1897
1892 1898
1893 #undef __ 1899 #undef __
1894 1900
1895 1901
1896 } } // namespace v8::internal 1902 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698