Revision: 24097
Author:   [email protected]
Date:     Fri Sep 19 16:35:42 2014 UTC
Log:      Fix JSBuiltinReducer to deal with non-JSFunction callees.

[email protected]
TEST=mozilla

Review URL: https://codereview.chromium.org/589573002
https://code.google.com/p/v8/source/detail?r=24097

Modified:
 /branches/bleeding_edge/src/compiler/js-builtin-reducer.cc

=======================================
--- /branches/bleeding_edge/src/compiler/js-builtin-reducer.cc Fri Sep 19 15:02:58 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-builtin-reducer.cc Fri Sep 19 16:35:42 2014 UTC
@@ -34,15 +34,18 @@
   // constant callee being a well-known builtin with a BuiltinFunctionId.
   bool HasBuiltinFunctionId() {
     if (node_->opcode() != IrOpcode::kJSCallFunction) return false;
- HeapObjectMatcher<JSFunction> m(NodeProperties::GetValueInput(node_, 0)); - return m.HasValue() && m.Value().handle()->shared()->HasBuiltinFunctionId();
+    HeapObjectMatcher<Object> m(NodeProperties::GetValueInput(node_, 0));
+    if (!m.HasValue() || !m.Value().handle()->IsJSFunction()) return false;
+ Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle());
+    return function->shared()->HasBuiltinFunctionId();
   }

   // Retrieves the BuiltinFunctionId as described above.
   BuiltinFunctionId GetBuiltinFunctionId() {
     DCHECK_EQ(IrOpcode::kJSCallFunction, node_->opcode());
- HeapObjectMatcher<JSFunction> m(NodeProperties::GetValueInput(node_, 0));
-    return m.Value().handle()->shared()->builtin_function_id();
+    HeapObjectMatcher<Object> m(NodeProperties::GetValueInput(node_, 0));
+ Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value().handle());
+    return function->shared()->builtin_function_id();
   }

   // Determines whether the call takes one input of the given type.

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