Update V8 to r4588

We're using WebKit r58033, as used by
http://src.chromium.org/svn/releases/5.0.387.0/DEPS
This requires http://v8.googlecode.com/svn/trunk@4465 but this version has a
crashing bug for ARM. Instead we use http://v8.googlecode.com/svn/trunk@4588,
which is used by http://src.chromium.org/svn/releases/6.0.399.0/DEPS

Note that a trivial bug fix was required in arm/codegen-arm.cc. This is guarded
with ANDROID. See http://code.google.com/p/v8/issues/detail?id=703

Change-Id: I459647a8286c4f8c7405f0c5581ecbf051a6f1e8
diff --git a/src/factory.cc b/src/factory.cc
index 8d20749..35d3c54 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -43,9 +43,11 @@
 }
 
 
-Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size) {
+Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size,
+                                                   PretenureFlag pretenure) {
   ASSERT(0 <= size);
-  CALL_HEAP_FUNCTION(Heap::AllocateFixedArrayWithHoles(size), FixedArray);
+  CALL_HEAP_FUNCTION(Heap::AllocateFixedArrayWithHoles(size, pretenure),
+                     FixedArray);
 }
 
 
@@ -282,31 +284,26 @@
 }
 
 
-Handle<JSFunction> Factory::BaseNewFunctionFromBoilerplate(
-    Handle<JSFunction> boilerplate,
+Handle<JSFunction> Factory::BaseNewFunctionFromSharedFunctionInfo(
+    Handle<SharedFunctionInfo> function_info,
     Handle<Map> function_map,
     PretenureFlag pretenure) {
-  ASSERT(boilerplate->IsBoilerplate());
-  ASSERT(!boilerplate->has_initial_map());
-  ASSERT(!boilerplate->has_prototype());
-  ASSERT(boilerplate->properties() == Heap::empty_fixed_array());
-  ASSERT(boilerplate->elements() == Heap::empty_fixed_array());
   CALL_HEAP_FUNCTION(Heap::AllocateFunction(*function_map,
-                                            boilerplate->shared(),
+                                            *function_info,
                                             Heap::the_hole_value(),
                                             pretenure),
                      JSFunction);
 }
 
 
-Handle<JSFunction> Factory::NewFunctionFromBoilerplate(
-    Handle<JSFunction> boilerplate,
+Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
+    Handle<SharedFunctionInfo> function_info,
     Handle<Context> context,
     PretenureFlag pretenure) {
-  Handle<JSFunction> result = BaseNewFunctionFromBoilerplate(
-      boilerplate, Top::function_map(), pretenure);
+  Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo(
+      function_info, Top::function_map(), pretenure);
   result->set_context(*context);
-  int number_of_literals = boilerplate->NumberOfLiterals();
+  int number_of_literals = function_info->num_literals();
   Handle<FixedArray> literals =
       Factory::NewFixedArray(number_of_literals, pretenure);
   if (number_of_literals > 0) {
@@ -317,7 +314,6 @@
                   context->global_context());
   }
   result->set_literals(*literals);
-  ASSERT(!result->IsBoilerplate());
   return result;
 }
 
@@ -490,36 +486,6 @@
 }
 
 
-Handle<JSFunction> Factory::NewFunctionBoilerplate(Handle<String> name,
-                                                   int number_of_literals,
-                                                   Handle<Code> code) {
-  Handle<JSFunction> function = NewFunctionBoilerplate(name);
-  function->set_code(*code);
-  int literals_array_size = number_of_literals;
-  // If the function contains object, regexp or array literals,
-  // allocate extra space for a literals array prefix containing the
-  // object, regexp and array constructor functions.
-  if (number_of_literals > 0) {
-    literals_array_size += JSFunction::kLiteralsPrefixSize;
-  }
-  Handle<FixedArray> literals =
-      Factory::NewFixedArray(literals_array_size, TENURED);
-  function->set_literals(*literals);
-  ASSERT(!function->has_initial_map());
-  ASSERT(!function->has_prototype());
-  return function;
-}
-
-
-Handle<JSFunction> Factory::NewFunctionBoilerplate(Handle<String> name) {
-  Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name);
-  CALL_HEAP_FUNCTION(Heap::AllocateFunction(Heap::boilerplate_function_map(),
-                                            *shared,
-                                            Heap::the_hole_value()),
-                     JSFunction);
-}
-
-
 Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name,
                                                      InstanceType type,
                                                      int instance_size,
@@ -547,6 +513,16 @@
 }
 
 
+Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
+                                                        Handle<Code> code) {
+  Handle<JSFunction> function = NewFunctionWithoutPrototype(name);
+  function->set_code(*code);
+  ASSERT(!function->has_initial_map());
+  ASSERT(!function->has_prototype());
+  return function;
+}
+
+
 Handle<Code> Factory::NewCode(const CodeDesc& desc,
                               ZoneScopeInfo* sinfo,
                               Code::Flags flags,
@@ -560,6 +536,11 @@
 }
 
 
+Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) {
+  CALL_HEAP_FUNCTION(Heap::CopyCode(*code, reloc_info), Code);
+}
+
+
 static inline Object* DoCopyInsert(DescriptorArray* array,
                                    String* key,
                                    Object* value,
@@ -681,6 +662,22 @@
 }
 
 
+Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
+    Handle<String> name, int number_of_literals, Handle<Code> code) {
+  Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name);
+  shared->set_code(*code);
+  int literals_array_size = number_of_literals;
+  // If the function contains object, regexp or array literals,
+  // allocate extra space for a literals array prefix containing the
+  // context.
+  if (number_of_literals > 0) {
+    literals_array_size += JSFunction::kLiteralsPrefixSize;
+  }
+  shared->set_num_literals(literals_array_size);
+  return shared;
+}
+
+
 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) {
   CALL_HEAP_FUNCTION(Heap::AllocateSharedFunctionInfo(*name),
                      SharedFunctionInfo);
@@ -718,6 +715,24 @@
 }
 
 
+Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
+    Handle<String> name) {
+  Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
+  CALL_HEAP_FUNCTION(Heap::AllocateFunction(
+                         *Top::function_without_prototype_map(),
+                         *function_share,
+                         *the_hole_value()),
+                     JSFunction);
+}
+
+
+Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name) {
+  Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name);
+  fun->set_context(Top::context()->global_context());
+  return fun;
+}
+
+
 Handle<Object> Factory::ToObject(Handle<Object> object) {
   CALL_HEAP_FUNCTION(object->ToObject(), Object);
 }
@@ -866,6 +881,7 @@
     map->set_instance_descriptors(*array);
   }
 
+  ASSERT(result->shared()->IsApiFunction());
   return result;
 }