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

Side by Side Diff: src/ia32/fast-codegen-ia32.cc

Issue 369003: In the toplevel code generator, suppor local context allocation... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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/compiler.cc ('k') | src/x64/fast-codegen-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 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 __ push(esi); // Callee's context. 60 __ push(esi); // Callee's context.
61 __ push(edi); // Callee's JS Function. 61 __ push(edi); // Callee's JS Function.
62 62
63 { Comment cmnt(masm_, "[ Allocate locals"); 63 { Comment cmnt(masm_, "[ Allocate locals");
64 int locals_count = fun->scope()->num_stack_slots(); 64 int locals_count = fun->scope()->num_stack_slots();
65 for (int i = 0; i < locals_count; i++) { 65 for (int i = 0; i < locals_count; i++) {
66 __ push(Immediate(Factory::undefined_value())); 66 __ push(Immediate(Factory::undefined_value()));
67 } 67 }
68 } 68 }
69 69
70 // Possibly allocate a local context.
71 if (fun->scope()->num_heap_slots() > 0) {
72 Comment cmnt(masm_, "[ Allocate local context");
73 // Argument to NewContext is the function, still in edi.
74 __ push(edi);
75 __ CallRuntime(Runtime::kNewContext, 1);
76 // Context is returned in both eax and esi. It replaces the context
77 // passed to us. It's saved in the stack and kept live in esi.
78 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi);
79 #ifdef DEBUG
80 // Assert we do not have to copy any parameters into the context.
81 for (int i = 0, len = fun->scope()->num_parameters(); i < len; i++) {
82 Slot* slot = fun->scope()->parameter(i)->slot();
83 ASSERT(slot != NULL && slot->type() != Slot::CONTEXT);
84 }
85 #endif
86 }
87
70 { Comment cmnt(masm_, "[ Declarations"); 88 { Comment cmnt(masm_, "[ Declarations");
71 VisitDeclarations(fun->scope()->declarations()); 89 VisitDeclarations(fun->scope()->declarations());
72 } 90 }
73 91
74 { Comment cmnt(masm_, "[ Stack check"); 92 { Comment cmnt(masm_, "[ Stack check");
75 Label ok; 93 Label ok;
76 ExternalReference stack_guard_limit = 94 ExternalReference stack_guard_limit =
77 ExternalReference::address_of_stack_guard_limit(); 95 ExternalReference::address_of_stack_guard_limit();
78 __ cmp(esp, Operand::StaticVariable(stack_guard_limit)); 96 __ cmp(esp, Operand::StaticVariable(stack_guard_limit));
79 __ j(above_equal, &ok, taken); 97 __ j(above_equal, &ok, taken);
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 true_label_ = saved_true; 1300 true_label_ = saved_true;
1283 false_label_ = saved_false; 1301 false_label_ = saved_false;
1284 // Convert current context to test context: End post-test code. 1302 // Convert current context to test context: End post-test code.
1285 } 1303 }
1286 1304
1287 1305
1288 #undef __ 1306 #undef __
1289 1307
1290 1308
1291 } } // namespace v8::internal 1309 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698