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

Unified Diff: src/runtime.cc

Issue 6802: DeclareContextSlot took an extra completely random argument from the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 446)
+++ src/runtime.cc (working copy)
@@ -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();
}
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698