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

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

Issue 556100: 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
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 87
88 // Copy any necessary parameters into the context. 88 // Copy any necessary parameters into the context.
89 int num_parameters = fun->scope()->num_parameters(); 89 int num_parameters = fun->scope()->num_parameters();
90 for (int i = 0; i < num_parameters; i++) { 90 for (int i = 0; i < num_parameters; i++) {
91 Slot* slot = fun->scope()->parameter(i)->slot(); 91 Slot* slot = fun->scope()->parameter(i)->slot();
92 if (slot != NULL && slot->type() == Slot::CONTEXT) { 92 if (slot != NULL && slot->type() == Slot::CONTEXT) {
93 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 93 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
94 (num_parameters - 1 - i) * kPointerSize; 94 (num_parameters - 1 - i) * kPointerSize;
95 // Load parameter from stack. 95 // Load parameter from stack.
96 __ movq(rax, Operand(rbp, parameter_offset)); 96 __ movq(rax, Operand(rbp, parameter_offset));
97 // Store it in the context 97 // Store it in the context.
98 __ movq(Operand(rsi, Context::SlotOffset(slot->index())), rax); 98 int context_offset = Context::SlotOffset(slot->index());
99 __ movq(Operand(rsi, context_offset), rax);
100 // Update the write barrier. This clobbers all involved
101 // registers, so we have use a third register to avoid
102 // clobbering rsi.
103 __ movq(rcx, rsi);
104 __ RecordWrite(rcx, context_offset, rax, rbx);
99 } 105 }
100 } 106 }
101 } 107 }
102 108
103 // Possibly allocate an arguments object. 109 // Possibly allocate an arguments object.
104 Variable* arguments = fun->scope()->arguments()->AsVariable(); 110 Variable* arguments = fun->scope()->arguments()->AsVariable();
105 if (arguments != NULL) { 111 if (arguments != NULL) {
106 // Arguments object must be allocated after the context object, in 112 // Arguments object must be allocated after the context object, in
107 // case the "arguments" or ".arguments" variables are in the context. 113 // case the "arguments" or ".arguments" variables are in the context.
108 Comment cmnt(masm_, "[ Allocate arguments object"); 114 Comment cmnt(masm_, "[ Allocate arguments object");
109 if (function_in_register) { 115 if (function_in_register) {
110 __ push(rdi); 116 __ push(rdi);
111 } else { 117 } else {
112 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 118 __ push(Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
113 } 119 }
114 // The receiver is just before the parameters on the caller's stack. 120 // The receiver is just before the parameters on the caller's stack.
115 __ lea(rdx, Operand(rbp, StandardFrameConstants::kCallerSPOffset + 121 __ lea(rdx, Operand(rbp, StandardFrameConstants::kCallerSPOffset +
116 fun->num_parameters() * kPointerSize)); 122 fun->num_parameters() * kPointerSize));
117 __ push(rdx); 123 __ push(rdx);
118 __ Push(Smi::FromInt(fun->num_parameters())); 124 __ Push(Smi::FromInt(fun->num_parameters()));
119 // Arguments to ArgumentsAccessStub: 125 // Arguments to ArgumentsAccessStub:
120 // function, receiver address, parameter count. 126 // function, receiver address, parameter count.
121 // The stub will rewrite receiver and parameter count if the previous 127 // The stub will rewrite receiver and parameter count if the previous
122 // stack frame was an arguments adapter frame. 128 // stack frame was an arguments adapter frame.
123 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 129 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
124 __ CallStub(&stub); 130 __ CallStub(&stub);
125 // Store new arguments object in both "arguments" and ".arguments" slots. 131 // Store new arguments object in both "arguments" and ".arguments" slots.
126 __ movq(rcx, rax); 132 __ movq(rcx, rax);
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 __ movq(Operand(rsp, 0), rdx); 1890 __ movq(Operand(rsp, 0), rdx);
1885 // And return. 1891 // And return.
1886 __ ret(0); 1892 __ ret(0);
1887 } 1893 }
1888 1894
1889 1895
1890 #undef __ 1896 #undef __
1891 1897
1892 1898
1893 } } // namespace v8::internal 1899 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698