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

Side by Side Diff: src/ia32/full-codegen-ia32.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
« no previous file with comments | « src/full-codegen.cc ('k') | src/ia32/macro-assembler-ia32.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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // formal parameter count expected by the function. 44 // formal parameter count expected by the function.
45 // 45 //
46 // The live registers are: 46 // The live registers are:
47 // o edi: the JS function object being called (ie, ourselves) 47 // o edi: the JS function object being called (ie, ourselves)
48 // o esi: our context 48 // o esi: our context
49 // o ebp: our caller's frame pointer 49 // o ebp: our caller's frame pointer
50 // o esp: stack pointer (pointing to return address) 50 // o esp: stack pointer (pointing to return address)
51 // 51 //
52 // The function builds a JS frame. Please see JavaScriptFrameConstants in 52 // The function builds a JS frame. Please see JavaScriptFrameConstants in
53 // frames-ia32.h for its layout. 53 // frames-ia32.h for its layout.
54 void FullCodeGenerator::Generate(FunctionLiteral* fun, Mode mode) { 54 void FullCodeGenerator::Generate(FunctionLiteral* fun', Mode mode) {
Mads Ager (chromium) 2010/02/02 07:51:15 Accidental edit?
Lasse Reichstein 2010/02/02 07:51:33 Typo '.
55 function_ = fun; 55 function_ = fun;
56 SetFunctionPosition(fun); 56 SetFunctionPosition(fun);
57 57
58 if (mode == PRIMARY) { 58 if (mode == PRIMARY) {
59 __ push(ebp); // Caller's frame pointer. 59 __ push(ebp); // Caller's frame pointer.
60 __ mov(ebp, esp); 60 __ mov(ebp, esp);
61 __ push(esi); // Callee's context. 61 __ push(esi); // Callee's context.
62 __ push(edi); // Callee's JS Function. 62 __ push(edi); // Callee's JS Function.
63 63
64 { Comment cmnt(masm_, "[ Allocate locals"); 64 { Comment cmnt(masm_, "[ Allocate locals");
(...skipping 23 matching lines...) Expand all
88 88
89 // Copy parameters into context if necessary. 89 // Copy parameters into context if necessary.
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 __ mov(eax, Operand(ebp, parameter_offset)); 97 __ mov(eax, Operand(ebp, parameter_offset));
98 // Store it in the context 98 // Store it in the context.
99 __ mov(Operand(esi, Context::SlotOffset(slot->index())), eax); 99 int context_offset = Context::SlotOffset(slot->index());
100 __ mov(Operand(esi, context_offset), eax);
101 // Update the write barrier. This clobbers all involved
102 // registers, so we have use a third register to avoid
103 // clobbering esi.
104 __ mov(ecx, esi);
105 __ RecordWrite(ecx, context_offset, eax, ebx);
100 } 106 }
101 } 107 }
102 } 108 }
103 109
104 Variable* arguments = fun->scope()->arguments()->AsVariable(); 110 Variable* arguments = fun->scope()->arguments()->AsVariable();
105 if (arguments != NULL) { 111 if (arguments != NULL) {
106 // Function uses arguments object. 112 // Function uses arguments object.
107 Comment cmnt(masm_, "[ Allocate arguments object"); 113 Comment cmnt(masm_, "[ Allocate arguments object");
108 if (function_in_register) { 114 if (function_in_register) {
109 __ push(edi); 115 __ push(edi);
110 } else { 116 } else {
111 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 117 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
112 } 118 }
113 // Receiver is just before the parameters on the caller's stack. 119 // Receiver is just before the parameters on the caller's stack.
114 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + 120 __ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset +
115 fun->num_parameters() * kPointerSize)); 121 fun->num_parameters() * kPointerSize));
116 __ push(edx); 122 __ push(edx);
117 __ push(Immediate(Smi::FromInt(fun->num_parameters()))); 123 __ push(Immediate(Smi::FromInt(fun->num_parameters())));
118 // Arguments to ArgumentsAccessStub: 124 // Arguments to ArgumentsAccessStub:
119 // function, receiver address, parameter count. 125 // function, receiver address, parameter count.
120 // The stub will rewrite receiver and parameter count if the previous 126 // The stub will rewrite receiver and parameter count if the previous
121 // stack frame was an arguments adapter frame. 127 // stack frame was an arguments adapter frame.
122 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 128 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
123 __ CallStub(&stub); 129 __ CallStub(&stub);
124 __ mov(ecx, eax); // Duplicate result. 130 __ mov(ecx, eax); // Duplicate result.
125 Move(arguments->slot(), eax, ebx, edx); 131 Move(arguments->slot(), eax, ebx, edx);
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 __ add(Operand(edx), Immediate(masm_->CodeObject())); 1891 __ add(Operand(edx), Immediate(masm_->CodeObject()));
1886 __ mov(Operand(esp, 0), edx); 1892 __ mov(Operand(esp, 0), edx);
1887 // And return. 1893 // And return.
1888 __ ret(0); 1894 __ ret(0);
1889 } 1895 }
1890 1896
1891 1897
1892 #undef __ 1898 #undef __
1893 1899
1894 } } // namespace v8::internal 1900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/ia32/macro-assembler-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698