| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
| (...skipping 11398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11409 Handle<JSFunction>::cast(HConstant::cast(right)->handle(isolate())); | 11409 Handle<JSFunction>::cast(HConstant::cast(right)->handle(isolate())); |
| 11410 // Make sure the prototype of {function} is the %FunctionPrototype%, and | 11410 // Make sure the prototype of {function} is the %FunctionPrototype%, and |
| 11411 // it already has a meaningful initial map (i.e. we constructed at least | 11411 // it already has a meaningful initial map (i.e. we constructed at least |
| 11412 // one instance using the constructor {function}). | 11412 // one instance using the constructor {function}). |
| 11413 // We can only use the fast case if @@hasInstance was not used so far. | 11413 // We can only use the fast case if @@hasInstance was not used so far. |
| 11414 if (function->has_initial_map() && | 11414 if (function->has_initial_map() && |
| 11415 function->map()->prototype() == | 11415 function->map()->prototype() == |
| 11416 function->native_context()->closure() && | 11416 function->native_context()->closure() && |
| 11417 !function->map()->has_non_instance_prototype() && | 11417 !function->map()->has_non_instance_prototype() && |
| 11418 isolate()->IsHasInstanceLookupChainIntact()) { | 11418 isolate()->IsHasInstanceLookupChainIntact()) { |
| 11419 // Make sure the feedback for the instanceof is still fast (i.e. the | 11419 Handle<Map> initial_map(function->initial_map(), isolate()); |
| 11420 // vector slot is still unintialized). | 11420 top_info()->dependencies()->AssumeInitialMapCantChange(initial_map); |
| 11421 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); | 11421 top_info()->dependencies()->AssumePropertyCell( |
| 11422 Handle<Object> feedback( | 11422 isolate()->factory()->has_instance_protector()); |
| 11423 vector->Get(expr->CompareOperationFeedbackSlot()), isolate()); | 11423 HInstruction* prototype = |
| 11424 if (feedback.is_identical_to( | 11424 Add<HConstant>(handle(initial_map->prototype(), isolate())); |
| 11425 TypeFeedbackVector::UninitializedSentinel(isolate()))) { | 11425 HHasInPrototypeChainAndBranch* result = |
| 11426 Handle<Map> initial_map(function->initial_map(), isolate()); | 11426 New<HHasInPrototypeChainAndBranch>(left, prototype); |
| 11427 top_info()->dependencies()->AssumeInitialMapCantChange(initial_map); | 11427 return ast_context()->ReturnControl(result, expr->id()); |
| 11428 top_info()->dependencies()->AssumePropertyCell( | |
| 11429 isolate()->factory()->has_instance_protector()); | |
| 11430 HInstruction* prototype = | |
| 11431 Add<HConstant>(handle(initial_map->prototype(), isolate())); | |
| 11432 HHasInPrototypeChainAndBranch* result = | |
| 11433 New<HHasInPrototypeChainAndBranch>(left, prototype); | |
| 11434 return ast_context()->ReturnControl(result, expr->id()); | |
| 11435 } | |
| 11436 } | 11428 } |
| 11437 } | 11429 } |
| 11438 | 11430 |
| 11439 Callable callable = CodeFactory::InstanceOf(isolate()); | 11431 Callable callable = CodeFactory::InstanceOf(isolate()); |
| 11440 HValue* stub = Add<HConstant>(callable.code()); | 11432 HValue* stub = Add<HConstant>(callable.code()); |
| 11441 HValue* values[] = {context(), left, right}; | 11433 HValue* values[] = {context(), left, right}; |
| 11442 HCallWithDescriptor* result = New<HCallWithDescriptor>( | 11434 HCallWithDescriptor* result = New<HCallWithDescriptor>( |
| 11443 stub, 0, callable.descriptor(), ArrayVector(values)); | 11435 stub, 0, callable.descriptor(), ArrayVector(values)); |
| 11444 result->set_type(HType::Boolean()); | 11436 result->set_type(HType::Boolean()); |
| 11445 return ast_context()->ReturnInstruction(result, expr->id()); | 11437 return ast_context()->ReturnInstruction(result, expr->id()); |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13294 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13286 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13295 } | 13287 } |
| 13296 | 13288 |
| 13297 #ifdef DEBUG | 13289 #ifdef DEBUG |
| 13298 graph_->Verify(false); // No full verify. | 13290 graph_->Verify(false); // No full verify. |
| 13299 #endif | 13291 #endif |
| 13300 } | 13292 } |
| 13301 | 13293 |
| 13302 } // namespace internal | 13294 } // namespace internal |
| 13303 } // namespace v8 | 13295 } // namespace v8 |
| OLD | NEW |