Author: [EMAIL PROTECTED]
Date: Mon Oct 6 09:57:38 2008
New Revision: 448
Modified:
branches/bleeding_edge/src/codegen-arm.cc
branches/bleeding_edge/src/codegen-ia32.cc
branches/bleeding_edge/src/runtime.cc
branches/bleeding_edge/src/runtime.h
Log:
DeclareContextSlot took an extra completely random argument from the
stack which was returned and always pushed back.
Removed it.
Review URL: http://codereview.chromium.org/6802
Modified: branches/bleeding_edge/src/codegen-arm.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-arm.cc (original)
+++ branches/bleeding_edge/src/codegen-arm.cc Mon Oct 6 09:57:38 2008
@@ -1442,9 +1442,8 @@
__ mov(r0, Operand(0)); // no initial value!
__ push(r0);
}
- __ CallRuntime(Runtime::kDeclareContextSlot, 5);
- __ push(r0);
-
+ __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ // Ignore the return value (declarations are statements).
return;
}
Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc Mon Oct 6 09:57:38 2008
@@ -1735,11 +1735,8 @@
} else {
__ push(Immediate(0)); // no initial value!
}
- __ CallRuntime(Runtime::kDeclareContextSlot, 5);
- // DeclareContextSlot pops the assigned value by accepting an
- // extra argument and returning the TOS; no need to explicitly
- // pop here.
- __ push(eax);
+ __ CallRuntime(Runtime::kDeclareContextSlot, 4);
+ // Ignore the return value (declarations are statements).
return;
}
Modified: branches/bleeding_edge/src/runtime.cc
==============================================================================
--- branches/bleeding_edge/src/runtime.cc (original)
+++ branches/bleeding_edge/src/runtime.cc Mon Oct 6 09:57:38 2008
@@ -402,22 +402,21 @@
IgnoreAttributesAndSetLocalProperty(global, name, value, attributes);
}
}
- // Done.
+
return Heap::undefined_value();
}
static Object* Runtime_DeclareContextSlot(Arguments args) {
HandleScope scope;
- ASSERT(args.length() == 5);
+ ASSERT(args.length() == 4);
- // args[0] is result (TOS)
- CONVERT_ARG_CHECKED(Context, context, 1);
- Handle<String> name(String::cast(args[2]));
+ CONVERT_ARG_CHECKED(Context, context, 0);
+ Handle<String> name(String::cast(args[1]));
PropertyAttributes mode =
- static_cast<PropertyAttributes>(Smi::cast(args[3])->value());
+ static_cast<PropertyAttributes>(Smi::cast(args[2])->value());
ASSERT(mode == READ_ONLY || mode == NONE);
- Handle<Object> initial_value(args[4]);
+ Handle<Object> initial_value(args[3]);
// Declarations are always done in the function context.
context = Handle<Context>(context->fcontext());
@@ -456,32 +455,35 @@
SetProperty(context_ext, name, initial_value, mode);
}
}
- return args[0]; // return TOS
- }
- // The property is not in the function context. It needs to be "declared"
- // in the function context's extension context, or in the global context.
- Handle<JSObject> context_ext;
- if (context->extension() != NULL) {
- // The function context's extension context exists - use it.
- context_ext = Handle<JSObject>(context->extension());
} else {
- // The function context's extension context does not exists - allocate
it.
- context_ext = Factory::NewJSObject(Top::context_extension_function());
- // And store it in the extension slot.
- context->set_extension(*context_ext);
+ // The property is not in the function context. It needs to be
+ // "declared" in the function context's extension context, or in the
+ // global context.
+ Handle<JSObject> context_ext;
+ if (context->extension() != NULL) {
+ // The function context's extension context exists - use it.
+ context_ext = Handle<JSObject>(context->extension());
+ } else {
+ // The function context's extension context does not exists -
allocate
+ // it.
+ context_ext =
Factory::NewJSObject(Top::context_extension_function());
+ // And store it in the extension slot.
+ context->set_extension(*context_ext);
+ }
+ ASSERT(*context_ext != NULL);
+
+ // Declare the property by setting it to the initial value if provided,
+ // or undefined, and use the correct mode (e.g. READ_ONLY attribute for
+ // constant declarations).
+ ASSERT(!context_ext->HasLocalProperty(*name));
+ Handle<Object> value(Heap::undefined_value());
+ if (*initial_value != NULL) value = initial_value;
+ SetProperty(context_ext, name, value, mode);
+ ASSERT(context_ext->GetLocalPropertyAttribute(*name) == mode);
}
- ASSERT(*context_ext != NULL);
- // Declare the property by setting it to the initial value if provided,
- // or undefined, and use the correct mode (e.g. READ_ONLY attribute for
- // constant declarations).
- ASSERT(!context_ext->HasLocalProperty(*name));
- Handle<Object> value(Heap::undefined_value());
- if (*initial_value != NULL) value = initial_value;
- SetProperty(context_ext, name, value, mode);
- ASSERT(context_ext->GetLocalPropertyAttribute(*name) == mode);
- return args[0]; // return TOS
+ return Heap::undefined_value();
}
Modified: branches/bleeding_edge/src/runtime.h
==============================================================================
--- branches/bleeding_edge/src/runtime.h (original)
+++ branches/bleeding_edge/src/runtime.h Mon Oct 6 09:57:38 2008
@@ -260,7 +260,7 @@
\
/* Declarations and initialization */ \
F(DeclareGlobals, 3) \
- F(DeclareContextSlot, 5) \
+ F(DeclareContextSlot, 4) \
F(InitializeVarGlobal, -1 /* 1 or 2 */) \
F(InitializeConstGlobal, 2) \
F(InitializeConstContextSlot, 3) \
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---