Revert to code state of 3.13.1 plus r12350

R=yangguo@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10878047

git-svn-id: http://v8.googlecode.com/svn/trunk@12377 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/heap.cc b/src/heap.cc
index abbeff2..8fc0253 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -97,7 +97,6 @@
       linear_allocation_scope_depth_(0),
       contexts_disposed_(0),
       global_ic_age_(0),
-      flush_monomorphic_ics_(false),
       scan_on_scavenge_pages_(0),
       new_space_(this),
       old_pointer_space_(NULL),
@@ -176,7 +175,7 @@
   }
 
   memset(roots_, 0, sizeof(roots_[0]) * kRootListLength);
-  native_contexts_list_ = NULL;
+  global_contexts_list_ = NULL;
   mark_compact_collector_.heap_ = this;
   external_string_table_.heap_ = this;
   // Put a dummy entry in the remembered pages so we can find the list the
@@ -756,7 +755,7 @@
 void Heap::ClearJSFunctionResultCaches() {
   if (isolate_->bootstrapper()->IsActive()) return;
 
-  Object* context = native_contexts_list_;
+  Object* context = global_contexts_list_;
   while (!context->IsUndefined()) {
     // Get the caches for this context. GC can happen when the context
     // is not fully initialized, so the caches can be undefined.
@@ -783,7 +782,7 @@
     return;
   }
 
-  Object* context = native_contexts_list_;
+  Object* context = global_contexts_list_;
   while (!context->IsUndefined()) {
     // GC can happen when the context is not fully initialized,
     // so the cache can be undefined.
@@ -993,7 +992,7 @@
 
   contexts_disposed_ = 0;
 
-  flush_monomorphic_ics_ = false;
+  isolate_->set_context_exit_happened(false);
 }
 
 
@@ -1296,8 +1295,8 @@
     }
   }
 
-  // Scavenge object reachable from the native contexts list directly.
-  scavenge_visitor.VisitPointer(BitCast<Object**>(&native_contexts_list_));
+  // Scavenge object reachable from the global contexts list directly.
+  scavenge_visitor.VisitPointer(BitCast<Object**>(&global_contexts_list_));
 
   new_space_front = DoScavenge(&scavenge_visitor, new_space_front);
   isolate_->global_handles()->IdentifyNewSpaceWeakIndependentHandles(
@@ -1457,7 +1456,7 @@
   Object* undefined = undefined_value();
   Object* head = undefined;
   Context* tail = NULL;
-  Object* candidate = native_contexts_list_;
+  Object* candidate = global_contexts_list_;
 
   // We don't record weak slots during marking or scavenges.
   // Instead we do it once when we complete mark-compact cycle.
@@ -1530,7 +1529,7 @@
   }
 
   // Update the head of the list of contexts.
-  native_contexts_list_ = head;
+  global_contexts_list_ = head;
 }
 
 
@@ -1656,7 +1655,7 @@
     table_.Register(kVisitFixedArray, &EvacuateFixedArray);
     table_.Register(kVisitFixedDoubleArray, &EvacuateFixedDoubleArray);
 
-    table_.Register(kVisitNativeContext,
+    table_.Register(kVisitGlobalContext,
                     &ObjectEvacuationStrategy<POINTER_OBJECT>::
                         template VisitSpecialized<Context::kSize>);
 
@@ -2442,10 +2441,10 @@
         AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
     if (!maybe_obj->ToObject(&obj)) return false;
   }
-  Map* native_context_map = Map::cast(obj);
-  native_context_map->set_dictionary_map(true);
-  native_context_map->set_visitor_id(StaticVisitorBase::kVisitNativeContext);
-  set_native_context_map(native_context_map);
+  Map* global_context_map = Map::cast(obj);
+  global_context_map->set_dictionary_map(true);
+  global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
+  set_global_context_map(global_context_map);
 
   { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
                                          SharedFunctionInfo::kAlignedSize);
@@ -3724,7 +3723,7 @@
   // from the function's context, since the function can be from a
   // different context.
   JSFunction* object_function =
-      function->context()->native_context()->object_function();
+      function->context()->global_context()->object_function();
 
   // Each function prototype gets a copy of the object function map.
   // This avoid unwanted sharing of maps between prototypes of different
@@ -3774,12 +3773,12 @@
       !JSFunction::cast(callee)->shared()->is_classic_mode();
   if (strict_mode_callee) {
     boilerplate =
-        isolate()->context()->native_context()->
+        isolate()->context()->global_context()->
             strict_mode_arguments_boilerplate();
     arguments_object_size = kArgumentsObjectSizeStrict;
   } else {
     boilerplate =
-        isolate()->context()->native_context()->arguments_boilerplate();
+        isolate()->context()->global_context()->arguments_boilerplate();
     arguments_object_size = kArgumentsObjectSize;
   }
 
@@ -4310,7 +4309,7 @@
     map->set_function_with_prototype(true);
     InitializeFunction(JSFunction::cast(object), shared, the_hole_value());
     JSFunction::cast(object)->set_context(
-        isolate()->context()->native_context());
+        isolate()->context()->global_context());
   }
 
   // Put in filler if the new object is smaller than the old.
@@ -4605,10 +4604,10 @@
 MaybeObject* Heap::AllocateJSArray(
     ElementsKind elements_kind,
     PretenureFlag pretenure) {
-  Context* native_context = isolate()->context()->native_context();
-  JSFunction* array_function = native_context->array_function();
+  Context* global_context = isolate()->context()->global_context();
+  JSFunction* array_function = global_context->array_function();
   Map* map = array_function->initial_map();
-  Object* maybe_map_array = native_context->js_array_maps();
+  Object* maybe_map_array = global_context->js_array_maps();
   if (!maybe_map_array->IsUndefined()) {
     Object* maybe_transitioned_map =
         FixedArray::cast(maybe_map_array)->get(elements_kind);
@@ -4891,16 +4890,16 @@
 }
 
 
-MaybeObject* Heap::AllocateNativeContext() {
+MaybeObject* Heap::AllocateGlobalContext() {
   Object* result;
   { MaybeObject* maybe_result =
-        AllocateFixedArray(Context::NATIVE_CONTEXT_SLOTS);
+        AllocateFixedArray(Context::GLOBAL_CONTEXT_SLOTS);
     if (!maybe_result->ToObject(&result)) return maybe_result;
   }
   Context* context = reinterpret_cast<Context*>(result);
-  context->set_map_no_write_barrier(native_context_map());
+  context->set_map_no_write_barrier(global_context_map());
   context->set_js_array_maps(undefined_value());
-  ASSERT(context->IsNativeContext());
+  ASSERT(context->IsGlobalContext());
   ASSERT(result->IsContext());
   return result;
 }
@@ -4931,7 +4930,7 @@
   context->set_closure(function);
   context->set_previous(function->context());
   context->set_extension(Smi::FromInt(0));
-  context->set_global_object(function->context()->global_object());
+  context->set_global(function->context()->global());
   return context;
 }
 
@@ -4951,7 +4950,7 @@
   context->set_closure(function);
   context->set_previous(previous);
   context->set_extension(name);
-  context->set_global_object(previous->global_object());
+  context->set_global(previous->global());
   context->set(Context::THROWN_OBJECT_INDEX, thrown_object);
   return context;
 }
@@ -4969,7 +4968,7 @@
   context->set_closure(function);
   context->set_previous(previous);
   context->set_extension(extension);
-  context->set_global_object(previous->global_object());
+  context->set_global(previous->global());
   return context;
 }
 
@@ -4987,7 +4986,7 @@
   context->set_closure(function);
   context->set_previous(previous);
   context->set_extension(scope_info);
-  context->set_global_object(previous->global_object());
+  context->set_global(previous->global());
   return context;
 }
 
@@ -6164,7 +6163,7 @@
     // Create initial objects
     if (!CreateInitialObjects()) return false;
 
-    native_contexts_list_ = undefined_value();
+    global_contexts_list_ = undefined_value();
   }
 
   LOG(isolate_, IntPtrTEvent("heap-capacity", Capacity()));
@@ -6691,8 +6690,8 @@
 }
 
 
-static bool SafeIsNativeContext(HeapObject* obj) {
-  return obj->map() == obj->GetHeap()->raw_unchecked_native_context_map();
+static bool SafeIsGlobalContext(HeapObject* obj) {
+  return obj->map() == obj->GetHeap()->raw_unchecked_global_context_map();
 }
 
 
@@ -6714,7 +6713,7 @@
     return;
   }
 
-  bool is_native_context = SafeIsNativeContext(obj);
+  bool is_global_context = SafeIsGlobalContext(obj);
 
   // not visited yet
   Map* map_p = reinterpret_cast<Map*>(HeapObject::cast(map));
@@ -6724,7 +6723,7 @@
   obj->set_map_no_write_barrier(reinterpret_cast<Map*>(map_addr + kMarkTag));
 
   // Scan the object body.
-  if (is_native_context && (visit_mode_ == VISIT_ONLY_STRONG)) {
+  if (is_global_context && (visit_mode_ == VISIT_ONLY_STRONG)) {
     // This is specialized to scan Context's properly.
     Object** start = reinterpret_cast<Object**>(obj->address() +
                                                 Context::kHeaderSize);