Revision: 4150
Author: [email protected]
Date: Wed Mar 17 01:14:59 2010
Log: Keep more track of whether code is from the built
in .js files in V8.  This change gets bleeding edge
a tiny bit closer to the partial snapshots branch.
Review URL: http://codereview.chromium.org/1052003
http://code.google.com/p/v8/source/detail?r=4150

Modified:
 /branches/bleeding_edge/src/api.cc
 /branches/bleeding_edge/src/bootstrapper.cc
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/globals.h
 /branches/bleeding_edge/src/handles.cc
 /branches/bleeding_edge/test/cctest/test-compiler.cc

=======================================
--- /branches/bleeding_edge/src/api.cc  Thu Mar 11 01:48:01 2010
+++ /branches/bleeding_edge/src/api.cc  Wed Mar 17 01:14:59 2010
@@ -1137,8 +1137,14 @@
     pre_data_impl = NULL;
   }
   i::Handle<i::JSFunction> boilerplate =
-      i::Compiler::Compile(str, name_obj, line_offset, column_offset, NULL,
-                           pre_data_impl, Utils::OpenHandle(*script_data));
+      i::Compiler::Compile(str,
+                           name_obj,
+                           line_offset,
+                           column_offset,
+                           NULL,
+                           pre_data_impl,
+                           Utils::OpenHandle(*script_data),
+                           i::NOT_NATIVES_CODE);
   has_pending_exception = boilerplate.is_null();
   EXCEPTION_BAILOUT_CHECK(Local<Script>());
   return Local<Script>(ToApi<Script>(boilerplate));
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Fri Mar 12 02:20:01 2010
+++ /branches/bleeding_edge/src/bootstrapper.cc Wed Mar 17 01:14:59 2010
@@ -816,8 +816,15 @@
     ASSERT(source->IsAsciiRepresentation());
     Handle<String> script_name = Factory::NewStringFromUtf8(name);
     boilerplate =
-        Compiler::Compile(source, script_name, 0, 0, extension, NULL,
-                          Handle<String>::null());
+        Compiler::Compile(
+            source,
+            script_name,
+            0,
+            0,
+            extension,
+            NULL,
+            Handle<String>::null(),
+            use_runtime_context ? NATIVES_CODE : NOT_NATIVES_CODE);
     if (boilerplate.is_null()) return false;
     cache->Add(name, boilerplate);
   }
=======================================
--- /branches/bleeding_edge/src/compiler.cc     Fri Mar 12 07:01:05 2010
+++ /branches/bleeding_edge/src/compiler.cc     Wed Mar 17 01:14:59 2010
@@ -278,7 +278,8 @@
                                      int line_offset, int column_offset,
                                      v8::Extension* extension,
                                      ScriptDataImpl* input_pre_data,
-                                     Handle<Object> script_data) {
+                                     Handle<Object> script_data,
+                                     NativesFlag natives) {
   int source_length = source->length();
   Counters::total_load_size.Increment(source_length);
   Counters::total_compile_size.Increment(source_length);
@@ -306,6 +307,9 @@

     // Create a script object describing the script to be compiled.
     Handle<Script> script = Factory::NewScript(source);
+    if (natives == NATIVES_CODE) {
+      script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
+    }
     if (!script_name.is_null()) {
       script->set_name(*script_name);
       script->set_line_offset(Smi::FromInt(line_offset));
=======================================
--- /branches/bleeding_edge/src/compiler.h      Fri Mar  5 14:08:58 2010
+++ /branches/bleeding_edge/src/compiler.h      Wed Mar 17 01:14:59 2010
@@ -237,7 +237,8 @@
                                     int line_offset, int column_offset,
                                     v8::Extension* extension,
                                     ScriptDataImpl* pre_data,
-                                    Handle<Object> script_data);
+                                    Handle<Object> script_data,
+                                    NativesFlag is_natives_code);

   // Compile a String source within a context for Eval.
   static Handle<JSFunction> CompileEval(Handle<String> source,
=======================================
--- /branches/bleeding_edge/src/debug.cc        Fri Mar 12 02:20:01 2010
+++ /branches/bleeding_edge/src/debug.cc        Wed Mar 17 01:14:59 2010
@@ -686,8 +686,14 @@
   bool allow_natives_syntax = FLAG_allow_natives_syntax;
   FLAG_allow_natives_syntax = true;
   Handle<JSFunction> boilerplate;
- boilerplate = Compiler::Compile(source_code, script_name, 0, 0, NULL, NULL,
-                                  Handle<String>::null());
+  boilerplate = Compiler::Compile(source_code,
+                                  script_name,
+                                  0,
+                                  0,
+                                  NULL,
+                                  NULL,
+                                  Handle<String>::null(),
+                                  NATIVES_CODE);
   FLAG_allow_natives_syntax = allow_natives_syntax;

   // Silently ignore stack overflows during compilation.
=======================================
--- /branches/bleeding_edge/src/globals.h       Fri Mar 12 02:20:01 2010
+++ /branches/bleeding_edge/src/globals.h       Wed Mar 17 01:14:59 2010
@@ -322,6 +322,10 @@
 enum VisitMode { VISIT_ALL, VISIT_ALL_IN_SCAVENGE, VISIT_ONLY_STRONG };


+// Flag indicating whether code is built into the VM (one of the natives files).
+enum NativesFlag { NOT_NATIVES_CODE, NATIVES_CODE };
+
+
 // A CodeDesc describes a buffer holding instructions and relocation
 // information. The instructions start at the beginning of the buffer
 // and grow forward, the relocation information starts at the end of
=======================================
--- /branches/bleeding_edge/src/handles.cc      Tue Mar  2 10:47:03 2010
+++ /branches/bleeding_edge/src/handles.cc      Wed Mar 17 01:14:59 2010
@@ -780,7 +780,7 @@
     bool allow_natives_syntax = FLAG_allow_natives_syntax;
     FLAG_allow_natives_syntax = true;
boilerplate = Compiler::Compile(source_code, script_name, 0, 0, NULL, NULL,
-                                    Handle<String>::null());
+                                    Handle<String>::null(), NATIVES_CODE);
     FLAG_allow_natives_syntax = allow_natives_syntax;
     // If the compilation failed (possibly due to stack overflows), we
     // should never enter the result in the natives cache. Instead we
=======================================
--- /branches/bleeding_edge/test/cctest/test-compiler.cc Tue Feb 16 07:29:35 2010 +++ /branches/bleeding_edge/test/cctest/test-compiler.cc Wed Mar 17 01:14:59 2010
@@ -115,8 +115,14 @@
 static Handle<JSFunction> Compile(const char* source) {
Handle<String> source_code(Factory::NewStringFromUtf8(CStrVector(source)));
   Handle<JSFunction> boilerplate =
-      Compiler::Compile(source_code, Handle<String>(), 0, 0, NULL, NULL,
-                        Handle<String>::null());
+      Compiler::Compile(source_code,
+                        Handle<String>(),
+                        0,
+                        0,
+                        NULL,
+                        NULL,
+                        Handle<String>::null(),
+                        NOT_NATIVES_CODE);
   return Factory::NewFunctionFromBoilerplate(boilerplate,
                                              Top::global_context());
 }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to