Revision: 25291
Author:   dslo...@chromium.org
Date:     Wed Nov 12 11:34:09 2014 UTC
Log:      Various clean-ups after top-level lexical declarations are done.

1. Global{Context,Scope}=>Script{Context,Scope}
2. Enable fixed tests
3. Update comments

R=rossb...@chromium.org
BUG=v8:2198
LOG=N

Review URL: https://codereview.chromium.org/716833002
https://code.google.com/p/v8/source/detail?r=25291

Modified:
 /branches/bleeding_edge/include/v8.h
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/arm/full-codegen-arm.cc
 /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc
 /branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/compiler/js-generic-lowering.cc
 /branches/bleeding_edge/src/compiler/js-operator.cc
 /branches/bleeding_edge/src/compiler/js-operator.h
 /branches/bleeding_edge/src/compiler/opcodes.h
 /branches/bleeding_edge/src/compiler/typer.cc
 /branches/bleeding_edge/src/compiler/verifier.cc
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/contexts.cc
 /branches/bleeding_edge/src/contexts.h
 /branches/bleeding_edge/src/factory.cc
 /branches/bleeding_edge/src/factory.h
 /branches/bleeding_edge/src/full-codegen.cc
 /branches/bleeding_edge/src/globals.h
 /branches/bleeding_edge/src/heap/heap.cc
 /branches/bleeding_edge/src/heap/heap.h
 /branches/bleeding_edge/src/heap-snapshot-generator.cc
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/hydrogen.cc
 /branches/bleeding_edge/src/hydrogen.h
 /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
 /branches/bleeding_edge/src/ic/ic.cc
 /branches/bleeding_edge/src/interface.h
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/mips/full-codegen-mips.cc
 /branches/bleeding_edge/src/mips64/full-codegen-mips64.cc
 /branches/bleeding_edge/src/objects-inl.h
 /branches/bleeding_edge/src/objects.cc
 /branches/bleeding_edge/src/objects.h
 /branches/bleeding_edge/src/parser.cc
 /branches/bleeding_edge/src/parser.h
 /branches/bleeding_edge/src/ppc/full-codegen-ppc.cc
 /branches/bleeding_edge/src/preparser.cc
 /branches/bleeding_edge/src/preparser.h
 /branches/bleeding_edge/src/rewriter.cc
 /branches/bleeding_edge/src/runtime/runtime-debug.cc
 /branches/bleeding_edge/src/runtime/runtime-scopes.cc
 /branches/bleeding_edge/src/runtime/runtime.h
 /branches/bleeding_edge/src/scopes.cc
 /branches/bleeding_edge/src/scopes.h
 /branches/bleeding_edge/src/variables.cc
 /branches/bleeding_edge/src/variables.h
 /branches/bleeding_edge/src/x64/full-codegen-x64.cc
 /branches/bleeding_edge/src/x87/full-codegen-x87.cc
 /branches/bleeding_edge/test/cctest/test-decls.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc
 /branches/bleeding_edge/test/cctest/test-parsing.cc
 /branches/bleeding_edge/test/cctest/test-serialize.cc
 /branches/bleeding_edge/test/unittests/compiler/js-operator-unittest.cc

=======================================
--- /branches/bleeding_edge/include/v8.h        Tue Nov 11 21:44:38 2014 UTC
+++ /branches/bleeding_edge/include/v8.h        Wed Nov 12 11:34:09 2014 UTC
@@ -1011,7 +1011,7 @@
   /**
    * Runs the script returning the resulting value. It will be run in the
    * context in which it was created (ScriptCompiler::CompileBound or
-   * UnboundScript::BindToGlobalContext()).
+   * UnboundScript::BindToCurrentContext()).
    */
   Local<Value> Run();

=======================================
--- /branches/bleeding_edge/src/api.cc  Tue Nov 11 21:44:38 2014 UTC
+++ /branches/bleeding_edge/src/api.cc  Wed Nov 12 11:34:09 2014 UTC
@@ -1567,7 +1567,7 @@
       function_info(i::SharedFunctionInfo::cast(*obj), obj->GetIsolate());
   i::Handle<i::JSFunction> function =
       obj->GetIsolate()->factory()->NewFunctionFromSharedFunctionInfo(
-          function_info, obj->GetIsolate()->global_context());
+          function_info, obj->GetIsolate()->native_context());
   return ToApiHandle<Script>(function);
 }

@@ -1732,7 +1732,7 @@
     EXCEPTION_PREAMBLE(isolate);
     i::Handle<i::SharedFunctionInfo> result = i::Compiler::CompileScript(
         str, name_obj, line_offset, column_offset, is_shared_cross_origin,
-        isolate->global_context(), NULL, &script_data, options,
+        isolate->native_context(), NULL, &script_data, options,
         i::NOT_NATIVES_CODE);
     has_pending_exception = result.is_null();
     if (has_pending_exception && script_data != NULL) {
@@ -1777,17 +1777,6 @@
 ScriptCompiler::ScriptStreamingTask* ScriptCompiler::StartStreamingScript(
     Isolate* v8_isolate, StreamedSource* source, CompileOptions options) {
   i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
-  if (!isolate->global_context().is_null() &&
-      !isolate->global_context()->IsNativeContext()) {
-    // The context chain is non-trivial, and constructing the corresponding
- // non-trivial Scope chain outside the V8 heap is not implemented. Don't - // stream the script. This will only occur if Harmony scoping is enabled and - // a previous script has introduced "let" or "const" variables. TODO(marja): - // Implement externalizing ScopeInfos and constructing non-trivial Scope
-    // chains independent of the V8 heap so that we can stream also in this
-    // case.
-    return NULL;
-  }
   return new i::BackgroundParsingTask(source->impl(), options,
                                       i::FLAG_stack_size, isolate);
 }
@@ -1824,7 +1813,7 @@
                                          v8::True(v8_isolate));
     }
     source->info->set_script(script);
-    source->info->SetContext(isolate->global_context());
+    source->info->SetContext(isolate->native_context());

     EXCEPTION_PREAMBLE(isolate);

=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Nov 12 08:25:59 2014 UTC +++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Wed Nov 12 11:34:09 2014 UTC
@@ -195,10 +195,10 @@
     // Argument to NewContext is the function, which is still in r1.
     Comment cmnt(masm_, "[ Allocate context");
     bool need_write_barrier = true;
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ push(r1);
       __ Push(info->scope()->GetScopeInfo());
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -937,7 +937,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(r1, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(r1, scope_->ContextChainLength(scope_->ScriptScope()));
   __ ldr(r1, ContextOperand(r1, variable->interface()->Index()));
   __ ldr(r1, ContextOperand(r1, Context::EXTENSION_INDEX));

@@ -5071,7 +5071,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Wed Nov 12 08:25:59 2014 UTC +++ /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Wed Nov 12 11:34:09 2014 UTC
@@ -196,10 +196,10 @@
     // Argument to NewContext is the function, which is still in x1.
     Comment cmnt(masm_, "[ Allocate context");
     bool need_write_barrier = true;
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ Mov(x10, Operand(info->scope()->GetScopeInfo()));
       __ Push(x1, x10);
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -934,7 +934,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(x1, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(x1, scope_->ContextChainLength(scope_->ScriptScope()));
   __ Ldr(x1, ContextMemOperand(x1, variable->interface()->Index()));
   __ Ldr(x1, ContextMemOperand(x1, Context::EXTENSION_INDEX));

@@ -5096,7 +5096,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc Fri Nov 7 23:34:13 2014 UTC +++ /branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc Wed Nov 12 11:34:09 2014 UTC
@@ -4087,7 +4087,7 @@

   // Check the context is a native context.
   if (emit_debug_code()) {
-    // Read the first word and compare to the global_context_map.
+    // Read the first word and compare to the native_context_map.
     Ldr(scratch2, FieldMemOperand(scratch1, HeapObject::kMapOffset));
     CompareRoot(scratch2, Heap::kNativeContextMapRootIndex);
     Check(eq, kExpectedNativeContext);
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Tue Nov 11 10:24:52 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Wed Nov 12 11:34:09 2014 UTC
@@ -864,7 +864,6 @@
                                 Handle<JSGlobalProxy> global_proxy) {
   // Set the native context for the global object.
   global_object->set_native_context(*native_context());
-  global_object->set_global_context(*native_context());
   global_object->set_global_proxy(*global_proxy);
   global_proxy->set_native_context(*native_context());
   native_context()->set_global_proxy(*global_proxy);
@@ -909,9 +908,9 @@
   Factory* factory = isolate->factory();
   Heap* heap = isolate->heap();

-  Handle<GlobalContextTable> global_context_table =
-      factory->NewGlobalContextTable();
-  native_context()->set_global_context_table(*global_context_table);
+  Handle<ScriptContextTable> script_context_table =
+      factory->NewScriptContextTable();
+  native_context()->set_script_context_table(*script_context_table);

   Handle<String> object_name = factory->Object_string();
   JSObject::AddProperty(
@@ -1707,7 +1706,6 @@
Handle<JSBuiltinsObject>::cast(factory()->NewGlobalObject(builtins_fun));
   builtins->set_builtins(*builtins);
   builtins->set_native_context(*native_context());
-  builtins->set_global_context(*native_context());
   builtins->set_global_proxy(native_context()->global_proxy());


=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Nov 11 15:15:42 2014 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Wed Nov 12 11:34:09 2014 UTC
@@ -514,35 +514,35 @@


 template <>
-HValue* CodeStubGraphBuilder<LoadGlobalContextFieldStub>::BuildCodeStub() {
+HValue* CodeStubGraphBuilder<LoadScriptContextFieldStub>::BuildCodeStub() {
   int context_index = casted_stub()->context_index();
   int slot_index = casted_stub()->slot_index();

-  HValue* global_context = BuildGetGlobalContext(context_index);
-  return Add<HLoadNamedField>(global_context, static_cast<HValue*>(NULL),
+  HValue* script_context = BuildGetScriptContext(context_index);
+  return Add<HLoadNamedField>(script_context, static_cast<HValue*>(NULL),
                               HObjectAccess::ForContextSlot(slot_index));
 }


-Handle<Code> LoadGlobalContextFieldStub::GenerateCode() {
+Handle<Code> LoadScriptContextFieldStub::GenerateCode() {
   return DoGenerateCode(this);
 }


 template <>
-HValue* CodeStubGraphBuilder<StoreGlobalContextFieldStub>::BuildCodeStub() { +HValue* CodeStubGraphBuilder<StoreScriptContextFieldStub>::BuildCodeStub() {
   int context_index = casted_stub()->context_index();
   int slot_index = casted_stub()->slot_index();

-  HValue* global_context = BuildGetGlobalContext(context_index);
-  Add<HStoreNamedField>(global_context,
+  HValue* script_context = BuildGetScriptContext(context_index);
+  Add<HStoreNamedField>(script_context,
                         HObjectAccess::ForContextSlot(slot_index),
                         GetParameter(2), STORE_TO_INITIALIZED_ENTRY);
   return GetParameter(2);
 }


-Handle<Code> StoreGlobalContextFieldStub::GenerateCode() {
+Handle<Code> StoreScriptContextFieldStub::GenerateCode() {
   return DoGenerateCode(this);
 }

=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Tue Nov 11 15:15:42 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Wed Nov 12 11:34:09 2014 UTC
@@ -69,7 +69,7 @@
   V(InternalArrayNoArgumentConstructor)     \
   V(InternalArraySingleArgumentConstructor) \
   V(KeyedLoadGeneric)                       \
-  V(LoadGlobalContextField)                 \
+  V(LoadScriptContextField)                 \
   V(LoadDictionaryElement)                  \
   V(LoadFastElement)                        \
   V(MegamorphicLoad)                        \
@@ -77,7 +77,7 @@
   V(NumberToString)                         \
   V(RegExpConstructResult)                  \
   V(StoreFastElement)                       \
-  V(StoreGlobalContextField)                \
+  V(StoreScriptContextField)                \
   V(StringAdd)                              \
   V(ToBoolean)                              \
   V(TransitionElementsKind)                 \
@@ -2018,10 +2018,10 @@
 };


-class GlobalContextFieldStub : public HandlerStub {
+class ScriptContextFieldStub : public HandlerStub {
  public:
-  GlobalContextFieldStub(Isolate* isolate,
- const GlobalContextTable::LookupResult* lookup_result)
+  ScriptContextFieldStub(Isolate* isolate,
+ const ScriptContextTable::LookupResult* lookup_result)
       : HandlerStub(isolate) {
     DCHECK(Accepted(lookup_result));
set_sub_minor_key(ContextIndexBits::encode(lookup_result->context_index) |
@@ -2034,7 +2034,7 @@

   int slot_index() const { return SlotIndexBits::decode(sub_minor_key()); }

- static bool Accepted(const GlobalContextTable::LookupResult* lookup_result) { + static bool Accepted(const ScriptContextTable::LookupResult* lookup_result) {
     return ContextIndexBits::is_valid(lookup_result->context_index) &&
            SlotIndexBits::is_valid(lookup_result->slot_index);
   }
@@ -2048,33 +2048,33 @@

   virtual Code::StubType GetStubType() OVERRIDE { return Code::FAST; }

-  DEFINE_CODE_STUB_BASE(GlobalContextFieldStub, HandlerStub);
+  DEFINE_CODE_STUB_BASE(ScriptContextFieldStub, HandlerStub);
 };


-class LoadGlobalContextFieldStub : public GlobalContextFieldStub {
+class LoadScriptContextFieldStub : public ScriptContextFieldStub {
  public:
-  LoadGlobalContextFieldStub(
- Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result)
-      : GlobalContextFieldStub(isolate, lookup_result) {}
+  LoadScriptContextFieldStub(
+ Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
+      : ScriptContextFieldStub(isolate, lookup_result) {}

  private:
   virtual Code::Kind kind() const OVERRIDE { return Code::LOAD_IC; }

-  DEFINE_HANDLER_CODE_STUB(LoadGlobalContextField, GlobalContextFieldStub);
+  DEFINE_HANDLER_CODE_STUB(LoadScriptContextField, ScriptContextFieldStub);
 };


-class StoreGlobalContextFieldStub : public GlobalContextFieldStub {
+class StoreScriptContextFieldStub : public ScriptContextFieldStub {
  public:
-  StoreGlobalContextFieldStub(
- Isolate* isolate, const GlobalContextTable::LookupResult* lookup_result)
-      : GlobalContextFieldStub(isolate, lookup_result) {}
+  StoreScriptContextFieldStub(
+ Isolate* isolate, const ScriptContextTable::LookupResult* lookup_result)
+      : ScriptContextFieldStub(isolate, lookup_result) {}

  private:
   virtual Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }

- DEFINE_HANDLER_CODE_STUB(StoreGlobalContextField, GlobalContextFieldStub); + DEFINE_HANDLER_CODE_STUB(StoreScriptContextField, ScriptContextFieldStub);
 };


=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Fri Nov 7 15:34:42 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Wed Nov 12 11:34:09 2014 UTC
@@ -120,7 +120,7 @@
 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext)
 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext)
 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext)
-REPLACE_RUNTIME_CALL(JSCreateGlobalContext, Runtime::kAbort)
+REPLACE_RUNTIME_CALL(JSCreateScriptContext, Runtime::kAbort)
 #undef REPLACE_RUNTIME


=======================================
--- /branches/bleeding_edge/src/compiler/js-operator.cc Wed Oct 29 14:40:47 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-operator.cc Wed Nov 12 11:34:09 2014 UTC
@@ -244,7 +244,7 @@
   V(CreateWithContext, Operator::kNoProperties, 2, 1)     \
   V(CreateBlockContext, Operator::kNoProperties, 2, 1)    \
   V(CreateModuleContext, Operator::kNoProperties, 2, 1)   \
-  V(CreateGlobalContext, Operator::kNoProperties, 2, 1)
+  V(CreateScriptContext, Operator::kNoProperties, 2, 1)


 struct JSOperatorGlobalCache FINAL {
=======================================
--- /branches/bleeding_edge/src/compiler/js-operator.h Wed Oct 29 14:40:47 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-operator.h Wed Nov 12 11:34:09 2014 UTC
@@ -259,7 +259,7 @@
   const Operator* CreateWithContext();
   const Operator* CreateBlockContext();
   const Operator* CreateModuleContext();
-  const Operator* CreateGlobalContext();
+  const Operator* CreateScriptContext();

  private:
   Zone* zone() const { return zone_; }
=======================================
--- /branches/bleeding_edge/src/compiler/opcodes.h Mon Nov 3 10:04:37 2014 UTC +++ /branches/bleeding_edge/src/compiler/opcodes.h Wed Nov 12 11:34:09 2014 UTC
@@ -114,7 +114,7 @@
   V(JSCreateWithContext)      \
   V(JSCreateBlockContext)     \
   V(JSCreateModuleContext)    \
-  V(JSCreateGlobalContext)
+  V(JSCreateScriptContext)

 #define JS_OTHER_OP_LIST(V) \
   V(JSCallConstruct)        \
=======================================
--- /branches/bleeding_edge/src/compiler/typer.cc Mon Nov 10 14:28:09 2014 UTC +++ /branches/bleeding_edge/src/compiler/typer.cc Wed Nov 12 11:34:09 2014 UTC
@@ -1264,7 +1264,7 @@
 }


-Bounds Typer::Visitor::TypeJSCreateGlobalContext(Node* node) {
+Bounds Typer::Visitor::TypeJSCreateScriptContext(Node* node) {
   Bounds outer = ContextOperand(node);
   return Bounds(Type::Context(outer.upper, zone()));
 }
=======================================
--- /branches/bleeding_edge/src/compiler/verifier.cc Mon Nov 3 10:30:34 2014 UTC +++ /branches/bleeding_edge/src/compiler/verifier.cc Wed Nov 12 11:34:09 2014 UTC
@@ -460,7 +460,7 @@
     case IrOpcode::kJSCreateWithContext:
     case IrOpcode::kJSCreateBlockContext:
     case IrOpcode::kJSCreateModuleContext:
-    case IrOpcode::kJSCreateGlobalContext: {
+    case IrOpcode::kJSCreateScriptContext: {
       // Type is Context, and operand is Internal.
       Node* context = NodeProperties::GetContextInput(node);
       // TODO(rossberg): This should really be Is(Internal), but the typer
=======================================
--- /branches/bleeding_edge/src/compiler.cc     Wed Nov  5 11:37:02 2014 UTC
+++ /branches/bleeding_edge/src/compiler.cc     Wed Nov 12 11:34:09 2014 UTC
@@ -144,7 +144,7 @@
   isolate_ = isolate;
   function_ = NULL;
   scope_ = NULL;
-  global_scope_ = NULL;
+  script_scope_ = NULL;
   extension_ = NULL;
   cached_data_ = NULL;
   compile_options_ = ScriptCompiler::kNoCompileOptions;
@@ -1243,10 +1243,7 @@
     result = CompileToplevel(&info);
     if (extension == NULL && !result.is_null() && !result->dont_cache()) {
       compilation_cache->PutScript(source, context, result);
-      // TODO(yangguo): Issue 3628
-      // With block scoping, top-level variables may resolve to a global,
-      // context, which makes the code context-dependent.
-      if (FLAG_serialize_toplevel && !FLAG_harmony_scoping &&
+      if (FLAG_serialize_toplevel &&
           compile_options == ScriptCompiler::kProduceCodeCache) {
         HistogramTimerScope histogram_timer(
             isolate->counters()->compile_serialize());
=======================================
--- /branches/bleeding_edge/src/compiler.h      Tue Oct 28 13:23:54 2014 UTC
+++ /branches/bleeding_edge/src/compiler.h      Wed Nov 12 11:34:09 2014 UTC
@@ -105,7 +105,7 @@
   }
   FunctionLiteral* function() const { return function_; }
   Scope* scope() const { return scope_; }
-  Scope* global_scope() const { return global_scope_; }
+  Scope* script_scope() const { return script_scope_; }
   Handle<Code> code() const { return code_; }
   Handle<JSFunction> closure() const { return closure_; }
   Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
@@ -231,9 +231,9 @@
     function_ = literal;
   }
   void PrepareForCompilation(Scope* scope);
-  void SetGlobalScope(Scope* global_scope) {
-    DCHECK(global_scope_ == NULL);
-    global_scope_ = global_scope;
+  void SetScriptScope(Scope* script_scope) {
+    DCHECK(script_scope_ == NULL);
+    script_scope_ = script_scope;
   }
   Handle<TypeFeedbackVector> feedback_vector() const {
     return feedback_vector_;
@@ -441,8 +441,8 @@
   // The scope of the function literal as a convenience.  Set to indicate
   // that scopes have been analyzed.
   Scope* scope_;
-  // The global scope provided as a convenience.
-  Scope* global_scope_;
+  // The script scope provided as a convenience.
+  Scope* script_scope_;
   // For compiled stubs, the stub object
   HydrogenCodeStub* code_stub_;
   // The compiled code.
@@ -460,7 +460,7 @@
   ScriptData** cached_data_;
   ScriptCompiler::CompileOptions compile_options_;

-  // The context of the caller for eval code, and the global context for a
+  // The context of the caller for eval code, and the script context for a
   // global script. Will be a null handle otherwise.
   Handle<Context> context_;

=======================================
--- /branches/bleeding_edge/src/contexts.cc     Fri Nov  7 16:29:13 2014 UTC
+++ /branches/bleeding_edge/src/contexts.cc     Wed Nov 12 11:34:09 2014 UTC
@@ -12,32 +12,32 @@
 namespace internal {


-Handle<GlobalContextTable> GlobalContextTable::Extend(
-    Handle<GlobalContextTable> table, Handle<Context> global_context) {
-  Handle<GlobalContextTable> result;
+Handle<ScriptContextTable> ScriptContextTable::Extend(
+    Handle<ScriptContextTable> table, Handle<Context> script_context) {
+  Handle<ScriptContextTable> result;
   int used = table->used();
   int length = table->length();
   CHECK(used >= 0 && length > 0 && used < length);
   if (used + 1 == length) {
     CHECK(length < Smi::kMaxValue / 2);
-    result = Handle<GlobalContextTable>::cast(
+    result = Handle<ScriptContextTable>::cast(
         FixedArray::CopySize(table, length * 2));
   } else {
     result = table;
   }
   result->set_used(used + 1);

-  DCHECK(global_context->IsGlobalContext());
-  result->set(used + 1, *global_context);
+  DCHECK(script_context->IsScriptContext());
+  result->set(used + 1, *script_context);
   return result;
 }


-bool GlobalContextTable::Lookup(Handle<GlobalContextTable> table,
+bool ScriptContextTable::Lookup(Handle<ScriptContextTable> table,
Handle<String> name, LookupResult* result) {
   for (int i = 0; i < table->used(); i++) {
     Handle<Context> context = GetContext(table, i);
-    DCHECK(context->IsGlobalContext());
+    DCHECK(context->IsScriptContext());
     Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension()));
     int slot_index = ScopeInfo::ContextSlotIndex(
         scope_info, name, &result->mode, &result->init_flag,
@@ -74,9 +74,9 @@
 }


-Context* Context::global_context() {
+Context* Context::script_context() {
   Context* current = this;
-  while (!current->IsGlobalContext()) {
+  while (!current->IsScriptContext()) {
     current = current->previous();
   }
   return current;
@@ -214,7 +214,7 @@
   do {
     if (FLAG_trace_contexts) {
PrintF(" - looking in context %p", reinterpret_cast<void*>(*context));
-      if (context->IsGlobalContext()) PrintF(" (global context)");
+      if (context->IsScriptContext()) PrintF(" (script context)");
       if (context->IsNativeContext()) PrintF(" (native context)");
       PrintF("\n");
     }
@@ -229,23 +229,23 @@

       if (context->IsNativeContext()) {
         if (FLAG_trace_contexts) {
-          PrintF(" - trying other global contexts\n");
+          PrintF(" - trying other script contexts\n");
         }
-        // Try other global contexts.
-        Handle<GlobalContextTable> global_contexts(
- context->global_object()->native_context()->global_context_table());
-        GlobalContextTable::LookupResult r;
-        if (GlobalContextTable::Lookup(global_contexts, name, &r)) {
+        // Try other script contexts.
+        Handle<ScriptContextTable> script_contexts(
+ context->global_object()->native_context()->script_context_table());
+        ScriptContextTable::LookupResult r;
+        if (ScriptContextTable::Lookup(script_contexts, name, &r)) {
           if (FLAG_trace_contexts) {
- Handle<Context> c = GlobalContextTable::GetContext(global_contexts, + Handle<Context> c = ScriptContextTable::GetContext(script_contexts, r.context_index);
-            PrintF("=> found property in global context %d: %p\n",
+            PrintF("=> found property in script context %d: %p\n",
                    r.context_index, reinterpret_cast<void*>(*c));
           }
           *index = r.slot_index;
           GetAttributesAndBindingFlags(r.mode, r.init_flag, attributes,
                                        binding_flags);
-          return GlobalContextTable::GetContext(global_contexts,
+          return ScriptContextTable::GetContext(script_contexts,
                                                 r.context_index);
         }
       }
@@ -279,7 +279,7 @@

     // 2. Check the context proper if it has slots.
     if (context->IsFunctionContext() || context->IsBlockContext() ||
-        (FLAG_harmony_scoping && context->IsGlobalContext())) {
+        (FLAG_harmony_scoping && context->IsScriptContext())) {
       // Use serialized scope information of functions and blocks to search
       // for the context index.
       Handle<ScopeInfo> scope_info;
@@ -480,7 +480,7 @@
   if (child->GetIsolate()->bootstrapper()->IsActive()) return true;
   if (!object->IsContext()) return false;
   Context* context = Context::cast(object);
-  return context->IsNativeContext() || context->IsGlobalContext() ||
+  return context->IsNativeContext() || context->IsScriptContext() ||
          context->IsModuleContext() || !child->IsModuleContext();
 }

=======================================
--- /branches/bleeding_edge/src/contexts.h      Tue Nov 11 11:16:30 2014 UTC
+++ /branches/bleeding_edge/src/contexts.h      Wed Nov 12 11:34:09 2014 UTC
@@ -184,20 +184,20 @@
V(ITERATOR_SYMBOL_INDEX, Symbol, iterator_symbol) \ V(UNSCOPABLES_SYMBOL_INDEX, Symbol, unscopables_symbol) \ V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \
-  V(GLOBAL_CONTEXT_TABLE_INDEX, GlobalContextTable, global_context_table)
+  V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table)


-// A table of all global contexts. Every loaded top-level script with top-level
-// lexical declarations contributes its GlobalContext into this table.
+// A table of all script contexts. Every loaded top-level script with top-level
+// lexical declarations contributes its ScriptContext into this table.
 //
 // The table is a fixed array, its first slot is the current used count and
-// the subsequent slots 1..used contain GlobalContexts.
-class GlobalContextTable : public FixedArray {
+// the subsequent slots 1..used contain ScriptContexts.
+class ScriptContextTable : public FixedArray {
  public:
   // Conversions.
-  static GlobalContextTable* cast(Object* context) {
-    DCHECK(context->IsGlobalContextTable());
-    return reinterpret_cast<GlobalContextTable*>(context);
+  static ScriptContextTable* cast(Object* context) {
+    DCHECK(context->IsScriptContextTable());
+    return reinterpret_cast<ScriptContextTable*>(context);
   }

   struct LookupResult {
@@ -212,22 +212,22 @@

   void set_used(int used) { set(kUsedSlot, Smi::FromInt(used)); }

- static Handle<Context> GetContext(Handle<GlobalContextTable> table, int i) { + static Handle<Context> GetContext(Handle<ScriptContextTable> table, int i) {
     DCHECK(i < table->used());
     return Handle<Context>::cast(FixedArray::get(table, i + 1));
   }

-  // Lookup a variable `name` in a GlobalContextTable.
+  // Lookup a variable `name` in a ScriptContextTable.
   // If it returns true, the variable is found and `result` contains
   // valid information about its location.
   // If it returns false, `result` is untouched.
   MUST_USE_RESULT
-  static bool Lookup(Handle<GlobalContextTable> table, Handle<String> name,
+  static bool Lookup(Handle<ScriptContextTable> table, Handle<String> name,
                      LookupResult* result);

   MUST_USE_RESULT
- static Handle<GlobalContextTable> Extend(Handle<GlobalContextTable> table,
-                                           Handle<Context> global_context);
+ static Handle<ScriptContextTable> Extend(Handle<ScriptContextTable> table,
+                                           Handle<Context> script_context);

   static int GetContextOffset(int context_index) {
     return kFirstContextOffset + context_index * kPointerSize;
@@ -238,7 +238,7 @@
   static const int kFirstContextOffset =
       FixedArray::kHeaderSize + (kUsedSlot + 1) * kPointerSize;

-  DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalContextTable);
+  DISALLOW_IMPLICIT_CONSTRUCTORS(ScriptContextTable);
 };

 // JSFunctions are pairs (context, function code), sometimes also called
@@ -284,9 +284,9 @@
 // properties.
 //
 // Finally, with Harmony scoping, the JSFunction representing a top level
-// script will have the GlobalContext rather than a FunctionContext.
-// Global contexts from all top-level scripts are gathered in
-// GlobalContextTable.
+// script will have the ScriptContext rather than a FunctionContext.
+// Script contexts from all top-level scripts are gathered in
+// ScriptContextTable.

 class Context: public FixedArray {
  public:
@@ -418,7 +418,7 @@
     ITERATOR_SYMBOL_INDEX,
     UNSCOPABLES_SYMBOL_INDEX,
     ARRAY_VALUES_ITERATOR_INDEX,
-    GLOBAL_CONTEXT_TABLE_INDEX,
+    SCRIPT_CONTEXT_TABLE_INDEX,
     MAP_CACHE_INDEX,

     // Properties from here are treated as weak references by the full GC.
@@ -471,8 +471,8 @@
   // The builtins object.
   JSBuiltinsObject* builtins();

-  // Get the innermost global context by traversing the context chain.
-  Context* global_context();
+  // Get the script context by traversing the context chain.
+  Context* script_context();

   // Compute the native context by traversing the context chain.
   Context* native_context();
@@ -504,9 +504,9 @@
     Map* map = this->map();
     return map == map->GetHeap()->module_context_map();
   }
-  bool IsGlobalContext() {
+  bool IsScriptContext() {
     Map* map = this->map();
-    return map == map->GetHeap()->global_context_map();
+    return map == map->GetHeap()->script_context_map();
   }

   bool HasSameSecurityTokenAs(Context* that) {
=======================================
--- /branches/bleeding_edge/src/factory.cc      Mon Nov 10 18:03:50 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc      Wed Nov 12 11:34:09 2014 UTC
@@ -693,26 +693,26 @@
 }


-Handle<Context> Factory::NewGlobalContext(Handle<JSFunction> function,
+Handle<Context> Factory::NewScriptContext(Handle<JSFunction> function,
                                           Handle<ScopeInfo> scope_info) {
   Handle<FixedArray> array =
       NewFixedArray(scope_info->ContextLength(), TENURED);
-  array->set_map_no_write_barrier(*global_context_map());
+  array->set_map_no_write_barrier(*script_context_map());
   Handle<Context> context = Handle<Context>::cast(array);
   context->set_closure(*function);
   context->set_previous(function->context());
   context->set_extension(*scope_info);
   context->set_global_object(function->context()->global_object());
-  DCHECK(context->IsGlobalContext());
+  DCHECK(context->IsScriptContext());
   return context;
 }


-Handle<GlobalContextTable> Factory::NewGlobalContextTable() {
+Handle<ScriptContextTable> Factory::NewScriptContextTable() {
   Handle<FixedArray> array = NewFixedArray(1);
-  array->set_map_no_write_barrier(*global_context_table_map());
-  Handle<GlobalContextTable> context_table =
-      Handle<GlobalContextTable>::cast(array);
+  array->set_map_no_write_barrier(*script_context_table_map());
+  Handle<ScriptContextTable> context_table =
+      Handle<ScriptContextTable>::cast(array);
   context_table->set_used(0);
   return context_table;
 }
=======================================
--- /branches/bleeding_edge/src/factory.h       Mon Nov 10 18:03:50 2014 UTC
+++ /branches/bleeding_edge/src/factory.h       Wed Nov 12 11:34:09 2014 UTC
@@ -225,12 +225,12 @@
   // Create a global (but otherwise uninitialized) context.
   Handle<Context> NewNativeContext();

-  // Create a global context.
-  Handle<Context> NewGlobalContext(Handle<JSFunction> function,
+  // Create a script context.
+  Handle<Context> NewScriptContext(Handle<JSFunction> function,
                                    Handle<ScopeInfo> scope_info);

-  // Create an empty global context table.
-  Handle<GlobalContextTable> NewGlobalContextTable();
+  // Create an empty script context table.
+  Handle<ScriptContextTable> NewScriptContextTable();

   // Create a module context.
   Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info);
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Wed Nov 12 08:25:59 2014 UTC
+++ /branches/bleeding_edge/src/full-codegen.cc Wed Nov 12 11:34:09 2014 UTC
@@ -601,7 +601,7 @@


void FullCodeGenerator::AllocateModules(ZoneList<Declaration*>* declarations) {
-  DCHECK(scope_->is_global_scope());
+  DCHECK(scope_->is_script_scope());

   for (int i = 0; i < declarations->length(); i++) {
ModuleDeclaration* declaration = declarations->at(i)->AsModuleDeclaration();
@@ -642,8 +642,8 @@
 // modules themselves, however, are simple data properties.)
 //
 // All modules have a _hosting_ scope/context, which (currently) is the
-// (innermost) enclosing global scope. To deal with recursion, nested modules
-// are hosted by the same scope as global ones.
+// enclosing script scope. To deal with recursion, nested modules are hosted
+// by the same scope as global ones.
 //
 // For every (global or nested) module literal, the hosting context has an
// internal slot that points directly to the respective module context. This
@@ -673,7 +673,7 @@
 //
 // To deal with arbitrary recursion and aliases between modules,
// they are created and initialized in several stages. Each stage applies to
-// all modules in the hosting global scope, including nested ones.
+// all modules in the hosting script scope, including nested ones.
 //
 // 1. Allocate: for each module _literal_, allocate the module contexts and
 //    respective instance object and wire them up. This happens in the
@@ -708,7 +708,7 @@
     // This is a scope hosting modules. Allocate a descriptor array to pass
     // to the runtime for initialization.
     Comment cmnt(masm_, "[ Allocate modules");
-    DCHECK(scope_->is_global_scope());
+    DCHECK(scope_->is_script_scope());
     modules_ =
isolate()->factory()->NewFixedArray(scope_->num_modules(), TENURED);
     module_index_ = 0;
=======================================
--- /branches/bleeding_edge/src/globals.h       Tue Nov 11 10:24:52 2014 UTC
+++ /branches/bleeding_edge/src/globals.h       Wed Nov 12 11:34:09 2014 UTC
@@ -651,7 +651,7 @@
   EVAL_SCOPE,      // The top-level scope for an eval source.
   FUNCTION_SCOPE,  // The top-level scope for a function.
   MODULE_SCOPE,    // The scope introduced by a module literal
- GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
+  SCRIPT_SCOPE,    // The top-level scope for a script or a top-level eval.
   CATCH_SCOPE,     // The scope introduced by catch.
   BLOCK_SCOPE,     // The scope introduced by a new block.
   WITH_SCOPE,      // The scope introduced by with.
=======================================
--- /branches/bleeding_edge/src/heap/heap.cc    Tue Nov 11 10:24:52 2014 UTC
+++ /branches/bleeding_edge/src/heap/heap.cc    Wed Nov 12 11:34:09 2014 UTC
@@ -2635,8 +2635,8 @@
     ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, with_context)
     ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, block_context)
     ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, module_context)
-    ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, global_context)
-    ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, global_context_table)
+    ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, script_context)
+    ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, script_context_table)

     ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, native_context)
     native_context_map()->set_dictionary_map(true);
=======================================
--- /branches/bleeding_edge/src/heap/heap.h     Fri Nov  7 16:29:13 2014 UTC
+++ /branches/bleeding_edge/src/heap/heap.h     Wed Nov 12 11:34:09 2014 UTC
@@ -148,8 +148,8 @@
V(Map, with_context_map, WithContextMap) \ V(Map, block_context_map, BlockContextMap) \ V(Map, module_context_map, ModuleContextMap) \ - V(Map, global_context_map, GlobalContextMap) \ - V(Map, global_context_table_map, GlobalContextTableMap) \ + V(Map, script_context_map, ScriptContextMap) \ + V(Map, script_context_table_map, ScriptContextTableMap) \ V(Map, undefined_map, UndefinedMap) \ V(Map, the_hole_map, TheHoleMap) \ V(Map, null_map, NullMap) \
@@ -342,7 +342,7 @@
   V(WithContextMap)                     \
   V(BlockContextMap)                    \
   V(ModuleContextMap)                   \
-  V(GlobalContextMap)                   \
+  V(ScriptContextMap)                   \
   V(UndefinedMap)                       \
   V(TheHoleMap)                         \
   V(NullMap)                            \
=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.cc Mon Nov 10 18:03:50 2014 UTC +++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Wed Nov 12 11:34:09 2014 UTC
@@ -1166,14 +1166,11 @@
     SetInternalReference(global_obj, entry,
                          "native_context", global_obj->native_context(),
                          GlobalObject::kNativeContextOffset);
-    SetInternalReference(global_obj, entry,
-                         "global_context", global_obj->global_context(),
-                         GlobalObject::kGlobalContextOffset);
     SetInternalReference(global_obj, entry,
                          "global_proxy", global_obj->global_proxy(),
                          GlobalObject::kGlobalProxyOffset);
     STATIC_ASSERT(GlobalObject::kHeaderSize - JSObject::kHeaderSize ==
-                 4 * kPointerSize);
+                 3 * kPointerSize);
   } else if (obj->IsJSArrayBufferView()) {
     JSArrayBufferView* view = JSArrayBufferView::cast(obj);
     SetInternalReference(view, entry, "buffer", view->buffer(),
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Tue Nov 11 15:53:42 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Wed Nov 12 11:34:09 2014 UTC
@@ -4644,10 +4644,10 @@
 }


-HObjectAccess HObjectAccess::ForGlobalContext(int index) {
+HObjectAccess HObjectAccess::ForScriptContext(int index) {
   DCHECK(index >= 0);
   Portion portion = kInobject;
-  int offset = GlobalContextTable::GetContextOffset(index);
+  int offset = ScriptContextTable::GetContextOffset(index);
   return HObjectAccess(portion, offset, Representation::Tagged());
 }

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Tue Nov 11 11:16:30 2014 UTC +++ /branches/bleeding_edge/src/hydrogen-instructions.h Wed Nov 12 11:34:09 2014 UTC
@@ -6276,7 +6276,7 @@

   static HObjectAccess ForContextSlot(int index);

-  static HObjectAccess ForGlobalContext(int index);
+  static HObjectAccess ForScriptContext(int index);

   // Create an access to the backing store of an object.
   static HObjectAccess ForBackingStoreOffset(int offset,
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc     Tue Nov 11 19:54:21 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.cc     Wed Nov 12 11:34:09 2014 UTC
@@ -3119,7 +3119,7 @@


 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
-  // Get the global context, then the native context
+  // Get the global object, then the native context
   HInstruction* context =
       Add<HLoadNamedField>(closure, static_cast<HValue*>(NULL),
                            HObjectAccess::ForFunctionContextPointer());
@@ -3133,18 +3133,18 @@
 }


-HInstruction* HGraphBuilder::BuildGetGlobalContext(int context_index) {
+HInstruction* HGraphBuilder::BuildGetScriptContext(int context_index) {
   HValue* native_context = BuildGetNativeContext();
-  HValue* global_context_table = Add<HLoadNamedField>(
+  HValue* script_context_table = Add<HLoadNamedField>(
       native_context, static_cast<HValue*>(NULL),
-      HObjectAccess::ForContextSlot(Context::GLOBAL_CONTEXT_TABLE_INDEX));
- return Add<HLoadNamedField>(global_context_table, static_cast<HValue*>(NULL), - HObjectAccess::ForGlobalContext(context_index));
+      HObjectAccess::ForContextSlot(Context::SCRIPT_CONTEXT_TABLE_INDEX));
+ return Add<HLoadNamedField>(script_context_table, static_cast<HValue*>(NULL), + HObjectAccess::ForScriptContext(context_index));
 }


 HInstruction* HGraphBuilder::BuildGetNativeContext() {
-  // Get the global context, then the native context
+  // Get the global object, then the native context
   HValue* global_object = Add<HLoadNamedField>(
       context(), static_cast<HValue*>(NULL),
       HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
@@ -4565,7 +4565,7 @@
       Scope* declaration_scope = scope->DeclarationScope();
       HInstruction* function;
       HValue* outer_context = environment()->context();
-      if (declaration_scope->is_global_scope() ||
+      if (declaration_scope->is_script_scope() ||
           declaration_scope->is_eval_scope()) {
         function = new(zone()) HLoadContextSlot(
outer_context, Context::CLOSURE_INDEX, HLoadContextSlot::kNoCheck);
@@ -5388,15 +5388,15 @@
       Handle<GlobalObject> global(current_info()->global_object());

       if (FLAG_harmony_scoping) {
-        Handle<GlobalContextTable> global_contexts(
-            global->native_context()->global_context_table());
-        GlobalContextTable::LookupResult lookup;
-        if (GlobalContextTable::Lookup(global_contexts, variable->name(),
+        Handle<ScriptContextTable> script_contexts(
+            global->native_context()->script_context_table());
+        ScriptContextTable::LookupResult lookup;
+        if (ScriptContextTable::Lookup(script_contexts, variable->name(),
                                        &lookup)) {
-          Handle<Context> global_context = GlobalContextTable::GetContext(
-              global_contexts, lookup.context_index);
+          Handle<Context> script_context = ScriptContextTable::GetContext(
+              script_contexts, lookup.context_index);
           HInstruction* result = New<HLoadNamedField>(
-              Add<HConstant>(global_context), static_cast<HValue*>(NULL),
+              Add<HConstant>(script_context), static_cast<HValue*>(NULL),
               HObjectAccess::ForContextSlot(lookup.slot_index));
           return ast_context()->ReturnInstruction(result, expr->id());
         }
@@ -6544,14 +6544,14 @@
   Handle<GlobalObject> global(current_info()->global_object());

   if (FLAG_harmony_scoping) {
-    Handle<GlobalContextTable> global_contexts(
-        global->native_context()->global_context_table());
-    GlobalContextTable::LookupResult lookup;
- if (GlobalContextTable::Lookup(global_contexts, var->name(), &lookup)) {
-      Handle<Context> global_context =
- GlobalContextTable::GetContext(global_contexts, lookup.context_index);
+    Handle<ScriptContextTable> script_contexts(
+        global->native_context()->script_context_table());
+    ScriptContextTable::LookupResult lookup;
+ if (ScriptContextTable::Lookup(script_contexts, var->name(), &lookup)) {
+      Handle<Context> script_context =
+ ScriptContextTable::GetContext(script_contexts, lookup.context_index);
       HStoreNamedField* instr = Add<HStoreNamedField>(
-          Add<HConstant>(global_context),
+          Add<HConstant>(script_context),
           HObjectAccess::ForContextSlot(lookup.slot_index), value);
       USE(instr);
       DCHECK(instr->HasObservableSideEffects());
=======================================
--- /branches/bleeding_edge/src/hydrogen.h      Tue Nov 11 15:15:42 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen.h      Wed Nov 12 11:34:09 2014 UTC
@@ -1878,7 +1878,7 @@

   HInstruction* BuildGetNativeContext(HValue* closure);
   HInstruction* BuildGetNativeContext();
-  HInstruction* BuildGetGlobalContext(int context_index);
+  HInstruction* BuildGetScriptContext(int context_index);
   HInstruction* BuildGetArrayFunction();

  protected:
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Nov 12 08:25:59 2014 UTC +++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Wed Nov 12 11:34:09 2014 UTC
@@ -188,10 +188,10 @@
     Comment cmnt(masm_, "[ Allocate context");
     bool need_write_barrier = true;
     // Argument to NewContext is the function, which is still in edi.
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ push(edi);
       __ Push(info->scope()->GetScopeInfo());
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -872,7 +872,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(eax, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(eax, scope_->ContextChainLength(scope_->ScriptScope()));
   __ mov(eax, ContextOperand(eax, variable->interface()->Index()));
   __ mov(eax, ContextOperand(eax, Context::EXTENSION_INDEX));

@@ -5017,7 +5017,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/ic/ic.cc        Tue Nov 11 15:15:42 2014 UTC
+++ /branches/bleeding_edge/src/ic/ic.cc        Wed Nov 12 11:34:09 2014 UTC
@@ -662,20 +662,20 @@
   bool use_ic = MigrateDeprecated(object) ? false : FLAG_use_ic;

if (FLAG_harmony_scoping && object->IsGlobalObject() && name->IsString()) {
-    // Look up in global context table.
+    // Look up in script context table.
     Handle<String> str_name = Handle<String>::cast(name);
     Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
-    Handle<GlobalContextTable> global_contexts(
-        global->native_context()->global_context_table());
+    Handle<ScriptContextTable> script_contexts(
+        global->native_context()->script_context_table());

-    GlobalContextTable::LookupResult lookup_result;
- if (GlobalContextTable::Lookup(global_contexts, str_name, &lookup_result)) {
-      if (use_ic && LoadGlobalContextFieldStub::Accepted(&lookup_result)) {
-        LoadGlobalContextFieldStub stub(isolate(), &lookup_result);
+    ScriptContextTable::LookupResult lookup_result;
+ if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
+      if (use_ic && LoadScriptContextFieldStub::Accepted(&lookup_result)) {
+        LoadScriptContextFieldStub stub(isolate(), &lookup_result);
         PatchCache(name, stub.GetCode());
       }
-      return FixedArray::get(GlobalContextTable::GetContext(
- global_contexts, lookup_result.context_index),
+      return FixedArray::get(ScriptContextTable::GetContext(
+ script_contexts, lookup_result.context_index),
                              lookup_result.slot_index);
     }
   }
@@ -1383,27 +1383,27 @@
                                    Handle<Object> value,
                                    JSReceiver::StoreFromKeyed store_mode) {
if (FLAG_harmony_scoping && object->IsGlobalObject() && name->IsString()) {
-    // Look up in global context table.
+    // Look up in script context table.
     Handle<String> str_name = Handle<String>::cast(name);
     Handle<GlobalObject> global = Handle<GlobalObject>::cast(object);
-    Handle<GlobalContextTable> global_contexts(
-        global->native_context()->global_context_table());
+    Handle<ScriptContextTable> script_contexts(
+        global->native_context()->script_context_table());

-    GlobalContextTable::LookupResult lookup_result;
- if (GlobalContextTable::Lookup(global_contexts, str_name, &lookup_result)) {
-      Handle<Context> global_context = GlobalContextTable::GetContext(
-          global_contexts, lookup_result.context_index);
+    ScriptContextTable::LookupResult lookup_result;
+ if (ScriptContextTable::Lookup(script_contexts, str_name, &lookup_result)) {
+      Handle<Context> script_context = ScriptContextTable::GetContext(
+          script_contexts, lookup_result.context_index);
       if (lookup_result.mode == CONST) {
         return TypeError("harmony_const_assign", object, name);
       }

       if (FLAG_use_ic &&
-          StoreGlobalContextFieldStub::Accepted(&lookup_result)) {
-        StoreGlobalContextFieldStub stub(isolate(), &lookup_result);
+          StoreScriptContextFieldStub::Accepted(&lookup_result)) {
+        StoreScriptContextFieldStub stub(isolate(), &lookup_result);
         PatchCache(name, stub.GetCode());
       }

-      global_context->set(lookup_result.slot_index, *value);
+      script_context->set(lookup_result.slot_index, *value);
       return value;
     }
   }
=======================================
--- /branches/bleeding_edge/src/interface.h     Tue Oct 21 13:37:49 2014 UTC
+++ /branches/bleeding_edge/src/interface.h     Wed Nov 12 11:34:09 2014 UTC
@@ -123,7 +123,7 @@
     return exports ? exports->occupancy() : 0;
   }

- // The context slot in the hosting global context pointing to this module. + // The context slot in the hosting script context pointing to this module.
   int Index() {
     DCHECK(IsModule() && IsFrozen());
     return Chase()->index_;
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Fri Nov  7 16:03:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.cc      Wed Nov 12 11:34:09 2014 UTC
@@ -1483,11 +1483,6 @@
 Handle<Context> Isolate::native_context() {
   return handle(context()->native_context());
 }
-
-
-Handle<Context> Isolate::global_context() {
-  return handle(context()->global_object()->global_context());
-}


 Handle<Context> Isolate::GetCallingNativeContext() {
=======================================
--- /branches/bleeding_edge/src/isolate.h       Fri Nov  7 16:03:11 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h       Wed Nov 12 11:34:09 2014 UTC
@@ -821,9 +821,8 @@
   void IterateThread(ThreadVisitor* v, char* t);


-  // Returns the current native and global context.
+  // Returns the current native context.
   Handle<Context> native_context();
-  Handle<Context> global_context();

   // Returns the native context of the calling JavaScript code.  That
   // is, the native context of the top-most JavaScript frame.
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Nov 12 08:25:59 2014 UTC +++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Wed Nov 12 11:34:09 2014 UTC
@@ -204,10 +204,10 @@
     Comment cmnt(masm_, "[ Allocate context");
     // Argument to NewContext is the function, which is still in a1.
     bool need_write_barrier = true;
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ push(a1);
       __ Push(info->scope()->GetScopeInfo());
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -929,7 +929,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(a1, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(a1, scope_->ContextChainLength(scope_->ScriptScope()));
   __ lw(a1, ContextOperand(a1, variable->interface()->Index()));
   __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX));

@@ -5045,7 +5045,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/mips64/full-codegen-mips64.cc Wed Nov 12 08:25:59 2014 UTC +++ /branches/bleeding_edge/src/mips64/full-codegen-mips64.cc Wed Nov 12 11:34:09 2014 UTC
@@ -201,10 +201,10 @@
     Comment cmnt(masm_, "[ Allocate context");
     // Argument to NewContext is the function, which is still in a1.
     bool need_write_barrier = true;
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ push(a1);
       __ Push(info->scope()->GetScopeInfo());
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -924,7 +924,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(a1, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(a1, scope_->ContextChainLength(scope_->ScriptScope()));
   __ ld(a1, ContextOperand(a1, variable->interface()->Index()));
   __ ld(a1, ContextOperand(a1, Context::EXTENSION_INDEX));

@@ -5047,7 +5047,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/objects-inl.h   Wed Nov 12 10:01:45 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h   Wed Nov 12 11:34:09 2014 UTC
@@ -765,7 +765,7 @@
       map == heap->native_context_map() ||
       map == heap->block_context_map() ||
       map == heap->module_context_map() ||
-      map == heap->global_context_map());
+      map == heap->script_context_map());
 }


@@ -776,11 +776,11 @@
 }


-bool Object::IsGlobalContextTable() const {
+bool Object::IsScriptContextTable() const {
   if (!Object::IsHeapObject()) return false;
   Map* map = HeapObject::cast(this)->map();
   Heap* heap = map->GetHeap();
-  return map == heap->global_context_table_map();
+  return map == heap->script_context_table_map();
 }


@@ -5456,7 +5456,6 @@

 ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
 ACCESSORS(GlobalObject, native_context, Context, kNativeContextOffset)
-ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
 ACCESSORS(GlobalObject, global_proxy, JSObject, kGlobalProxyOffset)

 ACCESSORS(JSGlobalProxy, native_context, Object, kNativeContextOffset)
=======================================
--- /branches/bleeding_edge/src/objects.cc      Wed Nov 12 10:06:19 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc      Wed Nov 12 11:34:09 2014 UTC
@@ -5301,7 +5301,7 @@
     if (context->has_extension() && !context->IsCatchContext()) {
       // With harmony scoping, a JSFunction may have a global context.
       // TODO(mvstanton): walk into the ScopeInfo.
-      if (FLAG_harmony_scoping && context->IsGlobalContext()) {
+      if (FLAG_harmony_scoping && context->IsScriptContext()) {
         return false;
       }

=======================================
--- /branches/bleeding_edge/src/objects.h       Tue Nov 11 10:24:52 2014 UTC
+++ /branches/bleeding_edge/src/objects.h       Wed Nov 12 11:34:09 2014 UTC
@@ -87,7 +87,7 @@
 //         - JSFunctionResultCache
 //         - ScopeInfo
 //         - TransitionArray
-//         - GlobalContextTable
+//         - ScriptContextTable
 //       - FixedDoubleArray
 //       - ExternalArray
 //         - ExternalUint8ClampedArray
@@ -947,7 +947,7 @@
   V(FixedDoubleArray)              \
   V(ConstantPoolArray)             \
   V(Context)                       \
-  V(GlobalContextTable)            \
+  V(ScriptContextTable)            \
   V(NativeContext)                 \
   V(ScopeInfo)                     \
   V(JSFunction)                    \
@@ -7557,9 +7557,6 @@
   // [native context]: the natives corresponding to this global object.
   DECL_ACCESSORS(native_context, Context)

-  // [global context]: the most recent (i.e. innermost) global context.
-  DECL_ACCESSORS(global_context, Context)
-
   // [global proxy]: the global proxy object of the context
   DECL_ACCESSORS(global_proxy, JSObject)

@@ -7571,8 +7568,7 @@
   // Layout description.
   static const int kBuiltinsOffset = JSObject::kHeaderSize;
   static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize;
- static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; - static const int kGlobalProxyOffset = kGlobalContextOffset + kPointerSize; + static const int kGlobalProxyOffset = kNativeContextOffset + kPointerSize;
   static const int kHeaderSize = kGlobalProxyOffset + kPointerSize;

  private:
=======================================
--- /branches/bleeding_edge/src/parser.cc       Wed Nov 12 09:43:56 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc       Wed Nov 12 11:34:09 2014 UTC
@@ -902,8 +902,8 @@

   FunctionLiteral* result = NULL;
   {
-    *scope = NewScope(scope_, GLOBAL_SCOPE);
-    info->SetGlobalScope(*scope);
+    *scope = NewScope(scope_, SCRIPT_SCOPE);
+    info->SetScriptScope(*scope);
if (!info->context().is_null() && !info->context()->IsNativeContext()) { *scope = Scope::DeserializeScopeChain(*info->context(), *scope, zone()); // The Scope is backed up by ScopeInfo (which is in the V8 heap); this
@@ -914,11 +914,11 @@
     }
     original_scope_ = *scope;
     if (info->is_eval()) {
-      if (!(*scope)->is_global_scope() || info->strict_mode() == STRICT) {
+      if (!(*scope)->is_script_scope() || info->strict_mode() == STRICT) {
         *scope = NewScope(*scope, EVAL_SCOPE);
       }
     } else if (info->is_global()) {
-      *scope = NewScope(*scope, GLOBAL_SCOPE);
+      *scope = NewScope(*scope, SCRIPT_SCOPE);
     }
     (*scope)->set_start_position(0);
     // End position will be set by the caller.
@@ -1040,8 +1040,8 @@

   {
     // Parse the function literal.
-    Scope* scope = NewScope(scope_, GLOBAL_SCOPE);
-    info()->SetGlobalScope(scope);
+    Scope* scope = NewScope(scope_, SCRIPT_SCOPE);
+    info()->SetScriptScope(scope);
     if (!info()->closure().is_null()) {
scope = Scope::DeserializeScopeChain(info()->closure()->context(), scope,
                                            zone());
@@ -1145,7 +1145,7 @@
           // all over the code base, so we go with a quick-fix for now.
           // In the same manner, we have to patch the parsing mode.
           if (is_eval && !scope_->is_eval_scope()) {
-            DCHECK(scope_->is_global_scope());
+            DCHECK(scope_->is_script_scope());
             Scope* scope = NewScope(scope_, EVAL_SCOPE);
             scope->set_start_position(scope_->start_position());
             scope->set_end_position(scope_->end_position());
@@ -1779,14 +1779,9 @@
       declaration_scope->is_strict_eval_scope() ||
       declaration_scope->is_block_scope() ||
       declaration_scope->is_module_scope() ||
-      declaration_scope->is_global_scope()) {
+      declaration_scope->is_script_scope()) {
     // Declare the variable in the declaration scope.
-    // For the global scope, we have to check for collisions with earlier
- // (i.e., enclosing) global scopes, to maintain the illusion of a single
-    // global scope.
-    var = declaration_scope->is_global_scope()
-        ? declaration_scope->Lookup(name)
-        : declaration_scope->LookupLocal(name);
+    var = declaration_scope->LookupLocal(name);
     if (var == NULL) {
       // Declare the name.
       var = declaration_scope->DeclareLocal(name, mode,
@@ -1794,10 +1789,10 @@
kNotAssigned, proxy->interface()); } else if (IsLexicalVariableMode(mode) || IsLexicalVariableMode(var->mode())
                || ((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) &&
-                   !declaration_scope->is_global_scope())) {
+                   !declaration_scope->is_script_scope())) {
       // The name was declared in this scope before; check for conflicting
// re-declarations. We have a conflict if either of the declarations is - // not a var (in the global scope, we also have to ignore legacy const for + // not a var (in script scope, we also have to ignore legacy const for
       // compatibility). There is similar code in runtime.cc in the Declare
       // functions. The function CheckConflictingVarDeclarations checks for
// var and let bindings from different scopes whereas this is a check for
@@ -1842,7 +1837,7 @@
   // RuntimeHidden_DeclareLookupSlot calls.
   declaration_scope->AddDeclaration(declaration);

-  if (mode == CONST_LEGACY && declaration_scope->is_global_scope()) {
+  if (mode == CONST_LEGACY && declaration_scope->is_script_scope()) {
     // For global const variables we bind the proxy to a variable.
     DCHECK(resolve);  // should be set by all callers
     Variable::Kind kind = Variable::NORMAL;
@@ -1981,11 +1976,11 @@
   // Even if we're not at the top-level of the global or a function
   // scope, we treat it as such and introduce the function with its
   // initial value upon entering the corresponding scope.
-  // In ES6, a function behaves as a lexical binding, except in the
-  // global scope, or the initial scope of eval or another function.
+  // In ES6, a function behaves as a lexical binding, except in
+  // a script scope, or the initial scope of eval or another function.
   VariableMode mode =
       allow_harmony_scoping() && strict_mode() == STRICT &&
-      !(scope_->is_global_scope() || scope_->is_eval_scope() ||
+      !(scope_->is_script_scope() || scope_->is_eval_scope() ||
           scope_->is_function_scope()) ? LET : VAR;
   VariableProxy* proxy = NewUnresolved(name, mode, Interface::NewValue());
   Declaration* declaration =
@@ -2336,7 +2331,7 @@
     // declaration statement has been executed. This is important in
     // browsers where the global object (window) has lots of
     // properties defined in prototype objects.
-    if (initialization_scope->is_global_scope() &&
+    if (initialization_scope->is_script_scope() &&
         !IsLexicalVariableMode(mode)) {
       // Compute the arguments for the runtime call.
       ZoneList<Expression*>* arguments =
@@ -2633,7 +2628,7 @@
   }

   Scope* decl_scope = scope_->DeclarationScope();
-  if (decl_scope->is_global_scope() || decl_scope->is_eval_scope()) {
+  if (decl_scope->is_script_scope() || decl_scope->is_eval_scope()) {
     ReportMessageAt(loc, "illegal_return");
     *ok = false;
     return NULL;
=======================================
--- /branches/bleeding_edge/src/parser.h        Fri Nov  7 16:39:00 2014 UTC
+++ /branches/bleeding_edge/src/parser.h        Wed Nov 12 11:34:09 2014 UTC
@@ -427,7 +427,7 @@
   static void CheckFunctionLiteralInsideTopLevelObjectLiteral(
       Scope* scope, ObjectLiteralProperty* property, bool* has_function) {
     Expression* value = property->value();
-    if (scope->DeclarationScope()->is_global_scope() &&
+    if (scope->DeclarationScope()->is_script_scope() &&
         value->AsFunctionLiteral() != NULL) {
       *has_function = true;
       value->AsFunctionLiteral()->set_pretenure();
=======================================
--- /branches/bleeding_edge/src/ppc/full-codegen-ppc.cc Tue Nov 11 08:29:54 2014 UTC +++ /branches/bleeding_edge/src/ppc/full-codegen-ppc.cc Wed Nov 12 11:34:09 2014 UTC
@@ -200,10 +200,10 @@
     // Argument to NewContext is the function, which is still in r4.
     Comment cmnt(masm_, "[ Allocate context");
     bool need_write_barrier = true;
-    if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
+    if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
       __ push(r4);
       __ Push(info->scope()->GetScopeInfo());
-      __ CallRuntime(Runtime::kNewGlobalContext, 2);
+      __ CallRuntime(Runtime::kNewScriptContext, 2);
     } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
       FastNewContextStub stub(isolate(), heap_slots);
       __ CallStub(&stub);
@@ -897,7 +897,7 @@
   EmitDebugCheckDeclarationContext(variable);

   // Load instance object.
-  __ LoadContext(r4, scope_->ContextChainLength(scope_->GlobalScope()));
+  __ LoadContext(r4, scope_->ContextChainLength(scope_->ScriptScope()));
   __ LoadP(r4, ContextOperand(r4, variable->interface()->Index()));
   __ LoadP(r4, ContextOperand(r4, Context::EXTENSION_INDEX));

@@ -5095,7 +5095,7 @@

 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
   Scope* declaration_scope = scope()->DeclarationScope();
-  if (declaration_scope->is_global_scope() ||
+  if (declaration_scope->is_script_scope() ||
       declaration_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
     // as their closure, not the anonymous closure containing the global
=======================================
--- /branches/bleeding_edge/src/preparser.cc    Mon Nov  3 19:53:36 2014 UTC
+++ /branches/bleeding_edge/src/preparser.cc    Wed Nov 12 11:34:09 2014 UTC
@@ -105,7 +105,7 @@
     StrictMode strict_mode, bool is_generator, ParserRecorder* log) {
   log_ = log;
// Lazy functions always have trivial outer scopes (no with/catch scopes).
-  PreParserScope top_scope(scope_, GLOBAL_SCOPE);
+  PreParserScope top_scope(scope_, SCRIPT_SCOPE);
   PreParserFactory top_factory(NULL);
FunctionState top_state(&function_state_, &scope_, &top_scope, &top_factory);
   scope_->SetStrictMode(strict_mode);
@@ -863,7 +863,7 @@

// See Parser::ParseFunctionLiteral for more information about lazy parsing
   // and lazy compilation.
- bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && allow_lazy() && + bool is_lazily_parsed = (outer_scope_type == SCRIPT_SCOPE && allow_lazy() &&
                            !parenthesized_function_);
   parenthesized_function_ = false;

=======================================
--- /branches/bleeding_edge/src/preparser.h     Tue Nov 11 19:54:21 2014 UTC
+++ /branches/bleeding_edge/src/preparser.h     Wed Nov 12 11:34:09 2014 UTC
@@ -1435,7 +1435,7 @@
   // captured the syntax error), and false if a stack-overflow happened
   // during parsing.
   PreParseResult PreParseProgram() {
-    PreParserScope scope(scope_, GLOBAL_SCOPE);
+    PreParserScope scope(scope_, SCRIPT_SCOPE);
     PreParserFactory factory(NULL);
     FunctionState top_scope(&function_state_, &scope_, &scope, &factory);
     bool ok = true;
=======================================
--- /branches/bleeding_edge/src/rewriter.cc     Wed Oct 29 18:31:01 2014 UTC
+++ /branches/bleeding_edge/src/rewriter.cc     Wed Nov 12 11:34:09 2014 UTC
@@ -229,7 +229,7 @@
   DCHECK(function != NULL);
   Scope* scope = function->scope();
   DCHECK(scope != NULL);
-  if (!scope->is_global_scope() && !scope->is_eval_scope()) return true;
+  if (!scope->is_script_scope() && !scope->is_eval_scope()) return true;

   ZoneList<Statement*>* body = function->body();
   if (!body->is_empty()) {
=======================================
--- /branches/bleeding_edge/src/runtime/runtime-debug.cc Fri Nov 7 16:03:11 2014 UTC +++ /branches/bleeding_edge/src/runtime/runtime-debug.cc Wed Nov 12 11:34:09 2014 UTC
@@ -1147,7 +1147,7 @@
           scope_info->scope_type() != ARROW_SCOPE) {
         // Global or eval code.
         CompilationInfoWithZone info(script);
-        if (scope_info->scope_type() == GLOBAL_SCOPE) {
+        if (scope_info->scope_type() == SCRIPT_SCOPE) {
           info.MarkAsGlobal();
         } else {
           DCHECK(scope_info->scope_type() == EVAL_SCOPE);
@@ -1223,7 +1223,7 @@
         case MODULE_SCOPE:
           DCHECK(context_->IsModuleContext());
           return ScopeTypeModule;
-        case GLOBAL_SCOPE:
+        case SCRIPT_SCOPE:
           DCHECK(context_->IsNativeContext());
           return ScopeTypeGlobal;
         case WITH_SCOPE:
=======================================
--- /branches/bleeding_edge/src/runtime/runtime-scopes.cc Fri Nov 7 16:29:13 2014 UTC +++ /branches/bleeding_edge/src/runtime/runtime-scopes.cc Wed Nov 12 11:34:09 2014 UTC
@@ -27,10 +27,10 @@
                               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 @@
   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 @@

 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 @@
 }


-RUNTIME_FUNCTION(Runtime_NewGlobalContext) {
+RUNTIME_FUNCTION(Runtime_NewScriptContext) {
   HandleScope scope(isolate);
   DCHECK(args.length() == 2);

@@ -553,23 +553,23 @@
   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 @@

   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 @@
   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;
 }
=======================================
--- /branches/bleeding_edge/src/runtime/runtime.h Wed Nov 12 10:06:19 2014 UTC +++ /branches/bleeding_edge/src/runtime/runtime.h Wed Nov 12 11:34:09 2014 UTC
@@ -504,7 +504,7 @@
   F(PromoteScheduledException, 0, 1)                         \
                                                              \
   /* Contexts */                                             \
-  F(NewGlobalContext, 2, 1)                                  \
+  F(NewScriptContext, 2, 1)                                  \
   F(NewFunctionContext, 1, 1)                                \
   F(PushWithContext, 2, 1)                                   \
   F(PushCatchContext, 3, 1)                                  \
=======================================
--- /branches/bleeding_edge/src/scopes.cc       Tue Nov 11 19:54:21 2014 UTC
+++ /branches/bleeding_edge/src/scopes.cc       Wed Nov 12 11:34:09 2014 UTC
@@ -78,14 +78,14 @@
       unresolved_(16, zone),
       decls_(4, zone),
       interface_(FLAG_harmony_modules &&
-                 (scope_type == MODULE_SCOPE || scope_type == GLOBAL_SCOPE)
+                 (scope_type == MODULE_SCOPE || scope_type == SCRIPT_SCOPE)
                      ? Interface::NewModule(zone) : NULL),
       already_resolved_(false),
       ast_value_factory_(ast_value_factory),
       zone_(zone) {
   SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null());
-  // The outermost scope must be a global scope.
-  DCHECK(scope_type == GLOBAL_SCOPE || outer_scope != NULL);
+  // The outermost scope must be a script scope.
+  DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL);
   DCHECK(!HasIllegalRedeclaration());
 }

@@ -190,7 +190,7 @@
 }


-Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
+Scope* Scope::DeserializeScopeChain(Context* context, Scope* script_scope,
                                     Zone* zone) {
   // Reconstruct the outer scope chain from a closure's context chain.
   Scope* current_scope = NULL;
@@ -201,7 +201,7 @@
       Scope* with_scope = new(zone) Scope(current_scope,
                                           WITH_SCOPE,
                                           Handle<ScopeInfo>::null(),
-                                          global_scope->ast_value_factory_,
+                                          script_scope->ast_value_factory_,
                                           zone);
       current_scope = with_scope;
       // All the inner scopes are inside a with.
@@ -209,26 +209,26 @@
       for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
         s->scope_inside_with_ = true;
       }
-    } else if (context->IsGlobalContext()) {
+    } else if (context->IsScriptContext()) {
       ScopeInfo* scope_info = ScopeInfo::cast(context->extension());
       current_scope = new(zone) Scope(current_scope,
-                                      GLOBAL_SCOPE,
+                                      SCRIPT_SCOPE,
                                       Handle<ScopeInfo>(scope_info),
-                                      global_scope->ast_value_factory_,
+                                      script_scope->ast_value_factory_,
                                       zone);
     } else if (context->IsModuleContext()) {
ScopeInfo* scope_info = ScopeInfo::cast(context->module()->scope_info());
       current_scope = new(zone) Scope(current_scope,
                                       MODULE_SCOPE,
                                       Handle<ScopeInfo>(scope_info),
-                                      global_scope->ast_value_factory_,
+                                      script_scope->ast_value_factory_,
                                       zone);
     } else if (context->IsFunctionContext()) {
       ScopeInfo* scope_info = context->closure()->shared()->scope_info();
       current_scope = new(zone) Scope(current_scope,
                                       FUNCTION_SCOPE,
                                       Handle<ScopeInfo>(scope_info),
-                                      global_scope->ast_value_factory_,
+                                      script_scope->ast_value_factory_,
                                       zone);
       if (scope_info->IsAsmFunction()) current_scope->asm_function_ = true;
       if (scope_info->IsAsmModule()) current_scope->asm_module_ = true;
@@ -237,15 +237,15 @@
       current_scope = new(zone) Scope(current_scope,
                                       BLOCK_SCOPE,
                                       Handle<ScopeInfo>(scope_info),
-                                      global_scope->ast_value_factory_,
+                                      script_scope->ast_value_factory_,
                                       zone);
     } else {
       DCHECK(context->IsCatchContext());
       String* name = String::cast(context->extension());
       current_scope = new (zone) Scope(
           current_scope,
- global_scope->ast_value_factory_->GetString(Handle<String>(name)),
-          global_scope->ast_value_factory_, zone);
+ script_scope->ast_value_factory_->GetString(Handle<String>(name)),
+          script_scope->ast_value_factory_, zone);
     }
     if (contains_with) current_scope->RecordWithStatement();
     if (innermost_scope == NULL) innermost_scope = current_scope;
@@ -257,9 +257,9 @@
     context = context->previous();
   }

-  global_scope->AddInnerScope(current_scope);
-  global_scope->PropagateScopeInfo(false);
-  return (innermost_scope == NULL) ? global_scope : innermost_scope;
+  script_scope->AddInnerScope(current_scope);
+  script_scope->PropagateScopeInfo(false);
+  return (innermost_scope == NULL) ? script_scope : innermost_scope;
 }


@@ -270,7 +270,7 @@

   // Traverse the scope tree up to the first unresolved scope or the global
// scope and start scope resolution and variable allocation from that scope.
-  while (!top->is_global_scope() &&
+  while (!top->is_script_scope() &&
          !top->outer_scope()->already_resolved()) {
     top = top->outer_scope();
   }
@@ -288,7 +288,7 @@
     scope->Print();
   }

- if (FLAG_harmony_modules && FLAG_print_interfaces && top->is_global_scope()) { + if (FLAG_harmony_modules && FLAG_print_interfaces && top->is_script_scope()) {
     PrintF("global : ");
     top->interface()->Print();
   }
@@ -311,9 +311,9 @@
   }

   // Declare convenience variables.
-  // Declare and allocate receiver (even for the global scope, and even
+  // Declare and allocate receiver (even for the script scope, and even
   // if naccesses_ == 0).
-  // NOTE: When loading parameters in the global scope, we must take
+  // NOTE: When loading parameters in the script scope, we must take
   // care not to access them as properties of the global object, but
   // instead load them directly from the stack. Currently, the only
   // such parameter is 'this' which is passed on the stack when
@@ -479,7 +479,7 @@


 Variable* Scope::DeclareDynamicGlobal(const AstRawString* name) {
-  DCHECK(is_global_scope());
+  DCHECK(is_script_scope());
   return variables_.Declare(this,
                             name,
                             DYNAMIC_GLOBAL,
@@ -650,7 +650,7 @@
   PropagateScopeInfo(outer_scope_calls_sloppy_eval);

   // 2) Allocate module instances.
-  if (FLAG_harmony_modules && (is_global_scope() || is_module_scope())) {
+  if (FLAG_harmony_modules && (is_script_scope() || is_module_scope())) {
     DCHECK(num_modules_ == 0);
     AllocateModulesRecursively(this);
   }
@@ -730,9 +730,9 @@
 }


-Scope* Scope::GlobalScope() {
+Scope* Scope::ScriptScope() {
   Scope* scope = this;
-  while (!scope->is_global_scope()) {
+  while (!scope->is_script_scope()) {
     scope = scope->outer_scope();
   }
   return scope;
@@ -780,7 +780,7 @@
     case EVAL_SCOPE: return "eval";
     case FUNCTION_SCOPE: return "function";
     case MODULE_SCOPE: return "module";
-    case GLOBAL_SCOPE: return "global";
+    case SCRIPT_SCOPE: return "global";
     case CATCH_SCOPE: return "catch";
     case BLOCK_SCOPE: return "block";
     case WITH_SCOPE: return "with";
@@ -1009,7 +1009,7 @@
       var->ForceContextAllocation();
     }
   } else {
-    DCHECK(is_global_scope());
+    DCHECK(is_script_scope());
   }

   if (is_with_scope()) {
@@ -1041,7 +1041,7 @@
 bool Scope::ResolveVariable(CompilationInfo* info,
                             VariableProxy* proxy,
                             AstNodeFactory<AstNullVisitor>* factory) {
-  DCHECK(info->global_scope()->is_global_scope());
+  DCHECK(info->script_scope()->is_script_scope());

   // If the proxy is already resolved there's nothing to do
   // (functions and consts may be resolved by the parser).
@@ -1073,7 +1073,7 @@

     case UNBOUND:
// No binding has been found. Declare a variable on the global object.
-      var = info->global_scope()->DeclareDynamicGlobal(proxy->raw_name());
+      var = info->script_scope()->DeclareDynamicGlobal(proxy->raw_name());
       break;

     case UNBOUND_EVAL_SHADOWED:
@@ -1150,7 +1150,7 @@
 bool Scope::ResolveVariablesRecursively(
     CompilationInfo* info,
     AstNodeFactory<AstNullVisitor>* factory) {
-  DCHECK(info->global_scope()->is_global_scope());
+  DCHECK(info->script_scope()->is_script_scope());

   // Resolve unresolved variables for this scope.
   for (int i = 0; i < unresolved_.length(); i++) {
@@ -1216,7 +1216,7 @@
        is_catch_scope() ||
        is_block_scope() ||
        is_module_scope() ||
-       is_global_scope())) {
+       is_script_scope())) {
     var->set_is_used();
if (scope_calls_eval_ || inner_scope_calls_eval_) var->set_maybe_assigned();
   }
@@ -1239,7 +1239,7 @@
   if (var->mode() == TEMPORARY) return false;
   if (var->mode() == INTERNAL) return true;
if (is_catch_scope() || is_block_scope() || is_module_scope()) return true;
-  if (is_global_scope() && IsLexicalVariableMode(var->mode())) return true;
+  if (is_script_scope() && IsLexicalVariableMode(var->mode())) return true;
   return var->has_forced_context_allocation() ||
       scope_calls_eval_ ||
       inner_scope_calls_eval_ ||
=======================================
--- /branches/bleeding_edge/src/scopes.h        Tue Nov 11 19:54:21 2014 UTC
+++ /branches/bleeding_edge/src/scopes.h        Wed Nov 12 11:34:09 2014 UTC
@@ -80,7 +80,7 @@
   // doesn't re-allocate variables repeatedly.
   static bool Analyze(CompilationInfo* info);

- static Scope* DeserializeScopeChain(Context* context, Scope* global_scope, + static Scope* DeserializeScopeChain(Context* context, Scope* script_scope,
                                       Zone* zone);

   // The scope name is only used for printing/debugging.
@@ -135,7 +135,7 @@
                          Interface* interface = Interface::NewValue());

   // Declare an implicit global variable in this scope which must be a
-  // global scope.  The variable was introduced (possibly from an inner
+  // script scope.  The variable was introduced (possibly from an inner
   // scope) by a reference to an unresolved variable with no intervening
   // with statements or eval calls.
   Variable* DeclareDynamicGlobal(const AstRawString* name);
@@ -209,7 +209,7 @@
   void RecordWithStatement() { scope_contains_with_ = true; }

   // Inform the scope that the corresponding code contains an eval call.
- void RecordEvalCall() { if (!is_global_scope()) scope_calls_eval_ = true; } + void RecordEvalCall() { if (!is_script_scope()) scope_calls_eval_ = true; }

   // Inform the scope that the corresponding code uses "arguments".
   void RecordArgumentsUsage() { scope_uses_arguments_ = true; }
@@ -275,14 +275,14 @@
     return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE;
   }
   bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; }
-  bool is_global_scope() const { return scope_type_ == GLOBAL_SCOPE; }
+  bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; }
   bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; }
   bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
   bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
   bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; }
   bool is_declaration_scope() const {
     return is_eval_scope() || is_function_scope() ||
-        is_module_scope() || is_global_scope();
+        is_module_scope() || is_script_scope();
   }
   bool is_strict_eval_scope() const {
     return is_eval_scope() && strict_mode_ == STRICT;
@@ -379,7 +379,7 @@
   int StackLocalCount() const;
   int ContextLocalCount() const;

- // For global scopes, the number of module literals (including nested ones). + // For script scopes, the number of module literals (including nested ones).
   int num_modules() const { return num_modules_; }

// For module scopes, the host scope's internal variable binding this module.
@@ -403,8 +403,10 @@
   // The number of contexts between this and scope; zero if this == scope.
   int ContextChainLength(Scope* scope);

-  // Find the innermost global scope.
-  Scope* GlobalScope();
+  // Find the script scope.
+  // Used in modules implemenetation to find hosting scope.
+  // TODO(rossberg): is this needed?
+  Scope* ScriptScope();

   // Find the first function, global, or eval scope.  This is the scope
   // where var declarations will be hoisted to in the implementation.
@@ -456,7 +458,7 @@

   // The variables declared in this scope:
   //
-  // All user-declared variables (incl. parameters).  For global scopes
+  // All user-declared variables (incl. parameters).  For script scopes
   // variables may be implicitly 'declared' by being used (possibly in
   // an inner scope) with no intervening with statements or eval calls.
   VariableMap variables_;
@@ -565,14 +567,14 @@
// The variable reference could not be statically resolved to any binding
     // and thus should be considered referencing a global variable. NULL is
// returned. The variable reference is not inside any 'with' statement and
-    // no scope between the reference scope (inclusive) and global scope
+    // no scope between the reference scope (inclusive) and script scope
     // (exclusive) makes a sloppy 'eval' call.
     UNBOUND,

// The variable reference could not be statically resolved to any binding
     // NULL is returned. The variable reference is not inside any 'with'
// statement, but some scope between the reference scope (inclusive) and
-    // global scope (exclusive) makes a sloppy 'eval' call, that might
+    // script scope (exclusive) makes a sloppy 'eval' call, that might
     // possibly introduce a variable binding. Thus the reference should be
     // considered referencing a global variable unless it is shadowed by an
     // 'eval' introduced binding.
=======================================
***Additional files exist in this changeset.***

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to