Renamed the top level directory 'public' to 'include'.

Added option 'env' to the SCons build scripts to support overriding the ENV part of the build environment.  This is mostly to support Windows builds in cases where SCons cannot find the correct paths to the Windows SDK, as these paths cannot be passed through shell environment variables.

Enabled "Buffer Security Check" on for the Windows SCons build and added the linker option /OPT:ICF as an optimization.

Added the V8 benchmark suite to the repository.


git-svn-id: http://v8.googlecode.com/svn/trunk@101 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/SConscript b/src/SConscript
index 135af67..15ec440 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -97,6 +97,7 @@
 def ConfigureObjectFiles():
   env = Environment()
   env.Replace(**context.flags['v8'])
+  env['ENV'].update(**context.env_overrides)
   env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
   env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile $LOGFILE')
 
diff --git a/src/accessors.cc b/src/accessors.cc
index 7c16dad..4895f68 100644
--- a/src/accessors.cc
+++ b/src/accessors.cc
@@ -462,7 +462,8 @@
                                       void*) {
   // Before we can set the prototype we need to be sure
   // prototype cycles are prevented.
-  // It is suficient to validate the receiver is not in the new prototype chain.
+  // It is sufficient to validate that the receiver is not in the new prototype
+  // chain.
 
   // Silently ignore the change if value is not a JSObject or null.
   // SpiderMonkey behaves this way.
diff --git a/src/api.cc b/src/api.cc
index 5cd5238..0af0cac 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -687,13 +687,6 @@
 }
 
 
-void FunctionTemplate::SetLookupHandler(LookupCallback handler) {
-  if (IsDeadCheck("v8::FunctionTemplate::SetLookupHandler()")) return;
-  HandleScope scope;
-  Utils::OpenHandle(this)->set_lookup_callback(*FromCData(handler));
-}
-
-
 void FunctionTemplate::AddInstancePropertyAccessor(
       v8::Handle<String> name,
       AccessorGetter getter,
@@ -1867,7 +1860,7 @@
                                                       &attributes));
     return Utils::ToLocal(result);
   }
-  return Local<Value>();  // No real property was found in protoype chain.
+  return Local<Value>();  // No real property was found in prototype chain.
 }
 
 
@@ -2103,7 +2096,7 @@
 
 
 const char* v8::V8::GetVersion() {
-  return "0.2.4";
+  return "0.2.5";
 }
 
 
diff --git a/src/assembler-arm.cc b/src/assembler-arm.cc
index de029cd..6089b0f 100644
--- a/src/assembler-arm.cc
+++ b/src/assembler-arm.cc
@@ -742,7 +742,7 @@
 int Assembler::branch_offset(Label* L, bool jump_elimination_allowed) {
   // if we emit an unconditional jump/call and if the current position is the
   // target of the unbound label, we can change the binding position of the
-  // unbound label, thereby eliminating an unnessary jump
+  // unbound label, thereby eliminating an unnecessary jump
   bool can_eliminate = false;
   if (jump_elimination_allowed && FLAG_eliminate_jumps &&
       unbound_label_.is_linked() && binding_pos_ == pc_offset()) {
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index afb3d85..de04d1a 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -685,7 +685,7 @@
 
     global_context()->set_arguments_boilerplate(*result);
     // Note: callee must be added as the first property and
-    //       lenght must be added as the second property.
+    //       length must be added as the second property.
     SetProperty(result, Factory::callee_symbol(), Factory::undefined_value(),
                 DONT_ENUM);
     SetProperty(result, Factory::length_symbol(), Factory::undefined_value(),
@@ -1031,7 +1031,7 @@
 
     // Set the security token for the debugger global object to the same as
     // the shell global object to allow calling between these (otherwise
-    // exposing debug global object dosen't make much sense).
+    // exposing debug global object doesn't make much sense).
     debug_global->set_security_token(global->security_token());
   }
 
diff --git a/src/builtins-arm.cc b/src/builtins-arm.cc
index 323cb3d..54f7d96 100644
--- a/src/builtins-arm.cc
+++ b/src/builtins-arm.cc
@@ -357,7 +357,7 @@
 
 
 void Builtins::Generate_KeyedStoreIC_DebugBreak(MacroAssembler* masm) {
-  // Keyed store IC ont implemented on ARM.
+  // Keyed store IC not implemented on ARM.
 }
 
 
diff --git a/src/builtins-ia32.cc b/src/builtins-ia32.cc
index f61454a..9d83b72 100644
--- a/src/builtins-ia32.cc
+++ b/src/builtins-ia32.cc
@@ -837,7 +837,7 @@
 
 
 void Builtins::Generate_ConstructCall_DebugBreak(MacroAssembler* masm) {
-  // Register state just before return fron JS function (from codegen-ia32.cc).
+  // Register state just before return from JS function (from codegen-ia32.cc).
   // eax is the actual number of arguments not encoded as a smi see comment
   // above IC call.
   // ----------- S t a t e -------------
diff --git a/src/builtins.cc b/src/builtins.cc
index 9f95322..dc264b4 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -200,7 +200,7 @@
     if (__argc__ == 2) return array->SetElementsLength(BUILTIN_ARG(1));
   }
 
-  // Optimize the case where there are no paramaters passed.
+  // Optimize the case where there are no parameters passed.
   if (__argc__ == 1) return array->Initialize(4);
 
   // Take the arguments as elements.
@@ -664,7 +664,7 @@
 #undef DEF_FUNCTION_PTR_A
 
   // For now we generate builtin adaptor code into a stack-allocated
-  // buffer, before copying it into invididual code objects.
+  // buffer, before copying it into individual code objects.
   byte buffer[4*KB];
 
   // Traverse the list of builtins and generate an adaptor in a
diff --git a/src/codegen-arm.cc b/src/codegen-arm.cc
index b71c702..4ada0ad 100644
--- a/src/codegen-arm.cc
+++ b/src/codegen-arm.cc
@@ -534,7 +534,7 @@
       // ProcessDeclarations calls DeclareGlobals indirectly
       ProcessDeclarations(scope->declarations());
 
-      // Bail out if a stack-overflow exception occured when
+      // Bail out if a stack-overflow exception occurred when
       // processing declarations.
       if (HasStackOverflow()) return;
     }
@@ -1843,7 +1843,7 @@
   // TODO(1241834): Make sure that this is sufficient. If there is a chance
   // that reference errors can be thrown below, we must distinguish
   // between the 2 kinds of loads (typeof expression loads must not
-  // throw a reference errror).
+  // throw a reference error).
   bool is_load = (access == CodeGenState::LOAD ||
                   access == CodeGenState::LOAD_TYPEOF_EXPR);
 
diff --git a/src/codegen-ia32.cc b/src/codegen-ia32.cc
index 67df023..21a179c 100644
--- a/src/codegen-ia32.cc
+++ b/src/codegen-ia32.cc
@@ -584,7 +584,7 @@
     } else {
       Comment cmnt(masm_, "[ declarations");
       ProcessDeclarations(scope->declarations());
-      // Bail out if a stack-overflow exception occured when
+      // Bail out if a stack-overflow exception occurred when
       // processing declarations.
       if (HasStackOverflow()) return;
     }
@@ -997,7 +997,7 @@
   // TODO(1241834): Make sure that this is sufficient. If there is a chance
   // that reference errors can be thrown below, we must distinguish
   // between the 2 kinds of loads (typeof expression loads must not
-  // throw a reference errror).
+  // throw a reference error).
   bool is_load = (access == CodeGenState::LOAD ||
                   access == CodeGenState::LOAD_TYPEOF_EXPR);
 
@@ -1180,7 +1180,7 @@
       // eax: y
       // edx: x
       // a) both operands smi and result fits into a smi -> return.
-      // b) at least one of operans non-smi -> non_smi_operands.
+      // b) at least one of operands non-smi -> non_smi_operands.
       // c) result does not fit in a smi -> non_smi_result.
       Label non_smi_operands, non_smi_result;
       // Tag check.
@@ -2212,7 +2212,7 @@
 
   // TODO(1243847): Use cmov below once CpuFeatures are properly hooked up.
   Label below_lbl, above_lbl;
-  // use edx, eax to convert unsigned to signed comparision
+  // use edx, eax to convert unsigned to signed comparison
   __ j(below, &below_lbl, not_taken);
   __ j(above, &above_lbl, not_taken);
 
@@ -3568,7 +3568,7 @@
 
 
 void ObjectLiteralDeferred::Generate() {
-  // If the entry is undefined we call the runtime system to computed
+  // If the entry is undefined we call the runtime system to compute
   // the literal.
 
   // Literal array (0).
@@ -5212,7 +5212,7 @@
     // CopyRegistersFromStackToMemory() but it isn't! esp is assumed
     // correct here, but computed for the other call. Very error
     // prone! FIX THIS.  Actually there are deeper problems with
-    // register saving than this assymetry (see the bug report
+    // register saving than this asymmetry (see the bug report
     // associated with this issue).
     __ PushRegistersFromMemory(kJSCallerSaved);
   }
diff --git a/src/debug.cc b/src/debug.cc
index 8ba4490..7487cdc 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -282,7 +282,7 @@
 
 void BreakLocationIterator::SetDebugBreak() {
   // If there is already a break point here just return. This might happen if
-  // the same code is flodded with break points twice. Flodding the same
+  // the same code is flooded with break points twice. Flooding the same
   // function twice might happen when stepping in a function with an exception
   // handler as the handler and the function is the same.
   if (IsDebugBreak()) {
@@ -344,7 +344,7 @@
       rinfo()->set_target_address(stub->entry());
     }
   } else {
-    // Step in through constructs call requires no changs to the running code.
+    // Step in through constructs call requires no changes to the running code.
     ASSERT(is_js_construct_call(rmode()));
   }
 }
@@ -705,7 +705,7 @@
   int break_points_hit_count = 0;
   Handle<JSArray> break_points_hit = Factory::NewJSArray(1);
 
-  // If there are multiple break points they are in a Fixedrray.
+  // If there are multiple break points they are in a FixedArray.
   ASSERT(!break_point_objects->IsUndefined());
   if (break_point_objects->IsFixedArray()) {
     Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
@@ -929,7 +929,7 @@
     if (code->is_call_stub()) is_call_target = true;
   }
 
-  // If this is the last break code target step out is the only posibility.
+  // If this is the last break code target step out is the only possibility.
   if (it.IsExit() || step_action == StepOut) {
     // Step out: If there is a JavaScript caller frame, we need to
     // flood it with breakpoints.
@@ -967,7 +967,7 @@
 // is used to have step next and step in only report break back to the debugger
 // if on a different frame or in a different statement. In some situations
 // there will be several break points in the same statement when the code is
-// flodded with one-shot break points. This function helps to perform several
+// flooded with one-shot break points. This function helps to perform several
 // steps before reporting break back to the debugger.
 bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
                              JavaScriptFrame* frame) {
@@ -1107,7 +1107,7 @@
 // are used to support stepping.
 void Debug::ClearOneShot() {
   // The current implementation just runs through all the breakpoints. When the
-  // last break point for a function is removed that function is automaticaly
+  // last break point for a function is removed that function is automatically
   // removed from the list.
 
   DebugInfoListNode* node = debug_info_list_;
@@ -1154,24 +1154,7 @@
   if (!EnsureCompiled(shared)) return false;
 
   // Create the debug info object.
-  Handle<DebugInfo> debug_info =
-      Handle<DebugInfo>::cast(Factory::NewStruct(DEBUG_INFO_TYPE));
-
-  // Get the function original code.
-  Handle<Code> code(shared->code());
-
-  // Debug info contains function, a copy of the original code and the executing
-  // code.
-  debug_info->set_shared(*shared);
-  debug_info->set_original_code(*Factory::CopyCode(code));
-  debug_info->set_code(*code);
-
-  // Link debug info to function.
-  shared->set_debug_info(*debug_info);
-
-  // Initially no active break points.
-  debug_info->set_break_points(
-      *Factory::NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction));
+  Handle<DebugInfo> debug_info = Factory::NewDebugInfo(shared);
 
   // Add debug info to the list.
   DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
@@ -1788,10 +1771,10 @@
   bool interactive = false;
   switch (event) {
     case v8::Break:
-      interactive = true;  // Break event is always interavtive
+      interactive = true;  // Break event is always interactive
       break;
     case v8::Exception:
-      interactive = true;  // Exception event is always interavtive
+      interactive = true;  // Exception event is always interactive
       break;
     case v8::BeforeCompile:
       break;
@@ -1821,7 +1804,7 @@
     return;
   }
 
-  // Notify the debugger that a debug event has occoured.
+  // Notify the debugger that a debug event has occurred.
   host_running_ = false;
   SetEventJSONFromEvent(event_data);
 
diff --git a/src/debug.h b/src/debug.h
index 951acd5..3140dcd 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -28,7 +28,7 @@
 #ifndef V8_DEBUG_H_
 #define V8_DEBUG_H_
 
-#include "../public/debug.h"
+#include "../include/debug.h"
 #include "assembler.h"
 #include "code-stubs.h"
 #include "factory.h"
diff --git a/src/disasm-arm.cc b/src/disasm-arm.cc
index 34ea1d1..15c93ac 100644
--- a/src/disasm-arm.cc
+++ b/src/disasm-arm.cc
@@ -276,7 +276,7 @@
       }
       break;
     }
-    case 'p': {  // 'pu: P and U bits for load and store isntructions
+    case 'p': {  // 'pu: P and U bits for load and store instructions
       ASSERT(format[1] == 'u');
       switch (instr->PUField()) {
         case 0: {
diff --git a/src/execution.cc b/src/execution.cc
index f31337e..7f55c6f 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -200,7 +200,7 @@
 
     thread_local_.initial_jslimit_ = thread_local_.jslimit_ =
         GENERATED_CODE_STACK_LIMIT(kLimitSize);
-    // NOTE: The check for overflow is not safe as there is no guarentee that
+    // NOTE: The check for overflow is not safe as there is no guarantee that
     // the running thread has its stack in all memory up to address 0x00000000.
     thread_local_.initial_climit_ = thread_local_.climit_ =
         reinterpret_cast<uintptr_t>(this) >= kLimitSize ?
@@ -602,7 +602,7 @@
   v8::Handle<v8::Script> code =
       v8::Script::Compile(source, &origin);
 
-  // Run the code if no exception occured during the compilation. In
+  // Run the code if no exception occurred during the compilation. In
   // case of syntax errors, the code is empty and the exception is
   // scheduled and will be thrown when returning to JavaScript.
   if (!code.IsEmpty()) result = code->Run();
diff --git a/src/execution.h b/src/execution.h
index 6efe9a6..5d408a9 100644
--- a/src/execution.h
+++ b/src/execution.h
@@ -229,7 +229,7 @@
 
 // Support for temporarily postponing interrupts. When the outermost
 // postpone scope is left the interrupts will be re-enabled and any
-// interrupts that occured while in the scope will be taken into
+// interrupts that occurred while in the scope will be taken into
 // account.
 class PostponeInterruptsScope BASE_EMBEDDED {
  public:
diff --git a/src/factory.cc b/src/factory.cc
index 8016965..39bc763 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -28,6 +28,7 @@
 #include "v8.h"
 
 #include "api.h"
+#include "debug.h"
 #include "execution.h"
 #include "factory.h"
 #include "macro-assembler.h"
@@ -625,6 +626,37 @@
 }
 
 
+Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
+  // Get the original code of the function.
+  Handle<Code> code(shared->code());
+
+  // Create a copy of the code before allocating the debug info object to avoid
+  // allocation while setting up the debug info object.
+  Handle<Code> original_code(*Factory::CopyCode(code));
+
+  // Allocate initial fixed array for active break points before allocating the
+  // debug info object to avoid allocation while setting up the debug info
+  // object.
+  Handle<FixedArray> break_points(
+      Factory::NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction));
+
+  // Create and set up the debug info object. Debug info contains function, a
+  // copy of the original code, the executing code and initial fixed array for
+  // active break points.
+  Handle<DebugInfo> debug_info =
+      Handle<DebugInfo>::cast(Factory::NewStruct(DEBUG_INFO_TYPE));
+  debug_info->set_shared(*shared);
+  debug_info->set_original_code(*original_code);
+  debug_info->set_code(*code);
+  debug_info->set_break_points(*break_points);
+
+  // Link debug info to function.
+  shared->set_debug_info(*debug_info);
+
+  return debug_info;
+}
+
+
 Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee,
                                              int length) {
   CALL_HEAP_FUNCTION(Heap::AllocateArgumentsObject(*callee, length), JSObject);
diff --git a/src/factory.h b/src/factory.h
index a0cd936..40e1305 100644
--- a/src/factory.h
+++ b/src/factory.h
@@ -289,6 +289,8 @@
                                                   uint32_t key,
                                                   Handle<Object> value);
 
+  static Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
+
  private:
   static Handle<JSFunction> NewFunctionHelper(Handle<String> name,
                                               Handle<Object> prototype);
diff --git a/src/global-handles.cc b/src/global-handles.cc
index 8c7dc8e..de071df 100644
--- a/src/global-handles.cc
+++ b/src/global-handles.cc
@@ -267,7 +267,7 @@
   // Process weak global handle callbacks. This must be done after the
   // GC is completely done, because the callbacks may invoke arbitrary
   // API functions.
-  // At the same time deallocate all DESTORYED nodes
+  // At the same time deallocate all DESTROYED nodes
   ASSERT(Heap::gc_state() == Heap::NOT_IN_GC);
   Node** p = &head_;
   while (*p != NULL) {
diff --git a/src/objects-inl.h b/src/objects-inl.h
index f7978ae..3242e7a 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1713,7 +1713,6 @@
           kInstanceTemplateOffset)
 ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset)
 ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset)
-ACCESSORS(FunctionTemplateInfo, lookup_callback, Object, kLookupCallbackOffset)
 ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object,
           kInstanceCallHandlerOffset)
 ACCESSORS(FunctionTemplateInfo, access_check_info, Object,
diff --git a/src/objects.h b/src/objects.h
index 82c6faf..7fc88b7 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3548,7 +3548,6 @@
   DECL_ACCESSORS(instance_template, Object)
   DECL_ACCESSORS(class_name, Object)
   DECL_ACCESSORS(signature, Object)
-  DECL_ACCESSORS(lookup_callback, Object)
   DECL_ACCESSORS(instance_call_handler, Object)
   DECL_ACCESSORS(access_check_info, Object)
   DECL_ACCESSORS(flag, Smi)
@@ -3582,9 +3581,7 @@
       kIndexedPropertyHandlerOffset + kPointerSize;
   static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize;
   static const int kSignatureOffset = kClassNameOffset + kPointerSize;
-  static const int kLookupCallbackOffset = kSignatureOffset + kPointerSize;
-  static const int kInstanceCallHandlerOffset =
-      kLookupCallbackOffset + kPointerSize;
+  static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize;
   static const int kAccessCheckInfoOffset =
       kInstanceCallHandlerOffset + kPointerSize;
   static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize;
diff --git a/src/simulator-ia32.h b/src/simulator-ia32.h
index 31bc7d4..bf4072b 100644
--- a/src/simulator-ia32.h
+++ b/src/simulator-ia32.h
@@ -38,7 +38,7 @@
 // This macro must be called from a C++ method. It relies on being able to take
 // the address of "this" to get a value on the current execution stack and then
 // calculates the stack limit based on that value.
-// NOTE: The check for overflow is not safe as there is no guarentee that the
+// NOTE: The check for overflow is not safe as there is no guarantee that the
 // running thread has its stack in all memory up to address 0x00000000.
 #define GENERATED_CODE_STACK_LIMIT(limit) \
   (reinterpret_cast<uintptr_t>(this) >= limit ? \
diff --git a/src/third_party/jscre/pcre.h b/src/third_party/jscre/pcre.h
index 2a27cd8..1deeb85 100644
--- a/src/third_party/jscre/pcre.h
+++ b/src/third_party/jscre/pcre.h
@@ -42,7 +42,7 @@
 #ifndef JSRegExp_h
 #define JSRegExp_h
 
-#include "../../../public/v8.h"
+#include "../../../include/v8.h"
 
 // JSCRE is very chatty in debug mode, so in order to keep it slient
 // while still importing v8.h correctly (it contains #ifdef DEBUGs)
diff --git a/src/v8.h b/src/v8.h
index 8cacc69..c439006 100644
--- a/src/v8.h
+++ b/src/v8.h
@@ -48,7 +48,7 @@
 #endif
 
 // Basic includes
-#include "../public/v8.h"
+#include "../include/v8.h"
 #include "globals.h"
 #include "checks.h"
 #include "allocation.h"