| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 038834ca442daf22093bdb21e556920527364016..029cd808e22c1a6395e4d75a5d9084e97761c0c0 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -10828,41 +10828,19 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
|
| }
|
|
|
| if (op == Token::INSTANCEOF) {
|
| - // Check to see if the rhs of the instanceof is a global function not
|
| - // residing in new space. If it is we assume that the function will stay the
|
| - // same.
|
| - Handle<JSFunction> target = Handle<JSFunction>::null();
|
| - VariableProxy* proxy = expr->right()->AsVariableProxy();
|
| - bool global_function = (proxy != NULL) && proxy->var()->IsUnallocated();
|
| - if (global_function && current_info()->has_global_object()) {
|
| - Handle<String> name = proxy->name();
|
| - Handle<GlobalObject> global(current_info()->global_object());
|
| - LookupIterator it(global, name, LookupIterator::OWN_SKIP_INTERCEPTOR);
|
| - Handle<Object> value = JSObject::GetDataProperty(&it);
|
| - if (it.IsFound() && value->IsJSFunction()) {
|
| - Handle<JSFunction> candidate = Handle<JSFunction>::cast(value);
|
| - // If the function is in new space we assume it's more likely to
|
| - // change and thus prefer the general IC code.
|
| - if (!isolate()->heap()->InNewSpace(*candidate)) {
|
| - target = candidate;
|
| - }
|
| - }
|
| - }
|
| -
|
| - // If the target is not null we have found a known global function that is
|
| - // assumed to stay the same for this instanceof.
|
| - if (target.is_null()) {
|
| - HInstanceOf* result = New<HInstanceOf>(left, right);
|
| - return ast_context()->ReturnInstruction(result, expr->id());
|
| - } else {
|
| - Add<HCheckValue>(right, target);
|
| + // Check to see if the rhs of the instanceof is a known function.
|
| + if (right->IsConstant() &&
|
| + HConstant::cast(right)->handle(isolate())->IsJSFunction()) {
|
| + Handle<Object> function = HConstant::cast(right)->handle(isolate());
|
| + Handle<JSFunction> target = Handle<JSFunction>::cast(function);
|
| HInstanceOfKnownGlobal* result =
|
| - New<HInstanceOfKnownGlobal>(left, target);
|
| + New<HInstanceOfKnownGlobal>(left, target);
|
| return ast_context()->ReturnInstruction(result, expr->id());
|
| }
|
|
|
| - // Code below assumes that we don't fall through.
|
| - UNREACHABLE();
|
| + HInstanceOf* result = New<HInstanceOf>(left, right);
|
| + return ast_context()->ReturnInstruction(result, expr->id());
|
| +
|
| } else if (op == Token::IN) {
|
| HValue* function = AddLoadJSBuiltin(Builtins::IN);
|
| Add<HPushArguments>(left, right);
|
|
|