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

Unified Diff: src/codegen-arm.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
« no previous file with comments | « src/codegen-arm.h ('k') | src/codegen-ia32.h » ('j') | src/codegen-ia32.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-arm.cc
===================================================================
--- src/codegen-arm.cc (revision 854)
+++ src/codegen-arm.cc (working copy)
@@ -2303,7 +2303,7 @@
ZoneList<Expression*>* args = node->arguments();
- if (FLAG_debug_info) RecordStatementPosition(node);
+ RecordStatementPosition(node);
// Standard function call.
// Check if the function is a variable or a property.
@@ -2430,6 +2430,58 @@
}
+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);
+ __ mov(r2, Operand(Factory::undefined_value()));
+ __ push(r2); // Slot for receiver
+ for (int i = 0; i < args->length(); i++) {
+ Load(args->at(i));
+ }
+
+ // Prepare stack for call to ResolvePossiblyDirectEval.
+ __ ldr(r1, MemOperand(sp, args->length() * kPointerSize + kPointerSize));
+ __ push(r1);
+ if (args->length() > 0) {
+ __ ldr(r1, MemOperand(sp, args->length() * kPointerSize));
+ __ push(r1);
+ } else {
+ __ push(r2);
+ }
+
+ // Resolve the call.
+ __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 2);
+
+ // Touch up stack with the right values for the function and the receiver.
+ __ ldr(r1, FieldMemOperand(r0, FixedArray::kHeaderSize));
+ __ str(r1, MemOperand(sp, (args->length() + 1) * kPointerSize));
+ __ ldr(r1, FieldMemOperand(r0, FixedArray::kHeaderSize + kPointerSize));
+ __ str(r1, MemOperand(sp, args->length() * kPointerSize));
+
+ // Call the function.
+ __ RecordPosition(node->position());
+
+ CallFunctionStub call_function(args->length());
+ __ CallStub(&call_function);
+
+ __ ldr(cp, frame_->Context());
+ // Remove the function from the stack.
+ frame_->Pop();
+ frame_->Push(r0);
+}
+
+
void CodeGenerator::VisitCallNew(CallNew* node) {
Comment cmnt(masm_, "[ CallNew");
« no previous file with comments | « src/codegen-arm.h ('k') | src/codegen-ia32.h » ('j') | src/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698