Reviewers: Michael Starzinger,

Message:
Could you take a look, please?

Description:
[turbofan] Do not optimize with-context allocation in global code.

BUG=
[email protected]

Please review this at https://codereview.chromium.org/1292383007/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+6, -2 lines):
  M src/compiler/js-typed-lowering.cc


Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc index 628e7e07b69b1ae2ec4560e6c41058d2abdd58c5..68c3e308dc7df9c26ab9f92d5883389fce4c67d8 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -1189,12 +1189,16 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
   DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
   Node* const input = NodeProperties::GetValueInput(node, 0);
+  Node* const closure = NodeProperties::GetValueInput(node, 1);
   Type* input_type = NodeProperties::GetBounds(input).upper;
-  if (FLAG_turbo_allocate && input_type->Is(Type::Receiver())) {
+  // The closure can be NumberConstant(0) if the closure is global code
+  // (rather than a function). We exclude that case here.
+  // TODO(jarin) Find a better way to check that the closure is a function.
+  if (FLAG_turbo_allocate && input_type->Is(Type::Receiver()) &&
+      closure->opcode() != IrOpcode::kNumberConstant) {
     // JSCreateWithContext(o:receiver, f)
     Node* const effect = NodeProperties::GetEffectInput(node);
     Node* const control = NodeProperties::GetControlInput(node);
-    Node* const closure = NodeProperties::GetValueInput(node, 1);
     Node* const context = NodeProperties::GetContextInput(node);
     Node* const load = graph()->NewNode(
         simplified()->LoadField(


--
--
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