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

Unified Diff: src/runtime/runtime-scopes.cc

Issue 716833002: Various clean-ups after top-level lexical declarations are done. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing Created 6 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/runtime/runtime-debug.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index 5ee9b2559666de960ddb104f3cdd721de63ae31e..1a421268330edbfd8d7fbee64640e2458605f3f5 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -27,10 +27,10 @@ static Object* DeclareGlobals(Isolate* isolate, Handle<GlobalObject> global,
Handle<String> name, Handle<Object> value,
PropertyAttributes attr, bool is_var,
bool is_const, bool is_function) {
- Handle<GlobalContextTable> global_contexts(
- global->native_context()->global_context_table());
- GlobalContextTable::LookupResult lookup;
- if (GlobalContextTable::Lookup(global_contexts, name, &lookup) &&
+ Handle<ScriptContextTable> script_contexts(
+ global->native_context()->script_context_table());
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_contexts, name, &lookup) &&
IsLexicalVariableMode(lookup.mode)) {
return ThrowRedeclarationError(isolate, name);
}
@@ -197,7 +197,7 @@ RUNTIME_FUNCTION(Runtime_DeclareLookupSlot) {
HandleScope scope(isolate);
DCHECK(args.length() == 4);
- // Declarations are always made in a function, native, or global context. In
+ // Declarations are always made in a function, eval or script context. In
// the case of eval code, the context passed is the context of the caller,
// which may be some nested context and not the declaration context.
CONVERT_ARG_HANDLE_CHECKED(Context, context_arg, 0);
@@ -517,13 +517,13 @@ RUNTIME_FUNCTION(Runtime_NewClosure) {
static Object* FindNameClash(Handle<ScopeInfo> scope_info,
Handle<GlobalObject> global_object,
- Handle<GlobalContextTable> global_context) {
+ Handle<ScriptContextTable> script_context) {
Isolate* isolate = scope_info->GetIsolate();
for (int var = 0; var < scope_info->ContextLocalCount(); var++) {
Handle<String> name(scope_info->ContextLocalName(var));
VariableMode mode = scope_info->ContextLocalMode(var);
- GlobalContextTable::LookupResult lookup;
- if (GlobalContextTable::Lookup(global_context, name, &lookup)) {
+ ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_context, name, &lookup)) {
if (IsLexicalVariableMode(mode) || IsLexicalVariableMode(lookup.mode)) {
return ThrowRedeclarationError(isolate, name);
}
@@ -545,7 +545,7 @@ static Object* FindNameClash(Handle<ScopeInfo> scope_info,
}
-RUNTIME_FUNCTION(Runtime_NewGlobalContext) {
+RUNTIME_FUNCTION(Runtime_NewScriptContext) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
@@ -553,23 +553,23 @@ RUNTIME_FUNCTION(Runtime_NewGlobalContext) {
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
Handle<GlobalObject> global_object(function->context()->global_object());
Handle<Context> native_context(global_object->native_context());
- Handle<GlobalContextTable> global_context_table(
- native_context->global_context_table());
+ Handle<ScriptContextTable> script_context_table(
+ native_context->script_context_table());
Handle<String> clashed_name;
Object* name_clash_result =
- FindNameClash(scope_info, global_object, global_context_table);
+ FindNameClash(scope_info, global_object, script_context_table);
if (isolate->has_pending_exception()) return name_clash_result;
Handle<Context> result =
- isolate->factory()->NewGlobalContext(function, scope_info);
+ isolate->factory()->NewScriptContext(function, scope_info);
DCHECK(function->context() == isolate->context());
DCHECK(function->context()->global_object() == result->global_object());
- Handle<GlobalContextTable> new_global_context_table =
- GlobalContextTable::Extend(global_context_table, result);
- native_context->set_global_context_table(*new_global_context_table);
+ Handle<ScriptContextTable> new_script_context_table =
+ ScriptContextTable::Extend(script_context_table, result);
+ native_context->set_script_context_table(*new_script_context_table);
return *result;
}
@@ -679,7 +679,7 @@ RUNTIME_FUNCTION(Runtime_PushModuleContext) {
if (!args[1]->IsScopeInfo()) {
// Module already initialized. Find hosting context and retrieve context.
- Context* host = Context::cast(isolate->context())->global_context();
+ Context* host = Context::cast(isolate->context())->script_context();
Context* context = Context::cast(host->get(index));
DCHECK(context->previous() == isolate->context());
isolate->set_context(context);
@@ -701,7 +701,7 @@ RUNTIME_FUNCTION(Runtime_PushModuleContext) {
isolate->set_context(*context);
// Find hosting scope and initialize internal variable holding module there.
- previous->global_context()->set(index, *context);
+ previous->script_context()->set(index, *context);
return *context;
}
« no previous file with comments | « src/runtime/runtime-debug.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698