Revision: 21936
Author:   [email protected]
Date:     Mon Jun 23 13:17:42 2014 UTC
Log:      Harden %FunctionBindArguments wrt optimized code cache.

[email protected]
BUG=387627
LOG=N

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

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-387627.js
Modified:
 /branches/bleeding_edge/src/compiler.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-387627.js Mon Jun 23 13:17:42 2014 UTC
@@ -0,0 +1,13 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function f() {}
+%FunctionBindArguments(f, {}, undefined, 1);
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
=======================================
--- /branches/bleeding_edge/src/compiler.cc     Fri Jun 20 08:40:11 2014 UTC
+++ /branches/bleeding_edge/src/compiler.cc     Mon Jun 23 13:17:42 2014 UTC
@@ -1041,6 +1041,8 @@
     BailoutId osr_ast_id) {
   if (FLAG_cache_optimized_code) {
     Handle<SharedFunctionInfo> shared(function->shared());
+    // Bound functions are not cached.
+    if (shared->bound()) return MaybeHandle<Code>();
     DisallowHeapAllocation no_gc;
     int index = shared->SearchOptimizedCodeMap(
         function->context()->native_context(), osr_ast_id);
@@ -1070,6 +1072,8 @@
   if (FLAG_cache_optimized_code) {
     Handle<JSFunction> function = info->closure();
     Handle<SharedFunctionInfo> shared(function->shared());
+    // Do not cache bound functions.
+    if (shared->bound()) return;
     Handle<FixedArray> literals(function->literals());
     Handle<Context> native_context(function->context()->native_context());
     SharedFunctionInfo::AddToOptimizedCodeMap(

--
--
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/d/optout.

Reply via email to