Revision: 17334
Author:   [email protected]
Date:     Wed Oct 23 08:57:54 2013 UTC
Log:      Crankshaft builtins.

Enable optimizing compiler for V8 built-ins. Also fixes an issue uncovered in
x64 codegen.

[email protected], [email protected], [email protected]

Review URL: https://codereview.chromium.org/34503003
http://code.google.com/p/v8/source/detail?r=17334

Modified:
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/test/cctest/test-compiler.cc
 /branches/bleeding_edge/test/message/paren_in_arg_string.out

=======================================
--- /branches/bleeding_edge/src/compiler.cc     Mon Oct 21 13:35:48 2013 UTC
+++ /branches/bleeding_edge/src/compiler.cc     Wed Oct 23 08:57:54 2013 UTC
@@ -123,7 +123,7 @@
     mode_ = STUB;
     return;
   }
-  mode_ = isolate->use_crankshaft() ? mode : NONOPT;
+  mode_ = mode;
   abort_due_to_dependency_ = false;
   if (script_->type()->value() == Script::TYPE_NATIVE) {
     MarkAsNative();
=======================================
--- /branches/bleeding_edge/src/debug.cc        Thu Sep 26 08:21:48 2013 UTC
+++ /branches/bleeding_edge/src/debug.cc        Wed Oct 23 08:57:54 2013 UTC
@@ -2106,6 +2106,7 @@

           if (!shared->allows_lazy_compilation()) continue;
           if (!shared->script()->IsScript()) continue;
+          if (function->IsBuiltin()) continue;
if (shared->code()->gc_metadata() == active_code_marker) continue;

           Code::Kind kind = function->code()->kind();
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Fri Oct 18 12:52:07 2013 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Wed Oct 23 08:57:54 2013 UTC
@@ -2933,19 +2933,19 @@
   source_shared->set_dont_flush(true);

   // Set the code, scope info, formal parameter count, and the length
-  // of the target shared function info.  Set the source code of the
-  // target function to undefined.  SetCode is only used for built-in
-  // constructors like String, Array, and Object, and some web code
-  // doesn't like seeing source code for constructors.
+  // of the target shared function info.
   target_shared->ReplaceCode(source_shared->code());
   target_shared->set_scope_info(source_shared->scope_info());
   target_shared->set_length(source_shared->length());
   target_shared->set_formal_parameter_count(
       source_shared->formal_parameter_count());
-  target_shared->set_script(isolate->heap()->undefined_value());
-
-  // Since we don't store the source we should never optimize this.
-  target_shared->code()->set_optimizable(false);
+  target_shared->set_script(source_shared->script());
+  target_shared->set_start_position_and_type(
+      source_shared->start_position_and_type());
+  target_shared->set_end_position(source_shared->end_position());
+  bool was_native = target_shared->native();
+  target_shared->set_compiler_hints(source_shared->compiler_hints());
+  target_shared->set_native(was_native);

   // Set the code of the target function.
   target->ReplaceCode(source_shared->code());
@@ -8346,7 +8346,7 @@

// If the function is not optimizable or debugger is active continue using the
   // code from the full compiler.
-  if (!FLAG_crankshaft ||
+  if (!isolate->use_crankshaft() ||
       function->shared()->optimization_disabled() ||
       isolate->DebuggerHasBreakPoints()) {
     if (FLAG_trace_opt) {
@@ -8628,7 +8628,7 @@
                                             Handle<JSFunction> function,
                                             Handle<Code> unoptimized) {
   // Keep track of whether we've succeeded in optimizing.
-  if (!unoptimized->optimizable()) return false;
+ if (!isolate->use_crankshaft() || !unoptimized->optimizable()) return false;
   // If we are trying to do OSR when there are already optimized
   // activations of the function, it means (a) the function is directly or
   // indirectly recursive and (b) an optimized invocation has been
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Oct 23 08:47:15 2013 UTC +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Oct 23 08:57:54 2013 UTC
@@ -5249,7 +5249,7 @@
   __ Cmp(Operand(temp, StandardFrameConstants::kContextOffset),
          Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
   __ j(not_equal, &check_frame_marker, Label::kNear);
-  __ movq(temp, Operand(rax, StandardFrameConstants::kCallerFPOffset));
+  __ movq(temp, Operand(temp, StandardFrameConstants::kCallerFPOffset));

   // Check the marker in the calling frame.
   __ bind(&check_frame_marker);
=======================================
--- /branches/bleeding_edge/test/cctest/test-compiler.cc Thu Sep 19 13:30:47 2013 UTC +++ /branches/bleeding_edge/test/cctest/test-compiler.cc Wed Oct 23 08:57:54 2013 UTC
@@ -377,8 +377,10 @@
*v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1"))));
     Handle<JSFunction> fun2 = v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2"))));
-    CHECK(fun1->IsOptimized() || !fun1->IsOptimizable());
-    CHECK(fun2->IsOptimized() || !fun2->IsOptimizable());
+    CHECK(fun1->IsOptimized()
+ || !CcTest::i_isolate()->use_crankshaft() | | !fun1->IsOptimizable());
+    CHECK(fun2->IsOptimized()
+ || !CcTest::i_isolate()->use_crankshaft() | | !fun2->IsOptimizable());
     CHECK_EQ(fun1->code(), fun2->code());
   }
 }
=======================================
--- /branches/bleeding_edge/test/message/paren_in_arg_string.out Fri Apr 26 14:26:54 2013 UTC +++ /branches/bleeding_edge/test/message/paren_in_arg_string.out Wed Oct 23 08:57:54 2013 UTC
@@ -2,5 +2,5 @@
 var paren_in_arg_string_bad = new Function(')', 'return;');
                               ^
 SyntaxError: Function arg string contains parenthesis
-    at Function (<anonymous>)
+    at Function (native)
     at *%(basename)s:29:31

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to