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

Unified Diff: src/codegen-ia32.cc

Issue 12673: Change implementation of eval to make an exact distinction between direct eva... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 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 side-by-side diff with in-line comments
Download patch
« src/codegen-arm.cc ('K') | « src/codegen-ia32.h ('k') | src/contexts.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 854)
+++ src/codegen-ia32.cc (working copy)
@@ -2836,6 +2836,54 @@
}
+void CodeGenerator::VisitCallEval(CallEval* node) {
+ Comment cmnt(masm_, "[ Call");
Mads Ager (chromium) 2008/11/27 13:46:02 CallEval?
+
+ // In a call to eval, we first call %ResolvePossiblyDirectEval to resolve
+ // the function we need to call and the receiver of the call.
+ // Then we call the resolved function using the given arguments.
+
+ ZoneList<Expression*>* args = node->arguments();
+ Expression* function = node->expression();
+
+ RecordStatementPosition(node);
+
+ // Prepare stack for call to resolved function.
+ Load(function);
+ __ push(Immediate(Factory::undefined_value())); // Slot for receiver
+ for (int i = 0; i < args->length(); i++) {
+ Load(args->at(i));
+ }
+
+ // Prepare stack for call to ResolvePossiblyDirectEval.
+ __ push(Operand(esp, args->length() * kPointerSize + kPointerSize));
+ if (args->length() > 0) {
+ __ push(Operand(esp, args->length() * kPointerSize));
+ } else {
+ __ push(Immediate(Factory::undefined_value()));
+ }
+
+ // Resolve the call.
+ __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 2);
+
+ // Touch up stack with the right values for the function and the receiver.
+ __ mov(edx, FieldOperand(eax, FixedArray::kHeaderSize));
+ __ mov(Operand(esp, (args->length() + 1) * kPointerSize), edx);
+ __ mov(edx, FieldOperand(eax, FixedArray::kHeaderSize + kPointerSize));
+ __ mov(Operand(esp, args->length() * kPointerSize), edx);
+
+ // Call the function.
+ __ RecordPosition(node->position());
+
+ CallFunctionStub call_function(args->length());
+ __ CallStub(&call_function);
+
+ // Restore context and pop function from the stack.
+ __ mov(esi, frame_->Context());
+ __ mov(frame_->Top(), eax);
+}
+
+
void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
ASSERT(args->length() == 1);
Load(args->at(0));
« src/codegen-arm.cc ('K') | « src/codegen-ia32.h ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698