Included mjsunit JavaScript test suite and C++ unit tests.

Changed the shell sample to not print the result of executing a script provided on the command line.

Fixed issue when building samples on Windows using a shared V8 library.  Added visibility option on Linux build which makes the generated library 18% smaller.

Changed build system to accept multiple build modes in one build and generate separate objects, libraries and executables for each mode.

Removed deferred negation optimization (a * -b => -(a * b)) since this visibly changes operand conversion order.

Improved parsing performance by introducing stack guard in preparsing.  Without a stack guard preparsing always bails out with stack overflow.

Changed shell sample to take flags directly from the command-line. Added API call that implements this.

Added load, quit and version functions to the shell sample so it's easier to run benchmarks and tests.

Fixed issue with building samples and cctests on 64-bit machines.

Fixed bug in the runtime system where the prototype chain was not always searched for a setter when setting a property that does not exist locally.


git-svn-id: http://v8.googlecode.com/svn/trunk@60 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/heap.cc b/src/heap.cc
index 2c7660d..b04b4c1 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -861,7 +861,7 @@
   map->set_prototype(null_value());
   map->set_constructor(null_value());
   map->set_instance_size(instance_size);
-  map->set_instance_descriptors(DescriptorArray::cast(empty_fixed_array()));
+  map->set_instance_descriptors(empty_descriptor_array());
   map->set_code_cache(empty_fixed_array());
   map->set_unused_property_fields(0);
   map->set_bit_field(0);
@@ -894,17 +894,20 @@
   if (obj->IsFailure()) return false;
   null_value_ = obj;
 
-  // Fix the instance_descriptors for the existing maps.
-  DescriptorArray* empty_descriptors =
-      DescriptorArray::cast(empty_fixed_array());
+  // Allocate the empty descriptor array.  AllocateMap can now be used.
+  obj = AllocateEmptyFixedArray();
+  if (obj->IsFailure()) return false;
+  // There is a check against empty_descriptor_array() in cast().
+  empty_descriptor_array_ = reinterpret_cast<DescriptorArray*>(obj);
 
-  meta_map()->set_instance_descriptors(empty_descriptors);
+  // Fix the instance_descriptors for the existing maps.
+  meta_map()->set_instance_descriptors(empty_descriptor_array());
   meta_map()->set_code_cache(empty_fixed_array());
 
-  fixed_array_map()->set_instance_descriptors(empty_descriptors);
+  fixed_array_map()->set_instance_descriptors(empty_descriptor_array());
   fixed_array_map()->set_code_cache(empty_fixed_array());
 
-  oddball_map()->set_instance_descriptors(empty_descriptors);
+  oddball_map()->set_instance_descriptors(empty_descriptor_array());
   oddball_map()->set_code_cache(empty_fixed_array());
 
   // Fix prototype object for existing maps.
@@ -1004,6 +1007,7 @@
   if (obj->IsFailure()) return false;
   shared_function_info_map_ = Map::cast(obj);
 
+  ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
   return true;
 }
 
@@ -1108,28 +1112,6 @@
   if (obj->IsFailure()) return false;
   nan_value_ = obj;
 
-  obj = NumberFromDouble(INFINITY, TENURED);
-  if (obj->IsFailure()) return false;
-  infinity_value_ = obj;
-
-  obj = NumberFromDouble(-INFINITY, TENURED);
-  if (obj->IsFailure()) return false;
-  negative_infinity_value_ = obj;
-
-  obj = NumberFromDouble(DBL_MAX, TENURED);
-  if (obj->IsFailure()) return false;
-  number_max_value_ = obj;
-
-  // C++ doesn't provide a constant for the smallest denormalized
-  // double (approx. 5e-324) but only the smallest normalized one
-  // which is somewhat bigger (approx. 2e-308).  So we have to do
-  // this raw conversion hack.
-  uint64_t min_value_bits = 1L;
-  double min_value = *reinterpret_cast<double*>(&min_value_bits);
-  obj = NumberFromDouble(min_value, TENURED);
-  if (obj->IsFailure()) return false;
-  number_min_value_ = obj;
-
   obj = Allocate(oddball_map(), CODE_SPACE);
   if (obj->IsFailure()) return false;
   undefined_value_ = obj;
@@ -1628,9 +1610,8 @@
 
 
 Object* Heap::AllocateArgumentsObject(Object* callee, int length) {
-  // This allocation is odd since allocate an argument object
-  // based on the arguments_boilerplate.
-  // We do this to ensure fast allocation and map sharing.
+  // To get fast allocation and map sharing for arguments objects we
+  // allocate them based on an arguments boilerplate.
 
   // This calls Copy directly rather than using Heap::AllocateRaw so we
   // duplicate the check here.
@@ -1702,7 +1683,7 @@
   ASSERT(map->instance_type() != JS_FUNCTION_TYPE);
 
   // Allocate the backing storage for the properties.
-  Object* properties = AllocatePropertyStorageForMap(map);
+  Object* properties = AllocateFixedArray(map->unused_property_fields());
   if (properties->IsFailure()) return properties;
 
   // Allocate the JSObject.
@@ -1750,7 +1731,7 @@
   ASSERT(map->instance_size() == object->map()->instance_size());
 
   // Allocate the backing storage for the properties.
-  Object* properties = AllocatePropertyStorageForMap(map);
+  Object* properties = AllocateFixedArray(map->unused_property_fields());
   if (properties->IsFailure()) return properties;
 
   // Reset the map for the object.